mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Fix ping command output
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
From 0dc5a2febf37efa3a38cd08bbd4b37ca9da7d7ca Mon Sep 17 00:00:00 2001
|
||||
From 13ff42eb6bcfe97f9bcda34e85a1c46476430aac Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 13 Mar 2020 22:29:10 -0500
|
||||
Subject: [PATCH] Add /ping command
|
||||
|
||||
---
|
||||
.../net/minecraft/server/ArgumentEntity.java | 2 ++
|
||||
.../net/minecraft/server/ArgumentEntity.java | 2 +
|
||||
.../minecraft/server/CommandDispatcher.java | 5 ++-
|
||||
.../server/CommandListenerWrapper.java | 1 +
|
||||
.../java/net/pl3x/purpur/PurpurConfig.java | 2 ++
|
||||
.../net/pl3x/purpur/command/PingCommand.java | 34 +++++++++++++++++++
|
||||
5 files changed, 43 insertions(+), 1 deletion(-)
|
||||
.../java/net/pl3x/purpur/PurpurConfig.java | 2 +
|
||||
.../net/pl3x/purpur/command/PingCommand.java | 37 +++++++++++++++++++
|
||||
5 files changed, 46 insertions(+), 1 deletion(-)
|
||||
create mode 100644 src/main/java/net/pl3x/purpur/command/PingCommand.java
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ArgumentEntity.java b/src/main/java/net/minecraft/server/ArgumentEntity.java
|
||||
@@ -93,17 +93,19 @@ index f7e5d12cf..066ae1fec 100644
|
||||
public static String serverModName = "Purpur";
|
||||
diff --git a/src/main/java/net/pl3x/purpur/command/PingCommand.java b/src/main/java/net/pl3x/purpur/command/PingCommand.java
|
||||
new file mode 100644
|
||||
index 000000000..4b0f38b0a
|
||||
index 000000000..f36e655cb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/command/PingCommand.java
|
||||
@@ -0,0 +1,34 @@
|
||||
@@ -0,0 +1,37 @@
|
||||
+package net.pl3x.purpur.command;
|
||||
+
|
||||
+import net.minecraft.server.ArgumentEntity;
|
||||
+import net.minecraft.server.ChatMessage;
|
||||
+import net.minecraft.server.CommandDispatcher;
|
||||
+import net.minecraft.server.CommandListenerWrapper;
|
||||
+import net.minecraft.server.EntityPlayer;
|
||||
+import net.pl3x.purpur.PurpurConfig;
|
||||
+import org.bukkit.ChatColor;
|
||||
+import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
+
|
||||
+import java.util.Collection;
|
||||
@@ -126,7 +128,8 @@ index 000000000..4b0f38b0a
|
||||
+
|
||||
+ private static int execute(CommandListenerWrapper sender, Collection<EntityPlayer> targets) {
|
||||
+ for (EntityPlayer player : targets) {
|
||||
+ sender.sendMessage(CraftChatMessage.fromString(PurpurConfig.pingCommandOutput)[0], false);
|
||||
+ String output = String.format(PurpurConfig.pingCommandOutput, player.getProfile().getName(), player.ping);
|
||||
+ sender.sendMessage(CraftChatMessage.fromStringOrNull(output), false);
|
||||
+ }
|
||||
+ return targets.size();
|
||||
+ }
|
||||
|
||||
Reference in New Issue
Block a user