Add VanillaCommandWrapper which allows use of vanilla commands instead of Bukkit's versions

By: Thinkofdeath <thethinkofdeath@gmail.com>
This commit is contained in:
Spigot
2013-12-17 13:56:38 +00:00
parent 6eb0be4005
commit 823793d899
4 changed files with 413 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
From 2993d045a90bcfeae07f067426b3c7017cea19de Mon Sep 17 00:00:00 2001
From de08f8f69e8b657102b9a99a0a1cbdcff2174da8 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 1 Dec 2013 15:10:48 +1100
Subject: [PATCH] mc-dev imports
@@ -406,6 +406,105 @@ index 0000000..6d5090b
+ return false;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java
new file mode 100644
index 0000000..e63f17c
--- /dev/null
+++ b/src/main/java/net/minecraft/server/CommandDispatcher.java
@@ -0,0 +1,93 @@
+package net.minecraft.server;
+
+import java.util.Iterator;
+
+public class CommandDispatcher extends CommandHandler implements ICommandDispatcher {
+
+ public CommandDispatcher() {
+ this.a(new CommandTime());
+ this.a(new CommandGamemode());
+ this.a(new CommandDifficulty());
+ this.a(new CommandGamemodeDefault());
+ this.a(new CommandKill());
+ this.a(new CommandToggleDownfall());
+ this.a(new CommandWeather());
+ this.a(new CommandXp());
+ this.a(new CommandTp());
+ this.a(new CommandGive());
+ this.a(new CommandEffect());
+ this.a(new CommandEnchant());
+ this.a(new CommandMe());
+ this.a(new CommandSeed());
+ this.a(new CommandHelp());
+ this.a(new CommandDebug());
+ this.a(new CommandTell());
+ this.a(new CommandSay());
+ this.a(new CommandSpawnpoint());
+ this.a(new CommandSetWorldSpawn());
+ this.a(new CommandGamerule());
+ this.a(new CommandClear());
+ this.a(new CommandTestFor());
+ this.a(new CommandSpreadPlayers());
+ this.a(new CommandPlaySound());
+ this.a(new CommandScoreboard());
+ this.a(new CommandAchievement());
+ this.a(new CommandSummon());
+ this.a(new CommandSetBlock());
+ this.a(new CommandTestForBlock());
+ this.a(new CommandTellRaw());
+ if (MinecraftServer.getServer().V()) {
+ this.a(new CommandOp());
+ this.a(new CommandDeop());
+ this.a(new CommandStop());
+ this.a(new CommandSaveAll());
+ this.a(new CommandSaveOff());
+ this.a(new CommandSaveOn());
+ this.a(new CommandBanIp());
+ this.a(new CommandPardonIP());
+ this.a(new CommandBan());
+ this.a(new CommandBanList());
+ this.a(new CommandPardon());
+ this.a(new CommandKick());
+ this.a(new CommandList());
+ this.a(new CommandWhitelist());
+ this.a(new CommandIdleTimeout());
+ } else {
+ this.a(new CommandPublish());
+ }
+
+ CommandAbstract.a((ICommandDispatcher) this);
+ }
+
+ public void a(ICommandListener icommandlistener, int i, String s, Object... aobject) {
+ boolean flag = true;
+
+ if (icommandlistener instanceof CommandBlockListenerAbstract && !MinecraftServer.getServer().worldServer[0].getGameRules().getBoolean("commandBlockOutput")) {
+ flag = false;
+ }
+
+ ChatMessage chatmessage = new ChatMessage("chat.type.admin", new Object[] { icommandlistener.getName(), new ChatMessage(s, aobject)});
+
+ chatmessage.b().setColor(EnumChatFormat.GRAY);
+ chatmessage.b().setItalic(Boolean.valueOf(true));
+ if (flag) {
+ Iterator iterator = MinecraftServer.getServer().getPlayerList().players.iterator();
+
+ while (iterator.hasNext()) {
+ EntityPlayer entityplayer = (EntityPlayer) iterator.next();
+
+ if (entityplayer != icommandlistener && MinecraftServer.getServer().getPlayerList().isOp(entityplayer.getName())) {
+ entityplayer.sendMessage(chatmessage);
+ }
+ }
+ }
+
+ if (icommandlistener != MinecraftServer.getServer()) {
+ MinecraftServer.getServer().sendMessage(chatmessage);
+ }
+
+ if ((i & 1) != 1) {
+ icommandlistener.sendMessage(new ChatMessage(s, aobject));
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java
new file mode 100644
index 0000000..90a2a80
@@ -1606,5 +1705,5 @@ index 0000000..c0db754
+ }
+}
--
1.8.3.2
1.8.4.msysgit.0