Forgot to commit this...

This commit is contained in:
Steven Lawson 2011-11-21 01:47:19 -05:00
parent bb3c08b9c5
commit cdcc1e666a
10 changed files with 106 additions and 66 deletions

View file

@ -26,12 +26,10 @@ dist.jar=${dist.dir}/TotalFreedomMod.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.MobDisguise.jar=../MobDisguise/dist/MobDisguise.jar
includes=**
jar.compress=false
javac.classpath=\
${libs.Bukkit.classpath}:\
${file.reference.MobDisguise.jar}
${libs.Bukkit.classpath}
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:unchecked
javac.deprecation=false

View file

@ -0,0 +1,49 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
public class Command_cmdlist extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
List<String> commands = new ArrayList<String>();
for (Plugin p : plugin.getServer().getPluginManager().getPlugins())
{
try
{
PluginDescriptionFile desc = p.getDescription();
Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) desc.getCommands();
if (map != null)
{
for (Entry<String, Map<String, Object>> entry : map.entrySet())
{
String command_name = (String) entry.getKey();
commands.add(command_name);
}
}
}
catch (Throwable ex)
{
}
}
Collections.sort(commands);
sender.sendMessage(TFM_Util.implodeStringList(",", commands));
return true;
}
}

View file

@ -5,7 +5,6 @@ import java.util.Collections;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_RadarData;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import me.desmin88.mobdisguise.api.MobDisguiseAPI;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
@ -65,10 +64,10 @@ public class Command_radar extends TFM_Command
for (TFM_RadarData i : radar_data)
{
sender.sendMessage(ChatColor.YELLOW + String.format("%s - %d, Disguised: %s",
sender.sendMessage(ChatColor.YELLOW + String.format("%s - %d",
i.player.getName(),
Math.round(i.distance),
MobDisguiseAPI.isDisguised(i.player) ? "Yes" : "No"));
Math.round(i.distance)
));
if (--countmax <= 0)
{

View file

@ -0,0 +1,30 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.Arrays;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Command_rawsay extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!senderIsConsole || sender.getName().equalsIgnoreCase("remotebukkit"))
{
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
return true;
}
if (args.length == 0)
{
return false;
}
TFM_Util.bcastMsg(TFM_Util.implodeStringList(" ", Arrays.asList(args)));
return true;
}
}

View file

@ -47,16 +47,16 @@ public class Command_saconfig extends TFM_Command
boolean something_changed = false;
if (!plugin.superadmins.contains(user_name))
if (!TotalFreedomMod.superadmins.contains(user_name))
{
plugin.superadmins.add(user_name);
TotalFreedomMod.superadmins.add(user_name);
sender.sendMessage("Adding new superadmin: " + user_name);
something_changed = true;
}
if (!plugin.superadmin_ips.contains(new_ip))
if (!TotalFreedomMod.superadmin_ips.contains(new_ip))
{
plugin.superadmin_ips.add(new_ip);
TotalFreedomMod.superadmin_ips.add(new_ip);
sender.sendMessage("Adding new superadmin IP: " + new_ip);
something_changed = true;
}
@ -71,7 +71,7 @@ public class Command_saconfig extends TFM_Command
List<String> user_ips = new ArrayList<String>();
if (config.contains(user_name))
{
user_ips = config.getStringList(user_name);
user_ips = config.getStringListFixed(user_name);
}
if (!user_ips.contains(new_ip))
@ -118,14 +118,14 @@ public class Command_saconfig extends TFM_Command
return true;
}
plugin.superadmins.remove(user_name);
TotalFreedomMod.superadmins.remove(user_name);
if (config.contains(user_name))
{
List<String> user_ips = config.getStringList(user_name);
List<String> user_ips = config.getStringListFixed(user_name);
for (String ip : user_ips)
{
plugin.superadmin_ips.remove(ip);
TotalFreedomMod.superadmin_ips.remove(ip);
}
}

View file

