diff --git a/mcp/mobius/opis/events/PlayerTracker.java b/mcp/mobius/opis/events/PlayerTracker.java index 87ec251..3941253 100644 --- a/mcp/mobius/opis/events/PlayerTracker.java +++ b/mcp/mobius/opis/events/PlayerTracker.java @@ -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); } diff --git a/mcp/mobius/opis/modOpis.java b/mcp/mobius/opis/modOpis.java index 615fd00..6f578e1 100644 --- a/mcp/mobius/opis/modOpis.java +++ b/mcp/mobius/opis/modOpis.java @@ -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);