Skip to content

Commit

Permalink
this was a mess
Browse files Browse the repository at this point in the history
  • Loading branch information
YouHaveTrouble committed Dec 21, 2021
1 parent 3a6ae1d commit d95844f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
26 changes: 20 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,33 @@
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>purpur</id>
<url>https://repo.purpurmc.org/snapshots</url>
</repository>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
<repository>
<id>minecraft-libraries</id>
<name>Minecraft Libraries</name>
<url>https://libraries.minecraft.net</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>net.pl3x.purpur</groupId>
<artifactId>purpur</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<groupId>org.purpurmc.purpur</groupId>
<artifactId>purpur-api</artifactId>
<version>1.18-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-minimessage</artifactId>
<version>4.1.0-SNAPSHOT</version>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-mojangapi</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.checkerframework.checker.nullness.qual.NonNull;

public class FancyCommand implements Listener {

@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onCommandRegister(final @NonNull CommandRegisteredEvent<BukkitBrigadierCommandSource> event) {
public void onCommandRegister(final CommandRegisteredEvent<BukkitBrigadierCommandSource> event) {
if (event.getCommand().getName().equalsIgnoreCase("purpurextras")) {
event.setLiteral(
LiteralArgumentBuilder.<BukkitBrigadierCommandSource>literal(event.getCommandLabel())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package me.youhavetrouble.purpurextras.listeners;

import io.papermc.paper.event.player.AsyncChatEvent;

import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextReplacementConfig;
import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer;

import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
Expand All @@ -12,7 +14,8 @@ public class EscapeCommandSlashListener implements Listener {

@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onCommandEscape(AsyncChatEvent event) {
String message = PlainComponentSerializer.plain().serialize(event.message());

String message = PlainTextComponentSerializer.plainText().serialize(event.message());
String[] messageSplit = message.split(" ");
String command = messageSplit[0].substring(1);
Component component = event.message().replaceText(
Expand Down

0 comments on commit d95844f

Please sign in to comment.