diff --git a/mcp/mobius/opis/events/OpisServerTickHandler.java b/mcp/mobius/opis/events/OpisServerTickHandler.java index 3b849fb..7b66b39 100644 --- a/mcp/mobius/opis/events/OpisServerTickHandler.java +++ b/mcp/mobius/opis/events/OpisServerTickHandler.java @@ -31,6 +31,7 @@ import mcp.mobius.opis.data.profilers.ProfilerPacket; import mcp.mobius.opis.data.profilers.ProfilerTick; import mcp.mobius.opis.gui.overlay.OverlayStatus; import mcp.mobius.opis.network.OpisPacketHandler; +import mcp.mobius.opis.network.enums.AccessLevel; import mcp.mobius.opis.network.enums.Message; import mcp.mobius.opis.network.packets.server.NetDataCommand; import mcp.mobius.opis.network.packets.server.NetDataList; @@ -51,6 +52,8 @@ public enum OpisServerTickHandler implements ITickHandler { public long timer1000 = System.nanoTime(); public long timer5000 = System.nanoTime(); + public HashMap cachedAccess = new HashMap(); + @Override public void tickStart(EnumSet type, Object... tickData) { } @@ -82,7 +85,10 @@ public enum OpisServerTickHandler implements ITickHandler { OpisPacketHandler.sendPacketToAllSwing(NetDataValue.create(Message.VALUE_AMOUNT_ENTITIES, new SerialInt(EntityManager.INSTANCE.getAmountEntities()))); for (Player player : PlayerTracker.instance().playersSwing){ - OpisPacketHandler.validateAndSend(NetDataValue.create(Message.STATUS_ACCESS_LEVEL, new SerialInt(PlayerTracker.instance().getPlayerAccessLevel(player).ordinal())), player); + if (!cachedAccess.containsKey(player) || cachedAccess.get(player) != PlayerTracker.instance().getPlayerAccessLevel(player)){ + OpisPacketHandler.validateAndSend(NetDataValue.create(Message.STATUS_ACCESS_LEVEL, new SerialInt(PlayerTracker.instance().getPlayerAccessLevel(player).ordinal())), player); + cachedAccess.put(player, PlayerTracker.instance().getPlayerAccessLevel(player)); + } } // Dimension data update. diff --git a/mcp/mobius/opis/events/PlayerTracker.java b/mcp/mobius/opis/events/PlayerTracker.java index ab31eb8..dcb33c4 100644 --- a/mcp/mobius/opis/events/PlayerTracker.java +++ b/mcp/mobius/opis/events/PlayerTracker.java @@ -21,7 +21,7 @@ public class PlayerTracker implements IPlayerTracker{ public HashSet playersSwing = new HashSet(); //This is the list of players who have opened the UI //public HashSet playersOpis = new HashSet(); //This is the list of players who have opened the UI or used the command line - public HashMap filteredAmount = new HashMap(); //Should the entity amount be filtered or not + public HashMap filteredAmount = new HashMap(); //Should the entity amount be filtered or not public HashMap playerOverlayStatus = new HashMap(); public HashMap playerDimension = new HashMap(); public HashMap playerTab = new HashMap();