mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-25 14:34:37 +00:00
Overlays and tables minimum access level can now be configured by a config option.
This commit is contained in:
1 parent
3816cd0ea5
commit
0fbd042048
2 files changed
+29
-2
No files matched your search
@@ -47,6 +47,8 @@ import mcp.mobius.opis.helpers.ModIdentification;
|
||||
import mcp.mobius.opis.network.OpisConnectionHandler;
|
||||
import mcp.mobius.opis.network.OpisPacketHandler;
|
||||
import mcp.mobius.opis.network.custom.Packet251Extended;
|
||||
import mcp.mobius.opis.network.enums.AccessLevel;
|
||||
import mcp.mobius.opis.network.enums.DataReq;
|
||||
import mcp.mobius.opis.proxy.ProxyServer;
|
||||
import mcp.mobius.opis.tools.BlockLag;
|
||||
import mcp.mobius.opis.tools.TileLag;
|
||||
@@ -83,7 +85,7 @@ public class modOpis {
|
||||
public static boolean profilerRun = false;
|
||||
public static int profilerMaxTicks = 250;
|
||||
public static boolean microseconds = true;
|
||||
private static int lagGenID = -1;
|
||||
private static int lagGenID = -1;
|
||||
public static CoordinatesBlock selectedBlock = null;
|
||||
|
||||
public Configuration config = null;
|
||||
@@ -95,9 +97,16 @@ public class modOpis {
|
||||
profilerDelay = config.get(Configuration.CATEGORY_GENERAL, "profiler.delay", 1).getInt();
|
||||
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);
|
||||
microseconds = config.get(Configuration.CATEGORY_GENERAL, "display.microseconds", true).getBoolean(true);
|
||||
String[] users = config.get(Configuration.CATEGORY_GENERAL, "privileged", new String[]{}).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){}
|
||||
|
||||
DataReq.setTablesMinimumLevel(minTables);
|
||||
DataReq.setOverlaysMinimumLevel(minOverlays);
|
||||
|
||||
for (String s : users)
|
||||
PlayerTracker.instance().addPrivilegedPlayer(s,false);
|
||||
|
||||
@@ -76,5 +76,23 @@ public enum DataReq {
|
||||
|
||||
public boolean canPlayerUseCommand(String name){
|
||||
return PlayerTracker.instance().getPlayerAccessLevel(name).ordinal() >= this.accessLevel.ordinal();
|
||||
}
|
||||
|
||||
public static void setTablesMinimumLevel(AccessLevel level){
|
||||
DataReq.LIST_CHUNK_TILEENTS.setAccessLevel(level);
|
||||
DataReq.LIST_CHUNK_ENTITIES.setAccessLevel(level);
|
||||
DataReq.LIST_TIMING_TILEENTS.setAccessLevel(level);
|
||||
DataReq.LIST_TIMING_ENTITIES.setAccessLevel(level);
|
||||
DataReq.LIST_TIMING_HANDLERS.setAccessLevel(level);
|
||||
DataReq.LIST_TIMING_CHUNK.setAccessLevel(level);
|
||||
DataReq.LIST_AMOUNT_ENTITIES.setAccessLevel(level);
|
||||
DataReq.LIST_PLAYERS.setAccessLevel(level);
|
||||
}
|
||||
|
||||
public static void setOverlaysMinimumLevel(AccessLevel level){
|
||||
DataReq.OVERLAY_CHUNK_ENTITIES.setAccessLevel(level);
|
||||
DataReq.OVERLAY_CHUNK_TIMING.setAccessLevel(level);
|
||||
DataReq.LIST_CHUNK_LOADED.setAccessLevel(level);
|
||||
DataReq.LIST_CHUNK_TICKETS.setAccessLevel(level);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user