Added comments to some config keys.

Moved the list of privileged users to the access_right section.
This commit is contained in:
ProfMobius committed 2014-03-22 23:31:29 +01:00
1 parent 0fbd042048
commit c6380df8eb
2 files changed
+11 -6

No files matched your search

+3 -3
View File
@@ -41,7 +41,7 @@ public class PlayerTracker implements IPlayerTracker{
public void addPrivilegedPlayer(String name, boolean save){
this.playerPrivileged.add(name);
if (save){
modOpis.instance.config.get(Configuration.CATEGORY_GENERAL, "privileged", new String[]{}).set(playerPrivileged.toArray(new String[]{}));
modOpis.instance.config.get("ACCESS_RIGHTS", "privileged", new String[]{}, modOpis.commentPrivileged).set(playerPrivileged.toArray(new String[]{}));
modOpis.instance.config.save();
}
}
@@ -52,12 +52,12 @@ public class PlayerTracker implements IPlayerTracker{
public void rmPrivilegedPlayer(String name){
this.playerPrivileged.remove(name);
modOpis.instance.config.get(Configuration.CATEGORY_GENERAL, "privileged", new String[]{}).set(playerPrivileged.toArray(new String[]{}));
modOpis.instance.config.get("ACCESS_RIGHTS", "privileged", new String[]{}, modOpis.commentPrivileged).set(playerPrivileged.toArray(new String[]{}));
modOpis.instance.config.save();
}
public void reloeadPriviligedPlayers(){
String[] users = modOpis.instance.config.get(Configuration.CATEGORY_GENERAL, "privileged", new String[]{}).getStringList();
String[] users = modOpis.instance.config.get("ACCESS_RIGHTS", "privileged", new String[]{}, modOpis.commentPrivileged).getStringList();
for (String s : users)
PlayerTracker.instance().addPrivilegedPlayer(s,false);
}
+8 -3
View File
@@ -90,6 +90,10 @@ public class modOpis {
public Configuration config = null;
public static String commentTables = "Minimum access level to be able to view tables in /opis command. Valid values : NONE, PRIVILEGED, ADMIN";
public static String commentOverlays = "Minimum access level to be able to show overlays in MapWriter. Valid values : NONE, PRIVILEGED, ADMIN";
public static String commentPrivileged = "List of players with PRIVILEGED access level.";
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
config = new Configuration(event.getSuggestedConfigurationFile());
@@ -98,12 +102,13 @@ public class modOpis {
lagGenID = config.get(Configuration.CATEGORY_GENERAL, "laggenerator_id", -1).getInt();
profilerMaxTicks = config.get(Configuration.CATEGORY_GENERAL, "profiler.maxpts", 250).getInt();
microseconds = config.get(Configuration.CATEGORY_GENERAL, "display.microseconds", true).getBoolean(true);
String[] users = config.get(Configuration.CATEGORY_GENERAL, "privileged", new String[]{}).getStringList();
String[] users = config.get("ACCESS_RIGHTS", "privileged", new String[]{}, commentPrivileged).getStringList();
AccessLevel minTables = AccessLevel.PRIVILEGED;
AccessLevel minOverlays = AccessLevel.PRIVILEGED;
try{ minTables = AccessLevel.valueOf(config.get("ACCESS_RIGHTS", "tables", "NONE").getString()); } catch (IllegalArgumentException e){}
try{ minOverlays = AccessLevel.valueOf(config.get("ACCESS_RIGHTS", "overlays", "NONE").getString()); } catch (IllegalArgumentException e){}
try{ minTables = AccessLevel.valueOf(config.get("ACCESS_RIGHTS", "tables", "NONE", commentTables).getString()); } catch (IllegalArgumentException e){}
try{ minOverlays = AccessLevel.valueOf(config.get("ACCESS_RIGHTS", "overlays", "NONE", commentOverlays).getString()); } catch (IllegalArgumentException e){}
DataReq.setTablesMinimumLevel(minTables);
DataReq.setOverlaysMinimumLevel(minOverlays);