mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Various cleanup and bugfixes.
This commit is contained in:
parent
6083f94797
commit
59e6588779
@ -13,7 +13,7 @@ public class Command_adminmode extends TFM_Command
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (!senderIsConsole || sender.getName().equalsIgnoreCase("remotebukkit"))
|
if (!senderIsConsole || TFM_Util.isFromClanforge(sender.getName()))
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
|
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -15,11 +15,6 @@ public class Command_csay extends TFM_Command
|
|||||||
{
|
{
|
||||||
String sender_name = sender.getName();
|
String sender_name = sender.getName();
|
||||||
|
|
||||||
if (sender_name.equalsIgnoreCase("remotebukkit"))
|
|
||||||
{
|
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
||||||
}
|
|
||||||
|
|
||||||
sender_name = sender_name.split("-")[0];
|
sender_name = sender_name.split("-")[0];
|
||||||
|
|
||||||
StringBuilder outmessage_bldr = new StringBuilder();
|
StringBuilder outmessage_bldr = new StringBuilder();
|
||||||
|
@ -12,7 +12,7 @@ public class Command_kicknoob extends TFM_Command
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (!senderIsConsole || sender.getName().equalsIgnoreCase("remotebukkit"))
|
if (!senderIsConsole || TFM_Util.isFromClanforge(sender.getName()))
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
|
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -3,6 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -14,7 +15,7 @@ public class Command_list extends TFM_Command
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
final boolean is_clanforge = sender.getName().equalsIgnoreCase("remotebukkit");
|
final boolean is_clanforge = TFM_Util.isFromClanforge(sender.getName());
|
||||||
|
|
||||||
StringBuilder onlineStats = new StringBuilder();
|
StringBuilder onlineStats = new StringBuilder();
|
||||||
StringBuilder onlineUsers = new StringBuilder();
|
StringBuilder onlineUsers = new StringBuilder();
|
||||||
|
@ -67,7 +67,7 @@ public class Command_lockup extends TFM_Command
|
|||||||
startLockup(p);
|
startLockup(p);
|
||||||
TFM_Util.playerMsg(sender, "Locked up " + p.getName() + ".");
|
TFM_Util.playerMsg(sender, "Locked up " + p.getName() + ".");
|
||||||
}
|
}
|
||||||
else if (args[1].equalsIgnoreCase("off"))
|
else if (TFM_Util.isStopCommand(args[1]))
|
||||||
{
|
{
|
||||||
final Player p;
|
final Player p;
|
||||||
try
|
try
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -11,7 +12,7 @@ public class Command_moblimiter extends TFM_Command
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (!senderIsConsole || sender.getName().equalsIgnoreCase("remotebukkit"))
|
if (!senderIsConsole || TFM_Util.isFromClanforge(sender.getName()))
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
|
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -21,7 +21,7 @@ public class Command_mp extends TFM_Command
|
|||||||
{
|
{
|
||||||
for (Entity ent : world.getLivingEntities())
|
for (Entity ent : world.getLivingEntities())
|
||||||
{
|
{
|
||||||
if (ent instanceof Creature || ent instanceof Ghast || ent instanceof Slime || ent instanceof EnderDragon)
|
if (ent instanceof Creature || ent instanceof Ghast || ent instanceof Slime || ent instanceof EnderDragon || ent instanceof Ambient)
|
||||||
{
|
{
|
||||||
ent.remove();
|
ent.remove();
|
||||||
removed++;
|
removed++;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -11,7 +12,7 @@ public class Command_nonuke extends TFM_Command
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (!senderIsConsole || sender.getName().equalsIgnoreCase("remotebukkit"))
|
if (!senderIsConsole || TFM_Util.isFromClanforge(sender.getName()))
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
|
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -12,7 +12,7 @@ public class Command_rawsay extends TFM_Command
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (!senderIsConsole || sender.getName().equalsIgnoreCase("remotebukkit"))
|
if (!senderIsConsole || TFM_Util.isFromClanforge(sender.getName()))
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
|
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_RunSystemCommand;
|
import me.StevenLawson.TotalFreedomMod.TFM_RunSystemCommand;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
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;
|
||||||
@ -11,7 +12,7 @@ public class Command_terminal extends TFM_Command
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (!senderIsConsole || sender.getName().equalsIgnoreCase("remotebukkit"))
|
if (!senderIsConsole || TFM_Util.isFromClanforge(sender.getName()))
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
|
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
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.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -43,12 +43,7 @@ public class Command_tossmob extends TFM_Command
|
|||||||
|
|
||||||
if (args[0].equalsIgnoreCase("list"))
|
if (args[0].equalsIgnoreCase("list"))
|
||||||
{
|
{
|
||||||
StringBuilder output = new StringBuilder("Supported mobs: ");
|
sender.sendMessage(ChatColor.GREEN + "Supported mobs: " + StringUtils.join(TFM_Util.mobtypes.keySet(), ", "));
|
||||||
for (Entry<String, EntityType> mob : TFM_Util.mobtypes.entrySet())
|
|
||||||
{
|
|
||||||
output.append(mob.getKey()).append(", ");
|
|
||||||
}
|
|
||||||
sender.sendMessage(ChatColor.GREEN + output.toString());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ public class Command_ziptool extends TFM_Command
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (!senderIsConsole || sender.getName().equalsIgnoreCase("remotebukkit"))
|
if (!senderIsConsole || TFM_Util.isFromClanforge(sender.getName()))
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
|
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -64,6 +64,12 @@ public class TFM_EntityListener implements Listener
|
|||||||
{
|
{
|
||||||
if (TotalFreedomMod.mobLimiterEnabled)
|
if (TotalFreedomMod.mobLimiterEnabled)
|
||||||
{
|
{
|
||||||
|
if (event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.EGG))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Entity spawned = event.getEntity();
|
Entity spawned = event.getEntity();
|
||||||
|
|
||||||
if (spawned instanceof EnderDragon)
|
if (spawned instanceof EnderDragon)
|
||||||
@ -98,6 +104,11 @@ public class TFM_EntityListener implements Listener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (spawned instanceof Bat)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (TotalFreedomMod.mobLimiterMax > 0)
|
if (TotalFreedomMod.mobLimiterMax > 0)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod;
|
package me.StevenLawson.TotalFreedomMod;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -16,6 +15,7 @@ import org.bukkit.configuration.ConfigurationSection;
|
|||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.FileUtil;
|
||||||
|
|
||||||
public class TFM_SuperadminList
|
public class TFM_SuperadminList
|
||||||
{
|
{
|
||||||
@ -41,29 +41,43 @@ public class TFM_SuperadminList
|
|||||||
|
|
||||||
public static void loadSuperadminList()
|
public static void loadSuperadminList()
|
||||||
{
|
{
|
||||||
convertV1List();
|
try
|
||||||
|
|
||||||
superadminList.clear();
|
|
||||||
|
|
||||||
TFM_Util.createDefaultConfiguration(TotalFreedomMod.SUPERADMIN_FILE, TotalFreedomMod.plugin_file);
|
|
||||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
|
||||||
|
|
||||||
if (config.isConfigurationSection("superadmins"))
|
|
||||||
{
|
{
|
||||||
ConfigurationSection section = config.getConfigurationSection("superadmins");
|
// convertV1List();
|
||||||
|
|
||||||
for (String admin_name : section.getKeys(false))
|
superadminList.clear();
|
||||||
|
|
||||||
|
TFM_Util.createDefaultConfiguration(TotalFreedomMod.SUPERADMIN_FILE, TotalFreedomMod.plugin_file);
|
||||||
|
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
||||||
|
|
||||||
|
if (config.isConfigurationSection("superadmins"))
|
||||||
{
|
{
|
||||||
TFM_Superadmin superadmin = new TFM_Superadmin(admin_name, section.getConfigurationSection(admin_name));
|
ConfigurationSection section = config.getConfigurationSection("superadmins");
|
||||||
superadminList.put(admin_name.toLowerCase(), superadmin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TFM_Log.warning("Missing superadmins section in superadmin.yml.");
|
|
||||||
}
|
|
||||||
|
|
||||||
updateIndexLists();
|
for (String admin_name : section.getKeys(false))
|
||||||
|
{
|
||||||
|
TFM_Superadmin superadmin = new TFM_Superadmin(admin_name, section.getConfigurationSection(admin_name));
|
||||||
|
superadminList.put(admin_name.toLowerCase(), superadmin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TFM_Log.warning("Missing superadmins section in superadmin.yml.");
|
||||||
|
}
|
||||||
|
|
||||||
|
updateIndexLists();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TFM_Log.severe(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void backupSavedList()
|
||||||
|
{
|
||||||
|
File a = new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE);
|
||||||
|
File b = new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE + ".bak");
|
||||||
|
FileUtil.copy(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateIndexLists()
|
public static void updateIndexLists()
|
||||||
@ -98,51 +112,57 @@ public class TFM_SuperadminList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void convertV1List()
|
// public static void convertV1List()
|
||||||
{
|
// {
|
||||||
superadminList.clear();
|
// try
|
||||||
|
// {
|
||||||
TFM_Util.createDefaultConfiguration(TotalFreedomMod.SUPERADMIN_FILE, TotalFreedomMod.plugin_file);
|
// superadminList.clear();
|
||||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
//
|
||||||
|
// TFM_Util.createDefaultConfiguration(TotalFreedomMod.SUPERADMIN_FILE, TotalFreedomMod.plugin_file);
|
||||||
if (!config.isConfigurationSection("superadmins"))
|
// FileConfiguration config = YamlConfiguration.loadConfiguration(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
||||||
{
|
//
|
||||||
for (String admin_name : config.getKeys(false))
|
// if (!config.isConfigurationSection("superadmins"))
|
||||||
{
|
// {
|
||||||
TFM_Superadmin superadmin = new TFM_Superadmin(admin_name, config.getStringList(admin_name), new Date(), "", false, new ArrayList<String>());
|
// for (String admin_name : config.getKeys(false))
|
||||||
superadminList.put(admin_name.toLowerCase(), superadmin);
|
// {
|
||||||
}
|
// TFM_Superadmin superadmin = new TFM_Superadmin(admin_name, config.getStringList(admin_name), new Date(), "", false, new ArrayList<String>());
|
||||||
|
// superadminList.put(admin_name.toLowerCase(), superadmin);
|
||||||
saveSuperadminList();
|
// }
|
||||||
}
|
//
|
||||||
}
|
// saveSuperadminList();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
// TFM_Log.severe(ex);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
public static void saveSuperadminList()
|
public static void saveSuperadminList()
|
||||||
{
|
{
|
||||||
updateIndexLists();
|
|
||||||
|
|
||||||
YamlConfiguration config = new YamlConfiguration();
|
|
||||||
|
|
||||||
Iterator<Entry<String, TFM_Superadmin>> it = superadminList.entrySet().iterator();
|
|
||||||
while (it.hasNext())
|
|
||||||
{
|
|
||||||
Entry<String, TFM_Superadmin> pair = it.next();
|
|
||||||
|
|
||||||
String admin_name = pair.getKey().toLowerCase();
|
|
||||||
TFM_Superadmin superadmin = pair.getValue();
|
|
||||||
|
|
||||||
config.set("superadmins." + admin_name + ".ips", superadmin.getIps());
|
|
||||||
config.set("superadmins." + admin_name + ".last_login", TFM_Util.dateToString(superadmin.getLastLogin()));
|
|
||||||
config.set("superadmins." + admin_name + ".custom_login_message", superadmin.getCustomLoginMessage());
|
|
||||||
config.set("superadmins." + admin_name + ".is_super_awesome_admin", superadmin.isSuperAwesomeAdmin());
|
|
||||||
config.set("superadmins." + admin_name + ".console_aliases", superadmin.getConsoleAliases());
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
updateIndexLists();
|
||||||
|
|
||||||
|
YamlConfiguration config = new YamlConfiguration();
|
||||||
|
|
||||||
|
Iterator<Entry<String, TFM_Superadmin>> it = superadminList.entrySet().iterator();
|
||||||
|
while (it.hasNext())
|
||||||
|
{
|
||||||
|
Entry<String, TFM_Superadmin> pair = it.next();
|
||||||
|
|
||||||
|
String admin_name = pair.getKey().toLowerCase();
|
||||||
|
TFM_Superadmin superadmin = pair.getValue();
|
||||||
|
|
||||||
|
config.set("superadmins." + admin_name + ".ips", superadmin.getIps());
|
||||||
|
config.set("superadmins." + admin_name + ".last_login", TFM_Util.dateToString(superadmin.getLastLogin()));
|
||||||
|
config.set("superadmins." + admin_name + ".custom_login_message", superadmin.getCustomLoginMessage());
|
||||||
|
config.set("superadmins." + admin_name + ".is_super_awesome_admin", superadmin.isSuperAwesomeAdmin());
|
||||||
|
config.set("superadmins." + admin_name + ".console_aliases", superadmin.getConsoleAliases());
|
||||||
|
}
|
||||||
|
|
||||||
config.save(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
config.save(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
TFM_Log.severe(ex);
|
TFM_Log.severe(ex);
|
||||||
}
|
}
|
||||||
@ -246,48 +266,55 @@ public class TFM_SuperadminList
|
|||||||
|
|
||||||
public static boolean checkPartialSuperadminIP(String user_ip)
|
public static boolean checkPartialSuperadminIP(String user_ip)
|
||||||
{
|
{
|
||||||
user_ip = user_ip.trim();
|
try
|
||||||
|
|
||||||
if (superadminIPs.contains(user_ip))
|
|
||||||
{
|
{
|
||||||
return true;
|
user_ip = user_ip.trim();
|
||||||
}
|
|
||||||
else
|
if (superadminIPs.contains(user_ip))
|
||||||
{
|
|
||||||
String[] user_octets = user_ip.split("\\.");
|
|
||||||
if (user_octets.length != 4)
|
|
||||||
{
|
{
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
String match_ip = null;
|
|
||||||
for (String test_ip : getSuperadminIPs())
|
|
||||||
{
|
|
||||||
String[] test_octets = test_ip.split("\\.");
|
|
||||||
if (test_octets.length == 4)
|
|
||||||
{
|
|
||||||
if (user_octets[0].equals(test_octets[0]) && user_octets[1].equals(test_octets[1]) && user_octets[2].equals(test_octets[2]))
|
|
||||||
{
|
|
||||||
match_ip = test_ip;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match_ip != null)
|
|
||||||
{
|
|
||||||
TFM_Superadmin admin_entry = getAdminEntryByIP(match_ip);
|
|
||||||
|
|
||||||
if (admin_entry != null)
|
|
||||||
{
|
|
||||||
List<String> ips = admin_entry.getIps();
|
|
||||||
ips.add(user_ip);
|
|
||||||
admin_entry.setIps(ips);
|
|
||||||
saveSuperadminList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
String[] user_octets = user_ip.split("\\.");
|
||||||
|
if (user_octets.length != 4)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String match_ip = null;
|
||||||
|
for (String test_ip : getSuperadminIPs())
|
||||||
|
{
|
||||||
|
String[] test_octets = test_ip.split("\\.");
|
||||||
|
if (test_octets.length == 4)
|
||||||
|
{
|
||||||
|
if (user_octets[0].equals(test_octets[0]) && user_octets[1].equals(test_octets[1]) && user_octets[2].equals(test_octets[2]))
|
||||||
|
{
|
||||||
|
match_ip = test_ip;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match_ip != null)
|
||||||
|
{
|
||||||
|
TFM_Superadmin admin_entry = getAdminEntryByIP(match_ip);
|
||||||
|
|
||||||
|
if (admin_entry != null)
|
||||||
|
{
|
||||||
|
List<String> ips = admin_entry.getIps();
|
||||||
|
ips.add(user_ip);
|
||||||
|
admin_entry.setIps(ips);
|
||||||
|
saveSuperadminList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TFM_Log.severe(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -23,42 +23,29 @@ import org.bukkit.entity.*;
|
|||||||
|
|
||||||
public class TFM_Util
|
public class TFM_Util
|
||||||
{
|
{
|
||||||
private static Map<String, Integer> eject_tracker = new HashMap<String, Integer>();
|
private static final Map<String, Integer> eject_tracker = new HashMap<String, Integer>();
|
||||||
public static final Map<String, EntityType> mobtypes = new HashMap<String, EntityType>();
|
public static final Map<String, EntityType> mobtypes = new HashMap<String, EntityType>();
|
||||||
public static final List<String> stop_commands = new ArrayList<String>();
|
public static final List<String> stop_commands = Arrays.asList("stop", "off", "end", "halt", "die");
|
||||||
|
public static final List<String> restricted_senders = Arrays.asList("rcon, remotebukkit");
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
mobtypes.put("blaze", EntityType.BLAZE);
|
for (EntityType entity_type : EntityType.values())
|
||||||
mobtypes.put("cavespider", EntityType.CAVE_SPIDER);
|
{
|
||||||
mobtypes.put("chicken", EntityType.CHICKEN);
|
try
|
||||||
mobtypes.put("cow", EntityType.COW);
|
{
|
||||||
mobtypes.put("creeper", EntityType.CREEPER);
|
if (entity_type.getName() != null)
|
||||||
mobtypes.put("enderdragon", EntityType.ENDER_DRAGON);
|
{
|
||||||
mobtypes.put("enderman", EntityType.ENDERMAN);
|
if (Creature.class.isAssignableFrom(entity_type.getEntityClass()))
|
||||||
mobtypes.put("ghast", EntityType.GHAST);
|
{
|
||||||
mobtypes.put("giant", EntityType.GIANT);
|
mobtypes.put(entity_type.getName().toLowerCase(), entity_type);
|
||||||
mobtypes.put("irongolem", EntityType.IRON_GOLEM);
|
}
|
||||||
mobtypes.put("mushroomcow", EntityType.MUSHROOM_COW);
|
}
|
||||||
mobtypes.put("ocelot", EntityType.OCELOT);
|
}
|
||||||
mobtypes.put("pig", EntityType.PIG);
|
catch (Exception ex)
|
||||||
mobtypes.put("pigzombie", EntityType.PIG_ZOMBIE);
|
{
|
||||||
mobtypes.put("sheep", EntityType.SHEEP);
|
}
|
||||||
mobtypes.put("silverfish", EntityType.SILVERFISH);
|
}
|
||||||
mobtypes.put("skeleton", EntityType.SKELETON);
|
|
||||||
mobtypes.put("slime", EntityType.SLIME);
|
|
||||||
mobtypes.put("snowman", EntityType.SNOWMAN);
|
|
||||||
mobtypes.put("spider", EntityType.SPIDER);
|
|
||||||
mobtypes.put("squid", EntityType.SQUID);
|
|
||||||
mobtypes.put("villager", EntityType.VILLAGER);
|
|
||||||
mobtypes.put("wolf", EntityType.WOLF);
|
|
||||||
mobtypes.put("zombie", EntityType.ZOMBIE);
|
|
||||||
|
|
||||||
stop_commands.add("stop");
|
|
||||||
stop_commands.add("off");
|
|
||||||
stop_commands.add("end");
|
|
||||||
stop_commands.add("halt");
|
|
||||||
stop_commands.add("die");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TFM_Util()
|
private TFM_Util()
|
||||||
@ -910,6 +897,11 @@ public class TFM_Util
|
|||||||
return new Date(0L);
|
return new Date(0L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isFromClanforge(String sender_name)
|
||||||
|
{
|
||||||
|
return restricted_senders.contains(sender_name.toLowerCase());
|
||||||
|
}
|
||||||
// I wrote all this before i discovered getTargetBlock >.> - might come in handy some day...
|
// I wrote all this before i discovered getTargetBlock >.> - might come in handy some day...
|
||||||
// public static final double LOOKAT_VIEW_HEIGHT = 1.65;
|
// public static final double LOOKAT_VIEW_HEIGHT = 1.65;
|
||||||
// public static final double LOOKAT_STEP_DISTANCE = 0.2;
|
// public static final double LOOKAT_STEP_DISTANCE = 0.2;
|
||||||
|
@ -255,6 +255,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
TFM_SuperadminList.backupSavedList();
|
||||||
TFM_SuperadminList.loadSuperadminList();
|
TFM_SuperadminList.loadSuperadminList();
|
||||||
|
|
||||||
superadmins = TFM_SuperadminList.getSuperadminNames();
|
superadmins = TFM_SuperadminList.getSuperadminNames();
|
||||||
|
Loading…
Reference in New Issue
Block a user