Dieser Commit ist enthalten in:
Ursprung
37e6628aaa
Commit
3dddb48d0c
@ -44,7 +44,7 @@ public class AttributeRemoveCommand extends SWCommand {
|
||||
|
||||
@Register({"all"})
|
||||
@Register({"*"})
|
||||
public void genericCommand(Player player) {
|
||||
public void genericCommand(@Validator Player player) {
|
||||
ItemStack itemStack = player.getInventory().getItemInMainHand();
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
itemMeta.setLore(new ArrayList<>());
|
||||
@ -53,7 +53,7 @@ public class AttributeRemoveCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(description = "ATTRIBUTE_REMOVE_COMMAND_HELP")
|
||||
public void genericCommand(Player player, @Mapper("attribute") String attribute) {
|
||||
public void genericCommand(@Validator Player player, @Mapper("attribute") String attribute) {
|
||||
ItemStack itemStack = player.getInventory().getItemInMainHand();
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
if (itemMeta == null) {
|
||||
|
@ -41,7 +41,7 @@ public class AttributesCopyCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register
|
||||
public void genericCommand(Player player) {
|
||||
public void genericCommand(@Validator Player player) {
|
||||
Block block = player.getTargetBlockExact(8, FluidCollisionMode.ALWAYS);
|
||||
if (block == null) return;
|
||||
ItemStack mainHand = player.getInventory().getItemInMainHand();
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.attributescopy;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@ -40,6 +41,7 @@ public class AttributesPlaceListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
ItemStack itemStack = event.getItemInHand();
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
if (itemMeta == null) return;
|
||||
|
@ -32,7 +32,7 @@ public class AutoStartCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(description = "AUTOSTART_COMMAND_HELP")
|
||||
public void genericCommand(Player p) {
|
||||
public void genericCommand(@Validator Player p) {
|
||||
SWUtils.giveItemToPlayer(p, AutostartListener.getWandItem(p));
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,6 @@ public class AutoStartGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.MEMBER;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.autostart;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
@ -66,6 +67,7 @@ public class AutostartListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!ItemUtils.isItem(event.getItem(), "autostart")) {
|
||||
return;
|
||||
}
|
||||
@ -83,6 +85,7 @@ public class AutostartListener implements Listener {
|
||||
if (!(event.getPlayer() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
if(!Permission.BUILD.hasPermission((Player) event.getPlayer())) return;
|
||||
if (!ItemUtils.isItem(event.getPlayer().getInventory().getItemInMainHand(), "autostart")) {
|
||||
return;
|
||||
}
|
||||
|
@ -140,13 +140,6 @@ public class BackupCommand extends SWCommand {
|
||||
return SWCommandUtils.createMapper(s -> s, (commandSender, s) -> listBackup((Player) commandSender));
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> backupValidator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "BACKUP_NO_PERMS");
|
||||
};
|
||||
}
|
||||
|
||||
private List<String> listBackup(Player p) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
|
@ -45,7 +45,7 @@ public class DesignEndStoneCommand extends SWCommand implements Listener {
|
||||
private Map<Region, DesignEndStone> designEndStoneMap = new HashMap<>();
|
||||
|
||||
@Register(description = "DESIGN_ENDSTONE_COMMAND_HELP")
|
||||
public void genericCommand(Player player) {
|
||||
public void genericCommand(@Validator Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (!region.hasType(RegionType.BUILD)) {
|
||||
BauSystem.MESSAGE.send("DESIGN_ENDSTONE_REGION_ERROR", player);
|
||||
|
@ -47,6 +47,6 @@ public class DetonatorBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.MEMBER;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -58,12 +58,12 @@ public class DetonatorCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "wand", description = "DETONATOR_HELP_WAND")
|
||||
public void giveWand(Player p) {
|
||||
public void giveWand(@Validator Player p) {
|
||||
SWUtils.giveItemToPlayer(p, getWAND(p));
|
||||
}
|
||||
|
||||
@Register(value = "click", description = "DETONATOR_HELP_CLICK")
|
||||
public void clickDetonator(Player p) {
|
||||
public void clickDetonator(@Validator Player p) {
|
||||
Detonator.activateDetonator(new ItemStorage(p));
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.detonator;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.features.detonator.storage.DetonatorStorage;
|
||||
import de.steamwar.bausystem.features.detonator.storage.ItemStorage;
|
||||
@ -65,6 +66,7 @@ public class DetonatorListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
Player p = event.getPlayer();
|
||||
if (Detonator.isDetonator(p.getInventory().getItemInMainHand())) {
|
||||
event.setCancelled(true);
|
||||
@ -75,6 +77,7 @@ public class DetonatorListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!Detonator.isDetonator(event.getItem())) {
|
||||
return;
|
||||
}
|
||||
@ -89,6 +92,7 @@ public class DetonatorListener implements Listener {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerMove(PlayerMoveEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!Detonator.isDetonator(event.getPlayer().getInventory().getItemInMainHand())) {
|
||||
if (Detonator.hasActiveDetonatorShow(event.getPlayer())) {
|
||||
Detonator.hideDetonator(event.getPlayer());
|
||||
@ -110,6 +114,7 @@ public class DetonatorListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (Detonator.isDetonator(event.getPlayer().getInventory().getItemInMainHand())) {
|
||||
HAS_UPDATED.add(event.getPlayer());
|
||||
}
|
||||
@ -117,6 +122,7 @@ public class DetonatorListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerSwapHandItems(PlayerSwapHandItemsEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (Detonator.isDetonator(event.getMainHandItem()) || Detonator.isDetonator(event.getOffHandItem())) {
|
||||
HAS_UPDATED.add(event.getPlayer());
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class HotbarCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "load", description = "HOTBAR_HELP_LOAD")
|
||||
public void loadHotbar(Player p) {
|
||||
public void loadHotbar(@Validator Player p) {
|
||||
DefaultHotbar.setHotbar(p);
|
||||
BauSystem.MESSAGE.send("HOTBAR_LOADED", p);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.features.hotbar;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -30,6 +31,7 @@ public class HotbarListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (allNull(event.getPlayer().getInventory().getContents()) && allNull(event.getPlayer().getInventory().getArmorContents())) {
|
||||
DefaultHotbar.setHotbar(event.getPlayer());
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.inventoryfiller;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.configplayer.Config;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
@ -38,6 +39,7 @@ public class InventoryFiller implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return;
|
||||
if (!event.getPlayer().isSneaking()) return;
|
||||
Block block = event.getPlayer().getTargetBlockExact(5);
|
||||
@ -59,6 +61,7 @@ public class InventoryFiller implements Listener {
|
||||
*/
|
||||
@EventHandler
|
||||
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return;
|
||||
if (!event.getPlayer().isSneaking()) return;
|
||||
ItemStack itemStack = event.getPlayer().getInventory().getItemInMainHand();
|
||||
|
@ -54,7 +54,7 @@ public class KillcheckerCommand extends SWCommand implements Listener {
|
||||
}
|
||||
|
||||
@Register(value = "enable", description = "KILLCHECKER_HELP_ENABLE")
|
||||
public void genericCommand(Player player, @OptionalValue("-outline") @StaticValue(value = {"-area", "-outline"}, allowISE = true) boolean onlyOutline) {
|
||||
public void genericCommand(@Validator Player player, @OptionalValue("-outline") @StaticValue(value = {"-area", "-outline"}, allowISE = true) boolean onlyOutline) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
KillcheckerVisualizer killcheckerVisualizer = visualizers.computeIfAbsent(region, region1 -> new KillcheckerVisualizer(region1, bossBarService));
|
||||
killcheckerVisualizer.recalc();
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.loader;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.loader.elements.LoaderElement;
|
||||
import de.steamwar.bausystem.features.loader.elements.LoaderInteractionElement;
|
||||
import de.steamwar.bausystem.features.loader.elements.impl.LoaderTNT;
|
||||
@ -70,6 +71,7 @@ public class Loader implements Listener {
|
||||
|
||||
BauSystem.runTaskTimer(BauSystem.getInstance(), () -> {
|
||||
if (stage != Stage.RUNNING) return;
|
||||
if(!Permission.BUILD.hasPermission(p)) return;
|
||||
if (waitTime > 0) {
|
||||
waitTime--;
|
||||
return;
|
||||
|
@ -101,11 +101,4 @@ public class LoaderCommand extends SWCommand {
|
||||
BauSystem.MESSAGE.send("LOADER_NEW_LOAD_TIME", p, delay);
|
||||
loader.setTicksBetweenBlocks(delay);
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> loaderValidator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "LOADER_PERMS");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.loader;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@ -40,6 +41,7 @@ public class LoaderScoreboardElement implements ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if(!Permission.BUILD.hasPermission(p)) return null;
|
||||
Loader loader = Loader.getLoader(p);
|
||||
if (loader == null) return null;
|
||||
if (loader.getStage() == Loader.Stage.RUNNING) {
|
||||
|
@ -32,12 +32,12 @@ public class LoadtimerCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "start", description = "LOADTIMER_HELP_START_1")
|
||||
public void start(Player p) {
|
||||
public void start(@Validator Player p) {
|
||||
start(p, TimerMode.HALF);
|
||||
}
|
||||
|
||||
@Register(value = "start", description = {"LOADTIMER_HELP_START_2", "LOADTIMER_HELP_START_3"})
|
||||
public void start(Player p, TimerMode mode) {
|
||||
public void start(@Validator Player p, TimerMode mode) {
|
||||
Region r = Region.getRegion(p.getLocation());
|
||||
if (r.isGlobal()) return;
|
||||
if (!Loadtimer.hasTimer(r))
|
||||
@ -45,7 +45,7 @@ public class LoadtimerCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "stop", description = "LOADTIMER_HELP_STOP")
|
||||
public void stop(Player p) {
|
||||
public void stop(@Validator Player p) {
|
||||
Region r = Region.getRegion(p.getLocation());
|
||||
if (r.isGlobal()) return;
|
||||
if (Loadtimer.hasTimer(r))
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.observer;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -52,7 +53,7 @@ public class ObserverTracerCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "retrace", description = "OBSERVER_HELP_RETRACE")
|
||||
public void retrace(Player p) {
|
||||
public void retrace(@Validator Player p) {
|
||||
if (ObserverTracerListener.observerTracerMap.containsKey(p)) {
|
||||
BauSystem.MESSAGE.send("OBSERVER_RETRACE_NO_TRACE", p);
|
||||
return;
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.observer;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
@ -55,6 +56,7 @@ public class ObserverTracerListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!enabled.contains(event.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class ColorCommand extends SWCommand {
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!bauServer.getOwner().equals(player.getUniqueId()), "REGION_COLOR_NO_PERMS");
|
||||
return !messageSender.send(!bauServer.getOwner().equals(player.getUniqueId()), "NO_PERMISSION");
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -46,10 +46,6 @@ public class FireCommand extends SWCommand {
|
||||
}
|
||||
}
|
||||
|
||||
private String getNoPermMessage() {
|
||||
return "REGION_FIRE_NO_PERMS";
|
||||
}
|
||||
|
||||
private String getEnableMessage() {
|
||||
return "REGION_FIRE_ENABLED";
|
||||
}
|
||||
@ -69,11 +65,4 @@ public class FireCommand extends SWCommand {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), getNoPermMessage());
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -46,10 +46,6 @@ public class FreezeCommand extends SWCommand {
|
||||
}
|
||||
}
|
||||
|
||||
private String getNoPermMessage() {
|
||||
return "REGION_FREEZE_NO_PERMS";
|
||||
}
|
||||
|
||||
private String getEnableMessage(){
|
||||
return "REGION_FREEZE_ENABLED";
|
||||
}
|
||||
@ -69,11 +65,4 @@ public class FreezeCommand extends SWCommand {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), getNoPermMessage());
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -49,10 +49,6 @@ public class ItemsCommand extends SWCommand {
|
||||
}
|
||||
}
|
||||
|
||||
private String getNoPermMessage() {
|
||||
return "REGION_ITEMS_NO_PERMS";
|
||||
}
|
||||
|
||||
private String getEnableMessage(){
|
||||
return "REGION_ITEMS_ENABLED";
|
||||
}
|
||||
@ -72,11 +68,4 @@ public class ItemsCommand extends SWCommand {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), getNoPermMessage());
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -54,13 +54,6 @@ public class ProtectCommand extends SWCommand {
|
||||
}
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "REGION_PROTECT_NO_PERMS");
|
||||
};
|
||||
}
|
||||
|
||||
private Region regionCheck(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region.getFloorLevel() == 0) {
|
||||
|
@ -71,7 +71,7 @@ public class RegionCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "undo", description = "REGION_REGION_HELP_UNDO")
|
||||
public void undoCommand(@Validator("WORLD_EDIT") Player p) {
|
||||
public void undoCommand(@Validator Player p) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) return;
|
||||
|
||||
@ -83,7 +83,7 @@ public class RegionCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "redo", description = "REGION_REGION_HELP_REDO")
|
||||
public void redoCommand(@Validator("WORLD_EDIT") Player p) {
|
||||
public void redoCommand(@Validator Player p) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
@ -97,7 +97,7 @@ public class RegionCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "restore", description = "REGION_REGION_HELP_RESTORE")
|
||||
public void genericRestoreCommand(@Validator("WORLD_EDIT") Player p) {
|
||||
public void genericRestoreCommand(@Validator Player p) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if(checkGlobalRegion(region, p)) return;
|
||||
|
||||
@ -114,7 +114,7 @@ public class RegionCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "restore", description = "REGION_REGION_HELP_RESTORE_SCHEMATIC")
|
||||
public void schematicRestoreCommand(@Validator("WORLD_EDIT") Player p, SchematicNode node) {
|
||||
public void schematicRestoreCommand(@Validator Player p, SchematicNode node) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) return;
|
||||
|
||||
@ -176,7 +176,7 @@ public class RegionCommand extends SWCommand {
|
||||
|
||||
@Register(value = "changetype", description = "REGION_REGION_HELP_CHANGETYPE")
|
||||
@Register("type")
|
||||
public void changeTypeCommand(@Validator("WORLD") Player p, @Mapper("regionTypeMapper") String s) {
|
||||
public void changeTypeCommand(@Validator Player p, @Mapper("regionTypeMapper") String s) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
@ -210,7 +210,7 @@ public class RegionCommand extends SWCommand {
|
||||
|
||||
@Register(value = "changeskin", description = "REGION_REGION_HELP_CHANGESKIN")
|
||||
@Register("skin")
|
||||
public void changeSkinCommand(@Validator("WORLD") Player p, @Mapper("skinTypeMapper") String s) {
|
||||
public void changeSkinCommand(@Validator Player p, @Mapper("skinTypeMapper") String s) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
@ -266,18 +266,4 @@ public class RegionCommand extends SWCommand {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Validator(value = "WORLD", local = true)
|
||||
public TypeValidator<Player> worldValidator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "REGION_REGION_NO_PERMS");
|
||||
};
|
||||
}
|
||||
|
||||
@Validator(value = "WORLD_EDIT", local = true)
|
||||
public TypeValidator<Player> worldEditValidator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "REGION_REGION_NO_PERMS");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -97,13 +97,6 @@ public class ResetCommand extends SWCommand {
|
||||
}
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "REGION_RESET_NO_PERMS");
|
||||
};
|
||||
}
|
||||
|
||||
private Region regionCheck(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region == GlobalRegion.getInstance()) {
|
||||
|
@ -157,11 +157,4 @@ public class TNTCommand extends SWCommand {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "REGION_TNT_NO_PERMS");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -157,11 +157,6 @@ public class TestblockCommand extends SWCommand {
|
||||
};
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "REGION_TB_NO_PERMS");
|
||||
}
|
||||
|
||||
private Region regionCheck(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (!region.hasType(RegionType.TESTBLOCK)) {
|
||||
|
@ -57,6 +57,6 @@ public class FireBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLD;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,6 @@ public class FreezeBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLD;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,6 @@ public class ProtectBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLDEDIT;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,6 @@ public class ResetBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLDEDIT;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +64,6 @@ public class TestblockBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLDEDIT;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -116,6 +116,6 @@ public class TntBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLD;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class ScriptCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register
|
||||
public void genericCommand(Player player) {
|
||||
public void genericCommand(@Validator Player player) {
|
||||
ScriptGUI.open(player);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.features.script;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.utils.FlatteningWrapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -42,6 +43,8 @@ public class ScriptListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onLeftClick(PlayerInteractEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
|
||||
ItemStack item = event.getItem();
|
||||
if (item == null || FlatteningWrapper.impl.isNoBook(item) || item.getItemMeta() == null) {
|
||||
return;
|
||||
@ -68,6 +71,7 @@ public class ScriptListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
ScriptRunner.updateGlobalScript(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.features.script.event;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.script.ScriptRunner;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -41,6 +42,7 @@ public class CommandListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
String[] split = event.getMessage().split(" ");
|
||||
if (calledCommands.getOrDefault(event.getPlayer(), new HashSet<>()).contains(split[0])) {
|
||||
return;
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.script.event;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.script.ScriptRunner;
|
||||
import de.steamwar.bausystem.features.script.lua.SteamWarGlobalLuaPlugin;
|
||||
import de.steamwar.bausystem.features.script.lua.libs.StorageLib;
|
||||
@ -64,17 +65,20 @@ public class EventListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
ScriptRunner.callEvent(event.getPlayer(), SteamWarGlobalLuaPlugin.EventType.SelfJoin, LuaValue.NIL, event);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
StorageLib.removePlayer(event.getPlayer());
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
ScriptRunner.callEvent(event.getPlayer(), SteamWarGlobalLuaPlugin.EventType.SelfLeave, LuaValue.NIL, event);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onPlayerSwapHandItems(PlayerSwapHandItemsEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (LAST_FS.containsKey(event.getPlayer())) {
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
ScriptRunner.callEvent(event.getPlayer(), SteamWarGlobalLuaPlugin.EventType.DoubleSwap, LuaValue.NIL, event);
|
||||
@ -86,6 +90,7 @@ public class EventListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
LuaTable table = new LuaTable();
|
||||
table.set("x", event.getBlock().getX());
|
||||
table.set("y", event.getBlock().getY());
|
||||
@ -96,6 +101,7 @@ public class EventListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
LuaTable table = new LuaTable();
|
||||
table.set("x", event.getBlock().getX());
|
||||
table.set("y", event.getBlock().getY());
|
||||
@ -108,6 +114,7 @@ public class EventListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (ignore.remove(event.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
@ -144,6 +151,7 @@ public class EventListener implements Listener {
|
||||
Region tntRegion = Region.getRegion(event.getLocation());
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if(!Permission.BUILD.hasPermission(player)) continue;
|
||||
if (tntRegion.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
||||
ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.TNTSpawn, LuaValue.NIL, event);
|
||||
}
|
||||
@ -165,6 +173,7 @@ public class EventListener implements Listener {
|
||||
boolean inBuild = event.blockList().stream().anyMatch(block -> tntRegion.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION));
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if(!Permission.BUILD.hasPermission(player)) continue;
|
||||
if (tntRegion.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
||||
ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.TNTExplode, table, event);
|
||||
if (inBuild) {
|
||||
@ -176,6 +185,7 @@ public class EventListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
ignore.add(event.getPlayer());
|
||||
LuaTable table = new LuaTable();
|
||||
table.set("type", event.getItemDrop().getItemStack().getType().name());
|
||||
@ -185,6 +195,7 @@ public class EventListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if(!Permission.BUILD.hasPermission(player)) continue;
|
||||
LuaTable table = new LuaTable();
|
||||
table.set("type", event.getEntityType().name());
|
||||
ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.EntityDeath, table, event);
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.script.event;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.script.ScriptRunner;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.api.Plain;
|
||||
@ -36,6 +37,7 @@ public class HotkeyListener implements PluginMessageListener, Plain {
|
||||
|
||||
@Override
|
||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||
if(!Permission.BUILD.hasPermission(player)) return;
|
||||
if (!channel.equals("sw:hotkeys")) return;
|
||||
if (message.length < 5) return;
|
||||
int action = message[4] & 0xFF;
|
||||
|
@ -108,8 +108,8 @@ public class ShieldPrintingCommand extends SWCommand implements Listener {
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
if (!Permission.hasPermission(player, Permission.WORLD)) {
|
||||
messageSender.send("SHIELD_PRINTING_DISALLOWED", player);
|
||||
if (!Permission.BUILD.hasPermission(player)) {
|
||||
messageSender.send("NO_PERMISSION", player);
|
||||
return false;
|
||||
}
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
@ -123,6 +123,7 @@ public class ShieldPrintingCommand extends SWCommand implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (event.getClickedBlock() == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -102,11 +102,4 @@ public class SimulatorCommand extends SWCommand {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "SIMULATOR_NO_PERMS");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.simulator;
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
||||
import de.steamwar.bausystem.features.simulator.data.SimulatorElement;
|
||||
@ -148,6 +149,7 @@ public class SimulatorCursor implements Listener {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(!Permission.BUILD.hasPermission(player)) return;
|
||||
Simulator simulator = SimulatorStorage.getSimulator(player);
|
||||
SimulatorWatcher.show(simulator, player);
|
||||
|
||||
|
@ -78,11 +78,4 @@ public class LaufbauCommand extends SWCommand {
|
||||
public void laufbauSettings(@Validator Player player) {
|
||||
new LaufbauSettings(player);
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "LAUFBAU_NO_PERM");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -91,13 +91,6 @@ public class PanzernCommand extends SWCommand {
|
||||
}.runTaskTimer(BauSystem.getInstance(), 1, 1);
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "PANZERN_NO_PERM");
|
||||
};
|
||||
}
|
||||
|
||||
@Mapper(value = "block", local = true)
|
||||
private TypeMapper<Material> blockMapper() {
|
||||
Set<String> strings = new HashSet<>();
|
||||
|
@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.smartplace;
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.configplayer.Config;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@ -90,6 +91,7 @@ public class SmartPlaceListener implements Plain, Listener {
|
||||
|
||||
public SmartPlaceListener() {
|
||||
TinyProtocol.instance.addFilter(useItem, (player, packet) -> {
|
||||
if(!Permission.BUILD.hasPermission(player)) return packet;
|
||||
if (!Config.getInstance().get(player).getPlainValueOrDefault("smartPlace", false)) return packet;
|
||||
Block block = player.getTargetBlockExact(6);
|
||||
boolean shouldSneak = !(block != null && (block.getType().isInteractable() || block.getType() == Material.NOTE_BLOCK) && !CONTAINERS.contains(block.getType()) && !IGNORED.contains(block.getType()));
|
||||
@ -116,6 +118,7 @@ public class SmartPlaceListener implements Plain, Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return;
|
||||
WAS_EXECUTED.add(event.getPlayer());
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
||||
@ -134,6 +137,7 @@ public class SmartPlaceListener implements Plain, Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return;
|
||||
if (!SMART_PLACING.contains(event.getPlayer())) {
|
||||
if (CONTAINERS.contains(event.getBlockAgainst().getType())) {
|
||||
|
@ -55,7 +55,7 @@ public class TechHiderCommand extends SWCommand implements Listener, ScoreboardE
|
||||
public XrayCommand xrayCommand;
|
||||
|
||||
@Register(description = "TECHHIDER_HELP")
|
||||
public void toggleHider(Player player) {
|
||||
public void toggleHider(@Validator Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region.isGlobal()) {
|
||||
BauSystem.MESSAGE.send("TECHHIDER_GLOBAL", player);
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.testblock.blockcounter;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.configplayer.Config;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import lombok.experimental.UtilityClass;
|
||||
@ -49,6 +50,8 @@ public class BlockCounter {
|
||||
}
|
||||
|
||||
public String getMessage(Player player, int count, int tntCount, long tick, long lastTick) {
|
||||
if(!Permission.BUILD.hasPermission(player)) return null;
|
||||
|
||||
double countPerTNT = (double) count / tntCount;
|
||||
double countPerTick = (double) count / Math.max((lastTick - tick), 1);
|
||||
if (isActive(player)) {
|
||||
|
@ -143,16 +143,6 @@ public class TPSSystem implements Plain {
|
||||
}.runTaskTimer(BauSystem.getInstance(), 1, 1);
|
||||
}
|
||||
|
||||
public TypeValidator<Player> player() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
if (!Permission.hasPermission(player, Permission.WORLD)) {
|
||||
messageSender.send("TPSLIMIT_NO_PERMS");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
private class TPSBaseCommand extends SWCommand {
|
||||
|
||||
private TPSBaseCommand() {
|
||||
@ -160,11 +150,6 @@ public class TPSSystem implements Plain {
|
||||
setMessage(BauSystem.MESSAGE);
|
||||
addDefaultHelpMessage("TPSLIMIT_HELP");
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> player() {
|
||||
return TPSSystem.this.player();
|
||||
}
|
||||
}
|
||||
|
||||
@AbstractSWCommand.PartOf(TPSBaseCommand.class)
|
||||
@ -230,11 +215,6 @@ public class TPSSystem implements Plain {
|
||||
super("tick");
|
||||
setMessage(BauSystem.MESSAGE);
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> player() {
|
||||
return TPSSystem.this.player();
|
||||
}
|
||||
}
|
||||
|
||||
@AbstractSWCommand.PartOf(TickBaseCommand.class)
|
||||
@ -403,7 +383,7 @@ public class TPSSystem implements Plain {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLD;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -243,15 +243,4 @@ public class TraceCommand extends SWCommand {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
if (!Permission.hasPermission(player, Permission.WORLD)) {
|
||||
messageSender.send("TRACE_MESSAGE_DISALLOWED", player);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -96,6 +96,6 @@ public class TracerBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLD;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.steamwar.bausystem.features.util;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.features.script.ScriptCommand;
|
||||
import de.steamwar.bausystem.features.script.ScriptRunner;
|
||||
@ -62,7 +63,7 @@ public class BindCommand extends SWCommand implements Listener {
|
||||
}
|
||||
|
||||
@Register(description = "OTHER_BIND_HELP")
|
||||
public void bind(Player player, @Mapper("command") @ErrorMessage("OTHER_BIND_ERROR") String... command) {
|
||||
public void bind(@Validator Player player, @Mapper("command") @ErrorMessage("OTHER_BIND_ERROR") String... command) {
|
||||
bindInternal(player, command);
|
||||
}
|
||||
|
||||
@ -91,6 +92,7 @@ public class BindCommand extends SWCommand implements Listener {
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if (!event.hasItem()) return;
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
ItemStack itemStack = event.getItem();
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
if (meta == null) {
|
||||
|
@ -17,7 +17,7 @@ public class BookReplaceCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register("color")
|
||||
public void color(Player player) {
|
||||
public void color(@Validator Player player) {
|
||||
ItemStack itemStack = player.getInventory().getItemInMainHand();
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
if (itemMeta instanceof BookMeta) {
|
||||
@ -29,7 +29,7 @@ public class BookReplaceCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register("uncolor")
|
||||
public void uncolor(Player player) {
|
||||
public void uncolor(@Validator Player player) {
|
||||
ItemStack itemStack = player.getInventory().getItemInMainHand();
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
if (itemMeta instanceof BookMeta) {
|
||||
|
@ -34,7 +34,7 @@ public class DebugStickCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(description = "DEBUG_STICK_COMMAND_HELP")
|
||||
public void genericCommand(Player p) {
|
||||
public void genericCommand(@Validator Player p) {
|
||||
SWUtils.giveItemToPlayer(p, new ItemStack(Material.DEBUG_STICK));
|
||||
}
|
||||
}
|
||||
|
@ -45,12 +45,12 @@ public class KillAllCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(description = "OTHER_KILLALL_HELP_SELF")
|
||||
public void genericCommand(Player player) {
|
||||
public void genericCommand(@Validator Player player) {
|
||||
genericCommand(player, RegionSelectionType.LOCAL);
|
||||
}
|
||||
|
||||
@Register(description = "OTHER_KILLALL_HELP_ALL")
|
||||
public void genericCommand(Player player, RegionSelectionType regionSelectionType) {
|
||||
public void genericCommand(@Validator Player player, RegionSelectionType regionSelectionType) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
AtomicLong count = new AtomicLong(0);
|
||||
if (regionSelectionType == RegionSelectionType.GLOBAL || GlobalRegion.getInstance() == region) {
|
||||
|
@ -45,13 +45,6 @@ public class SelectCommand extends SWCommand {
|
||||
baurahmenCommand(p, RegionType.TESTBLOCK, regionExtensionType);
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "SELECT_NO_PERMS");
|
||||
};
|
||||
}
|
||||
|
||||
private void setSelection(RegionType regionType, RegionExtensionType regionExtensionType, Region region, Player p) {
|
||||
Point minPoint = region.getMinPoint(regionType, regionExtensionType);
|
||||
Point maxPoint = region.getMaxPoint(regionType, regionExtensionType);
|
||||
|
@ -43,7 +43,7 @@ public class SkullCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(description = "SKULL_HELP")
|
||||
public void giveCommand(Player p, @Mapper("player") @ErrorMessage("SKULL_INVALID") String skull) {
|
||||
public void giveCommand(@Validator Player p, @Mapper("player") @ErrorMessage("SKULL_INVALID") String skull) {
|
||||
ItemStack is = SWItem.getPlayerSkull(skull).getItemStack();
|
||||
SkullMeta sm = (SkullMeta) is.getItemMeta();
|
||||
assert sm != null;
|
||||
|
@ -34,7 +34,7 @@ public class StructureVoidCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(description = "STRUCTURE_VOID_COMMAND_HELP")
|
||||
public void genericCommand(Player p) {
|
||||
public void genericCommand(@Validator Player p) {
|
||||
SWUtils.giveItemToPlayer(p, new ItemStack(Material.STRUCTURE_VOID, 1));
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.util;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -34,9 +35,9 @@ public class TNTClickListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||
if (event.getHand() != EquipmentSlot.HAND) {
|
||||
return;
|
||||
}
|
||||
if (event.getHand() != EquipmentSlot.HAND) return;
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer()));
|
||||
|
||||
Entity entity = event.getRightClicked();
|
||||
if (event.getRightClicked() instanceof TNTPrimed) {
|
||||
TNTPrimed tntPrimed = (TNTPrimed) entity;
|
||||
|
@ -66,13 +66,6 @@ public class TimeCommand extends SWCommand {
|
||||
}, s -> tabCompletions);
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "OTHER_TIME_NO_PERM");
|
||||
};
|
||||
}
|
||||
|
||||
public enum Time {
|
||||
NIGHT(18000),
|
||||
DAY(6000),
|
||||
|
@ -50,6 +50,6 @@ public class DebugstickBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.MEMBER;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,6 @@ public class KillAllBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.MEMBER;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class NavWandBauGuiItem extends BauGuiItem {
|
||||
}
|
||||
|
||||
@Override public Permission permission() {
|
||||
return Permission.WORLDEDIT;
|
||||
return Permission.MEMBER;
|
||||
}
|
||||
|
||||
@Override public ItemStack getItem(Player player) {
|
||||
|
@ -18,7 +18,7 @@ public class SchemBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLDEDIT;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -88,7 +88,7 @@ public class SelectBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLDEDIT;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
|
@ -54,6 +54,6 @@ public class SkullBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.MEMBER;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class WorldEditBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLDEDIT;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren