Skip to content

Commit

Permalink
Only send settings update if the permissions actually changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Sollace committed Dec 19, 2024
1 parent 9f6d77d commit 335a609
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public static InteractionManager getInstance() {

private WeakReference<MinecraftServer> server = new WeakReference<>(null);
protected final BigPonyConfig config = BigPony.getInstance().getConfig();
private long previousPermissions = config.getPermissions();

protected InteractionManager() {
if (INSTANCE != null) {
Expand All @@ -34,10 +35,12 @@ protected void setServer(@Nullable MinecraftServer server) {
}

protected void onConfigurationChange() {
MinecraftServer server = this.server.get();
if (server != null) {
log("[S-SET] Sending settings update packet to all players");
Network.SERVER_CONSENT.sendToAllPlayers(new ConsentPacket(), server);
if (previousPermissions != config.getPermissions()) {
MinecraftServer server = this.server.get();
if (server != null) {
log("[S-SET] Sending settings update packet to all players");
Network.SERVER_CONSENT.sendToAllPlayers(new ConsentPacket(), server);
}
}
}

Expand Down

0 comments on commit 335a609

Please sign in to comment.