3
0
Mirror von https://github.com/Moulberry/AxiomPaperPlugin.git synchronisiert 2024-11-17 05:40:06 +01:00

Bypass permission check if player is opped

Dieser Commit ist enthalten in:
Moulberry 2024-03-27 17:45:52 +08:00
Ursprung a0dcd552c7
Commit ab4253ac9f
2 geänderte Dateien mit 7 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -194,7 +194,7 @@ public class AxiomPaper extends JavaPlugin implements Listener {
for (Player player : Bukkit.getServer().getOnlinePlayers()) { for (Player player : Bukkit.getServer().getOnlinePlayers()) {
if (activeAxiomPlayers.contains(player.getUniqueId())) { if (activeAxiomPlayers.contains(player.getUniqueId())) {
if (!player.hasPermission("axiom.*")) { if (!this.hasAxiomPermission(player)) {
FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer()); FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
buf.writeBoolean(false); buf.writeBoolean(false);
byte[] bytes = new byte[buf.writerIndex()]; byte[] bytes = new byte[buf.writerIndex()];
@ -280,8 +280,12 @@ public class AxiomPaper extends JavaPlugin implements Listener {
return this.logLargeBlockBufferChanges; return this.logLargeBlockBufferChanges;
} }
public boolean hasAxiomPermission(Player player) {
return player.hasPermission("axiom.*") || player.isOp();
}
public boolean canUseAxiom(Player player) { public boolean canUseAxiom(Player player) {
return player.hasPermission("axiom.*") && activeAxiomPlayers.contains(player.getUniqueId()); return hasAxiomPermission(player) && activeAxiomPlayers.contains(player.getUniqueId());
} }
public @Nullable RateLimiter getBlockBufferRateLimiter(UUID uuid) { public @Nullable RateLimiter getBlockBufferRateLimiter(UUID uuid) {

Datei anzeigen

@ -41,7 +41,7 @@ public class HelloPacketListener implements PluginMessageListener {
@Override @Override
public void onPluginMessageReceived(@NotNull String channel, @NotNull Player player, @NotNull byte[] message) { public void onPluginMessageReceived(@NotNull String channel, @NotNull Player player, @NotNull byte[] message) {
if (!player.hasPermission("axiom.*")) { if (!this.plugin.hasAxiomPermission(player)) {
return; return;
} }