SteamWar/BauSystem2.0
Archiviert
12
0

Addjusted permissions

Dieser Commit ist enthalten in:
D4rkr34lm 2023-12-16 14:47:33 +01:00
Ursprung 0cec90c55c
Commit 7802a03f48
11 geänderte Dateien mit 20 neuen und 22 gelöschten Zeilen

Datei anzeigen

@ -122,13 +122,6 @@ public class WarpCommand extends SWCommand implements Disable, Enable {
BauSystem.MESSAGE.sendPrefixless("WARP_GUI_DISTANCE", player, warp.getLocation().distance(player.getLocation())); BauSystem.MESSAGE.sendPrefixless("WARP_GUI_DISTANCE", player, warp.getLocation().distance(player.getLocation()));
} }
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> validator() {
return (commandSender, player, messageSender) -> {
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "WARP_DISALLOWED");
};
}
@Linked @Linked
public static class WarpsLink extends SWCommand { public static class WarpsLink extends SWCommand {

Datei anzeigen

@ -55,7 +55,7 @@ public class WarpGui {
), warp))); ), warp)));
SWListInv<Warp> inv = new SWListInv<>(player, BauSystem.MESSAGE.parse("WARP_GUI_NAME", player), false, entries, (clickType, warp) -> { SWListInv<Warp> inv = new SWListInv<>(player, BauSystem.MESSAGE.parse("WARP_GUI_NAME", player), false, entries, (clickType, warp) -> {
if (clickType.isRightClick() && Permission.hasPermission(player, Permission.WORLD)) { if (clickType.isRightClick() && Permission.BUILD.hasPermission(player)) {
openWarpGui(player, warp); openWarpGui(player, warp);
} else { } else {
warp.teleport(player); warp.teleport(player);

Datei anzeigen

@ -32,7 +32,7 @@ public class AxiomPermissionCheck implements Listener {
@EventHandler @EventHandler
public void onAxiomHandshake(AxiomHandshakeEvent event) { public void onAxiomHandshake(AxiomHandshakeEvent event) {
if (Permission.WORLDEDIT.hasPermission(event.getPlayer())) return; if (Permission.BUILD.hasPermission(event.getPlayer())) return;
event.setCancelled(true); event.setCancelled(true);
} }
} }

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.bausystem.features.world; package de.steamwar.bausystem.features.world;
import de.steamwar.bausystem.Permission;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import de.steamwar.sql.SchematicData; import de.steamwar.sql.SchematicData;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
@ -35,6 +36,8 @@ public class ClipboardListener implements Listener {
@EventHandler @EventHandler
public void onLogin(PlayerJoinEvent e) { public void onLogin(PlayerJoinEvent e) {
if(!Permission.BUILD.hasPermission(e.getPlayer())) return;
try { try {
SchematicNode schematic = SchematicNode.getSchematicNode(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, (Integer) null); SchematicNode schematic = SchematicNode.getSchematicNode(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, (Integer) null);
if (schematic != null) { if (schematic != null) {
@ -47,6 +50,8 @@ public class ClipboardListener implements Listener {
@EventHandler @EventHandler
public void onLogout(PlayerQuitEvent e) { public void onLogout(PlayerQuitEvent e) {
if(!Permission.SUPERVISOR.hasPermission(e.getPlayer())) return;
SchematicNode schematic = SchematicNode.getSchematicNode(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, (Integer) null); SchematicNode schematic = SchematicNode.getSchematicNode(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, (Integer) null);
boolean newSchem = false; boolean newSchem = false;
if (schematic == null) { if (schematic == null) {

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.bausystem.features.world; package de.steamwar.bausystem.features.world;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.SWUtils;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import org.bukkit.Material; import org.bukkit.Material;
@ -40,6 +41,9 @@ public class ItemFrameListener implements Listener {
if (!(event.getEntity() instanceof ItemFrame)) { if (!(event.getEntity() instanceof ItemFrame)) {
return; return;
} }
if(!Permission.BUILD.hasPermission((Player) event.getDamager())) return;
event.setCancelled(true); event.setCancelled(true);
ItemFrame itemFrame = (ItemFrame) event.getEntity(); ItemFrame itemFrame = (ItemFrame) event.getEntity();
ItemStack itemStack = itemFrame.getItem(); ItemStack itemStack = itemFrame.getItem();

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.bausystem.features.world; package de.steamwar.bausystem.features.world;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.BauServer; import de.steamwar.bausystem.config.BauServer;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeValidator; import de.steamwar.command.TypeValidator;
@ -38,16 +39,11 @@ public class KickallCommand extends SWCommand {
} }
@Register(description = "KICKALL_HELP") @Register(description = "KICKALL_HELP")
public void genericCommand(@Validator Player player) { public void genericCommand(Player player) {
if(!Permission.OWNER.hasPermission(player)) return;
Bukkit.getOnlinePlayers().forEach(p -> { Bukkit.getOnlinePlayers().forEach(p -> {
if (!bauServer.getOwner().equals(p.getUniqueId())) p.kickPlayer(""); if (!bauServer.getOwner().equals(p.getUniqueId())) p.kickPlayer("");
}); });
} }
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> validator() {
return (commandSender, player, messageSender) -> {
return !messageSender.send(!bauServer.getOwner().equals(player.getUniqueId()), "KICKALL_NO_PERM");
};
}
} }

Datei anzeigen

@ -51,7 +51,7 @@ public class StopCommand extends SWCommand {
return true; return true;
} }
Player player = (Player) sender; Player player = (Player) sender;
if (Permission.hasPermission(player, Permission.WORLD)) { if (Permission.SUPERVISOR.hasPermission(player)) {
return true; return true;
} }
SteamwarUser user = SteamwarUser.get(player.getUniqueId()); SteamwarUser user = SteamwarUser.get(player.getUniqueId());

Datei anzeigen

@ -40,7 +40,7 @@ public class WorldEditListener implements Listener {
if (!isWorldEditCommand(e.getMessage().split(" ")[0])) return; if (!isWorldEditCommand(e.getMessage().split(" ")[0])) return;
Player p = e.getPlayer(); Player p = e.getPlayer();
if (!Permission.hasPermission(p, Permission.WORLDEDIT)) { if (!Permission.BUILD.hasPermission(e.getPlayer())) {
BauSystem.MESSAGE.send("WORLD_EDIT_NO_PERMS", p); BauSystem.MESSAGE.send("WORLD_EDIT_NO_PERMS", p);
e.setCancelled(true); e.setCancelled(true);
e.setMessage("/"); e.setMessage("/");

Datei anzeigen

@ -63,7 +63,7 @@ public class ColorReplaceCommand extends SWCommand {
@Register(description = "COLORREPLACE_HELP") @Register(description = "COLORREPLACE_HELP")
@SneakyThrows @SneakyThrows
public void genericCommand(Player player, Pair<Integer, Color> from, Color to) { public void genericCommand(@Validator Player player, Pair<Integer, Color> from, Color to) {
if (from.getValue() == to) { if (from.getValue() == to) {
BukkitAdapter.adapt(player).printInfo(TranslatableComponent.of("worldedit.replace.replaced", new Component[]{TextComponent.of(0)})); BukkitAdapter.adapt(player).printInfo(TranslatableComponent.of("worldedit.replace.replaced", new Component[]{TextComponent.of(0)}));
return; return;

Datei anzeigen

@ -67,7 +67,7 @@ public class TypeReplaceCommand extends SWCommand {
@Register(description = "TYPEREPLACE_HELP") @Register(description = "TYPEREPLACE_HELP")
@SneakyThrows @SneakyThrows
public void genericCommand(Player player, Pair<Integer, Type> from, Type to) { public void genericCommand(@Validator Player player, Pair<Integer, Type> from, Type to) {
if (from.getValue() == to) { if (from.getValue() == to) {
BukkitAdapter.adapt(player).printInfo(TranslatableComponent.of("worldedit.replace.replaced", new Component[]{TextComponent.of(0)})); BukkitAdapter.adapt(player).printInfo(TranslatableComponent.of("worldedit.replace.replaced", new Component[]{TextComponent.of(0)}));
return; return;

Datei anzeigen

@ -62,7 +62,7 @@ public class XrayCommand extends SWCommand implements Listener, ScoreboardElemen
public TechHiderCommand techHiderCommand; public TechHiderCommand techHiderCommand;
@Register(description = "XRAY_HELP") @Register(description = "XRAY_HELP")
public void toggleHider(Player player) { public void toggleHider(@Validator Player player) {
Region region = Region.getRegion(player.getLocation()); Region region = Region.getRegion(player.getLocation());
if (region.isGlobal()) { if (region.isGlobal()) {
BauSystem.MESSAGE.send("XRAY_GLOBAL", player); BauSystem.MESSAGE.send("XRAY_GLOBAL", player);