mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-12-23 07:14:57 +00:00
Forgot to commit this...
This commit is contained in:
parent
bb3c08b9c5
commit
cdcc1e666a
10 changed files with 106 additions and 66 deletions
|
@ -26,12 +26,10 @@ dist.jar=${dist.dir}/TotalFreedomMod.jar
|
||||||
dist.javadoc.dir=${dist.dir}/javadoc
|
dist.javadoc.dir=${dist.dir}/javadoc
|
||||||
endorsed.classpath=
|
endorsed.classpath=
|
||||||
excludes=
|
excludes=
|
||||||
file.reference.MobDisguise.jar=../MobDisguise/dist/MobDisguise.jar
|
|
||||||
includes=**
|
includes=**
|
||||||
jar.compress=false
|
jar.compress=false
|
||||||
javac.classpath=\
|
javac.classpath=\
|
||||||
${libs.Bukkit.classpath}:\
|
${libs.Bukkit.classpath}
|
||||||
${file.reference.MobDisguise.jar}
|
|
||||||
# Space-separated list of extra javac options
|
# Space-separated list of extra javac options
|
||||||
javac.compilerargs=-Xlint:unchecked
|
javac.compilerargs=-Xlint:unchecked
|
||||||
javac.deprecation=false
|
javac.deprecation=false
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,7 +5,6 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_RadarData;
|
import me.StevenLawson.TotalFreedomMod.TFM_RadarData;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import me.desmin88.mobdisguise.api.MobDisguiseAPI;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -65,10 +64,10 @@ public class Command_radar extends TFM_Command
|
||||||
|
|
||||||
for (TFM_RadarData i : radar_data)
|
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(),
|
i.player.getName(),
|
||||||
Math.round(i.distance),
|
Math.round(i.distance)
|
||||||
MobDisguiseAPI.isDisguised(i.player) ? "Yes" : "No"));
|
));
|
||||||
|
|
||||||
if (--countmax <= 0)
|
if (--countmax <= 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,16 +47,16 @@ public class Command_saconfig extends TFM_Command
|
||||||
|
|
||||||
boolean something_changed = false;
|
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);
|
sender.sendMessage("Adding new superadmin: " + user_name);
|
||||||
something_changed = true;
|
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);
|
sender.sendMessage("Adding new superadmin IP: " + new_ip);
|
||||||
something_changed = true;
|
something_changed = true;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ public class Command_saconfig extends TFM_Command
|
||||||
List<String> user_ips = new ArrayList<String>();
|
List<String> user_ips = new ArrayList<String>();
|
||||||
if (config.contains(user_name))
|
if (config.contains(user_name))
|
||||||
{
|
{
|
||||||
user_ips = config.getStringList(user_name);
|
user_ips = config.getStringListFixed(user_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!user_ips.contains(new_ip))
|
if (!user_ips.contains(new_ip))
|
||||||
|
@ -118,14 +118,14 @@ public class Command_saconfig extends TFM_Command
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.superadmins.remove(user_name);
|
TotalFreedomMod.superadmins.remove(user_name);
|
||||||
|
|
||||||
if (config.contains(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)
|
for (String ip : user_ips)
|
||||||
{
|
{
|
||||||
plugin.superadmin_ips.remove(ip);
|
TotalFreedomMod.superadmin_ips.remove(ip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -339,14 +339,14 @@ public class TFM_PlayerListener extends PlayerListener
|
||||||
if (!Bukkit.getOnlineMode())
|
if (!Bukkit.getOnlineMode())
|
||||||
{
|
{
|
||||||
Player p = event.getPlayer();
|
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();
|
String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
|
||||||
if (user_ip != null && !user_ip.isEmpty())
|
if (user_ip != null && !user_ip.isEmpty())
|
||||||
{
|
{
|
||||||
TFM_Util.checkPartialSuperadminIP(user_ip, plugin);
|
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);
|
TFM_Util.bcastMsg(p.getName() + " might be a fake! IP: " + user_ip, ChatColor.RED);
|
||||||
p.setOp(false);
|
p.setOp(false);
|
||||||
|
|
|
@ -257,7 +257,7 @@ public class TFM_Util
|
||||||
|
|
||||||
if (Bukkit.getOnlineMode())
|
if (Bukkit.getOnlineMode())
|
||||||
{
|
{
|
||||||
if (tfm.superadmins.contains(user.getName().toLowerCase()))
|
if (TotalFreedomMod.superadmins.contains(user.getName().toLowerCase()))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ public class TFM_Util
|
||||||
String user_ip = ip_address_obj.getAddress().toString().replaceAll("/", "").trim();
|
String user_ip = ip_address_obj.getAddress().toString().replaceAll("/", "").trim();
|
||||||
if (user_ip != null && !user_ip.isEmpty())
|
if (user_ip != null && !user_ip.isEmpty())
|
||||||
{
|
{
|
||||||
if (tfm.superadmin_ips.contains(user_ip))
|
if (TotalFreedomMod.superadmin_ips.contains(user_ip))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ public class TFM_Util
|
||||||
{
|
{
|
||||||
user_ip = user_ip.trim();
|
user_ip = user_ip.trim();
|
||||||
|
|
||||||
if (tfm.superadmin_ips.contains(user_ip))
|
if (TotalFreedomMod.superadmin_ips.contains(user_ip))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ public class TFM_Util
|
||||||
}
|
}
|
||||||
|
|
||||||
String match_ip = null;
|
String match_ip = null;
|
||||||
for (String test_ip : tfm.superadmin_ips)
|
for (String test_ip : TotalFreedomMod.superadmin_ips)
|
||||||
{
|
{
|
||||||
String[] test_octets = test_ip.split("\\.");
|
String[] test_octets = test_ip.split("\\.");
|
||||||
if (test_octets.length == 4)
|
if (test_octets.length == 4)
|
||||||
|
@ -320,14 +320,14 @@ public class TFM_Util
|
||||||
|
|
||||||
if (match_ip != null)
|
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));
|
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(tfm.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
||||||
|
|
||||||
fileloop:
|
fileloop:
|
||||||
for (String user : config.getKeys(false))
|
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)
|
for (String ip : user_ips)
|
||||||
{
|
{
|
||||||
ip = ip.toLowerCase().trim();
|
ip = ip.toLowerCase().trim();
|
||||||
|
|
|
@ -176,7 +176,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||||
{
|
{
|
||||||
superadmins.add(user.toLowerCase().trim());
|
superadmins.add(user.toLowerCase().trim());
|
||||||
|
|
||||||
List<String> user_ips = config.getStringList(user);
|
List<String> user_ips = config.getStringListFixed(user);
|
||||||
for (String ip : user_ips)
|
for (String ip : user_ips)
|
||||||
{
|
{
|
||||||
ip = ip.toLowerCase().trim();
|
ip = ip.toLowerCase().trim();
|
||||||
|
|
|
@ -10,6 +10,9 @@ commands:
|
||||||
cake:
|
cake:
|
||||||
description: Superadmin command - For the people that are still alive.
|
description: Superadmin command - For the people that are still alive.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
|
cmdlist:
|
||||||
|
description: Show all commands for all server plugins.
|
||||||
|
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.
|
||||||
usage: /<command> [partialname]
|
usage: /<command> [partialname]
|
||||||
|
@ -92,6 +95,9 @@ commands:
|
||||||
radar:
|
radar:
|
||||||
description: Shows nearby people sorted by distance.
|
description: Shows nearby people sorted by distance.
|
||||||
usage: /<command> [range]
|
usage: /<command> [range]
|
||||||
|
rawsay:
|
||||||
|
description: Owner Command - Broadcasts the given message with no extra formatting.
|
||||||
|
usage: /<command> <message>
|
||||||
rd:
|
rd:
|
||||||
description: Remove drops, arrows, primed TNT, and expierence orbs in all worlds.
|
description: Remove drops, arrows, primed TNT, and expierence orbs in all worlds.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
|
@ -131,9 +137,6 @@ commands:
|
||||||
tossmob:
|
tossmob:
|
||||||
description: Throw a mob in the direction you are facing when you left click with a stick.
|
description: Throw a mob in the direction you are facing when you left click with a stick.
|
||||||
usage: /<command> [mobtype | off] [speed]
|
usage: /<command> [mobtype | off] [speed]
|
||||||
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>
|
||||||
|
|
Loading…
Reference in a new issue