@ -1,39 +0,0 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import me.desmin88.mobdisguise.api.MobDisguiseAPI;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Command_umd extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
{
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;
}
}

View file

@ -339,14 +339,14 @@ public class TFM_PlayerListener extends PlayerListener
if (!Bukkit.getOnlineMode())
{
Player p = event.getPlayer();
if (plugin.superadmins.contains(p.getName().toLowerCase()))
if (TotalFreedomMod.superadmins.contains(p.getName().toLowerCase()))
{
String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
if (user_ip != null && !user_ip.isEmpty())
{
TFM_Util.checkPartialSuperadminIP(user_ip, plugin);
if (!plugin.superadmin_ips.contains(user_ip))
if (!TotalFreedomMod.superadmin_ips.contains(user_ip))
{
TFM_Util.bcastMsg(p.getName() + " might be a fake! IP: " + user_ip, ChatColor.RED);
p.setOp(false);

View file

@ -257,7 +257,7 @@ public class TFM_Util
if (Bukkit.getOnlineMode())
{
if (tfm.superadmins.contains(user.getName().toLowerCase()))
if (TotalFreedomMod.superadmins.contains(user.getName().toLowerCase()))
{
return true;
}
@ -272,7 +272,7 @@ public class TFM_Util
String user_ip = ip_address_obj.getAddress().toString().replaceAll("/", "").trim();
if (user_ip != null && !user_ip.isEmpty())
{
if (tfm.superadmin_ips.contains(user_ip))
if (TotalFreedomMod.superadmin_ips.contains(user_ip))
{
return true;
}
@ -292,7 +292,7 @@ public class TFM_Util
{
user_ip = user_ip.trim();
if (tfm.superadmin_ips.contains(user_ip))
if (TotalFreedomMod.superadmin_ips.contains(user_ip))
{
return true;
}
@ -305,7 +305,7 @@ public class TFM_Util
}
String match_ip = null;
for (String test_ip : tfm.superadmin_ips)
for (String test_ip : TotalFreedomMod.superadmin_ips)
{
String[] test_octets = test_ip.split("\\.");
if (test_octets.length == 4)
@ -320,14 +320,14 @@ public class TFM_Util
if (match_ip != null)
{
tfm.superadmin_ips.add(user_ip);
TotalFreedomMod.superadmin_ips.add(user_ip);
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(tfm.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
fileloop:
for (String user : config.getKeys(false))
{
List<String> user_ips = config.getStringList(user);
List<String> user_ips = config.getStringListFixed(user);
for (String ip : user_ips)
{
ip = ip.toLowerCase().trim();

View file

@ -176,7 +176,7 @@ public class TotalFreedomMod extends JavaPlugin
{
superadmins.add(user.toLowerCase().trim());
List<String> user_ips = config.getStringList(user);
List<String> user_ips = config.getStringListFixed(user);
for (String ip : user_ips)
{
ip = ip.toLowerCase().trim();

View file

@ -10,6 +10,9 @@ commands:
cake:
description: Superadmin command - For the people that are still alive.
usage: /<command>
cmdlist:
description: Show all commands for all server plugins.
usage: /<command>
creative:
description: Quickly change your own gamemode to creative, or define someone's username to change theirs.
usage: /<command> [partialname]
@ -92,6 +95,9 @@ commands:
radar:
description: Shows nearby people sorted by distance.
usage: /<command> [range]
rawsay:
description: Owner Command - Broadcasts the given message with no extra formatting.
usage: /<command> <message>
rd:
description: Remove drops, arrows, primed TNT, and expierence orbs in all worlds.
usage: /<command>
@ -131,9 +137,6 @@ commands:
tossmob:
description: Throw a mob in the direction you are facing when you left click with a stick.
usage: /<command> [mobtype | off] [speed]
umd:
description: Superadmin command - Undisguse all players.
usage: /<command>
waterplace:
description: Superadmin command - Enable/disable water placement.
usage: /<command> <on | off>