Added umd, qual, and gcmd

This commit is contained in:
Steven Lawson 2011-10-03 17:41:09 -04:00
parent 473ed35e19
commit 84dbc63f86
5 changed files with 165 additions and 8 deletions

View File

@ -27,10 +27,12 @@ dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath= endorsed.classpath=
excludes= excludes=
file.reference.bukkit-0.0.1-SNAPSHOT.jar=C:\\github\\Bukkit\\target\\bukkit-0.0.1-SNAPSHOT.jar file.reference.bukkit-0.0.1-SNAPSHOT.jar=C:\\github\\Bukkit\\target\\bukkit-0.0.1-SNAPSHOT.jar
file.reference.MobDisguise.jar=C:\\github\\MobDisguise\\dist\\MobDisguise.jar
includes=** includes=**
jar.compress=false jar.compress=false
javac.classpath=\ javac.classpath=\
${file.reference.bukkit-0.0.1-SNAPSHOT.jar} ${file.reference.bukkit-0.0.1-SNAPSHOT.jar}:\
${file.reference.MobDisguise.jar}
# Space-separated list of extra javac options # Space-separated list of extra javac options
javac.compilerargs= javac.compilerargs=
javac.deprecation=false javac.deprecation=false

View File

@ -4,6 +4,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.logging.Logger; import java.util.logging.Logger;
import me.desmin88.mobdisguise.api.MobDisguiseAPI;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -132,7 +133,10 @@ public class TFM_Cmds_Admin implements CommandExecutor
p = matches.get(0); p = matches.get(0);
} }
plugin.tfm_broadcastMessage(p.getName() + " has been a naughty, naughty boy.", ChatColor.RED); plugin.tfm_broadcastMessage(p.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
//Undo WorldEdits:
Bukkit.getServer().dispatchCommand(sender, String.format("/undo %d %s", 15, p.getName()));
//Deop //Deop
p.setOp(false); p.setOp(false);
@ -154,9 +158,6 @@ public class TFM_Cmds_Admin implements CommandExecutor
} }
} }
//Attempt to kill:
p.setHealth(0);
//Ban IP Address: //Ban IP Address:
String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim(); String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
plugin.tfm_broadcastMessage(String.format("Banning: %s, IP: %s.", p.getName(), user_ip), ChatColor.RED); plugin.tfm_broadcastMessage(String.format("Banning: %s, IP: %s.", p.getName(), user_ip), ChatColor.RED);
@ -405,6 +406,143 @@ public class TFM_Cmds_Admin implements CommandExecutor
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
} }
return true;
}
else if (cmd.getName().equalsIgnoreCase("gcmd"))
{
if (senderIsConsole || plugin.isUserSuperadmin(sender))
{
if (args.length < 2)
{
return false;
}
Player p;
List<Player> matches = Bukkit.matchPlayer(args[0]);
if (matches.isEmpty())
{
sender.sendMessage(ChatColor.GRAY + "Can't find user " + args[0]);
return true;
}
else
{
p = matches.get(0);
}
String outcommand = "";
try
{
StringBuilder outcommand_bldr = new StringBuilder();
for (int i = 1; i < args.length; i++)
{
outcommand_bldr.append(args[i]).append(" ");
}
outcommand = outcommand_bldr.toString().trim();
}
catch (Exception cmdex)
{
sender.sendMessage(ChatColor.GRAY + "Error building command: " + cmdex.getMessage());
}
try
{
sender.sendMessage(ChatColor.GRAY + "Sending command as " + p.getName() + ": " + outcommand);
if (Bukkit.getServer().dispatchCommand(p, outcommand))
{
sender.sendMessage(ChatColor.GRAY + "Command sent.");
}
else
{
sender.sendMessage(ChatColor.GRAY + "Unknown error sending command.");
}
}
catch (Exception cmdex)
{
sender.sendMessage(ChatColor.GRAY + "Error sending command: " + cmdex.getMessage());
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}
else if (cmd.getName().equalsIgnoreCase("qjail"))
{
if (senderIsConsole || plugin.isUserSuperadmin(sender))
{
if (args.length < 1)
{
return false;
}
Player p;
List<Player> matches = Bukkit.matchPlayer(args[0]);
if (matches.isEmpty())
{
sender.sendMessage(ChatColor.GRAY + "Can't find user " + args[0]);
return true;
}
else
{
p = matches.get(0);
}
//Deop
p.setOp(false);
//Set gamemode to survival:
p.setGameMode(GameMode.SURVIVAL);
//Clear inventory:
p.getInventory().clear();
//Strike with lightning effect:
final Location target_pos = p.getLocation();
for (int x = -1; x <= 1; x++)
{
for (int z = -1; z <= 1; z++)
{
final Location strike_pos = new Location(target_pos.getWorld(), target_pos.getBlockX() + x, target_pos.getBlockY(), target_pos.getBlockZ() + z);
target_pos.getWorld().strikeLightning(strike_pos);
}
}
//Send to jail "mgjail":
Bukkit.getServer().dispatchCommand(sender, String.format("tjail %s mgjail", p.getName()));
plugin.tfm_broadcastMessage(p.getName() + " has been JAILED!", ChatColor.RED);
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}
else if (cmd.getName().equalsIgnoreCase("umd"))
{
if (senderIsConsole || plugin.isUserSuperadmin(sender))
{
for (Player p : Bukkit.getOnlinePlayers())
{
if (MobDisguiseAPI.isDisguised(p))
{
p.sendMessage(ChatColor.GRAY + "You have been undisguised by an administrator.");
}
MobDisguiseAPI.undisguisePlayer(p);
MobDisguiseAPI.undisguisePlayerAsPlayer(p, "");
}
sender.sendMessage(ChatColor.GRAY + "All players have been undisguised.");
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true; return true;
} }
} }

View File

@ -5,6 +5,7 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.logging.Logger; import java.util.logging.Logger;
import me.desmin88.mobdisguise.api.MobDisguiseAPI;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -186,7 +187,11 @@ public class TFM_Cmds_General implements CommandExecutor
break; break;
} }
sender.sendMessage(ChatColor.YELLOW + String.format("%s - %d blocks away @ %s.", i.player.getName(), Math.round(i.distance), plugin.formatLocation(i.location))); sender.sendMessage(ChatColor.YELLOW + String.format("%s - %d, Disguised: %s",
i.player.getName(),
Math.round(i.distance),
MobDisguiseAPI.isDisguised(i.player) ? "Yes" : "No"
));
} }
return true; return true;

