2022-03-20 12:35:43 +00:00
|
|
|
package me.StevenLawson.TotalFreedomMod.commands;
|
2011-10-19 00:37:00 +00:00
|
|
|
|
2022-03-20 12:35:43 +00:00
|
|
|
import me.StevenLawson.TotalFreedomMod.command.CommandBlocker;
|
2014-11-29 19:16:00 +00:00
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2022-03-23 23:15:51 +00:00
|
|
|
import org.bukkit.ChatColor;
|
2011-10-19 00:37:00 +00:00
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2013-03-19 22:05:20 +00:00
|
|
|
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
2022-03-20 12:35:43 +00:00
|
|
|
public class Command_gcmd extends FreedomCommand {
|
2022-03-31 01:46:24 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd,
|
|
|
|
String commandLabel, String[] args, boolean senderIsConsole) {
|
|
|
|
if (args.length < 2) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
String arguments = String.join(" ", args);
|
|
|
|
|
|
|
|
if (arguments.toLowerCase().contains("wildcard") || arguments.toLowerCase().contains("gcmd")
|
2022-04-01 21:04:12 +00:00
|
|
|
|| arguments.toLowerCase().contains("moles") || arguments.toLowerCase()
|
|
|
|
.contains("sudo")) {
|
2022-03-31 01:46:24 +00:00
|
|
|
playerMsg("What the hell are you trying to do, you stupid idiot...", ChatColor.RED);
|
|
|
|
if (sender_p != null) {
|
|
|
|
Command_smite.smite(sender_p);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
final Player player = getPlayer(args[0]);
|
|
|
|
|
|
|
|
if (player == null) {
|
|
|
|
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
final String outCommand = StringUtils.join(args, " ", 1, args.length);
|
|
|
|
|
|
|
|
if (CommandBlocker.isCommandBlocked(outCommand, sender)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
playerMsg(sender, "Sending command as " + player.getName() + ": " + outCommand);
|
|
|
|
if (server.dispatchCommand(player, outCommand)) {
|
|
|
|
playerMsg(sender, "Command sent.");
|
|
|
|
} else {
|
|
|
|
playerMsg(sender, "Unknown error sending command.");
|
|
|
|
}
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
playerMsg(sender, "Error sending command: " + ex.getMessage());
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2011-10-19 00:37:00 +00:00
|
|
|
}
|