Mirror von
https://github.com/Moulberry/AxiomPaperPlugin.git
synchronisiert 2024-11-17 05:40:06 +01:00
Add individual permissions
Dieser Commit ist enthalten in:
Ursprung
53bfc16dc5
Commit
82f5eca7ef
@ -305,11 +305,24 @@ public class AxiomPaper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasAxiomPermission(Player player) {
|
public boolean hasAxiomPermission(Player player) {
|
||||||
return player.hasPermission("axiom.*") || player.isOp();
|
return hasAxiomPermission(player, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasAxiomPermission(Player player, String permission) {
|
||||||
|
if (player.hasPermission("axiom.*") || player.isOp()) {
|
||||||
|
return true;
|
||||||
|
} else if (permission != null && !player.hasPermission(permission)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return player.hasPermission("axiom.use");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseAxiom(Player player) {
|
public boolean canUseAxiom(Player player) {
|
||||||
return hasAxiomPermission(player) && activeAxiomPlayers.contains(player.getUniqueId());
|
return canUseAxiom(player, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canUseAxiom(Player player, String permission) {
|
||||||
|
return activeAxiomPlayers.contains(player.getUniqueId()) && hasAxiomPermission(player, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
public @Nullable RateLimiter getBlockBufferRateLimiter(UUID uuid) {
|
public @Nullable RateLimiter getBlockBufferRateLimiter(UUID uuid) {
|
||||||
|
@ -36,7 +36,7 @@ public class BlueprintRequestPacketListener implements PluginMessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void process(Player player, byte[] message) {
|
private void process(Player player, byte[] message) {
|
||||||
if (!this.plugin.canUseAxiom(player)) {
|
if (!this.plugin.canUseAxiom(player, "axiom.blueprint.request")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,11 +35,7 @@ public class DeleteEntityPacketListener implements PluginMessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void process(Player player, byte[] message) {
|
private void process(Player player, byte[] message) {
|
||||||
if (!this.plugin.canUseAxiom(player)) {
|
if (!this.plugin.canUseAxiom(player, "axiom.entity.delete")) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!player.hasPermission("axiom.entity.*") && !player.hasPermission("axiom.entity.delete")) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,11 +90,7 @@ public class ManipulateEntityPacketListener implements PluginMessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void process(Player player, byte[] message) {
|
private void process(Player player, byte[] message) {
|
||||||
if (!this.plugin.canUseAxiom(player)) {
|
if (!this.plugin.canUseAxiom(player, "axiom.entity.manipulate")) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!player.hasPermission("axiom.entity.*") && !player.hasPermission("axiom.entity.manipulate")) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,11 +33,7 @@ public class MarkerNbtRequestPacketListener implements PluginMessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void process(Player player, byte[] message) {
|
private void process(Player player, byte[] message) {
|
||||||
if (!this.plugin.canUseAxiom(player)) {
|
if (!this.plugin.canUseAxiom(player, "axiom.entity.manipulate")) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!player.hasPermission("axiom.entity.*") && !player.hasPermission("axiom.entity.manipulate")) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public class RequestChunkDataPacketListener implements PluginMessageListener {
|
|||||||
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(Unpooled.wrappedBuffer(message));
|
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(Unpooled.wrappedBuffer(message));
|
||||||
long id = friendlyByteBuf.readLong();
|
long id = friendlyByteBuf.readLong();
|
||||||
|
|
||||||
if (!this.plugin.canUseAxiom(bukkitPlayer) || this.plugin.isMismatchedDataVersion(bukkitPlayer.getUniqueId())) {
|
if (!this.plugin.canUseAxiom(bukkitPlayer, "axiom.chunk.request") || this.plugin.isMismatchedDataVersion(bukkitPlayer.getUniqueId())) {
|
||||||
// We always send an 'empty' response in order to make the client happy
|
// We always send an 'empty' response in order to make the client happy
|
||||||
sendEmptyResponse(player, id);
|
sendEmptyResponse(player, id);
|
||||||
return;
|
return;
|
||||||
|
@ -125,7 +125,7 @@ public class SetBlockBufferPacketListener {
|
|||||||
ServerLevel world = player.serverLevel();
|
ServerLevel world = player.serverLevel();
|
||||||
if (!world.dimension().equals(worldKey)) return;
|
if (!world.dimension().equals(worldKey)) return;
|
||||||
|
|
||||||
if (!this.plugin.canUseAxiom(player.getBukkitEntity())) {
|
if (!this.plugin.canUseAxiom(player.getBukkitEntity(), "axiom.build.section")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,7 +325,7 @@ public class SetBlockBufferPacketListener {
|
|||||||
ServerLevel world = player.serverLevel();
|
ServerLevel world = player.serverLevel();
|
||||||
if (!world.dimension().equals(worldKey)) return;
|
if (!world.dimension().equals(worldKey)) return;
|
||||||
|
|
||||||
if (!this.plugin.canUseAxiom(player.getBukkitEntity())) {
|
if (!this.plugin.canUseAxiom(player.getBukkitEntity(), "axiom.build.section")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public class SetBlockPacketListener implements PluginMessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void process(Player bukkitPlayer, byte[] message) {
|
private void process(Player bukkitPlayer, byte[] message) {
|
||||||
if (!this.plugin.canUseAxiom(bukkitPlayer)) {
|
if (!this.plugin.canUseAxiom(bukkitPlayer, "axiom.build.place")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public class SetEditorViewsPacketListener implements PluginMessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void process(Player player, byte[] message) {
|
private void process(Player player, byte[] message) {
|
||||||
if (!this.plugin.canUseAxiom(player)) {
|
if (!this.plugin.canUseAxiom(player, "axiom.editor.views")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public class SetFlySpeedPacketListener implements PluginMessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void process(Player player, byte[] message) {
|
private void process(Player player, byte[] message) {
|
||||||
if (!this.plugin.canUseAxiom(player)) {
|
if (!this.plugin.canUseAxiom(player, "axiom.player.speed")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public class SetGamemodePacketListener implements PluginMessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void process(Player player, byte[] message) {
|
private void process(Player player, byte[] message) {
|
||||||
if (!this.plugin.canUseAxiom(player)) {
|
if (!this.plugin.canUseAxiom(player, "axiom.player.gamemode")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ public class SetHotbarSlotPacketListener implements PluginMessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void process(Player player, byte[] message) {
|
private void process(Player player, byte[] message) {
|
||||||
if (!this.plugin.canUseAxiom(player) || this.plugin.isMismatchedDataVersion(player.getUniqueId())) {
|
if (!this.plugin.canUseAxiom(player, "axiom.player.hotbar") || this.plugin.isMismatchedDataVersion(player.getUniqueId())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public class SetTimePacketListener implements PluginMessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void process(Player player, byte[] message) {
|
private void process(Player player, byte[] message) {
|
||||||
if (!this.plugin.canUseAxiom(player)) {
|
if (!this.plugin.canUseAxiom(player, "axiom.world.time")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ public class SetWorldPropertyListener implements PluginMessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void process(Player player, byte[] message) {
|
private void process(Player player, byte[] message) {
|
||||||
if (!this.plugin.canUseAxiom(player)) {
|
if (!this.plugin.canUseAxiom(player, "axiom.world.property")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,11 +55,7 @@ public class SpawnEntityPacketListener implements PluginMessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void process(Player player, byte[] message) {
|
private void process(Player player, byte[] message) {
|
||||||
if (!this.plugin.canUseAxiom(player)) {
|
if (!this.plugin.canUseAxiom(player, "axiom.entity.spawn")) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!player.hasPermission("axiom.entity.*") && !player.hasPermission("axiom.entity.spawn")) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public class SwitchActiveHotbarPacketListener implements PluginMessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void process(Player player, byte[] message) {
|
private void process(Player player, byte[] message) {
|
||||||
if (!this.plugin.canUseAxiom(player) || this.plugin.isMismatchedDataVersion(player.getUniqueId())) {
|
if (!this.plugin.canUseAxiom(player, "axiom.player.hotbar") || this.plugin.isMismatchedDataVersion(player.getUniqueId())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class TeleportPacketListener implements PluginMessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void process(Player player, byte[] message) {
|
private void process(Player player, byte[] message) {
|
||||||
if (!this.plugin.canUseAxiom(player)) {
|
if (!this.plugin.canUseAxiom(player, "axiom.world.teleport")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ public class UploadBlueprintPacketListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onReceive(ServerPlayer serverPlayer, FriendlyByteBuf friendlyByteBuf) {
|
public void onReceive(ServerPlayer serverPlayer, FriendlyByteBuf friendlyByteBuf) {
|
||||||
if (!this.plugin.canUseAxiom(serverPlayer.getBukkitEntity())) {
|
if (!this.plugin.canUseAxiom(serverPlayer.getBukkitEntity(), "axiom.blueprint.upload")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,23 +5,64 @@ description: $description
|
|||||||
authors:
|
authors:
|
||||||
- Moulberry
|
- Moulberry
|
||||||
api-version: "$apiVersion"
|
api-version: "$apiVersion"
|
||||||
softdepend: ["CoreProtect"]
|
softdepend:
|
||||||
|
- ViaVersion
|
||||||
|
- WorldGuard
|
||||||
|
- PlotSquared
|
||||||
permissions:
|
permissions:
|
||||||
axiom.*:
|
axiom.*:
|
||||||
description: Allows use of all default Axiom features
|
description: Allows use of all default Axiom features
|
||||||
default: op
|
default: op
|
||||||
|
axiom.use:
|
||||||
|
description: Allows basic use of axiom
|
||||||
|
default: op
|
||||||
axiom.debug:
|
axiom.debug:
|
||||||
description: Allows use of the /axiompaperdebug command
|
description: Allows use of the /axiompaperdebug command
|
||||||
default: op
|
default: op
|
||||||
axiom.entity.*:
|
axiom.entity.*:
|
||||||
description: Allows use of all entity-related features (spawning, manipulating, deleting)
|
description: Allows use of all entity-related features (spawning, manipulating, deleting)
|
||||||
default: op
|
default: op
|
||||||
axiom.entity.spawn:
|
children:
|
||||||
description: Allows entity spawning
|
axiom.entity.spawn: true
|
||||||
axiom.entity.manipulate:
|
axiom.entity.manipulate: true
|
||||||
description: Allows entity manipulation
|
axiom.entity.delete: true
|
||||||
axiom.entity.delete:
|
axiom.blueprint.*:
|
||||||
description: Allows entity deletion
|
description: Allows use of all blueprint-related features
|
||||||
|
default: op
|
||||||
|
children:
|
||||||
|
axiom.blueprint.upload: true
|
||||||
|
axiom.blueprint.request: true
|
||||||
|
axiom.blueprint.manifest: true
|
||||||
|
axiom.chunk.*:
|
||||||
|
description: Allows use of all chunk-related features
|
||||||
|
default: op
|
||||||
|
children:
|
||||||
|
axiom.chunk.request: true
|
||||||
|
axiom.build.*:
|
||||||
|
description: Allows use of all build-related features
|
||||||
|
default: op
|
||||||
|
children:
|
||||||
|
axiom.build.place: true
|
||||||
|
axiom.build.section: true
|
||||||
|
axiom.editor.*:
|
||||||
|
description: Allows use of all editor-related features
|
||||||
|
default: op
|
||||||
|
children:
|
||||||
|
axiom.editor.views: true
|
||||||
|
axiom.player.*:
|
||||||
|
description: Allows use of all player-related features
|
||||||
|
default: op
|
||||||
|
children:
|
||||||
|
axiom.player.speed: true
|
||||||
|
axiom.player.gamemode: true
|
||||||
|
axiom.player.hotbar: true
|
||||||
|
axiom.world.*:
|
||||||
|
description: Allows use of all world-related features
|
||||||
|
default: op
|
||||||
|
children:
|
||||||
|
axiom.world.time: true
|
||||||
|
axiom.world.property: true
|
||||||
|
axiom.world.teleport: true
|
||||||
|
|
||||||
axiom.allow_copying_other_plots:
|
axiom.allow_copying_other_plots:
|
||||||
description: This permission allows users to copy other user's plots
|
description: This permission allows users to copy other user's plots
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren