mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +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!
|
#Build Number for ANT. Do not edit!
|
||||||
#Tue Apr 15 15:42:20 CEST 2014
|
#Tue Apr 15 16:05:55 CEST 2014
|
||||||
build.number=755
|
build.number=761
|
||||||
|
@ -114,10 +114,15 @@ public class TFM_PlayerListener implements Listener
|
|||||||
break;
|
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)
|
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;
|
break;
|
||||||
@ -724,7 +729,7 @@ public class TFM_PlayerListener implements Listener
|
|||||||
{
|
{
|
||||||
playerdata.setSuperadminIdVerified(false);
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@ public class TFM_TelnetListener implements Listener
|
|||||||
|
|
||||||
final TFM_Admin admin = TFM_AdminList.getEntryByIp(ip, true);
|
final TFM_Admin admin = TFM_AdminList.getEntryByIp(ip, true);
|
||||||
|
|
||||||
if (admin == null || !(admin.isTelnetAdmin() || admin.isSeniorAdmin()))
|
if (admin == null || !admin.isTelnetAdmin())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class TFM_AdminList
|
|||||||
private static final Set<UUID> superadminUUIDs;
|
private static final Set<UUID> superadminUUIDs;
|
||||||
private static final Set<UUID> telnetadminUUIDs;
|
private static final Set<UUID> telnetadminUUIDs;
|
||||||
private static final Set<UUID> senioradminUUIDs;
|
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 final Set<String> superadminIps;
|
||||||
private static int cleanThreshold = 24 * 7; // 1 Week in hours
|
private static int cleanThreshold = 24 * 7; // 1 Week in hours
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ public class TFM_AdminList
|
|||||||
superadminUUIDs = new HashSet<UUID>();
|
superadminUUIDs = new HashSet<UUID>();
|
||||||
telnetadminUUIDs = new HashSet<UUID>();
|
telnetadminUUIDs = new HashSet<UUID>();
|
||||||
senioradminUUIDs = new HashSet<UUID>();
|
senioradminUUIDs = new HashSet<UUID>();
|
||||||
senioradminAliases = new HashSet<String>();
|
consoleAliases = new HashSet<String>();
|
||||||
superadminIps = new HashSet<String>();
|
superadminIps = new HashSet<String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ public class TFM_AdminList
|
|||||||
|
|
||||||
public static Set<String> getConsoleAliases()
|
public static Set<String> getConsoleAliases()
|
||||||
{
|
{
|
||||||
return Collections.unmodifiableSet(senioradminAliases);
|
return Collections.unmodifiableSet(consoleAliases);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set<String> getSuperadminIps()
|
public static Set<String> getSuperadminIps()
|
||||||
@ -103,9 +103,45 @@ public class TFM_AdminList
|
|||||||
|
|
||||||
cleanThreshold = config.getInt("clean_threshold_hours", cleanThreshold);
|
cleanThreshold = config.getInt("clean_threshold_hours", cleanThreshold);
|
||||||
|
|
||||||
|
// Parse old superadmins
|
||||||
if (config.isConfigurationSection("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"))
|
if (!config.isConfigurationSection("admins"))
|
||||||
@ -150,40 +186,39 @@ public class TFM_AdminList
|
|||||||
superadminUUIDs.clear();
|
superadminUUIDs.clear();
|
||||||
telnetadminUUIDs.clear();
|
telnetadminUUIDs.clear();
|
||||||
senioradminUUIDs.clear();
|
senioradminUUIDs.clear();
|
||||||
senioradminAliases.clear();
|
consoleAliases.clear();
|
||||||
superadminIps.clear();
|
superadminIps.clear();
|
||||||
|
|
||||||
final Iterator<Entry<UUID, TFM_Admin>> it = adminList.entrySet().iterator();
|
for (TFM_Admin admin : adminList.values())
|
||||||
while (it.hasNext())
|
|
||||||
{
|
{
|
||||||
final Entry<UUID, TFM_Admin> pair = it.next();
|
if (!admin.isActivated())
|
||||||
|
|
||||||
final UUID uuid = pair.getKey();
|
|
||||||
TFM_Admin superadmin = pair.getValue();
|
|
||||||
|
|
||||||
if (superadmin.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())
|
if (admin.isSeniorAdmin())
|
||||||
{
|
{
|
||||||
senioradminAliases.add(alias.toLowerCase());
|
senioradminUUIDs.add(uuid);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (superadmin.isTelnetAdmin())
|
|
||||||
{
|
|
||||||
telnetadminUUIDs.add(uuid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,10 +244,10 @@ public class TFM_AdminList
|
|||||||
|
|
||||||
config.set("admins." + uuid + ".last_login_name", superadmin.getLastLoginName());
|
config.set("admins." + uuid + ".last_login_name", superadmin.getLastLoginName());
|
||||||
config.set("admins." + uuid + ".is_activated", superadmin.isActivated());
|
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 + ".last_login", TFM_Util.dateToString(superadmin.getLastLogin()));
|
||||||
config.set("admins." + uuid + ".custom_login_message", superadmin.getCustomLoginMessage());
|
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 + ".console_aliases", TFM_Util.removeDuplicates(superadmin.getConsoleAliases()));
|
||||||
config.set("admins." + uuid + ".ips", TFM_Util.removeDuplicates(superadmin.getIps()));
|
config.set("admins." + uuid + ".ips", TFM_Util.removeDuplicates(superadmin.getIps()));
|
||||||
}
|
}
|
||||||
@ -316,7 +351,7 @@ public class TFM_AdminList
|
|||||||
|
|
||||||
if (!(sender instanceof Player))
|
if (!(sender instanceof Player))
|
||||||
{
|
{
|
||||||
return senioradminAliases.contains(sender.getName());
|
return consoleAliases.contains(sender.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
final TFM_Admin entry = getEntry((Player) sender);
|
final TFM_Admin entry = getEntry((Player) sender);
|
||||||
@ -367,7 +402,7 @@ public class TFM_AdminList
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return entry.getIps().contains(TFM_Util.getIp(player));
|
return entry.getUniqueId().equals(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -13,7 +13,7 @@ public class TFM_Jumppads
|
|||||||
public static final Material BLOCK_ID = Material.WOOL;
|
public static final Material BLOCK_ID = Material.WOOL;
|
||||||
public static final double DAMPING_COEFFICIENT = 0.8;
|
public static final double DAMPING_COEFFICIENT = 0.8;
|
||||||
public final Map<Player, Boolean> canPushMap = new HashMap<Player, Boolean>();
|
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;
|
private double strength = 0.4;
|
||||||
|
|
||||||
public void PlayerMoveEvent(PlayerMoveEvent event)
|
public void PlayerMoveEvent(PlayerMoveEvent event)
|
||||||
|
@ -7,11 +7,31 @@ admins:
|
|||||||
is_activated: true
|
is_activated: true
|
||||||
is_senior_admin: true
|
is_senior_admin: true
|
||||||
is_telnet_admin: true
|
is_telnet_admin: true
|
||||||
last_login: Fri, 9 Nov 2012 03:09:14 -0500
|
|
||||||
custom_login_message: the &5Lead Executive Developer
|
|
||||||
ips:
|
ips:
|
||||||
- 127.0.0.1
|
- 127.0.0.1
|
||||||
console_aliases:
|
console_aliases:
|
||||||
- darth
|
- darth
|
||||||
|
last_login: Tue, 15 Apr 2014 16:08:39 +0200
|
||||||
# Todo: Add mark and madgeek
|
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