mirror of
https://github.com/kaboomserver/commandspy.git
synced 2025-07-06 22:21:31 +00:00
Better command handling in console
This commit is contained in:
parent
1fa559b92f
commit
fd068e2682
1 changed files with 14 additions and 9 deletions
|
@ -6,6 +6,7 @@ import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@ -71,16 +72,20 @@ class CommandCommandSpy implements CommandExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
final Player player = (Player) sender;
|
if (sender instanceof ConsoleCommandSender) {
|
||||||
|
sender.sendMessage("Command has to be run by a player");
|
||||||
if (main.getConfig().contains(player.getUniqueId().toString())) {
|
|
||||||
main.getConfig().set(player.getUniqueId().toString(), null);
|
|
||||||
main.saveConfig();
|
|
||||||
player.sendMessage("Successfully disabled CommandSpy");
|
|
||||||
} else {
|
} else {
|
||||||
main.getConfig().set(player.getUniqueId().toString(), true);
|
final Player player = (Player) sender;
|
||||||
main.saveConfig();
|
|
||||||
player.sendMessage("Successfully enabled CommandSpy");
|
if (main.getConfig().contains(player.getUniqueId().toString())) {
|
||||||
|
main.getConfig().set(player.getUniqueId().toString(), null);
|
||||||
|
main.saveConfig();
|
||||||
|
player.sendMessage("Successfully disabled CommandSpy");
|
||||||
|
} else {
|
||||||
|
main.getConfig().set(player.getUniqueId().toString(), true);
|
||||||
|
main.saveConfig();
|
||||||
|
player.sendMessage("Successfully enabled CommandSpy");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue