Made the command execute at it's executor

This commit is contained in:
Norbi Peti 2016-06-18 23:31:56 +02:00
parent e382020b57
commit 75b5fd2bb0

View file

@ -12,8 +12,8 @@ import org.bukkit.entity.Player;
public class Commands implements CommandExecutor public class Commands implements CommandExecutor
{ {
private final String[] replacecmds = { "achievement", "ban", private final String[] replacecmds = { "achievement", "ban", "ban-ip",
"ban-ip", "banlist", "blockdata", "clear", "clone", "debug", "banlist", "blockdata", "clear", "clone", "debug",
"defaultgamemode", "deop", "difficulty", "effect", "enchant", "defaultgamemode", "deop", "difficulty", "effect", "enchant",
"entitydata", "execute", "fill", "gamemode", "gamerule", "give", "entitydata", "execute", "fill", "gamemode", "gamerule", "give",
"help", "kick", "kill", "list", "me", "op", "pardon", "particle", "help", "kick", "kill", "list", "me", "op", "pardon", "particle",
@ -30,7 +30,8 @@ public class Commands implements CommandExecutor
public boolean onCommand(CommandSender sender, Command cmd, String alias, public boolean onCommand(CommandSender sender, Command cmd, String alias,
String[] args) String[] args)
{ {
StringBuilder acmdb = new StringBuilder("minecraft:execute @p ~ ~ ~"); StringBuilder acmdb = new StringBuilder("minecraft:execute "
+ sender.getName() + " ~ ~ ~");
if (sender != Bukkit.getConsoleSender() if (sender != Bukkit.getConsoleSender()
&& !(sender instanceof BlockCommandSender)) && !(sender instanceof BlockCommandSender))
{ {
@ -44,8 +45,7 @@ public class Commands implements CommandExecutor
} }
CommandBlock cmdblock = (CommandBlock) block.getState(); CommandBlock cmdblock = (CommandBlock) block.getState();
acmdb.append(" ").append(cmdblock.getCommand()); acmdb.append(" ").append(cmdblock.getCommand());
} } else
else
{ {
if (args.length == 0) if (args.length == 0)
{ {