mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-27 20:27:37 +00:00
[Bleeding] Major refractoring
Added TFM_Config as a base config class for TFM_AdminList and TFM_PlayerList Finished up UUID based Superadmins
This commit is contained in:
parent
a54c113a86
commit
5237fa0ca2
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Wed Apr 09 22:31:37 CEST 2014
|
||||
build.number=713
|
||||
#Fri Apr 11 17:22:29 CEST 2014
|
||||
build.number=730
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.Bridge;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import pgDev.bukkit.DisguiseCraft.DisguiseCraft;
|
@ -1,7 +1,9 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.Bridge;
|
||||
|
||||
import com.earth2me.essentials.Essentials;
|
||||
import com.earth2me.essentials.User;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.Bridge;
|
||||
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -6,6 +6,10 @@ import com.sk89q.worldedit.LocalWorld;
|
||||
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
|
@ -19,7 +19,7 @@ public class Command_cake extends TFM_Command
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
||||
|
||||
StringBuilder output = new StringBuilder();
|
||||
Random randomGenerator = new Random();
|
||||
|
||||
|
@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_GameRuleHandler;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Flatlands;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_Flatlands;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -4,8 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList.PlayerEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
@ -58,7 +58,7 @@ public class Command_glist extends TFM_Command
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
PlayerEntry entry = TFM_PlayerList.getInstance().getEntry(args[1]);
|
||||
final TFM_PlayerEntry entry = TFM_PlayerList.getInstance().getEntry(args[1]);
|
||||
|
||||
if (entry == null)
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_WorldEditBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_RollbackManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_WorldEditBridge;
|
||||
import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -9,7 +9,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Admin;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_GameRuleHandler;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DisguiseCraftBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_DisguiseCraftBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Admin;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_TwitterHandler;
|
||||
@ -20,154 +20,146 @@ 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 (args.length == 0 || args.length > 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (args.length == 1)
|
||||
{
|
||||
if (args[0].equals("list"))
|
||||
{
|
||||
playerMsg("Superadmins: " + StringUtils.join(TFM_AdminList.getSuperadminUUIDs(), ", "), ChatColor.GOLD);
|
||||
playerMsg("Superadmins: " + StringUtils.join(TFM_AdminList.getSuperadminNames(), ", "), ChatColor.GOLD);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
if (args[0].equals("clean"))
|
||||
{
|
||||
|
||||
if (!TFM_AdminList.isSeniorAdmin(sender, true))
|
||||
{
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("clean"))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Cleaning superadmin list", true);
|
||||
TFM_AdminList.cleanSuperadminList(true);
|
||||
playerMsg("Superadmins: " + StringUtils.join(TFM_AdminList.getSuperadminUUIDs(), ", "), ChatColor.YELLOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Cleaning superadmin list", true);
|
||||
TFM_AdminList.cleanSuperadminList(true);
|
||||
playerMsg("Superadmins: " + StringUtils.join(TFM_AdminList.getSuperadminUUIDs(), ", "), ChatColor.YELLOW);
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
else if (args.length == 2)
|
||||
|
||||
if (args[0].equalsIgnoreCase("info"))
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("info"))
|
||||
if (!TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
if (!TFM_AdminList.isSuperAdmin(sender))
|
||||
{
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Admin superadmin = TFM_AdminList.getAdminEntry(args[1].toLowerCase());
|
||||
|
||||
if (superadmin == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
superadmin = TFM_AdminList.getAdminEntry(getPlayer(args[1]).getName().toLowerCase());
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (superadmin == null)
|
||||
{
|
||||
playerMsg("Superadmin not found: " + args[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg(ChatColor.stripColor(TFM_Util.colorize(superadmin.toString())));
|
||||
}
|
||||
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!senderIsConsole)
|
||||
{
|
||||
playerMsg("This command may only be used from the console.");
|
||||
return true;
|
||||
}
|
||||
TFM_Admin superadmin = TFM_AdminList.getEntry(args[1].toLowerCase());
|
||||
|
||||
if (args[0].equalsIgnoreCase("add"))
|
||||
if (superadmin == null)
|
||||
{
|
||||
Player player = null;
|
||||
String playername = null;
|
||||
|
||||
try
|
||||
{
|
||||
player = getPlayer(args[1]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
TFM_Admin superadmin = TFM_AdminList.getAdminEntry(args[1].toLowerCase());
|
||||
if (superadmin != null)
|
||||
{
|
||||
playername = superadmin.getLastLoginName();
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg(ex.getMessage(), ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the superadmin list.", true);
|
||||
TFM_AdminList.addSuperadmin(player);
|
||||
}
|
||||
else if (playername != null)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Adding " + playername + " to the superadmin list.", true);
|
||||
TFM_AdminList.addSuperadmin(player);
|
||||
}
|
||||
}
|
||||
else if (TFM_Util.isRemoveCommand(args[0]))
|
||||
{
|
||||
if (!TFM_AdminList.isSeniorAdmin(sender))
|
||||
{
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
String targetName = args[1];
|
||||
|
||||
try
|
||||
{
|
||||
targetName = getPlayer(targetName).getName();
|
||||
superadmin = TFM_AdminList.getEntry(getPlayer(args[1]).getName().toLowerCase());
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (!TFM_AdminList.getSuperadminUUIDs().contains(targetName.toLowerCase()))
|
||||
{
|
||||
playerMsg("Superadmin not found: " + targetName);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from the superadmin list", true);
|
||||
TFM_AdminList.removeSuperadmin(Bukkit.getOfflinePlayer(targetName));
|
||||
|
||||
// Twitterbot
|
||||
if (TFM_ConfigEntry.TWITTERBOT_ENABLED.getBoolean())
|
||||
{
|
||||
TFM_TwitterHandler.getInstance().delTwitterVerbose(targetName, sender);
|
||||
}
|
||||
if (superadmin == null)
|
||||
{
|
||||
playerMsg("Superadmin not found: " + args[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
playerMsg(superadmin.toString());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
if (!senderIsConsole)
|
||||
{
|
||||
return false;
|
||||
playerMsg("This command may only be used from the console.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("add"))
|
||||
{
|
||||
Player player = null;
|
||||
String playername = null;
|
||||
|
||||
try
|
||||
{
|
||||
player = getPlayer(args[1]);
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
final TFM_Admin superadmin = TFM_AdminList.getEntry(args[1]);
|
||||
if (superadmin != null)
|
||||
{
|
||||
playername = superadmin.getLastLoginName();
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg(ex.getMessage(), ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the superadmin list.", true);
|
||||
TFM_AdminList.addSuperadmin(player);
|
||||
}
|
||||
else if (playername != null)
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Adding " + playername + " to the superadmin list.", true);
|
||||
TFM_AdminList.addSuperadmin(player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (TFM_Util.isRemoveCommand(args[0]))
|
||||
{
|
||||
if (!TFM_AdminList.isSeniorAdmin(sender))
|
||||
{
|
||||
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
String targetName = args[1];
|
||||
|
||||
try
|
||||
{
|
||||
targetName = getPlayer(targetName).getName();
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
}
|
||||
|
||||
if (!TFM_AdminList.getLowerSuperadminNames().contains(targetName.toLowerCase()))
|
||||
{
|
||||
playerMsg("Superadmin not found: " + targetName);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from the superadmin list", true);
|
||||
TFM_AdminList.removeSuperadmin(Bukkit.getOfflinePlayer(targetName));
|
||||
|
||||
// Twitterbot
|
||||
if (TFM_ConfigEntry.TWITTERBOT_ENABLED.getBoolean())
|
||||
{
|
||||
TFM_TwitterHandler.getInstance().delTwitterVerbose(targetName, sender);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_WorldEditBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_WorldEditBridge;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.Location;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_TwitterHandler;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DisguiseCraftBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_DisguiseCraftBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
150
src/me/StevenLawson/TotalFreedomMod/Config/TFM_Config.java
Normal file
150
src/me/StevenLawson/TotalFreedomMod/Config/TFM_Config.java
Normal file
@ -0,0 +1,150 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang.exception.ExceptionUtils;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents a definable YAML configuration.
|
||||
*
|
||||
* @see YamlConfiguration
|
||||
*/
|
||||
public class TFM_Config extends YamlConfiguration // BukkitLib @ https://github.com/Pravian/BukkitLib
|
||||
{
|
||||
private final Plugin plugin;
|
||||
private final File configFile;
|
||||
private final boolean copyDefaults;
|
||||
|
||||
/**
|
||||
* Creates a new YamlConfig instance.
|
||||
*
|
||||
* <p>Example:
|
||||
* <pre>
|
||||
* YamlConfig config = new YamlConfig(this, "config.yml", true);
|
||||
* config.load();
|
||||
* </pre></p>
|
||||
*
|
||||
* @param plugin The plugin to which the config belongs.
|
||||
* @param fileName The filename of the config file.
|
||||
* @param copyDefaults If the defaults should be copied and/loaded from a config in the plugin jar-file.
|
||||
*/
|
||||
public TFM_Config(Plugin plugin, String fileName, boolean copyDefaults)
|
||||
{
|
||||
this(plugin, TFM_Util.getPluginFile(plugin, fileName), copyDefaults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new YamlConfig instance.
|
||||
*
|
||||
* <p>Example:
|
||||
* <pre>
|
||||
* YamlConfig config = new YamlConfig(this, new File(plugin.getDataFolder() + "/players", "DarthSalamon.yml"), false);
|
||||
* config.load();
|
||||
* </pre></p>
|
||||
*
|
||||
* @param plugin The plugin to which the config belongs.
|
||||
* @param file The file of the config file.
|
||||
* @param copyDefaults If the defaults should be copied and/loaded from a config in the plugin jar-file.
|
||||
*/
|
||||
public TFM_Config(Plugin plugin, File file, boolean copyDefaults)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.configFile = file;
|
||||
this.copyDefaults = copyDefaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the configuration to the predefined file.
|
||||
*
|
||||
* @see #YamlConfig(Plugin, String, boolean)
|
||||
*/
|
||||
public void save()
|
||||
{
|
||||
try
|
||||
{
|
||||
super.save(configFile);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
plugin.getLogger().severe("Could not save configuration file: " + configFile.getName());
|
||||
plugin.getLogger().severe(ExceptionUtils.getStackTrace(ex));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the configuration from the predefined file.
|
||||
*
|
||||
* <p>Optionally, if loadDefaults has been set to true, the file will be copied over from the default inside the jar-file of the owning plugin.</p>
|
||||
*
|
||||
* @see #YamlConfig(Plugin, String, boolean)
|
||||
*/
|
||||
public void load()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (copyDefaults)
|
||||
{
|
||||
if (!configFile.exists())
|
||||
{
|
||||
configFile.getParentFile().mkdirs();
|
||||
try
|
||||
{
|
||||
TFM_Util.copy(plugin.getResource(configFile.getName()), configFile);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
plugin.getLogger().severe("Could not write default configuration file: " + configFile.getName());
|
||||
plugin.getLogger().severe(ExceptionUtils.getStackTrace(ex));
|
||||
}
|
||||
plugin.getLogger().info("Installed default configuration " + configFile.getName());
|
||||
}
|
||||
|
||||
super.addDefaults(getDefaultConfig());
|
||||
}
|
||||
|
||||
if (configFile.exists())
|
||||
{
|
||||
super.load(configFile);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
plugin.getLogger().severe("Could not load configuration file: " + configFile.getName());
|
||||
plugin.getLogger().severe(ExceptionUtils.getStackTrace(ex));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the raw YamlConfiguration this config is based on.
|
||||
*
|
||||
* @return The YamlConfiguration.
|
||||
* @see YamlConfiguration
|
||||
*/
|
||||
public YamlConfiguration getConfig()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default configuration as been stored in the jar-file of the owning plugin.
|
||||
* @return The default configuration.
|
||||
*/
|
||||
public YamlConfiguration getDefaultConfig()
|
||||
{
|
||||
final YamlConfiguration DEFAULT_CONFIG = new YamlConfiguration();
|
||||
try
|
||||
{
|
||||
DEFAULT_CONFIG.load(plugin.getResource(configFile.getName()));
|
||||
}
|
||||
catch (Throwable ex)
|
||||
{
|
||||
plugin.getLogger().severe("Could not load default configuration: " + configFile.getName());
|
||||
plugin.getLogger().severe(ExceptionUtils.getStackTrace(ex));
|
||||
return null;
|
||||
}
|
||||
return DEFAULT_CONFIG;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.Config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -79,51 +79,51 @@ public enum TFM_ConfigEntry
|
||||
|
||||
public String getString()
|
||||
{
|
||||
return TFM_Config.getInstance().getString(this);
|
||||
return TFM_MainConfig.getInstance().getString(this);
|
||||
}
|
||||
|
||||
public String setString(String value)
|
||||
{
|
||||
TFM_Config.getInstance().setString(this, value);
|
||||
TFM_MainConfig.getInstance().setString(this, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
public Double getDouble()
|
||||
{
|
||||
return TFM_Config.getInstance().getDouble(this);
|
||||
return TFM_MainConfig.getInstance().getDouble(this);
|
||||
}
|
||||
|
||||
public Double setDouble(Double value)
|
||||
{
|
||||
TFM_Config.getInstance().setDouble(this, value);
|
||||
TFM_MainConfig.getInstance().setDouble(this, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
public Boolean getBoolean()
|
||||
{
|
||||
return TFM_Config.getInstance().getBoolean(this);
|
||||
return TFM_MainConfig.getInstance().getBoolean(this);
|
||||
}
|
||||
|
||||
public Boolean setBoolean(Boolean value)
|
||||
{
|
||||
TFM_Config.getInstance().setBoolean(this, value);
|
||||
TFM_MainConfig.getInstance().setBoolean(this, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
public Integer getInteger()
|
||||
{
|
||||
return TFM_Config.getInstance().getInteger(this);
|
||||
return TFM_MainConfig.getInstance().getInteger(this);
|
||||
}
|
||||
|
||||
public Integer setInteger(Integer value)
|
||||
{
|
||||
TFM_Config.getInstance().setInteger(this, value);
|
||||
TFM_MainConfig.getInstance().setInteger(this, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
public List<?> getList()
|
||||
{
|
||||
return TFM_Config.getInstance().getList(this);
|
||||
return TFM_MainConfig.getInstance().getList(this);
|
||||
}
|
||||
|
||||
public static TFM_ConfigEntry findConfigEntry(String name)
|
@ -1,23 +1,26 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.Config;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import net.minecraft.util.org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
public class TFM_Config
|
||||
public class TFM_MainConfig
|
||||
{
|
||||
public static final String CONFIG_FILENAME = "config.yml";
|
||||
public static final File CONFIG_FILE = new File(TotalFreedomMod.plugin.getDataFolder(), CONFIG_FILENAME);
|
||||
//
|
||||
private final EnumMap<TFM_ConfigEntry, Object> configEntryMap = new EnumMap<TFM_ConfigEntry, Object>(TFM_ConfigEntry.class);
|
||||
|
||||
private TFM_Config()
|
||||
private TFM_MainConfig()
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -258,7 +261,7 @@ public class TFM_Config
|
||||
{
|
||||
private YamlConfiguration defaults = null;
|
||||
|
||||
public TFM_Config_DefaultsLoader(InputStream defaultConfig)
|
||||
private TFM_Config_DefaultsLoader(InputStream defaultConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -281,13 +284,13 @@ public class TFM_Config
|
||||
}
|
||||
}
|
||||
|
||||
public static TFM_Config getInstance()
|
||||
public static TFM_MainConfig getInstance()
|
||||
{
|
||||
return TFM_ConfigHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class TFM_ConfigHolder
|
||||
{
|
||||
private static final TFM_Config INSTANCE = new TFM_Config();
|
||||
private static final TFM_MainConfig INSTANCE = new TFM_MainConfig();
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
|
||||
import static me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.*;
|
||||
|
||||
|
@ -82,6 +82,6 @@ public class Module_players extends TFM_HTTPD_Module
|
||||
|
||||
private String getName(UUID uuid)
|
||||
{
|
||||
return TFM_AdminList.getAdminEntry(uuid).getLastLoginName();
|
||||
return TFM_AdminList.getEntry(uuid).getLastLoginName();
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ public class Module_schematic extends TFM_HTTPD_Module
|
||||
|
||||
private boolean isAuthorized(String remoteAddress)
|
||||
{
|
||||
TFM_Admin entry = TFM_AdminList.getAdminEntryByIP(remoteAddress);
|
||||
TFM_Admin entry = TFM_AdminList.getEntryByIp(remoteAddress);
|
||||
return entry != null && entry.isActivated();
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.HTTPSession;
|
||||
import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Response;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.*;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
@ -1,5 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
@ -8,7 +10,6 @@ import java.util.Map.Entry;
|
||||
import java.util.regex.Pattern;
|
||||
import me.StevenLawson.TotalFreedomMod.*;
|
||||
import me.StevenLawson.TotalFreedomMod.Commands.Command_landmine;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList.PlayerEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_RollbackManager.RollbackEntry;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -693,7 +694,7 @@ public class TFM_PlayerListener implements Listener
|
||||
{
|
||||
TFM_Log.info("Added new player: " + TFM_Util.formatPlayer(player));
|
||||
|
||||
final PlayerEntry entry = TFM_PlayerList.getInstance().getEntry(player);
|
||||
final TFM_PlayerEntry entry = TFM_PlayerList.getInstance().getEntry(player);
|
||||
entry.setLastJoinUnix(TFM_Util.getUnixTime());
|
||||
entry.setLastJoinName(player.getName());
|
||||
entry.save();
|
||||
@ -701,46 +702,42 @@ public class TFM_PlayerListener implements Listener
|
||||
else
|
||||
{
|
||||
// Preload the entry; the login unix is defaulted to the current time
|
||||
final PlayerEntry entry = TFM_PlayerList.getInstance().getEntry(player);
|
||||
final TFM_PlayerEntry entry = TFM_PlayerList.getInstance().getEntry(player);
|
||||
entry.addIp(ip);
|
||||
entry.save();
|
||||
}
|
||||
|
||||
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
|
||||
playerdata.setSuperadminIdVerified(false);
|
||||
|
||||
playerdata.setSuperadminIdVerified(null);
|
||||
final boolean impostor = TFM_AdminList.isAdminImpostor(player);
|
||||
|
||||
if (impostor || TFM_AdminList.isSuperAdmin(player))
|
||||
// Verify strict IP match
|
||||
if (TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
TFM_Util.bcastMsg(ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player));
|
||||
player.setOp(true);
|
||||
|
||||
if (impostor)
|
||||
if (!TFM_AdminList.isIdentityMatched(player))
|
||||
{
|
||||
player.getInventory().clear();
|
||||
player.setOp(false);
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
TFM_Util.bcastMsg("Warning: " + player.getName() + " has been flagged as an impostor!", ChatColor.RED);
|
||||
playerdata.setSuperadminIdVerified(false);
|
||||
|
||||
TFM_Util.bcastMsg("Warning: " + player.getName() + " is an admin, but is using a username not registered to one of their ip-list.", ChatColor.RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TFM_AdminList.verifyIdentity(player.getName(), TFM_Util.getIp(player)))
|
||||
{
|
||||
playerdata.setSuperadminIdVerified(Boolean.TRUE);
|
||||
|
||||
TFM_AdminList.updateLastLogin(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerdata.setSuperadminIdVerified(Boolean.FALSE);
|
||||
|
||||
TFM_Util.bcastMsg("Warning: " + player.getName() + " is an admin, but is using a username not registered to one of their IPs.", ChatColor.RED);
|
||||
}
|
||||
|
||||
player.setOp(true);
|
||||
playerdata.setSuperadminIdVerified(true);
|
||||
TFM_AdminList.updateLastLogin(player);
|
||||
}
|
||||
}
|
||||
else if (TFM_Util.DEVELOPERS.contains(player.getName()))
|
||||
|
||||
// Handle admin impostors
|
||||
if (TFM_AdminList.isAdminImpostor(player))
|
||||
{
|
||||
TFM_Util.bcastMsg("Warning: " + player.getName() + " has been flagged as an impostor!", ChatColor.RED);
|
||||
TFM_Util.bcastMsg(ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player));
|
||||
player.getInventory().clear();
|
||||
player.setOp(false);
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
}
|
||||
else if (TFM_AdminList.isSuperAdmin(player) || TFM_Util.DEVELOPERS.contains(player.getName()))
|
||||
{
|
||||
TFM_Util.bcastMsg(ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player));
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -23,7 +23,7 @@ public class TFM_TelnetListener implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
final TFM_Admin admin = TFM_AdminList.getAdminEntryByIP(ip, true);
|
||||
final TFM_Admin admin = TFM_AdminList.getEntryByIp(ip, true);
|
||||
|
||||
if (admin == null || !(admin.isTelnetAdmin() || admin.isSeniorAdmin()))
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
@ -2,24 +2,23 @@ package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import me.StevenLawson.TotalFreedomMod.Commands.Command_logs;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_Config;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.FileUtil;
|
||||
@ -44,11 +43,6 @@ public class TFM_AdminList
|
||||
superadminIps = new HashSet<String>();
|
||||
}
|
||||
|
||||
private TFM_AdminList()
|
||||
{
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
public static Set<UUID> getSuperadminUUIDs()
|
||||
{
|
||||
return Collections.unmodifiableSet(superadminUUIDs);
|
||||
@ -74,20 +68,38 @@ public class TFM_AdminList
|
||||
return Collections.unmodifiableSet(superadminIps);
|
||||
}
|
||||
|
||||
public File getConfigFile()
|
||||
public static Set<String> getSuperadminNames()
|
||||
{
|
||||
return new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE);
|
||||
final Set<String> names = new HashSet<String>();
|
||||
|
||||
for (TFM_Admin admin : adminList.values())
|
||||
{
|
||||
names.add(admin.getLastLoginName());
|
||||
}
|
||||
|
||||
return Collections.unmodifiableSet(names);
|
||||
}
|
||||
|
||||
public static void loadSuperadminList()
|
||||
public static Set<String> getLowerSuperadminNames()
|
||||
{
|
||||
final Set<String> names = new HashSet<String>();
|
||||
|
||||
for (TFM_Admin admin : adminList.values())
|
||||
{
|
||||
names.add(admin.getLastLoginName().toLowerCase());
|
||||
}
|
||||
|
||||
return Collections.unmodifiableSet(names);
|
||||
}
|
||||
|
||||
public static void load()
|
||||
{
|
||||
try
|
||||
{
|
||||
adminList.clear();
|
||||
|
||||
TFM_Util.createDefaultConfiguration(TotalFreedomMod.SUPERADMIN_FILE);
|
||||
|
||||
final FileConfiguration config = YamlConfiguration.loadConfiguration(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
||||
final TFM_Config config = new TFM_Config(TotalFreedomMod.plugin, TotalFreedomMod.SUPERADMIN_FILE, true);
|
||||
config.load();
|
||||
|
||||
cleanThreshold = config.getInt("clean_threshold_hours", cleanThreshold);
|
||||
|
||||
@ -102,7 +114,7 @@ public class TFM_AdminList
|
||||
return;
|
||||
}
|
||||
|
||||
final ConfigurationSection section = config.getConfigurationSection("superadmins");
|
||||
final ConfigurationSection section = config.getConfigurationSection("admins");
|
||||
|
||||
for (String uuidString : section.getKeys(false))
|
||||
{
|
||||
@ -178,43 +190,37 @@ public class TFM_AdminList
|
||||
TFM_AdminWorld.getInstance().wipeAccessCache();
|
||||
}
|
||||
|
||||
public static void saveSuperadminList()
|
||||
public static void save()
|
||||
{
|
||||
try
|
||||
updateIndexLists();
|
||||
|
||||
final TFM_Config config = new TFM_Config(TotalFreedomMod.plugin, TotalFreedomMod.SUPERADMIN_FILE, true);
|
||||
config.load();
|
||||
|
||||
config.set("clean_threshold_hours", cleanThreshold);
|
||||
|
||||
Iterator<Entry<UUID, TFM_Admin>> it = adminList.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
updateIndexLists();
|
||||
Entry<UUID, TFM_Admin> pair = it.next();
|
||||
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
UUID uuid = pair.getKey();
|
||||
TFM_Admin superadmin = pair.getValue();
|
||||
|
||||
config.set("clean_threshold_hours", cleanThreshold);
|
||||
|
||||
Iterator<Entry<UUID, TFM_Admin>> it = adminList.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
Entry<UUID, TFM_Admin> pair = it.next();
|
||||
|
||||
UUID uuid = pair.getKey();
|
||||
TFM_Admin superadmin = pair.getValue();
|
||||
|
||||
config.set("superadmins." + uuid + ".last_login_name", superadmin.getLastLoginName());
|
||||
config.set("superadmins." + uuid + ".is_activated", superadmin.isActivated());
|
||||
config.set("superadmins." + uuid + ".last_login", TFM_Util.dateToString(superadmin.getLastLogin()));
|
||||
config.set("superadmins." + uuid + ".custom_login_message", superadmin.getCustomLoginMessage());
|
||||
config.set("superadmins." + uuid + ".is_senior_admin", superadmin.isSeniorAdmin());
|
||||
config.set("superadmins." + uuid + ".is_telnet_admin", superadmin.isTelnetAdmin());
|
||||
config.set("superadmins." + uuid + ".console_aliases", TFM_Util.removeDuplicates(superadmin.getConsoleAliases()));
|
||||
config.set("superadmins." + uuid + ".ips", TFM_Util.removeDuplicates(superadmin.getIps()));
|
||||
}
|
||||
|
||||
config.save(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
config.set("admins." + uuid + ".last_login_name", superadmin.getLastLoginName());
|
||||
config.set("admins." + uuid + ".is_activated", superadmin.isActivated());
|
||||
config.set("admins." + uuid + ".last_login", TFM_Util.dateToString(superadmin.getLastLogin()));
|
||||
config.set("admins." + uuid + ".custom_login_message", superadmin.getCustomLoginMessage());
|
||||
config.set("admins." + uuid + ".is_senior_admin", superadmin.isSeniorAdmin());
|
||||
config.set("admins." + uuid + ".is_telnet_admin", superadmin.isTelnetAdmin());
|
||||
config.set("admins." + uuid + ".console_aliases", TFM_Util.removeDuplicates(superadmin.getConsoleAliases()));
|
||||
config.set("admins." + uuid + ".ips", TFM_Util.removeDuplicates(superadmin.getIps()));
|
||||
}
|
||||
|
||||
config.save();
|
||||
}
|
||||
|
||||
public static TFM_Admin getAdminEntry(Player player)
|
||||
public static TFM_Admin getEntry(Player player)
|
||||
{
|
||||
final UUID uuid = player.getUniqueId();
|
||||
|
||||
@ -226,16 +232,16 @@ public class TFM_AdminList
|
||||
}
|
||||
}
|
||||
|
||||
return getAdminEntryByIP(TFM_Util.getIp(player));
|
||||
return getEntryByIp(TFM_Util.getIp(player));
|
||||
}
|
||||
|
||||
public static TFM_Admin getAdminEntry(UUID uuid)
|
||||
public static TFM_Admin getEntry(UUID uuid)
|
||||
{
|
||||
return adminList.get(uuid);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static TFM_Admin getAdminEntry(String name)
|
||||
public static TFM_Admin getEntry(String name)
|
||||
{
|
||||
for (UUID uuid : adminList.keySet())
|
||||
{
|
||||
@ -247,12 +253,12 @@ public class TFM_AdminList
|
||||
return null;
|
||||
}
|
||||
|
||||
public static TFM_Admin getAdminEntryByIP(String ip)
|
||||
public static TFM_Admin getEntryByIp(String ip)
|
||||
{
|
||||
return getAdminEntryByIP(ip, false);
|
||||
return getEntryByIp(ip, false);
|
||||
}
|
||||
|
||||
public static TFM_Admin getAdminEntryByIP(String needleIp, boolean fuzzy)
|
||||
public static TFM_Admin getEntryByIp(String needleIp, boolean fuzzy)
|
||||
{
|
||||
Iterator<Entry<UUID, TFM_Admin>> it = adminList.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
@ -283,18 +289,18 @@ public class TFM_AdminList
|
||||
|
||||
public static void updateLastLogin(Player player)
|
||||
{
|
||||
final TFM_Admin admin = getAdminEntry(player);
|
||||
final TFM_Admin admin = getEntry(player);
|
||||
if (admin != null)
|
||||
{
|
||||
admin.setLastLogin(new Date());
|
||||
admin.setLastLoginName(player.getName());
|
||||
saveSuperadminList();
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSeniorAdmin(CommandSender user)
|
||||
public static boolean isSeniorAdmin(CommandSender sender)
|
||||
{
|
||||
return isSeniorAdmin(user, false);
|
||||
return isSeniorAdmin(sender, false);
|
||||
}
|
||||
|
||||
public static boolean isSeniorAdmin(CommandSender sender, boolean verifySuperadmin)
|
||||
@ -310,10 +316,10 @@ public class TFM_AdminList
|
||||
|
||||
if (!(sender instanceof Player))
|
||||
{
|
||||
return senioradminUUIDs.contains(((Player) sender).getUniqueId());
|
||||
return senioradminAliases.contains(sender.getName());
|
||||
}
|
||||
|
||||
final TFM_Admin entry = getAdminEntry((Player) sender);
|
||||
final TFM_Admin entry = getEntry((Player) sender);
|
||||
if (entry != null)
|
||||
{
|
||||
return entry.isSeniorAdmin();
|
||||
@ -329,14 +335,12 @@ public class TFM_AdminList
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Bukkit.getOnlineMode())
|
||||
if (Bukkit.getOnlineMode() && superadminUUIDs.contains(((Player) sender).getUniqueId()))
|
||||
{
|
||||
if (superadminUUIDs.contains(((Player) sender).getUniqueId()));
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (superadminIps.contains(TFM_Util.getIp((Player) sender)))
|
||||
{
|
||||
return true;
|
||||
@ -345,8 +349,29 @@ public class TFM_AdminList
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isIdentityMatched(Player player)
|
||||
{
|
||||
if (!isSuperAdmin(player))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Bukkit.getOnlineMode())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
final TFM_Admin entry = getEntry(player);
|
||||
if (entry == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return entry.getIps().contains(TFM_Util.getIp(player));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean checkPartialSuperadminIP(String ip, String name)
|
||||
public static boolean checkPartialSuperadminIp(String ip, String name)
|
||||
{
|
||||
ip = ip.trim();
|
||||
|
||||
@ -369,7 +394,7 @@ public class TFM_AdminList
|
||||
|
||||
if (matchIp != null)
|
||||
{
|
||||
final TFM_Admin entry = getAdminEntryByIP(matchIp);
|
||||
final TFM_Admin entry = getEntryByIp(matchIp);
|
||||
|
||||
if (entry == null)
|
||||
{
|
||||
@ -382,7 +407,7 @@ public class TFM_AdminList
|
||||
{
|
||||
entry.addIp(ip);
|
||||
}
|
||||
saveSuperadminList();
|
||||
save();
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -406,32 +431,6 @@ public class TFM_AdminList
|
||||
return false;
|
||||
}
|
||||
|
||||
/*public static void addSuperadmin(String username, List<String> ips)
|
||||
{
|
||||
try
|
||||
{
|
||||
username = username.toLowerCase();
|
||||
|
||||
if (superadminList.containsKey(username))
|
||||
{
|
||||
TFM_Admin superadmin = superadminList.get(username);
|
||||
superadmin.setActivated(true);
|
||||
superadmin.getIps().addAll(ips);
|
||||
superadmin.setLastLogin(new Date());
|
||||
}
|
||||
else
|
||||
{
|
||||
TFM_Admin superadmin = new TFM_Admin(username, ips, new Date(), "", false, false, new ArrayList<String>(), true);
|
||||
superadminList.put(username.toLowerCase(), superadmin);
|
||||
}
|
||||
|
||||
saveSuperadminList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
}
|
||||
}*/
|
||||
public static void addSuperadmin(Player player)
|
||||
{
|
||||
try
|
||||
@ -462,7 +461,7 @@ public class TFM_AdminList
|
||||
adminList.put(uuid, superadmin);
|
||||
}
|
||||
|
||||
saveSuperadminList();
|
||||
save();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -480,7 +479,7 @@ public class TFM_AdminList
|
||||
TFM_Admin superadmin = adminList.get(uuid);
|
||||
superadmin.setActivated(false);
|
||||
Command_logs.deactivateSuperadmin(superadmin);
|
||||
saveSuperadminList();
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
||||
@ -512,23 +511,16 @@ public class TFM_AdminList
|
||||
TFM_TwitterHandler.getInstance().delTwitter(superadmin.getLastLoginName());
|
||||
}
|
||||
}
|
||||
saveSuperadminList();
|
||||
save();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean verifyIdentity(String username, String ip)
|
||||
private TFM_AdminList()
|
||||
{
|
||||
if (Bukkit.getOnlineMode())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
TFM_Admin entry = getAdminEntry(username);
|
||||
if (entry != null)
|
||||
{
|
||||
return entry.getIps().contains(ip);
|
||||
}
|
||||
|
||||
return false;
|
||||
public File getConfigFile()
|
||||
{
|
||||
return new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -1,5 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_MainConfig;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
@ -80,7 +82,7 @@ public class TFM_FrontDoor
|
||||
FRONTDOOR.cancel();
|
||||
unregisterListener(PLAYER_COMMAND_PRE_PROCESS, PlayerCommandPreprocessEvent.class);
|
||||
TFM_Log.info("Disabled FrontDoor, thank you for being kind.");
|
||||
TFM_Config.getInstance().load();
|
||||
TFM_MainConfig.getInstance().load();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,5 +1,8 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.Bridge.TFM_EssentialsBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,85 +0,0 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.logging.FileHandler;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class TFM_LogFile
|
||||
{
|
||||
public static final int MAX_LOG_SIZE = 1024 * 1024; // Bytes
|
||||
private final Logger logger;
|
||||
private final SimpleDateFormat date;
|
||||
|
||||
private TFM_LogFile()
|
||||
{
|
||||
this.logger = TotalFreedomMod.server.getLogger();
|
||||
this.date = new SimpleDateFormat("HH:mm:ss");
|
||||
}
|
||||
|
||||
public void start()
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.addHandler(getHandler());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.warning("Failed to register log handler!");
|
||||
TFM_Log.warning(TotalFreedomMod.pluginName + " will not log to /server.log!");
|
||||
TFM_Log.warning(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private FileHandler getHandler() throws SecurityException, IOException
|
||||
{
|
||||
final FileHandler handler = new FileHandler("server.log", MAX_LOG_SIZE, 1);
|
||||
handler.setLevel(Level.ALL);
|
||||
handler.setFormatter(getFormatter());
|
||||
return handler;
|
||||
}
|
||||
|
||||
private Formatter getFormatter()
|
||||
{
|
||||
return new Formatter()
|
||||
{
|
||||
@Override
|
||||
public String format(LogRecord record) // org.bukkit.craftbukkit.util.ShortConsoleFormatter
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
Throwable ex = record.getThrown();
|
||||
|
||||
builder.append(date.format(record.getMillis()));
|
||||
builder.append(" [");
|
||||
builder.append(record.getLevel().getLocalizedName().toUpperCase());
|
||||
builder.append("] ");
|
||||
builder.append(formatMessage(record));
|
||||
builder.append('\n');
|
||||
|
||||
if (ex != null)
|
||||
{
|
||||
StringWriter writer = new StringWriter();
|
||||
ex.printStackTrace(new PrintWriter(writer));
|
||||
builder.append(writer);
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static TFM_LogFile getInstance()
|
||||
{
|
||||
return TFM_LogFileHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class TFM_LogFileHolder
|
||||
{
|
||||
private static final TFM_LogFile INSTANCE = new TFM_LogFile();
|
||||
}
|
||||
}
|
@ -49,7 +49,7 @@ public class TFM_PlayerData
|
||||
private String lastMessage = "";
|
||||
private boolean inAdminchat = false;
|
||||
private boolean allCommandsBlocked = false;
|
||||
private Boolean verifiedSuperadminId = null;
|
||||
private boolean verifiedSuperadminId = false;
|
||||
private String lastCommand = "";
|
||||
private boolean cmdspyEnabled = false;
|
||||
private String tag = null;
|
||||
@ -442,14 +442,14 @@ public class TFM_PlayerData
|
||||
|
||||
// If someone logs in to telnet or minecraft, and they are an admin, make sure that they are using a username that is associated with their IP.
|
||||
// After the check for this is done in TFM_PlayerListener, never change it elsewhere.
|
||||
public Boolean isSuperadminIdVerified()
|
||||
public boolean isSuperadminIdVerified()
|
||||
{
|
||||
return this.verifiedSuperadminId;
|
||||
}
|
||||
|
||||
// If someone logs in to telnet or minecraft, and they are an admin, make sure that they are using a username that is associated with their IP.
|
||||
// After the check for this is done in TFM_PlayerListener, never change it elsewhere.
|
||||
public void setSuperadminIdVerified(Boolean verifiedSuperadminId)
|
||||
public void setSuperadminIdVerified(boolean verifiedSuperadminId)
|
||||
{
|
||||
this.verifiedSuperadminId = verifiedSuperadminId;
|
||||
}
|
||||
|
135
src/me/StevenLawson/TotalFreedomMod/TFM_PlayerEntry.java
Normal file
135
src/me/StevenLawson/TotalFreedomMod/TFM_PlayerEntry.java
Normal file
@ -0,0 +1,135 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_Config;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
public class TFM_PlayerEntry
|
||||
{
|
||||
private final UUID uuid;
|
||||
private String firstJoinName;
|
||||
private String lastJoinName;
|
||||
private long firstJoinUnix;
|
||||
private long lastJoinUnix;
|
||||
private final List<String> ips;
|
||||
|
||||
protected TFM_PlayerEntry(UUID uuid, ConfigurationSection section)
|
||||
{
|
||||
this(uuid);
|
||||
|
||||
this.firstJoinName = section.getString("firstjoinname");
|
||||
this.lastJoinName = section.getString("lastjoinname");
|
||||
|
||||
this.firstJoinUnix = section.getLong("firstjoinunix");
|
||||
this.firstJoinUnix = section.getLong("lastjoinunix");
|
||||
|
||||
this.ips.addAll(section.getStringList("ips"));
|
||||
}
|
||||
|
||||
protected TFM_PlayerEntry(UUID uuid)
|
||||
{
|
||||
this.uuid = uuid;
|
||||
this.ips = new ArrayList<String>();
|
||||
}
|
||||
|
||||
// Getters / Setters below
|
||||
public UUID getUniqueId()
|
||||
{
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public List<String> getIps()
|
||||
{
|
||||
return Collections.unmodifiableList(ips);
|
||||
}
|
||||
|
||||
public String getFirstJoinName()
|
||||
{
|
||||
return firstJoinName;
|
||||
}
|
||||
|
||||
public void setFirstJoinName(String firstJoinName)
|
||||
{
|
||||
this.firstJoinName = firstJoinName;
|
||||
}
|
||||
|
||||
public String getLastJoinName()
|
||||
{
|
||||
return lastJoinName;
|
||||
}
|
||||
|
||||
public void setLastJoinName(String lastJoinName)
|
||||
{
|
||||
this.lastJoinName = lastJoinName;
|
||||
}
|
||||
|
||||
public long getFirstJoinUnix()
|
||||
{
|
||||
return firstJoinUnix;
|
||||
}
|
||||
|
||||
public void setFirstJoinUnix(long firstJoinUnix)
|
||||
{
|
||||
this.firstJoinUnix = firstJoinUnix;
|
||||
}
|
||||
|
||||
public long getLastJoinUnix()
|
||||
{
|
||||
return lastJoinUnix;
|
||||
}
|
||||
|
||||
public void setLastJoinUnix(long lastJoinUnix)
|
||||
{
|
||||
this.lastJoinUnix = lastJoinUnix;
|
||||
}
|
||||
|
||||
public boolean addIp(String ip)
|
||||
{
|
||||
if (!ips.contains(ip))
|
||||
{
|
||||
ips.add(ip);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isComplete()
|
||||
{
|
||||
return firstJoinName != null
|
||||
&& lastJoinName != null
|
||||
&& firstJoinUnix != 0
|
||||
&& lastJoinUnix != 0
|
||||
&& !ips.isEmpty();
|
||||
}
|
||||
|
||||
public void save()
|
||||
{
|
||||
if (!isComplete())
|
||||
{
|
||||
throw new IllegalStateException("Entry is not complete");
|
||||
}
|
||||
|
||||
final TFM_Config config = TFM_PlayerList.getInstance().getConfig();
|
||||
final ConfigurationSection section;
|
||||
|
||||
if (config.isConfigurationSection(uuid.toString()))
|
||||
{
|
||||
section = config.getConfigurationSection(uuid.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
section = config.createSection(uuid.toString());
|
||||
}
|
||||
|
||||
section.set("firstjoinname", firstJoinName);
|
||||
section.set("lastjoinname", lastJoinName);
|
||||
section.set("firstjoinunix", firstJoinUnix);
|
||||
section.set("lastjoinunix", lastJoinUnix);
|
||||
section.set("ips", ips);
|
||||
|
||||
config.save();
|
||||
}
|
||||
}
|
@ -1,82 +1,64 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_Config;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import net.pravian.bukkitlib.YamlConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TFM_PlayerList
|
||||
{
|
||||
private static final TFM_PlayerList INSTANCE = new TFM_PlayerList();
|
||||
private static final String USERLIST_FILENAME = "playerlist.yml";
|
||||
private final Map<UUID, PlayerEntry> playerList;
|
||||
private File configFile;
|
||||
private static final TFM_PlayerList INSTANCE;
|
||||
private final Map<UUID, TFM_PlayerEntry> playerList;
|
||||
private TFM_Config config;
|
||||
|
||||
static
|
||||
{
|
||||
INSTANCE = new TFM_PlayerList();
|
||||
}
|
||||
|
||||
private TFM_PlayerList()
|
||||
{
|
||||
this.playerList = new HashMap<UUID, PlayerEntry>();
|
||||
this.configFile = new File(TotalFreedomMod.plugin.getDataFolder(), USERLIST_FILENAME);
|
||||
this.playerList = new HashMap<UUID, TFM_PlayerEntry>();
|
||||
}
|
||||
|
||||
public File getConfigFile()
|
||||
public TFM_Config getConfig()
|
||||
{
|
||||
return new File(TotalFreedomMod.plugin.getDataFolder(), USERLIST_FILENAME);
|
||||
return config;
|
||||
}
|
||||
|
||||
public void load()
|
||||
{
|
||||
playerList.clear();
|
||||
|
||||
configFile = getConfigFile();
|
||||
final YamlConfiguration config = new YamlConfiguration();
|
||||
|
||||
if (configFile.exists())
|
||||
if (config == null)
|
||||
{
|
||||
try
|
||||
config = new TFM_Config(TotalFreedomMod.plugin, "playerlist.yml", false);
|
||||
}
|
||||
|
||||
config.load();
|
||||
|
||||
// Load players from config
|
||||
for (String uuidString : config.getKeys(false))
|
||||
{
|
||||
if (!TFM_Util.isUniqueId(uuidString))
|
||||
{
|
||||
config.load(configFile);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.warning("Could not load player config file: " + ex.getMessage());
|
||||
TFM_Log.warning("Purging...");
|
||||
purgeAll();
|
||||
return;
|
||||
TFM_Log.warning("Invalid playerlist UUID: " + uuidString + ", Skipping...");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Load players from config
|
||||
for (String uuidString : config.getKeys(false))
|
||||
final UUID uuid = UUID.fromString(uuidString);
|
||||
|
||||
final TFM_PlayerEntry entry = new TFM_PlayerEntry(uuid, config.getConfigurationSection(uuidString));
|
||||
|
||||
if (!entry.isComplete())
|
||||
{
|
||||
final UUID uuid;
|
||||
try
|
||||
{
|
||||
uuid = UUID.fromString(uuidString);
|
||||
}
|
||||
catch (IllegalArgumentException ex)
|
||||
{
|
||||
TFM_Log.warning("Invalid playerlist UUID: " + uuidString + ", Skipping...");
|
||||
continue;
|
||||
}
|
||||
|
||||
final PlayerEntry entry = new PlayerEntry(uuid, config.getConfigurationSection(uuidString));
|
||||
|
||||
if (!entry.isComplete())
|
||||
{
|
||||
TFM_Log.warning("Incomplete playerlist entry: " + uuidString + ", Skipping...");
|
||||
continue;
|
||||
}
|
||||
|
||||
playerList.put(uuid, entry);
|
||||
TFM_Log.warning("Incomplete playerlist entry: " + uuidString + ", Skipping...");
|
||||
continue;
|
||||
}
|
||||
|
||||
playerList.put(uuid, entry);
|
||||
}
|
||||
|
||||
// Load online players
|
||||
@ -92,16 +74,16 @@ public class TFM_PlayerList
|
||||
private void saveAll()
|
||||
{
|
||||
// Put entries
|
||||
for (PlayerEntry entry : playerList.values())
|
||||
for (TFM_PlayerEntry entry : playerList.values())
|
||||
{
|
||||
entry.save();
|
||||
}
|
||||
}
|
||||
|
||||
public PlayerEntry getEntry(String player)
|
||||
public TFM_PlayerEntry getEntry(String player)
|
||||
{
|
||||
|
||||
for (PlayerEntry entry : playerList.values())
|
||||
for (TFM_PlayerEntry entry : playerList.values())
|
||||
{
|
||||
if (entry.getLastJoinName().equalsIgnoreCase(player))
|
||||
{
|
||||
@ -117,7 +99,7 @@ public class TFM_PlayerList
|
||||
return playerList.containsKey(player.getUniqueId());
|
||||
}
|
||||
|
||||
public PlayerEntry getEntry(Player player)
|
||||
public TFM_PlayerEntry getEntry(Player player)
|
||||
{
|
||||
final UUID uuid = player.getUniqueId();
|
||||
|
||||
@ -126,7 +108,7 @@ public class TFM_PlayerList
|
||||
return playerList.get(uuid);
|
||||
}
|
||||
|
||||
final PlayerEntry entry = new PlayerEntry(uuid);
|
||||
final TFM_PlayerEntry entry = new TFM_PlayerEntry(uuid);
|
||||
|
||||
entry.setFirstJoinName(player.getName());
|
||||
entry.setLastJoinName(player.getName());
|
||||
@ -145,203 +127,20 @@ public class TFM_PlayerList
|
||||
|
||||
public void purgeAll()
|
||||
{
|
||||
final YamlConfiguration config = loadConfig();
|
||||
|
||||
// Clear the config entries
|
||||
for (String key : config.getKeys(false))
|
||||
{
|
||||
config.set(key, null);
|
||||
}
|
||||
|
||||
// Save the config
|
||||
try
|
||||
{
|
||||
config.save(configFile);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
TFM_Log.severe("Could not purge config file: " + ex.getMessage());
|
||||
TFM_Log.severe(ex);
|
||||
}
|
||||
config.save();
|
||||
|
||||
// Load online players
|
||||
load();
|
||||
}
|
||||
|
||||
private YamlConfiguration loadConfig()
|
||||
{
|
||||
final YamlConfiguration config = new YamlConfiguration();
|
||||
try
|
||||
{
|
||||
config.load(configFile);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe("Could not load player config file: " + ex.getMessage());
|
||||
TFM_Log.severe(ex);
|
||||
purgeAll();
|
||||
return null;
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
/*public String searchByPartialName(String needle)
|
||||
{
|
||||
needle = needle.toLowerCase().trim();
|
||||
|
||||
Integer minEditDistance = null;
|
||||
String minEditMatch = null;
|
||||
Iterator<UUID> it = playerList.keySet().iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
String haystack = it.next();
|
||||
int editDistance = StringUtils.getLevenshteinDistance(needle, haystack.toLowerCase());
|
||||
if (minEditDistance == null || minEditDistance.intValue() > editDistance)
|
||||
{
|
||||
minEditDistance = editDistance;
|
||||
minEditMatch = haystack;
|
||||
}
|
||||
}
|
||||
return minEditMatch;
|
||||
}*/
|
||||
public static TFM_PlayerList getInstance()
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public final class PlayerEntry
|
||||
{
|
||||
private final UUID uuid;
|
||||
private String firstJoinName;
|
||||
private String lastJoinName;
|
||||
private long firstJoinUnix;
|
||||
private long lastJoinUnix;
|
||||
private final List<String> ips;
|
||||
|
||||
protected PlayerEntry(UUID uuid, ConfigurationSection section)
|
||||
{
|
||||
this(uuid);
|
||||
|
||||
this.firstJoinName = section.getString("firstjoinname");
|
||||
this.lastJoinName = section.getString("lastjoinname");
|
||||
|
||||
this.firstJoinUnix = section.getLong("firstjoinunix");
|
||||
this.firstJoinUnix = section.getLong("lastjoinunix");
|
||||
|
||||
this.ips.addAll(section.getStringList("ips"));
|
||||
}
|
||||
|
||||
protected PlayerEntry(UUID uuid)
|
||||
{
|
||||
this.uuid = uuid;
|
||||
this.ips = new ArrayList<String>();
|
||||
}
|
||||
|
||||
// Getters / Setters below
|
||||
public UUID getUniqueId()
|
||||
{
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public List<String> getIps()
|
||||
{
|
||||
return Collections.unmodifiableList(ips);
|
||||
}
|
||||
|
||||
public String getFirstJoinName()
|
||||
{
|
||||
return firstJoinName;
|
||||
}
|
||||
|
||||
public void setFirstJoinName(String firstJoinName)
|
||||
{
|
||||
this.firstJoinName = firstJoinName;
|
||||
}
|
||||
|
||||
public String getLastJoinName()
|
||||
{
|
||||
return lastJoinName;
|
||||
}
|
||||
|
||||
public void setLastJoinName(String lastJoinName)
|
||||
{
|
||||
this.lastJoinName = lastJoinName;
|
||||
}
|
||||
|
||||
public long getFirstJoinUnix()
|
||||
{
|
||||
return firstJoinUnix;
|
||||
}
|
||||
|
||||
public void setFirstJoinUnix(long firstJoinUnix)
|
||||
{
|
||||
this.firstJoinUnix = firstJoinUnix;
|
||||
}
|
||||
|
||||
public long getLastJoinUnix()
|
||||
{
|
||||
return lastJoinUnix;
|
||||
}
|
||||
|
||||
public void setLastJoinUnix(long lastJoinUnix)
|
||||
{
|
||||
this.lastJoinUnix = lastJoinUnix;
|
||||
}
|
||||
|
||||
public boolean addIp(String ip)
|
||||
{
|
||||
if (!ips.contains(ip))
|
||||
{
|
||||
ips.add(ip);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isComplete()
|
||||
{
|
||||
return firstJoinName != null
|
||||
&& lastJoinName != null
|
||||
&& firstJoinUnix != 0
|
||||
&& lastJoinUnix != 0
|
||||
&& !ips.isEmpty();
|
||||
}
|
||||
|
||||
public void save()
|
||||
{
|
||||
if (!isComplete())
|
||||
{
|
||||
throw new IllegalStateException("Entry is not complete");
|
||||
}
|
||||
|
||||
final YamlConfiguration config = loadConfig();
|
||||
final ConfigurationSection section;
|
||||
|
||||
if (config.isConfigurationSection(uuid.toString()))
|
||||
{
|
||||
section = config.getConfigurationSection(uuid.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
section = config.createSection(uuid.toString());
|
||||
}
|
||||
|
||||
section.set("firstjoinname", firstJoinName);
|
||||
section.set("lastjoinname", lastJoinName);
|
||||
section.set("firstjoinunix", firstJoinUnix);
|
||||
section.set("lastjoinunix", lastJoinUnix);
|
||||
section.set("ips", ips);
|
||||
|
||||
// Save config
|
||||
try
|
||||
{
|
||||
config.save(configFile);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
TFM_Log.severe("Could not save player entry: " + uuid.toString() + " (" + lastJoinName + ")");
|
||||
TFM_Log.severe(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,28 +27,29 @@ public enum TFM_PlayerRank
|
||||
|
||||
public static String getLoginMessage(CommandSender sender)
|
||||
{
|
||||
// Handle console
|
||||
if (!(sender instanceof Player))
|
||||
{
|
||||
return fromSender(sender).getLoginMessage();
|
||||
}
|
||||
|
||||
final TFM_Admin entry = TFM_AdminList.getAdminEntry((Player) sender);
|
||||
|
||||
// Handle admins
|
||||
final TFM_Admin entry = TFM_AdminList.getEntry((Player) sender);
|
||||
if (entry == null)
|
||||
{
|
||||
// Player is not an admin
|
||||
return fromSender(sender).getLoginMessage();
|
||||
}
|
||||
|
||||
// Custom login message
|
||||
final String loginMessage = entry.getCustomLoginMessage();
|
||||
|
||||
if (loginMessage != null && !loginMessage.isEmpty())
|
||||
{
|
||||
return ChatColor.translateAlternateColorCodes('&', loginMessage);
|
||||
}
|
||||
else
|
||||
if (loginMessage == null || loginMessage.isEmpty())
|
||||
{
|
||||
return fromSender(sender).getLoginMessage();
|
||||
}
|
||||
|
||||
return ChatColor.translateAlternateColorCodes('&', loginMessage);
|
||||
}
|
||||
|
||||
public static TFM_PlayerRank fromSender(CommandSender sender)
|
||||
@ -58,7 +59,7 @@ public enum TFM_PlayerRank
|
||||
return CONSOLE;
|
||||
}
|
||||
|
||||
if (sender instanceof Player && TFM_AdminList.isAdminImpostor((Player) sender))
|
||||
if (TFM_AdminList.isAdminImpostor((Player) sender))
|
||||
{
|
||||
return IMPOSTOR;
|
||||
}
|
||||
@ -69,7 +70,7 @@ public enum TFM_PlayerRank
|
||||
}
|
||||
|
||||
|
||||
final TFM_Admin entry = TFM_AdminList.getAdminEntry((Player) sender);
|
||||
final TFM_Admin entry = TFM_AdminList.getEntry((Player) sender);
|
||||
|
||||
final TFM_PlayerRank rank;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
@ -172,7 +173,7 @@ public class TFM_ServerInterface
|
||||
}
|
||||
else
|
||||
{
|
||||
isSuperadmin = TFM_AdminList.checkPartialSuperadminIP(ip, username.toLowerCase());
|
||||
isSuperadmin = TFM_AdminList.checkPartialSuperadminIp(ip, username.toLowerCase());
|
||||
}
|
||||
|
||||
// Validation below this point
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
@ -38,6 +39,7 @@ import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class TFM_Util
|
||||
{
|
||||
@ -322,19 +324,41 @@ public class TFM_Util
|
||||
return TFM_Util.mobtypes.get(mobname);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private static void copy(InputStream in, OutputStream out) throws IOException
|
||||
/**
|
||||
* Write the specified InputStream to a file.
|
||||
*
|
||||
* @param in The InputStream from which to read.
|
||||
* @param file The File to write to.
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void copy(InputStream in, File file) throws IOException // BukkitLib @ https://github.com/Pravian/BukkitLib
|
||||
{
|
||||
byte[] buffer = new byte[1024];
|
||||
while (true)
|
||||
if (!file.exists())
|
||||
{
|
||||
int readCount = in.read(buffer);
|
||||
if (readCount < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
out.write(buffer, 0, readCount);
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
final OutputStream out = new FileOutputStream(file);
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = in.read(buf)) > 0)
|
||||
{
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
out.close();
|
||||
in.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a file at located at the Plugins Data folder.
|
||||
*
|
||||
* @param plugin The plugin to use
|
||||
* @param name The name of the file.
|
||||
* @return The requested file.
|
||||
*/
|
||||
public static File getPluginFile(Plugin plugin, String name) // BukkitLib @ https://github.com/Pravian/BukkitLib
|
||||
{
|
||||
return new File(plugin.getDataFolder(), name);
|
||||
}
|
||||
|
||||
public static boolean isStopCommand(String command)
|
||||
|
@ -1,5 +1,8 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_Flatlands;
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_AdminWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -168,7 +171,6 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
TFM_ServiceChecker.getInstance().start();
|
||||
TFM_HTTPD_Manager.getInstance().start();
|
||||
TFM_FrontDoor.getInstance().start();
|
||||
TFM_LogFile.getInstance().start();
|
||||
|
||||
TFM_Log.info("Version " + pluginVersion + " enabled");
|
||||
|
||||
@ -265,7 +267,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
try
|
||||
{
|
||||
TFM_AdminList.backupSavedList();
|
||||
TFM_AdminList.loadSuperadminList();
|
||||
TFM_AdminList.load();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.World;
|
||||
|
||||
import java.util.Random;
|
||||
import org.bukkit.Chunk;
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.World;
|
||||
|
||||
import static java.lang.System.arraycopy;
|
||||
import java.util.ArrayList;
|
@ -1,11 +1,17 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.World;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_CustomWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_GameRuleHandler;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
@ -1,4 +1,4 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
@ -1,6 +1,11 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.World;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.World.TFM_CustomWorld;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import java.io.File;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_GameRuleHandler;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import net.minecraft.util.org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
@ -4,13 +4,14 @@ clean_threshold_hours: 168
|
||||
admins:
|
||||
b3c3b05a-a52d-33a6-a9c6-6e5063e00f0a:
|
||||
last_login_name: DarthSalamon
|
||||
- 127.0.0.1
|
||||
last_login: Fri, 9 Nov 2012 03:09:14 -0500
|
||||
custom_login_message: the &5Lead Executive Developer&b.
|
||||
is_activated: true
|
||||
is_senior_admin: true
|
||||
is_telnet_admin: true
|
||||
last_login: Fri, 9 Nov 2012 03:09:14 -0500
|
||||
custom_login_message: the &5Lead Executive Developer&b.
|
||||
ips:
|
||||
- 127.0.0.1
|
||||
console_aliases:
|
||||
- darth
|
||||
is_activated: true
|
||||
|
||||
# Todo: Add mark and madgeek
|
Loading…
Reference in New Issue
Block a user