From f313d0897d0c21c4f35be04e2dbd6d2798c5c234 Mon Sep 17 00:00:00 2001 From: overkidding <46853321+overkidding@users.noreply.github.com> Date: Tue, 10 Sep 2024 09:38:07 +0200 Subject: [PATCH 1/7] fix: permission load --- src/main/java/ac/grim/grimac/checks/Check.java | 10 +++++++++- src/main/java/ac/grim/grimac/player/GrimPlayer.java | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/ac/grim/grimac/checks/Check.java b/src/main/java/ac/grim/grimac/checks/Check.java index c2b3f615c8..6b6e432808 100644 --- a/src/main/java/ac/grim/grimac/checks/Check.java +++ b/src/main/java/ac/grim/grimac/checks/Check.java @@ -7,6 +7,7 @@ import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon; import github.scarsz.configuralize.DynamicConfig; +import io.github.retrooper.packetevents.util.folia.FoliaScheduler; import lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -60,6 +61,13 @@ public boolean shouldModifyPackets() { return isEnabled && !player.disableGrim && !player.noModifyPacketPermission && !exempted; } + public void updateExempted(){ + if(player.bukkitPlayer == null || checkName == null) return; + FoliaScheduler.getEntityScheduler().run(player.bukkitPlayer, GrimAPI.INSTANCE.getPlugin(), + t -> exempted = player.bukkitPlayer != null && player.bukkitPlayer.hasPermission("grim.exempt." + checkName.toLowerCase()), + ()->{}); + } + public final boolean flagAndAlert(String verbose) { if (flag()) { alert(verbose); @@ -105,7 +113,7 @@ public void reload() { if (setbackVL == -1) setbackVL = Double.MAX_VALUE; - exempted = player.bukkitPlayer != null && player.bukkitPlayer.hasPermission("grim.exempt." + checkName.toLowerCase()); + updateExempted(); } public boolean alert(String verbose) { diff --git a/src/main/java/ac/grim/grimac/player/GrimPlayer.java b/src/main/java/ac/grim/grimac/player/GrimPlayer.java index 106110eed1..3b75b0be79 100644 --- a/src/main/java/ac/grim/grimac/player/GrimPlayer.java +++ b/src/main/java/ac/grim/grimac/player/GrimPlayer.java @@ -3,6 +3,7 @@ import ac.grim.grimac.GrimAPI; import ac.grim.grimac.api.AbstractCheck; import ac.grim.grimac.api.GrimUser; +import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.impl.aim.processor.AimProcessor; import ac.grim.grimac.checks.impl.misc.ClientBrand; import ac.grim.grimac.checks.impl.misc.TransactionOrder; @@ -35,7 +36,6 @@ import com.github.retrooper.packetevents.protocol.player.GameMode; import com.github.retrooper.packetevents.protocol.player.User; import com.github.retrooper.packetevents.protocol.world.BlockFace; -import com.github.retrooper.packetevents.protocol.world.Dimension; import com.github.retrooper.packetevents.protocol.world.dimension.DimensionType; import com.github.retrooper.packetevents.util.Vector3d; import com.github.retrooper.packetevents.wrapper.PacketWrapper; @@ -504,6 +504,8 @@ public void updatePermissions() { if (bukkitPlayer == null) return; this.noModifyPacketPermission = bukkitPlayer.hasPermission("grim.nomodifypacket"); this.noSetbackPermission = bukkitPlayer.hasPermission("grim.nosetback"); + FoliaScheduler.getAsyncScheduler().runNow(GrimAPI.INSTANCE.getPlugin(), t-> checkManager.allChecks.values().stream().map(c->(Check)c) + .forEach(Check::updateExempted)); } private int spamThreshold = 100; From 21a7bdd39562a34226f21fe84235c98f6017a21d Mon Sep 17 00:00:00 2001 From: overkidding <46853321+overkidding@users.noreply.github.com> Date: Sat, 14 Sep 2024 07:08:53 +0200 Subject: [PATCH 2/7] fix spacing formatting 1 Co-authored-by: ManInMyVan <113963219+ManInMyVan@users.noreply.github.com> --- src/main/java/ac/grim/grimac/player/GrimPlayer.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/ac/grim/grimac/player/GrimPlayer.java b/src/main/java/ac/grim/grimac/player/GrimPlayer.java index 3b75b0be79..71882b15ce 100644 --- a/src/main/java/ac/grim/grimac/player/GrimPlayer.java +++ b/src/main/java/ac/grim/grimac/player/GrimPlayer.java @@ -504,8 +504,13 @@ public void updatePermissions() { if (bukkitPlayer == null) return; this.noModifyPacketPermission = bukkitPlayer.hasPermission("grim.nomodifypacket"); this.noSetbackPermission = bukkitPlayer.hasPermission("grim.nosetback"); - FoliaScheduler.getAsyncScheduler().runNow(GrimAPI.INSTANCE.getPlugin(), t-> checkManager.allChecks.values().stream().map(c->(Check)c) - .forEach(Check::updateExempted)); + FoliaScheduler.getAsyncScheduler().runNow(GrimAPI.INSTANCE.getPlugin(), t -> + for (AbstractCheck check : checkManager.allChecks.values()) { + if (check instanceof Check) { + ((Check) check).updateExempted(); + } + } + ); } private int spamThreshold = 100; From 049c30f8b1474c4218c390128d0f764ecd8b24d2 Mon Sep 17 00:00:00 2001 From: overkidding <46853321+overkidding@users.noreply.github.com> Date: Sat, 14 Sep 2024 07:09:04 +0200 Subject: [PATCH 3/7] fix spacing formatting 2 Co-authored-by: ManInMyVan <113963219+ManInMyVan@users.noreply.github.com> --- src/main/java/ac/grim/grimac/checks/Check.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/ac/grim/grimac/checks/Check.java b/src/main/java/ac/grim/grimac/checks/Check.java index 6b6e432808..a7c6e7b624 100644 --- a/src/main/java/ac/grim/grimac/checks/Check.java +++ b/src/main/java/ac/grim/grimac/checks/Check.java @@ -62,7 +62,7 @@ public boolean shouldModifyPackets() { } public void updateExempted(){ - if(player.bukkitPlayer == null || checkName == null) return; + if (player.bukkitPlayer == null || checkName == null) return; FoliaScheduler.getEntityScheduler().run(player.bukkitPlayer, GrimAPI.INSTANCE.getPlugin(), t -> exempted = player.bukkitPlayer != null && player.bukkitPlayer.hasPermission("grim.exempt." + checkName.toLowerCase()), ()->{}); From a61b710e8177ff5ed7dd8bbecbffed2e7d89d6bf Mon Sep 17 00:00:00 2001 From: overkidding <46853321+overkidding@users.noreply.github.com> Date: Sat, 14 Sep 2024 07:09:26 +0200 Subject: [PATCH 4/7] fix spacing formatting 3 Co-authored-by: ManInMyVan <113963219+ManInMyVan@users.noreply.github.com> --- src/main/java/ac/grim/grimac/checks/Check.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/ac/grim/grimac/checks/Check.java b/src/main/java/ac/grim/grimac/checks/Check.java index a7c6e7b624..14c1c63985 100644 --- a/src/main/java/ac/grim/grimac/checks/Check.java +++ b/src/main/java/ac/grim/grimac/checks/Check.java @@ -64,7 +64,7 @@ public boolean shouldModifyPackets() { public void updateExempted(){ if (player.bukkitPlayer == null || checkName == null) return; FoliaScheduler.getEntityScheduler().run(player.bukkitPlayer, GrimAPI.INSTANCE.getPlugin(), - t -> exempted = player.bukkitPlayer != null && player.bukkitPlayer.hasPermission("grim.exempt." + checkName.toLowerCase()), + t -> exempted = player.bukkitPlayer.hasPermission("grim.exempt." + checkName.toLowerCase()), ()->{}); } From 510247f3b46c88d05f5c3796d4223c7d500d07dc Mon Sep 17 00:00:00 2001 From: overkidding <46853321+overkidding@users.noreply.github.com> Date: Sat, 14 Sep 2024 07:09:35 +0200 Subject: [PATCH 5/7] fix spacing formatting 4 Co-authored-by: ManInMyVan <113963219+ManInMyVan@users.noreply.github.com> --- src/main/java/ac/grim/grimac/checks/Check.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/ac/grim/grimac/checks/Check.java b/src/main/java/ac/grim/grimac/checks/Check.java index 14c1c63985..5e52c78e7d 100644 --- a/src/main/java/ac/grim/grimac/checks/Check.java +++ b/src/main/java/ac/grim/grimac/checks/Check.java @@ -61,7 +61,7 @@ public boolean shouldModifyPackets() { return isEnabled && !player.disableGrim && !player.noModifyPacketPermission && !exempted; } - public void updateExempted(){ + public void updateExempted () { if (player.bukkitPlayer == null || checkName == null) return; FoliaScheduler.getEntityScheduler().run(player.bukkitPlayer, GrimAPI.INSTANCE.getPlugin(), t -> exempted = player.bukkitPlayer.hasPermission("grim.exempt." + checkName.toLowerCase()), From 89a795a7e69164fb0cffc3d8364811007d8df19e Mon Sep 17 00:00:00 2001 From: overkidding <46853321+overkidding@users.noreply.github.com> Date: Sat, 14 Sep 2024 07:09:48 +0200 Subject: [PATCH 6/7] fix spacing formatting 1 Co-authored-by: ManInMyVan <113963219+ManInMyVan@users.noreply.github.com> --- src/main/java/ac/grim/grimac/checks/Check.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/ac/grim/grimac/checks/Check.java b/src/main/java/ac/grim/grimac/checks/Check.java index 5e52c78e7d..c5fc165c6d 100644 --- a/src/main/java/ac/grim/grimac/checks/Check.java +++ b/src/main/java/ac/grim/grimac/checks/Check.java @@ -65,7 +65,7 @@ public void updateExempted () { if (player.bukkitPlayer == null || checkName == null) return; FoliaScheduler.getEntityScheduler().run(player.bukkitPlayer, GrimAPI.INSTANCE.getPlugin(), t -> exempted = player.bukkitPlayer.hasPermission("grim.exempt." + checkName.toLowerCase()), - ()->{}); + () -> {}); } public final boolean flagAndAlert(String verbose) { From 7ac2319c07616437e60fa34c9792a5957c70e1ca Mon Sep 17 00:00:00 2001 From: overkidding <46853321+overkidding@users.noreply.github.com> Date: Sat, 14 Sep 2024 09:05:48 +0200 Subject: [PATCH 7/7] fix spacing formatting 6 Co-authored-by: ManInMyVan <113963219+ManInMyVan@users.noreply.github.com> --- src/main/java/ac/grim/grimac/checks/Check.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/ac/grim/grimac/checks/Check.java b/src/main/java/ac/grim/grimac/checks/Check.java index c5fc165c6d..8adc776957 100644 --- a/src/main/java/ac/grim/grimac/checks/Check.java +++ b/src/main/java/ac/grim/grimac/checks/Check.java @@ -61,7 +61,7 @@ public boolean shouldModifyPackets() { return isEnabled && !player.disableGrim && !player.noModifyPacketPermission && !exempted; } - public void updateExempted () { + public void updateExempted() { if (player.bukkitPlayer == null || checkName == null) return; FoliaScheduler.getEntityScheduler().run(player.bukkitPlayer, GrimAPI.INSTANCE.getPlugin(), t -> exempted = player.bukkitPlayer.hasPermission("grim.exempt." + checkName.toLowerCase()),