mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-27 20:27:37 +00:00
[Dry] (Hopefully) fixed the latest bugs
Added superadmin.yml conversion
This commit is contained in:
parent
7f2e72ee51
commit
d8560ebc1f
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Tue Apr 15 15:42:20 CEST 2014
|
||||
build.number=755
|
||||
#Tue Apr 15 16:05:55 CEST 2014
|
||||
build.number=761
|
||||
|
@ -114,10 +114,15 @@ public class TFM_PlayerListener implements Listener
|
||||
break;
|
||||
}
|
||||
|
||||
TFM_Util.playerMsg(player, "Block edits at (" + ChatColor.WHITE + "x" + location.getBlockX() + ", y" + location.getBlockY() + ", z" + location.getBlockZ() + ChatColor.BLUE + ")" + ChatColor.WHITE + ":", ChatColor.BLUE);
|
||||
TFM_Util.playerMsg(player, "Block edits at ("
|
||||
+ ChatColor.WHITE + "x" + location.getBlockX()
|
||||
+ ", y" + location.getBlockY()
|
||||
+ ", z" + location.getBlockZ()
|
||||
+ ChatColor.BLUE + ")" + ChatColor.WHITE + ":", ChatColor.BLUE);
|
||||
for (RollbackEntry entry : entries)
|
||||
{
|
||||
TFM_Util.playerMsg(player, " - " + ChatColor.BLUE + entry.author + " " + entry.getType() + " " + StringUtils.capitalize(entry.getMaterial().toString().toLowerCase()) + (entry.data == 0 ? "" : ":" + entry.data));
|
||||
TFM_Util.playerMsg(player, " - " + ChatColor.BLUE + entry.author + " " + entry.getType() + " "
|
||||
+ StringUtils.capitalize(entry.getMaterial().toString().toLowerCase()) + (entry.data == 0 ? "" : ":" + entry.data));
|
||||
}
|
||||
|
||||
break;
|
||||
@ -724,7 +729,7 @@ public class TFM_PlayerListener implements Listener
|
||||
{
|
||||
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);
|
||||
TFM_Util.bcastMsg("Warning: " + player.getName() + " is an admin, but is using an account not registered to one of their ip-list.", ChatColor.RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ public class TFM_TelnetListener implements Listener
|
||||
|
||||
final TFM_Admin admin = TFM_AdminList.getEntryByIp(ip, true);
|
||||
|
||||
if (admin == null || !(admin.isTelnetAdmin() || admin.isSeniorAdmin()))
|
||||
if (admin == null || !admin.isTelnetAdmin())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class TFM_AdminList
|
||||
private static final Set<UUID> superadminUUIDs;
|
||||
private static final Set<UUID> telnetadminUUIDs;
|
||||
private static final Set<UUID> senioradminUUIDs;
|
||||
private static final Set<String> senioradminAliases;
|
||||
private static final Set<String> consoleAliases;
|
||||
private static final Set<String> superadminIps;
|
||||
private static int cleanThreshold = 24 * 7; // 1 Week in hours
|
||||
|
||||
@ -39,7 +39,7 @@ public class TFM_AdminList
|
||||
superadminUUIDs = new HashSet<UUID>();
|
||||
telnetadminUUIDs = new HashSet<UUID>();
|
||||
senioradminUUIDs = new HashSet<UUID>();
|
||||
senioradminAliases = new HashSet<String>();
|
||||
consoleAliases = new HashSet<String>();
|
||||
superadminIps = new HashSet<String>();
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ public class TFM_AdminList
|
||||
|
||||
public static Set<String> getConsoleAliases()
|
||||
{
|
||||
return Collections.unmodifiableSet(senioradminAliases);
|
||||
return Collections.unmodifiableSet(consoleAliases);
|
||||
}
|
||||
|
||||
public static Set<String> getSuperadminIps()
|
||||
@ -103,9 +103,45 @@ public class TFM_AdminList
|
||||
|
||||
cleanThreshold = config.getInt("clean_threshold_hours", cleanThreshold);
|
||||
|
||||
// Parse old superadmins
|
||||
if (config.isConfigurationSection("superadmins"))
|
||||
{
|
||||
// TODO: Loading from old
|
||||
TFM_Log.info("Old superadmin configuration found, parsing...");
|
||||
|
||||
final ConfigurationSection section = config.getConfigurationSection("superadmins");
|
||||
|
||||
int counter = 0;
|
||||
int errors = 0;
|
||||
|
||||
for (String admin : config.getConfigurationSection("superadmins").getKeys(false))
|
||||
{
|
||||
final OfflinePlayer player = Bukkit.getOfflinePlayer(admin);
|
||||
|
||||
if (player == null || player.getUniqueId() == null)
|
||||
{
|
||||
errors++;
|
||||
TFM_Log.warning("Could not convert admin " + admin + ", UUID could not be found!");
|
||||
continue;
|
||||
}
|
||||
|
||||
final String uuid = player.getUniqueId().toString();
|
||||
|
||||
config.set("admins." + uuid + ".last_login_name", player.getName());
|
||||
config.set("admins." + uuid + ".is_activated", section.getBoolean(admin + ".is_activated"));
|
||||
config.set("admins." + uuid + ".is_telnet_admin", section.getBoolean(admin + ".is_telnet_admin"));
|
||||
config.set("admins." + uuid + ".is_senior_admin", section.getBoolean(admin + ".is_senior_admin"));
|
||||
config.set("admins." + uuid + ".last_login", section.getString(admin + ".last_login"));
|
||||
config.set("admins." + uuid + ".custom_login_message", section.getString(admin + ".custom_login_message"));
|
||||
config.set("admins." + uuid + ".console_aliases", section.getStringList(admin + ".console_aliases"));
|
||||
config.set("admins." + uuid + ".ips", section.getStringList(admin + ".ips"));
|
||||
|
||||
counter++;
|
||||
}
|
||||
|
||||
config.set("superadmins", null);
|
||||
config.save();
|
||||
|
||||
TFM_Log.info(counter + " admins parsed, " + errors + " errors");
|
||||
}
|
||||
|
||||
if (!config.isConfigurationSection("admins"))
|
||||
@ -150,40 +186,39 @@ public class TFM_AdminList
|
||||
superadminUUIDs.clear();
|
||||
telnetadminUUIDs.clear();
|
||||
senioradminUUIDs.clear();
|
||||
senioradminAliases.clear();
|
||||
consoleAliases.clear();
|
||||
superadminIps.clear();
|
||||
|
||||
final Iterator<Entry<UUID, TFM_Admin>> it = adminList.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
for (TFM_Admin admin : adminList.values())
|
||||
{
|
||||
final Entry<UUID, TFM_Admin> pair = it.next();
|
||||
|
||||
final UUID uuid = pair.getKey();
|
||||
TFM_Admin superadmin = pair.getValue();
|
||||
|
||||
if (superadmin.isActivated())
|
||||
if (!admin.isActivated())
|
||||
{
|
||||
superadminUUIDs.add(uuid);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (String ip : superadmin.getIps())
|
||||
final UUID uuid = admin.getUniqueId();
|
||||
|
||||
superadminUUIDs.add(uuid);
|
||||
|
||||
for (String ip : admin.getIps())
|
||||
{
|
||||
superadminIps.add(ip);
|
||||
}
|
||||
|
||||
if (admin.isTelnetAdmin())
|
||||
{
|
||||
telnetadminUUIDs.add(uuid);
|
||||
|
||||
for (String alias : admin.getConsoleAliases())
|
||||
{
|
||||
superadminIps.add(ip);
|
||||
consoleAliases.add(alias.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
if (superadmin.isSeniorAdmin())
|
||||
{
|
||||
senioradminUUIDs.add(uuid);
|
||||
|
||||
for (String alias : superadmin.getConsoleAliases())
|
||||
{
|
||||
senioradminAliases.add(alias.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
if (superadmin.isTelnetAdmin())
|
||||
{
|
||||
telnetadminUUIDs.add(uuid);
|
||||
}
|
||||
if (admin.isSeniorAdmin())
|
||||
{
|
||||
senioradminUUIDs.add(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,10 +244,10 @@ public class TFM_AdminList
|
||||
|
||||
config.set("admins." + uuid + ".last_login_name", superadmin.getLastLoginName());
|
||||
config.set("admins." + uuid + ".is_activated", superadmin.isActivated());
|
||||
config.set("admins." + uuid + ".is_telnet_admin", superadmin.isTelnetAdmin());
|
||||
config.set("admins." + uuid + ".is_senior_admin", superadmin.isSeniorAdmin());
|
||||
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()));
|
||||
}
|
||||
@ -316,7 +351,7 @@ public class TFM_AdminList
|
||||
|
||||
if (!(sender instanceof Player))
|
||||
{
|
||||
return senioradminAliases.contains(sender.getName());
|
||||
return consoleAliases.contains(sender.getName());
|
||||
}
|
||||
|
||||
final TFM_Admin entry = getEntry((Player) sender);
|
||||
@ -367,7 +402,7 @@ public class TFM_AdminList
|
||||
return false;
|
||||
}
|
||||
|
||||
return entry.getIps().contains(TFM_Util.getIp(player));
|
||||
return entry.getUniqueId().equals(player.getUniqueId());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -13,7 +13,7 @@ public class TFM_Jumppads
|
||||
public static final Material BLOCK_ID = Material.WOOL;
|
||||
public static final double DAMPING_COEFFICIENT = 0.8;
|
||||
public final Map<Player, Boolean> canPushMap = new HashMap<Player, Boolean>();
|
||||
private JumpPadMode mode = JumpPadMode.OFF;
|
||||
private JumpPadMode mode = JumpPadMode.MADGEEK;
|
||||
private double strength = 0.4;
|
||||
|
||||
public void PlayerMoveEvent(PlayerMoveEvent event)
|
||||
|
@ -7,11 +7,31 @@ admins:
|
||||
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
|
||||
ips:
|
||||
- 127.0.0.1
|
||||
- 127.0.0.1
|
||||
console_aliases:
|
||||
- darth
|
||||
|
||||
# Todo: Add mark and madgeek
|
||||
last_login: Tue, 15 Apr 2014 16:08:39 +0200
|
||||
custom_login_message: the &5Lead Developer&b!
|
||||
1156a81a-23fb-435e-9aff-fe9c2ea7e82d:
|
||||
last_login_name: Madgeek1450
|
||||
is_activated: true
|
||||
is_telnet_admin: true
|
||||
is_senior_admin: true
|
||||
console_aliases:
|
||||
- madgeek
|
||||
ips:
|
||||
- 1.2.3.4
|
||||
- 8.8.8.8
|
||||
last_login: Tue, 15 Apr 2014 16:01:24 +0200
|
||||
custom_login_message: the &4Co-Founder&b and &6Master-ass-kicker&b.
|
||||
58a6ea8a-3ac3-4033-80e3-41bf9caa634b:
|
||||
last_login_name: markbyron
|
||||
is_activated: true
|
||||
is_telnet_admin: true
|
||||
is_senior_admin: true
|
||||
console_aliases: []
|
||||
ips:
|
||||
- 8.8.4.4
|
||||
last_login: Sat, 10 Nov 2012 08:09:14 +0100
|
||||
custom_login_message: the &dOwner&b.
|
||||
|
Loading…
Reference in New Issue
Block a user