[Bleeding] Fixed permissions through console. Resolves #195

This commit is contained in:
unknown 2014-06-28 11:43:05 +02:00
parent 850fd9aa4a
commit ba2ada569f
3 changed files with 19 additions and 14 deletions

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit! #Build Number for ANT. Do not edit!
#Fri Jun 27 23:44:06 CEST 2014 #Sat Jun 28 11:40:26 CEST 2014
build.number=881 build.number=886

View File

@ -27,7 +27,6 @@ public class TFM_TelnetListener implements Listener
if (admin == null || !admin.isTelnetAdmin()) if (admin == null || !admin.isTelnetAdmin())
{ {
event.setCancelled(true);
return; return;
} }

View File

@ -30,7 +30,7 @@ public class TFM_AdminList
private static final Set<UUID> superUUIDs; private static final Set<UUID> superUUIDs;
private static final Set<UUID> telnetUUIDs; private static final Set<UUID> telnetUUIDs;
private static final Set<UUID> seniorUUIDs; private static final Set<UUID> seniorUUIDs;
private static final Set<String> seniorConsoleAliases; private static final Set<String> seniorConsoleNames;
private static final Set<String> superIps; private static final Set<String> superIps;
private static int cleanThreshold = 24 * 7; // 1 Week in hours private static int cleanThreshold = 24 * 7; // 1 Week in hours
@ -40,7 +40,7 @@ public class TFM_AdminList
superUUIDs = new HashSet<UUID>(); superUUIDs = new HashSet<UUID>();
telnetUUIDs = new HashSet<UUID>(); telnetUUIDs = new HashSet<UUID>();
seniorUUIDs = new HashSet<UUID>(); seniorUUIDs = new HashSet<UUID>();
seniorConsoleAliases = new HashSet<String>(); seniorConsoleNames = new HashSet<String>();
superIps = new HashSet<String>(); superIps = new HashSet<String>();
} }
@ -64,9 +64,9 @@ public class TFM_AdminList
return Collections.unmodifiableSet(seniorUUIDs); return Collections.unmodifiableSet(seniorUUIDs);
} }
public static Set<String> getSeniorConsoleAliases() public static Set<String> getSeniorConsoleNames()
{ {
return Collections.unmodifiableSet(seniorConsoleAliases); return Collections.unmodifiableSet(seniorConsoleNames);
} }
public static Set<String> getSuperadminIps() public static Set<String> getSuperadminIps()
@ -160,7 +160,7 @@ public class TFM_AdminList
superUUIDs.clear(); superUUIDs.clear();
telnetUUIDs.clear(); telnetUUIDs.clear();
seniorUUIDs.clear(); seniorUUIDs.clear();
seniorConsoleAliases.clear(); seniorConsoleNames.clear();
superIps.clear(); superIps.clear();
for (TFM_Admin admin : adminList.values()) for (TFM_Admin admin : adminList.values())
@ -182,17 +182,18 @@ public class TFM_AdminList
if (admin.isTelnetAdmin()) if (admin.isTelnetAdmin())
{ {
telnetUUIDs.add(uuid); telnetUUIDs.add(uuid);
for (String alias : admin.getConsoleAliases())
{
seniorConsoleAliases.add(alias.toLowerCase());
}
} }
if (admin.isSeniorAdmin()) if (admin.isSeniorAdmin())
{ {
seniorUUIDs.add(uuid); seniorUUIDs.add(uuid);
seniorConsoleNames.add(admin.getLastLoginName());
for (String alias : admin.getConsoleAliases())
{
seniorConsoleNames.add(alias.toLowerCase());
}
} }
} }
@ -364,7 +365,7 @@ public class TFM_AdminList
if (!(sender instanceof Player)) if (!(sender instanceof Player))
{ {
return seniorConsoleAliases.contains(sender.getName()) return seniorConsoleNames.contains(sender.getName())
|| (TFM_MainConfig.getInstance().getBoolean(TFM_ConfigEntry.CONSOLE_IS_SENIOR) && sender.getName().equals("CONSOLE")); || (TFM_MainConfig.getInstance().getBoolean(TFM_ConfigEntry.CONSOLE_IS_SENIOR) && sender.getName().equals("CONSOLE"));
} }
@ -408,6 +409,11 @@ public class TFM_AdminList
} }
} }
if (!(sender instanceof Player))
{
return true;
}
final TFM_Admin entry = getEntry((Player) sender); final TFM_Admin entry = getEntry((Player) sender);
if (entry != null) if (entry != null)
{ {