mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Added saconfig
Moved superadmin lists Added CantFindPlayerException Code cleanup
This commit is contained in:
parent
0a2f7fb4c5
commit
f84f10a7ad
@ -33,8 +33,4 @@ disable_weather: true
|
|||||||
|
|
||||||
# Superadmins: Users that can always log in and use the most powerful commands:
|
# Superadmins: Users that can always log in and use the most powerful commands:
|
||||||
# When online-mode = false, only superadmin_ips will be used.
|
# When online-mode = false, only superadmin_ips will be used.
|
||||||
superadmins:
|
# The superadmin lists have been moved to superadmin.yml
|
||||||
- Madgeek1450
|
|
||||||
- markbyron
|
|
||||||
superadmin_ips:
|
|
||||||
- 127.0.0.1
|
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
public class CantFindPlayerException extends Exception
|
||||||
|
{
|
||||||
|
public CantFindPlayerException()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public CantFindPlayerException(String msg)
|
||||||
|
{
|
||||||
|
super("Can't find player: " + msg);
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,8 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -26,15 +24,14 @@ public class Command_cage extends TFM_Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player p;
|
Player p;
|
||||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
try
|
||||||
if (matches.isEmpty())
|
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "Can't find user " + args[0]);
|
p = getPlayer(args[0]);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else
|
catch (CantFindPlayerException ex)
|
||||||
{
|
{
|
||||||
p = matches.get(0);
|
sender.sendMessage(ex.getMessage());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin);
|
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin);
|
||||||
|
@ -3,6 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -21,31 +22,28 @@ public class Command_creative extends TFM_Command
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (!sender.isOp())
|
||||||
{
|
{
|
||||||
if (!sender.isOp())
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
{
|
return true;
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Player p;
|
Player p;
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
p = Bukkit.getPlayerExact(sender.getName());
|
p = sender_p;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
try
|
||||||
if (matches.isEmpty())
|
|
||||||
{
|
{
|
||||||
sender.sendMessage("Can't find user " + args[0]);
|
p = getPlayer(args[0]);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else
|
catch (CantFindPlayerException ex)
|
||||||
{
|
{
|
||||||
p = matches.get(0);
|
sender.sendMessage(ex.getMessage());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ public class Command_expel extends TFM_Command
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
radius = Double.parseDouble(args[0]);
|
radius = Math.max(1.0, Math.min(200.0, Double.parseDouble(args[0])));
|
||||||
}
|
}
|
||||||
catch (NumberFormatException nfex)
|
catch (NumberFormatException nfex)
|
||||||
{
|
{
|
||||||
@ -40,7 +40,7 @@ public class Command_expel extends TFM_Command
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
strength = Double.parseDouble(args[1]);
|
strength = Math.max(0.0, Math.min(200.0, Double.parseDouble(args[1])));
|
||||||
}
|
}
|
||||||
catch (NumberFormatException nfex)
|
catch (NumberFormatException nfex)
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@ public class Command_explosives extends TFM_Command
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
plugin.explosiveRadius = Double.parseDouble(args[1]);
|
plugin.explosiveRadius = Math.max(1.0, Math.min(30.0, Double.parseDouble(args[1])));
|
||||||
}
|
}
|
||||||
catch (NumberFormatException nfex)
|
catch (NumberFormatException nfex)
|
||||||
{
|
{
|
||||||
|
@ -37,15 +37,14 @@ public class Command_fr extends TFM_Command
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Player p;
|
Player p;
|
||||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
try
|
||||||
if (matches.isEmpty())
|
|
||||||
{
|
{
|
||||||
sender.sendMessage("Can't find user " + args[0]);
|
p = getPlayer(args[0]);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else
|
catch (CantFindPlayerException ex)
|
||||||
{
|
{
|
||||||
p = matches.get(0);
|
sender.sendMessage(ex.getMessage());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin);
|
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin);
|
||||||
|
@ -22,15 +22,14 @@ public class Command_gcmd extends TFM_Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player p;
|
Player p;
|
||||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
try
|
||||||
if (matches.isEmpty())
|
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "Can't find user " + args[0]);
|
p = getPlayer(args[0]);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else
|
catch (CantFindPlayerException ex)
|
||||||
{
|
{
|
||||||
p = matches.get(0);
|
sender.sendMessage(ex.getMessage());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String outcommand = "";
|
String outcommand = "";
|
||||||
@ -43,9 +42,9 @@ public class Command_gcmd extends TFM_Command
|
|||||||
}
|
}
|
||||||
outcommand = outcommand_bldr.toString().trim();
|
outcommand = outcommand_bldr.toString().trim();
|
||||||
}
|
}
|
||||||
catch (Exception cmdex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "Error building command: " + cmdex.getMessage());
|
sender.sendMessage(ChatColor.GRAY + "Error building command: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -60,9 +59,9 @@ public class Command_gcmd extends TFM_Command
|
|||||||
sender.sendMessage(ChatColor.GRAY + "Unknown error sending command.");
|
sender.sendMessage(ChatColor.GRAY + "Unknown error sending command.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception cmdex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "Error sending command: " + cmdex.getMessage());
|
sender.sendMessage(ChatColor.GRAY + "Error sending command: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -24,15 +24,14 @@ public class Command_gtfo extends TFM_Command
|
|||||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||||
{
|
{
|
||||||
Player p;
|
Player p;
|
||||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
try
|
||||||
if (matches.isEmpty())
|
|
||||||
{
|
{
|
||||||
sender.sendMessage("Can't find user " + args[0]);
|
p = getPlayer(args[0]);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else
|
catch (CantFindPlayerException ex)
|
||||||
{
|
{
|
||||||
p = matches.get(0);
|
sender.sendMessage(ex.getMessage());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TFM_Util.tfm_broadcastMessage(p.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
|
TFM_Util.tfm_broadcastMessage(p.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
|
||||||
|
@ -23,7 +23,7 @@ public class Command_nonuke extends TFM_Command
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
plugin.nukeMonitorRange = Double.parseDouble(args[1]);
|
plugin.nukeMonitorRange = Math.max(1.0, Math.min(500.0, Double.parseDouble(args[1])));
|
||||||
}
|
}
|
||||||
catch (NumberFormatException nfex)
|
catch (NumberFormatException nfex)
|
||||||
{
|
{
|
||||||
@ -34,7 +34,7 @@ public class Command_nonuke extends TFM_Command
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
plugin.nukeMonitorCountBreak = Integer.parseInt(args[2]);
|
plugin.nukeMonitorCountBreak = Math.max(1, Math.min(500, Integer.parseInt(args[2])));
|
||||||
}
|
}
|
||||||
catch (NumberFormatException nfex)
|
catch (NumberFormatException nfex)
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -25,15 +23,14 @@ public class Command_orbit extends TFM_Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player p;
|
Player p;
|
||||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
try
|
||||||
if (matches.isEmpty())
|
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "Can't find user " + args[0]);
|
p = getPlayer(args[0]);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else
|
catch (CantFindPlayerException ex)
|
||||||
{
|
{
|
||||||
p = matches.get(0);
|
sender.sendMessage(ex.getMessage());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin);
|
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin);
|
||||||
@ -51,11 +48,10 @@ public class Command_orbit extends TFM_Command
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
strength = Double.parseDouble(args[1]);
|
strength = Math.max(1.0, Math.min(150.0, Double.parseDouble(args[1])));
|
||||||
}
|
}
|
||||||
catch (NumberFormatException nfex)
|
catch (NumberFormatException nfex)
|
||||||
{
|
{
|
||||||
strength = 10.0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,15 +24,14 @@ public class Command_qjail extends TFM_Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player p;
|
Player p;
|
||||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
try
|
||||||
if (matches.isEmpty())
|
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "Can't find user " + args[0]);
|
p = getPlayer(args[0]);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else
|
catch (CantFindPlayerException ex)
|
||||||
{
|
{
|
||||||
p = matches.get(0);
|
sender.sendMessage(ex.getMessage());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Deop
|
//Deop
|
||||||
|
@ -47,7 +47,7 @@ public class Command_radar extends TFM_Command
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
countmax = Integer.parseInt(args[0]);
|
countmax = Math.max(1, Math.min(64, Integer.parseInt(args[0])));
|
||||||
}
|
}
|
||||||
catch (NumberFormatException nfex)
|
catch (NumberFormatException nfex)
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,74 @@
|
|||||||
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class Command_saconfig 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 < 2)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[0].equalsIgnoreCase("add"))
|
||||||
|
{
|
||||||
|
Player p;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
p = getPlayer(args[1]);
|
||||||
|
}
|
||||||
|
catch (CantFindPlayerException ex)
|
||||||
|
{
|
||||||
|
sender.sendMessage(ex.getMessage());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String user_name = p.getName().toLowerCase().trim();
|
||||||
|
String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
|
||||||
|
|
||||||
|
sender.sendMessage(ChatColor.GRAY + "Adding " + user_name + " as a superadmin, with current IP = " + user_ip);
|
||||||
|
|
||||||
|
if (!plugin.superadmins.contains(user_name))
|
||||||
|
{
|
||||||
|
plugin.superadmins.add(user_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!plugin.superadmin_ips.contains(user_ip))
|
||||||
|
{
|
||||||
|
plugin.superadmin_ips.add(user_ip);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FileConfiguration sa_config = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
||||||
|
sa_config.set("superadmins", plugin.superadmins);
|
||||||
|
sa_config.set("superadmin_ips", plugin.superadmin_ips);
|
||||||
|
sa_config.save(new File(plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -21,31 +22,28 @@ public class Command_survival extends TFM_Command
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (!sender.isOp())
|
||||||
{
|
{
|
||||||
if (!sender.isOp())
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
{
|
return true;
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Player p;
|
Player p;
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
p = Bukkit.getPlayerExact(sender.getName());
|
p = sender_p;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
try
|
||||||
if (matches.isEmpty())
|
|
||||||
{
|
{
|
||||||
sender.sendMessage("Can't find user " + args[0]);
|
p = getPlayer(args[0]);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else
|
catch (CantFindPlayerException ex)
|
||||||
{
|
{
|
||||||
p = matches.get(0);
|
sender.sendMessage(ex.getMessage());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -27,4 +29,17 @@ public class TFM_Command
|
|||||||
{
|
{
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Player getPlayer(String partialname) throws CantFindPlayerException
|
||||||
|
{
|
||||||
|
List<Player> matches = Bukkit.matchPlayer(partialname);
|
||||||
|
if (matches.isEmpty())
|
||||||
|
{
|
||||||
|
throw new CantFindPlayerException(partialname);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return matches.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ public class TFM_Heartbeat implements Runnable
|
|||||||
{
|
{
|
||||||
private TotalFreedomMod plugin;
|
private TotalFreedomMod plugin;
|
||||||
|
|
||||||
TFM_Heartbeat(TotalFreedomMod instance)
|
public TFM_Heartbeat(TotalFreedomMod instance)
|
||||||
{
|
{
|
||||||
this.plugin = instance;
|
this.plugin = instance;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
|
|
||||||
public static final long HEARTBEAT_RATE = 5L; //Seconds
|
public static final long HEARTBEAT_RATE = 5L; //Seconds
|
||||||
public static final String CONFIG_FILE = "config.yml";
|
public static final String CONFIG_FILE = "config.yml";
|
||||||
|
public static final String SUPERADMIN_FILE = "superadmin.yml";
|
||||||
private static final String COMMAND_PATH = "me.StevenLawson.TotalFreedomMod.Commands";
|
private static final String COMMAND_PATH = "me.StevenLawson.TotalFreedomMod.Commands";
|
||||||
private static final String COMMAND_PREFIX = "Command_";
|
private static final String COMMAND_PREFIX = "Command_";
|
||||||
|
|
||||||
@ -42,7 +43,9 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
loadTFMConfig();
|
loadMainConfig();
|
||||||
|
loadSuperadminConfig();
|
||||||
|
|
||||||
registerEventHandlers();
|
registerEventHandlers();
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new TFM_Heartbeat(this), HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
|
Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new TFM_Heartbeat(this), HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
|
||||||
@ -93,7 +96,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "Command not loaded: " + cmd.getName(), ex);
|
log.log(Level.SEVERE, "[" + getDescription().getName() + "] Command not loaded: " + cmd.getName(), ex);
|
||||||
sender.sendMessage(ChatColor.RED + "Command Error: Command not loaded: " + cmd.getName());
|
sender.sendMessage(ChatColor.RED + "Command Error: Command not loaded: " + cmd.getName());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -109,7 +112,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "Command Error: " + commandLabel, ex);
|
log.log(Level.SEVERE, "[" + getDescription().getName() + "] Command Error: " + commandLabel, ex);
|
||||||
sender.sendMessage(ChatColor.RED + "Unknown Command Error.");
|
sender.sendMessage(ChatColor.RED + "Unknown Command Error.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,13 +135,10 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
public Boolean preprocessLogEnabled = true;
|
public Boolean preprocessLogEnabled = true;
|
||||||
public Boolean disableNight = true;
|
public Boolean disableNight = true;
|
||||||
public Boolean disableWeather = true;
|
public Boolean disableWeather = true;
|
||||||
public List<String> superadmins = new ArrayList<String>();
|
|
||||||
public List<String> superadmin_ips = new ArrayList<String>();
|
|
||||||
|
|
||||||
private void loadTFMConfig()
|
public void loadMainConfig()
|
||||||
{
|
{
|
||||||
TFM_Util.createDefaultConfiguration(CONFIG_FILE, this, getFile());
|
TFM_Util.createDefaultConfiguration(CONFIG_FILE, this, getFile());
|
||||||
|
|
||||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), CONFIG_FILE));
|
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), CONFIG_FILE));
|
||||||
|
|
||||||
allowFirePlace = config.getBoolean("allow_fire_place", allowFirePlace);
|
allowFirePlace = config.getBoolean("allow_fire_place", allowFirePlace);
|
||||||
@ -157,9 +157,18 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
preprocessLogEnabled = config.getBoolean("preprocess_log", preprocessLogEnabled);
|
preprocessLogEnabled = config.getBoolean("preprocess_log", preprocessLogEnabled);
|
||||||
disableNight = config.getBoolean("disable_night", disableNight);
|
disableNight = config.getBoolean("disable_night", disableNight);
|
||||||
disableWeather = config.getBoolean("disable_weather", disableWeather);
|
disableWeather = config.getBoolean("disable_weather", disableWeather);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> superadmins = new ArrayList<String>();
|
||||||
|
public List<String> superadmin_ips = new ArrayList<String>();
|
||||||
|
|
||||||
|
public void loadSuperadminConfig()
|
||||||
|
{
|
||||||
|
TFM_Util.createDefaultConfiguration(SUPERADMIN_FILE, this, getFile());
|
||||||
|
FileConfiguration sa_config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), SUPERADMIN_FILE));
|
||||||
|
|
||||||
superadmins = new ArrayList<String>();
|
superadmins = new ArrayList<String>();
|
||||||
List<String> superadmins_temp = (List<String>) config.getList("superadmins", null);
|
List<String> superadmins_temp = (List<String>) sa_config.getList("superadmins", null);
|
||||||
if (superadmins_temp == null || superadmins_temp.isEmpty())
|
if (superadmins_temp == null || superadmins_temp.isEmpty())
|
||||||
{
|
{
|
||||||
superadmins.add("Madgeek1450");
|
superadmins.add("Madgeek1450");
|
||||||
@ -174,7 +183,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
superadmin_ips = new ArrayList<String>();
|
superadmin_ips = new ArrayList<String>();
|
||||||
List<String> superadmin_ips_temp = (List<String>) config.getList("superadmin_ips", null);
|
List<String> superadmin_ips_temp = (List<String>) sa_config.getList("superadmin_ips", null);
|
||||||
if (superadmin_ips_temp == null || superadmin_ips_temp.isEmpty())
|
if (superadmin_ips_temp == null || superadmin_ips_temp.isEmpty())
|
||||||
{
|
{
|
||||||
superadmin_ips.add("127.0.0.1");
|
superadmin_ips.add("127.0.0.1");
|
||||||
|
257
src/plugin.yml
257
src/plugin.yml
@ -4,130 +4,133 @@ version: 2.1
|
|||||||
description: Plugin for the Total Freedom server.
|
description: Plugin for the Total Freedom server.
|
||||||
author: StevenLawson / Madgeek1450
|
author: StevenLawson / Madgeek1450
|
||||||
commands:
|
commands:
|
||||||
cage:
|
cage:
|
||||||
description: Superadmin command - Place a cage around someone.
|
description: Superadmin command - Place a cage around someone.
|
||||||
usage: /<command> <partialname> [off | outermaterial] [water | lava]
|
usage: /<command> <partialname> [off | outermaterial] [water | lava]
|
||||||
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>
|
||||||
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]
|
||||||
csay:
|
csay:
|
||||||
description: Telnet command - Send a chat message with chat formatting over telnet.
|
description: Telnet command - Send a chat message with chat formatting over telnet.
|
||||||
usage: /<command> [partialname]
|
usage: /<command> [partialname]
|
||||||
deopall:
|
deopall:
|
||||||
description: Superadmin command - Deop everyone on the server. Use 'purge' to clear ops.txt as well.
|
description: Superadmin command - Deop everyone on the server. Use 'purge' to clear ops.txt as well.
|
||||||
usage: /<command> [purge]
|
usage: /<command> [purge]
|
||||||
expel:
|
expel:
|
||||||
description: Superadmin command - Push people away from you.
|
description: Superadmin command - Push people away from you.
|
||||||
usage: /<command> [radius] [strength]
|
usage: /<command> [radius] [strength]
|
||||||
explosives:
|
explosives:
|
||||||
description: Superadmin command - Enable/disable explosives and set effect radius.
|
description: Superadmin command - Enable/disable explosives and set effect radius.
|
||||||
usage: /<command> <on | off> [radius]
|
usage: /<command> <on | off> [radius]
|
||||||
fireplace:
|
fireplace:
|
||||||
description: Superadmin command - Enable/disable fire placement.
|
description: Superadmin command - Enable/disable fire placement.
|
||||||
usage: /<command> <on | off>
|
usage: /<command> <on | off>
|
||||||
firespread:
|
firespread:
|
||||||
description: Superadmin command - Enable/disable fire spread.
|
description: Superadmin command - Enable/disable fire spread.
|
||||||
usage: /<command> <on | off>
|
usage: /<command> <on | off>
|
||||||
flatlands:
|
flatlands:
|
||||||
description: Goto the flatlands.
|
description: Goto the flatlands.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
fr:
|
fr:
|
||||||
description: Superadmin command - Freeze all players (toggles on and off).
|
description: Superadmin command - Freeze all players (toggles on and off).
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
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:
|
gcmd:
|
||||||
description: Superadmin command - Send a command as someone else.
|
description: Superadmin command - Send a command as someone else.
|
||||||
usage: /<command> <fromname> <outcommand>
|
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>
|
||||||
lavaplace:
|
lavaplace:
|
||||||
description: Superadmin command - Enable/disable lava placement.
|
description: Superadmin command - Enable/disable lava placement.
|
||||||
usage: /<command> <on | off>
|
usage: /<command> <on | off>
|
||||||
list:
|
list:
|
||||||
description: Lists the real names of all online players.
|
description: Lists the real names of all online players.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
aliases: [listreal]
|
aliases: [listreal]
|
||||||
mp:
|
mp:
|
||||||
description: Purge all mobs in all worlds.
|
description: Purge all mobs in all worlds.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
mp44:
|
mp44:
|
||||||
description: Superadmin Command - Modern weaponry, FTW. Use 'draw' to start firing, 'sling' to stop firing.
|
description: Superadmin Command - Modern weaponry, FTW. Use 'draw' to start firing, 'sling' to stop firing.
|
||||||
usage: /<command> <draw | sling>
|
usage: /<command> <draw | sling>
|
||||||
nether:
|
nether:
|
||||||
description: Goto the nether.
|
description: Goto the nether.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
nonuke:
|
nonuke:
|
||||||
description: Superadmin command - Attempt to detect "invisible griefers" and "nukers".
|
description: Superadmin command - Attempt to detect "invisible griefers" and "nukers".
|
||||||
usage: /<command> <on | off> [range] [blockrate]
|
usage: /<command> <on | off> [range] [blockrate]
|
||||||
opall:
|
opall:
|
||||||
description: Superadmin command - Op everyone on the server, optionally change everyone's gamemode at the same time.
|
description: Superadmin command - Op everyone on the server, optionally change everyone's gamemode at the same time.
|
||||||
usage: /<command> [-c | -s]
|
usage: /<command> [-c | -s]
|
||||||
opme:
|
opme:
|
||||||
description: Superadmin command - Automatically ops user.
|
description: Superadmin command - Automatically ops user.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
orbit:
|
orbit:
|
||||||
description: Superadmin command - POW!!! Right in the kisser! One of these days Alice, straight to the Moon!
|
description: Superadmin command - POW!!! Right in the kisser! One of these days Alice, straight to the Moon!
|
||||||
usage: /<command> <target> [power]
|
usage: /<command> <target> [power]
|
||||||
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>
|
||||||
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>
|
||||||
qjail:
|
qjail:
|
||||||
description: Quick Jail - Quickly jail someone (mgjail must be set as a jail!)
|
description: Quick Jail - Quickly jail someone (mgjail must be set as a jail!)
|
||||||
usage: /<command> <partialname>
|
usage: /<command> <partialname>
|
||||||
qop:
|
qop:
|
||||||
description: Quick Op - op someone based on a partial name.
|
description: Quick Op - op someone based on a partial name.
|
||||||
usage: /<command> <partialname>
|
usage: /<command> <partialname>
|
||||||
radar:
|
radar:
|
||||||
description: Shows nearby people sorted by distance.
|
description: Shows nearby people sorted by distance.
|
||||||
usage: /<command> [range]
|
usage: /<command> [range]
|
||||||
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>
|
||||||
say:
|
saconfig:
|
||||||
description: Broadcasts the given message as the console, includes sender name.
|
description: Owner command - Manage superadmins.
|
||||||
usage: /<command> <message>
|
usage: /<command> <add> <username>
|
||||||
skylands:
|
say:
|
||||||
description: Goto the skylands.
|
description: Broadcasts the given message as the console, includes sender name.
|
||||||
usage: /<command>
|
usage: /<command> <message>
|
||||||
status:
|
skylands:
|
||||||
description: Show misc. server info.
|
description: Goto the skylands.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
stop:
|
status:
|
||||||
description: Superadmin command - Kicks everyone and stops the server.
|
description: Show misc. server info.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
survival:
|
stop:
|
||||||
description: Quickly change your own gamemode to survival, or define someone's username to change theirs.
|
description: Superadmin command - Kicks everyone and stops the server.
|
||||||
usage: /<command> [partialname]
|
usage: /<command>
|
||||||
tfbanlist:
|
survival:
|
||||||
description: Shows all banned player names. Superadmins may optionally use 'purge' to clear the list.
|
description: Quickly change your own gamemode to survival, or define someone's username to change theirs.
|
||||||
usage: /<command> [purge]
|
usage: /<command> [partialname]
|
||||||
tfipbanlist:
|
tfbanlist:
|
||||||
description: Shows all banned IPs. Superadmins may optionally use 'purge' to clear the list.
|
description: Shows all banned player names. Superadmins may optionally use 'purge' to clear the list.
|
||||||
usage: /<command> [purge]
|
usage: /<command> [purge]
|
||||||
tfsmite:
|
tfipbanlist:
|
||||||
description: De-op, inventory clear, de-godmode, lightning, and kill your target. For naughty people only (or the entire server).
|
description: Shows all banned IPs. Superadmins may optionally use 'purge' to clear the list.
|
||||||
usage: /<command> <playername | all>
|
usage: /<command> [purge]
|
||||||
tossmob:
|
tfsmite:
|
||||||
description: Throw a mob in the direction you are facing when you left click with a stick.
|
description: De-op, inventory clear, de-godmode, lightning, and kill your target. For naughty people only (or the entire server).
|
||||||
usage: /<command> [mobtype | off] [speed]
|
usage: /<command> <playername | all>
|
||||||
umd:
|
tossmob:
|
||||||
description: Superadmin command - Undisguse all players.
|
description: Throw a mob in the direction you are facing when you left click with a stick.
|
||||||
usage: /<command>
|
usage: /<command> [mobtype | off] [speed]
|
||||||
waterplace:
|
umd:
|
||||||
description: Superadmin command - Enable/disable water placement.
|
description: Superadmin command - Undisguse all players.
|
||||||
usage: /<command> <on | off>
|
usage: /<command>
|
||||||
wildcard:
|
waterplace:
|
||||||
description: Superadmin command - Run any command on all users, username placeholder = ?.
|
description: Superadmin command - Enable/disable water placement.
|
||||||
usage: /<command> [fluff] ? [fluff] ?
|
usage: /<command> <on | off>
|
||||||
|
wildcard:
|
||||||
|
description: Superadmin command - Run any command on all users, username placeholder = ?.
|
||||||
|
usage: /<command> [fluff] ? [fluff] ?
|
||||||
|
5
src/superadmin.yml
Normal file
5
src/superadmin.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
superadmins:
|
||||||
|
- Madgeek1450
|
||||||
|
- markbyron
|
||||||
|
superadmin_ips:
|
||||||
|
- 127.0.0.1
|
Loading…
Reference in New Issue
Block a user