View File

@ -300,6 +300,9 @@ public class TotalFreedomMod extends JavaPlugin
this.getCommand("nonuke").setExecutor(AdminCommands); this.getCommand("nonuke").setExecutor(AdminCommands);
this.getCommand("prelog").setExecutor(AdminCommands); this.getCommand("prelog").setExecutor(AdminCommands);
this.getCommand("cake").setExecutor(AdminCommands); this.getCommand("cake").setExecutor(AdminCommands);
this.getCommand("gcmd").setExecutor(AdminCommands);
this.getCommand("qjail").setExecutor(AdminCommands);
this.getCommand("umd").setExecutor(AdminCommands);
this.getCommand("explosives").setExecutor(AntiblockCommands); this.getCommand("explosives").setExecutor(AntiblockCommands);
this.getCommand("lavadmg").setExecutor(AntiblockCommands); this.getCommand("lavadmg").setExecutor(AntiblockCommands);

View File

@ -5,7 +5,7 @@ description: Plugin for the Total Freedom server
author: StevenLawson / Madgeek1450 author: StevenLawson / Madgeek1450
commands: commands:
cake: cake:
description: For the people that are still alive. description: Superadmin command - For the people that are still alive.
usage: /<command> usage: /<command>
creative: creative:
description: Quickly change your own gamemode to creative, or define someone's username to change theirs. description: Quickly change your own gamemode to creative, or define someone's username to change theirs.
@ -31,9 +31,12 @@ commands:
gadmin: gadmin:
description: Superadmin command - Use admin commands on someone by hash. Use mode 'list' to get a player's hash. Other modes are kick, nameban, ipban, ban, op, deop, ci description: Superadmin command - Use admin commands on someone by hash. Use mode 'list' to get a player's hash. Other modes are kick, nameban, ipban, ban, op, deop, ci
usage: /<command> [list | <kick|nameban|ipban|ban|op|deop|ci> <targethash>] usage: /<command> [list | <kick|nameban|ipban|ban|op|deop|ci> <targethash>]
gcmd:
description: Superadmin command - Send a command as someone else.
usage: /<command> <fromname> <outcommand>
gtfo: gtfo:
description: Superadmin command - Makes someone GTFO (deop and ip ban by username). description: Superadmin command - Makes someone GTFO (deop and ip ban by username).
usage: /<command> [partialname] usage: /<command> <partialname>
lavadmg: lavadmg:
description: Superadmin command - Enable/disable lava damage. description: Superadmin command - Enable/disable lava damage.
usage: /<command> <on|off> usage: /<command> <on|off>
@ -61,6 +64,9 @@ commands:
prelog: prelog:
description: Superadmin command - Enable/disable the command prelogger. When this is on, logs will be filled with many duplicate messages. description: Superadmin command - Enable/disable the command prelogger. When this is on, logs will be filled with many duplicate messages.
usage: /<command> <on|off> usage: /<command> <on|off>
qjail:
description: Quick Jail - Quickly jail someone (mgjail must be set as a jail!)
usage: /<command> <partialname>
qdeop: qdeop:
description: Quick De-Op - deop someone based on a partial name. description: Quick De-Op - deop someone based on a partial name.
usage: /<command> <partialname> usage: /<command> <partialname>
@ -88,6 +94,9 @@ commands:
survival: survival:
description: Quickly change your own gamemode to survival, or define someone's username to change theirs. description: Quickly change your own gamemode to survival, or define someone's username to change theirs.
usage: /<command> [partialname] usage: /<command> [partialname]
umd:
description: Superadmin command - Undisguse all players.
usage: /<command>
waterplace: waterplace:
description: Superadmin command - Enable/disable water placement. description: Superadmin command - Enable/disable water placement.
usage: /<command> <on|off> usage: /<command> <on|off>