diff --git a/src/com/massivecraft/mcore/mixin/CommandMixin.java b/src/com/massivecraft/mcore/mixin/CommandMixin.java index 5b0087a4..34e2c31d 100644 --- a/src/com/massivecraft/mcore/mixin/CommandMixin.java +++ b/src/com/massivecraft/mcore/mixin/CommandMixin.java @@ -8,5 +8,6 @@ public interface CommandMixin { public boolean dispatchCommand(CommandSender sender, String commandLine); public boolean dispatchCommand(SenderEntity sender, String commandLine); - public boolean dispatchCommand(String sender, String commandLine); + public boolean dispatchCommand(String senderId, String commandLine); + public boolean dispatchCommand(String presentId, String senderId, String commandLine); // This one is non-abstract } diff --git a/src/com/massivecraft/mcore/mixin/CommandMixinAbstract.java b/src/com/massivecraft/mcore/mixin/CommandMixinAbstract.java index ce6b270d..4c1e2ae0 100644 --- a/src/com/massivecraft/mcore/mixin/CommandMixinAbstract.java +++ b/src/com/massivecraft/mcore/mixin/CommandMixinAbstract.java @@ -1,21 +1,27 @@ package com.massivecraft.mcore.mixin; -import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import com.massivecraft.mcore.store.SenderEntity; +import com.massivecraft.mcore.util.SenderUtil; public abstract class CommandMixinAbstract implements CommandMixin { + @Override public boolean dispatchCommand(CommandSender sender, String commandLine) { - return Bukkit.getServer().dispatchCommand(sender, commandLine); + return this.dispatchCommand(SenderUtil.getSenderId(sender), SenderUtil.getSenderId(sender), commandLine); } @Override public boolean dispatchCommand(SenderEntity sender, String commandLine) { - return this.dispatchCommand(sender.getId(), commandLine); + return this.dispatchCommand(sender.getId(), sender.getId(), commandLine); } + @Override + public boolean dispatchCommand(String senderId, String commandLine) + { + return this.dispatchCommand(senderId, senderId, commandLine); + } } diff --git a/src/com/massivecraft/mcore/mixin/CommandMixinDefault.java b/src/com/massivecraft/mcore/mixin/CommandMixinDefault.java index 9e9f1219..5a967866 100644 --- a/src/com/massivecraft/mcore/mixin/CommandMixinDefault.java +++ b/src/com/massivecraft/mcore/mixin/CommandMixinDefault.java @@ -1,5 +1,6 @@ package com.massivecraft.mcore.mixin; +import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import com.massivecraft.mcore.util.SenderUtil; @@ -16,13 +17,21 @@ public class CommandMixinDefault extends CommandMixinAbstract // -------------------------------------------- // // OVERRIDE // -------------------------------------------- // - + @Override - public boolean dispatchCommand(String sender, String commandLine) + public boolean dispatchCommand(String presentId, String senderId, String commandLine) { - CommandSender commandSender = SenderUtil.getSender(sender); - if (commandSender == null) return false; - return this.dispatchCommand(sender, commandLine); + // Additional enforced presence + CommandSender present = SenderUtil.getSender(presentId); + if (present == null) return false; + + // We must then of course have the presence of the sender + CommandSender sender = SenderUtil.getSender(senderId); + if (sender == null) return false; + + // Great! Let's do it! + Bukkit.getServer().dispatchCommand(sender, commandLine); + return true; } } \ No newline at end of file diff --git a/src/com/massivecraft/mcore/mixin/Mixin.java b/src/com/massivecraft/mcore/mixin/Mixin.java index 3853e493..c0b2ee10 100644 --- a/src/com/massivecraft/mcore/mixin/Mixin.java +++ b/src/com/massivecraft/mcore/mixin/Mixin.java @@ -720,9 +720,14 @@ public class Mixin return getCommandMixin().dispatchCommand(sender, commandLine); } - public static boolean dispatchCommand(String sender, String commandLine) + public static boolean dispatchCommand(String senderId, String commandLine) { - return getCommandMixin().dispatchCommand(sender, commandLine); + return getCommandMixin().dispatchCommand(senderId, commandLine); + } + + public static boolean dispatchCommand(String presentId, String senderId, String commandLine) + { + return getCommandMixin().dispatchCommand(presentId, senderId, commandLine); } }