Fix inverted hooks for PermissionsChangedEvent (#8089)

Because IEventBus#post returns true on cancellation and the patched-in
hooks inverts the return of the ForgeHooks method, if the player
whose permission level is being changed is online and the event is not
cancelled, the permission change _is_ cancelled.

The fix is inverting the patched-in hooks and the default return value
of the ForgeHooks method, so that the permission change is cancelled
only if the player is online, the event is fired, and the event is cancelled.

Fixes #8088
This commit is contained in:
sciwhiz12 authored and GitHub committed 2021-09-18 14:58:27 -07:00
1 parent a31adc2823
commit b2dbe9de51
2 files changed
+3 -3

No files matched your search

@@ -794,6 +794,6 @@ public class ForgeEventFactory
{
return MinecraftForge.EVENT_BUS.post(new PermissionsChangedEvent(player, newLevel, oldLevel));
}
return true;
return false;
}
}