Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
72f0d08808
Commit
028c115731
@ -30,10 +30,8 @@ import de.steamwar.bausystem.region.flags.Flag;
|
|||||||
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
|
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
|
||||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
import de.steamwar.command.GuardCheckType;
|
|
||||||
import de.steamwar.command.GuardChecker;
|
|
||||||
import de.steamwar.command.GuardResult;
|
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
|
import de.steamwar.command.TypeValidator;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -54,7 +52,7 @@ public class ColorCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(description = "REGION_COLOR_HELP_COLOR_TYPE")
|
@Register(description = "REGION_COLOR_HELP_COLOR_TYPE")
|
||||||
public void genericColorSet(@Guard Player p, ColorMode color, ColorizationType colorizationType) {
|
public void genericColorSet(@Validator Player p, ColorMode color, ColorizationType colorizationType) {
|
||||||
if (colorizationType == ColorizationType.GLOBAL) {
|
if (colorizationType == ColorizationType.GLOBAL) {
|
||||||
Region.setGlobal(Flag.COLOR, color);
|
Region.setGlobal(Flag.COLOR, color);
|
||||||
BauSystem.MESSAGE.send("REGION_COLOR_GLOBAL", p, BauSystem.MESSAGE.parse(color.getChatValue(), p));
|
BauSystem.MESSAGE.send("REGION_COLOR_GLOBAL", p, BauSystem.MESSAGE.parse(color.getChatValue(), p));
|
||||||
@ -80,17 +78,10 @@ public class ColorCommand extends SWCommand {
|
|||||||
genericColorSet(p, color, colorizationType);
|
genericColorSet(p, color, colorizationType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ClassGuard(value = Player.class, local = true)
|
@ClassValidator(value = Player.class, local = true)
|
||||||
public GuardChecker loaderGuard() {
|
public TypeValidator<Player> validator() {
|
||||||
return (commandSender, guardCheckType, strings, s) -> {
|
return (commandSender, player, messageSender) -> {
|
||||||
Player player = (Player) commandSender;
|
return !messageSender.send(!bauServer.getOwner().equals(player.getUniqueId()), "REGION_COLOR_NO_PERMS");
|
||||||
if (bauServer.getOwner().equals(player.getUniqueId())) {
|
|
||||||
return GuardResult.ALLOWED;
|
|
||||||
}
|
|
||||||
if (guardCheckType != GuardCheckType.TAB_COMPLETE) {
|
|
||||||
BauSystem.MESSAGE.send("REGION_COLOR_NO_PERMS", player);
|
|
||||||
}
|
|
||||||
return GuardResult.DENIED;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.region;
|
package de.steamwar.bausystem.features.region;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.linkage.LinkageType;
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
import de.steamwar.bausystem.linkage.Linked;
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
@ -27,10 +26,8 @@ import de.steamwar.bausystem.region.Region;
|
|||||||
import de.steamwar.bausystem.region.RegionUtils;
|
import de.steamwar.bausystem.region.RegionUtils;
|
||||||
import de.steamwar.bausystem.region.flags.Flag;
|
import de.steamwar.bausystem.region.flags.Flag;
|
||||||
import de.steamwar.bausystem.region.flags.flagvalues.FireMode;
|
import de.steamwar.bausystem.region.flags.flagvalues.FireMode;
|
||||||
import de.steamwar.command.GuardCheckType;
|
|
||||||
import de.steamwar.command.GuardChecker;
|
|
||||||
import de.steamwar.command.GuardResult;
|
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
|
import de.steamwar.command.TypeValidator;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@Linked(LinkageType.COMMAND)
|
@Linked(LinkageType.COMMAND)
|
||||||
@ -41,7 +38,7 @@ public class FireCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(description = "REGION_FIRE_HELP")
|
@Register(description = "REGION_FIRE_HELP")
|
||||||
public void toggleCommand(@Guard Player p) {
|
public void toggleCommand(@Validator Player p) {
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if (toggle(region)) {
|
if (toggle(region)) {
|
||||||
RegionUtils.actionBar(region, getEnableMessage());
|
RegionUtils.actionBar(region, getEnableMessage());
|
||||||
@ -74,17 +71,10 @@ public class FireCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ClassGuard(value = Player.class, local = true)
|
@ClassValidator(value = Player.class, local = true)
|
||||||
public GuardChecker guard() {
|
public TypeValidator<Player> validator() {
|
||||||
return (commandSender, guardCheckType, strings, s) -> {
|
return (commandSender, player, messageSender) -> {
|
||||||
Player player = (Player) commandSender;
|
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), getNoPermMessage());
|
||||||
if (!Permission.hasPermission(player, Permission.WORLD)) {
|
|
||||||
if (guardCheckType != GuardCheckType.TAB_COMPLETE) {
|
|
||||||
BauSystem.MESSAGE.send(getNoPermMessage(), player);
|
|
||||||
}
|
|
||||||
return GuardResult.DENIED;
|
|
||||||
}
|
|
||||||
return GuardResult.ALLOWED;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.region;
|
package de.steamwar.bausystem.features.region;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.linkage.LinkageType;
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
import de.steamwar.bausystem.linkage.Linked;
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
@ -27,10 +26,8 @@ import de.steamwar.bausystem.region.Region;
|
|||||||
import de.steamwar.bausystem.region.RegionUtils;
|
import de.steamwar.bausystem.region.RegionUtils;
|
||||||
import de.steamwar.bausystem.region.flags.Flag;
|
import de.steamwar.bausystem.region.flags.Flag;
|
||||||
import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode;
|
import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode;
|
||||||
import de.steamwar.command.GuardCheckType;
|
|
||||||
import de.steamwar.command.GuardChecker;
|
|
||||||
import de.steamwar.command.GuardResult;
|
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
|
import de.steamwar.command.TypeValidator;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@Linked(LinkageType.COMMAND)
|
@Linked(LinkageType.COMMAND)
|
||||||
@ -41,7 +38,7 @@ public class FreezeCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(description = "REGION_FREEZE_HELP")
|
@Register(description = "REGION_FREEZE_HELP")
|
||||||
public void toggleCommand(@Guard Player p) {
|
public void toggleCommand(@Validator Player p) {
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if (toggle(region)) {
|
if (toggle(region)) {
|
||||||
RegionUtils.actionBar(region, getEnableMessage());
|
RegionUtils.actionBar(region, getEnableMessage());
|
||||||
@ -74,17 +71,10 @@ public class FreezeCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ClassGuard(value = Player.class, local = true)
|
@ClassValidator(value = Player.class, local = true)
|
||||||
public GuardChecker guard() {
|
public TypeValidator<Player> validator() {
|
||||||
return (commandSender, guardCheckType, strings, s) -> {
|
return (commandSender, player, messageSender) -> {
|
||||||
Player player = (Player) commandSender;
|
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), getNoPermMessage());
|
||||||
if (!Permission.hasPermission(player, Permission.WORLD)) {
|
|
||||||
if (guardCheckType != GuardCheckType.TAB_COMPLETE) {
|
|
||||||
BauSystem.MESSAGE.send(getNoPermMessage(), player);
|
|
||||||
}
|
|
||||||
return GuardResult.DENIED;
|
|
||||||
}
|
|
||||||
return GuardResult.ALLOWED;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,10 +27,8 @@ import de.steamwar.bausystem.region.Region;
|
|||||||
import de.steamwar.bausystem.region.RegionUtils;
|
import de.steamwar.bausystem.region.RegionUtils;
|
||||||
import de.steamwar.bausystem.region.flags.Flag;
|
import de.steamwar.bausystem.region.flags.Flag;
|
||||||
import de.steamwar.bausystem.region.flags.flagvalues.ProtectMode;
|
import de.steamwar.bausystem.region.flags.flagvalues.ProtectMode;
|
||||||
import de.steamwar.command.GuardCheckType;
|
|
||||||
import de.steamwar.command.GuardChecker;
|
|
||||||
import de.steamwar.command.GuardResult;
|
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
|
import de.steamwar.command.TypeValidator;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@Linked(LinkageType.COMMAND)
|
@Linked(LinkageType.COMMAND)
|
||||||
@ -41,7 +39,7 @@ public class ProtectCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(description = "REGION_PROTECT_HELP")
|
@Register(description = "REGION_PROTECT_HELP")
|
||||||
public void genericProtectCommand(@Guard Player p) {
|
public void genericProtectCommand(@Validator Player p) {
|
||||||
Region region = regionCheck(p);
|
Region region = regionCheck(p);
|
||||||
if (region == null) return;
|
if (region == null) return;
|
||||||
switch (region.getPlain(Flag.PROTECT, ProtectMode.class)) {
|
switch (region.getPlain(Flag.PROTECT, ProtectMode.class)) {
|
||||||
@ -57,17 +55,10 @@ public class ProtectCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ClassGuard(value = Player.class, local = true)
|
@ClassValidator(value = Player.class, local = true)
|
||||||
public GuardChecker guard() {
|
public TypeValidator<Player> validator() {
|
||||||
return (commandSender, guardCheckType, strings, s) -> {
|
return (commandSender, player, messageSender) -> {
|
||||||
Player player = (Player) commandSender;
|
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "REGION_PROTECT_NO_PERMS");
|
||||||
if (!Permission.hasPermission(player, Permission.WORLDEDIT)) {
|
|
||||||
if (guardCheckType != GuardCheckType.TAB_COMPLETE) {
|
|
||||||
BauSystem.MESSAGE.send("REGION_PROTECT_NO_PERMS", player);
|
|
||||||
}
|
|
||||||
return GuardResult.DENIED;
|
|
||||||
}
|
|
||||||
return GuardResult.ALLOWED;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,9 @@ import de.steamwar.bausystem.region.Region;
|
|||||||
import de.steamwar.bausystem.region.RegionUtils;
|
import de.steamwar.bausystem.region.RegionUtils;
|
||||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
import de.steamwar.command.*;
|
import de.steamwar.command.SWCommand;
|
||||||
|
import de.steamwar.command.TypeMapper;
|
||||||
|
import de.steamwar.command.TypeValidator;
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -66,7 +68,7 @@ public class RegionCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "undo", description = "REGION_REGION_HELP_UNDO")
|
@Register(value = "undo", description = "REGION_REGION_HELP_UNDO")
|
||||||
public void undoCommand(@Guard("WORLD_EDIT") Player p) {
|
public void undoCommand(@Validator("WORLD_EDIT") Player p) {
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if (checkGlobalRegion(region, p)) return;
|
if (checkGlobalRegion(region, p)) return;
|
||||||
|
|
||||||
@ -78,7 +80,7 @@ public class RegionCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "redo", description = "REGION_REGION_HELP_REDO")
|
@Register(value = "redo", description = "REGION_REGION_HELP_REDO")
|
||||||
public void redoCommand(@Guard("WORLD_EDIT") Player p) {
|
public void redoCommand(@Validator("WORLD_EDIT") Player p) {
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if (checkGlobalRegion(region, p)) {
|
if (checkGlobalRegion(region, p)) {
|
||||||
return;
|
return;
|
||||||
@ -92,7 +94,7 @@ public class RegionCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "restore", description = "REGION_REGION_HELP_RESTORE")
|
@Register(value = "restore", description = "REGION_REGION_HELP_RESTORE")
|
||||||
public void genericRestoreCommand(@Guard("WORLD_EDIT") Player p) {
|
public void genericRestoreCommand(@Validator("WORLD_EDIT") Player p) {
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if(checkGlobalRegion(region, p)) return;
|
if(checkGlobalRegion(region, p)) return;
|
||||||
|
|
||||||
@ -106,7 +108,7 @@ public class RegionCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "restore", description = "REGION_REGION_HELP_RESTORE_SCHEMATIC")
|
@Register(value = "restore", description = "REGION_REGION_HELP_RESTORE_SCHEMATIC")
|
||||||
public void schematicRestoreCommand(@Guard("WORLD_EDIT") Player p, SchematicNode node) {
|
public void schematicRestoreCommand(@Validator("WORLD_EDIT") Player p, SchematicNode node) {
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if (checkGlobalRegion(region, p)) return;
|
if (checkGlobalRegion(region, p)) return;
|
||||||
|
|
||||||
@ -165,7 +167,7 @@ public class RegionCommand extends SWCommand {
|
|||||||
|
|
||||||
@Register(value = "changetype", description = "REGION_REGION_HELP_CHANGETYPE")
|
@Register(value = "changetype", description = "REGION_REGION_HELP_CHANGETYPE")
|
||||||
@Register("type")
|
@Register("type")
|
||||||
public void changeTypeCommand(@Guard("WORLD") Player p, @Mapper("regionTypeMapper") String s) {
|
public void changeTypeCommand(@Validator("WORLD") Player p, @Mapper("regionTypeMapper") String s) {
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if (checkGlobalRegion(region, p)) {
|
if (checkGlobalRegion(region, p)) {
|
||||||
return;
|
return;
|
||||||
@ -199,7 +201,7 @@ public class RegionCommand extends SWCommand {
|
|||||||
|
|
||||||
@Register(value = "changeskin", description = "REGION_REGION_HELP_CHANGESKIN")
|
@Register(value = "changeskin", description = "REGION_REGION_HELP_CHANGESKIN")
|
||||||
@Register("skin")
|
@Register("skin")
|
||||||
public void changeSkinCommand(@Guard("WORLD") Player p, @Mapper("skinTypeMapper") String s) {
|
public void changeSkinCommand(@Validator("WORLD") Player p, @Mapper("skinTypeMapper") String s) {
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if (checkGlobalRegion(region, p)) {
|
if (checkGlobalRegion(region, p)) {
|
||||||
return;
|
return;
|
||||||
@ -256,31 +258,17 @@ public class RegionCommand extends SWCommand {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Guard(value = "WORLD", local = true)
|
@Validator(value = "WORLD", local = true)
|
||||||
public GuardChecker worldGuard() {
|
public TypeValidator<Player> worldValidator() {
|
||||||
return (commandSender, guardCheckType, strings, s) -> {
|
return (commandSender, player, messageSender) -> {
|
||||||
Player player = (Player) commandSender;
|
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "REGION_REGION_NO_PERMS");
|
||||||
if (!Permission.hasPermission(player, Permission.WORLD)) {
|
|
||||||
if (guardCheckType != GuardCheckType.TAB_COMPLETE) {
|
|
||||||
BauSystem.MESSAGE.send("REGION_REGION_NO_PERMS", player);
|
|
||||||
}
|
|
||||||
return GuardResult.DENIED;
|
|
||||||
}
|
|
||||||
return GuardResult.ALLOWED;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Guard(value = "WORLD_EDIT", local = true)
|
@Validator(value = "WORLD_EDIT", local = true)
|
||||||
public GuardChecker worldEditGuard() {
|
public TypeValidator<Player> worldEditValidator() {
|
||||||
return (commandSender, guardCheckType, strings, s) -> {
|
return (commandSender, player, messageSender) -> {
|
||||||
Player player = (Player) commandSender;
|
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "REGION_REGION_NO_PERMS");
|
||||||
if (!Permission.hasPermission(player, Permission.WORLDEDIT)) {
|
|
||||||
if (guardCheckType != GuardCheckType.TAB_COMPLETE) {
|
|
||||||
BauSystem.MESSAGE.send("REGION_REGION_NO_PERMS", player);
|
|
||||||
}
|
|
||||||
return GuardResult.DENIED;
|
|
||||||
}
|
|
||||||
return GuardResult.ALLOWED;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,10 +27,8 @@ import de.steamwar.bausystem.region.GlobalRegion;
|
|||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.region.RegionUtils;
|
import de.steamwar.bausystem.region.RegionUtils;
|
||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
import de.steamwar.command.GuardCheckType;
|
|
||||||
import de.steamwar.command.GuardChecker;
|
|
||||||
import de.steamwar.command.GuardResult;
|
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
|
import de.steamwar.command.TypeValidator;
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -46,7 +44,7 @@ public class ResetCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(description = "REGION_RESET_HELP_RESET")
|
@Register(description = "REGION_RESET_HELP_RESET")
|
||||||
public void genericResetCommand(@Guard Player p) {
|
public void genericResetCommand(@Validator Player p) {
|
||||||
Region region = regionCheck(p);
|
Region region = regionCheck(p);
|
||||||
if (region == null) return;
|
if (region == null) return;
|
||||||
try {
|
try {
|
||||||
@ -59,7 +57,7 @@ public class ResetCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(description = "REGION_RESET_HELP_SCHEMATIC")
|
@Register(description = "REGION_RESET_HELP_SCHEMATIC")
|
||||||
public void schematicResetCommand(@Guard Player p, SchematicNode node) {
|
public void schematicResetCommand(@Validator Player p, SchematicNode node) {
|
||||||
Region region = regionCheck(p);
|
Region region = regionCheck(p);
|
||||||
if (region == null) return;
|
if (region == null) return;
|
||||||
if (node.isDir()) {
|
if (node.isDir()) {
|
||||||
@ -75,17 +73,10 @@ public class ResetCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ClassGuard(value = Player.class, local = true)
|
@ClassValidator(value = Player.class, local = true)
|
||||||
public GuardChecker worldGuard() {
|
public TypeValidator<Player> validator() {
|
||||||
return (commandSender, guardCheckType, strings, s) -> {
|
return (commandSender, player, messageSender) -> {
|
||||||
Player player = (Player) commandSender;
|
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "REGION_RESET_NO_PERMS");
|
||||||
if (!Permission.hasPermission(player, Permission.WORLD)) {
|
|
||||||
if (guardCheckType != GuardCheckType.TAB_COMPLETE) {
|
|
||||||
BauSystem.MESSAGE.send("REGION_RESET_NO_PERMS", player);
|
|
||||||
}
|
|
||||||
return GuardResult.DENIED;
|
|
||||||
}
|
|
||||||
return GuardResult.ALLOWED;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,9 @@ import de.steamwar.bausystem.region.RegionUtils;
|
|||||||
import de.steamwar.bausystem.region.flags.Flag;
|
import de.steamwar.bausystem.region.flags.Flag;
|
||||||
import de.steamwar.bausystem.region.flags.flagvalues.TNTMode;
|
import de.steamwar.bausystem.region.flags.flagvalues.TNTMode;
|
||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
import de.steamwar.command.*;
|
import de.steamwar.command.SWCommand;
|
||||||
|
import de.steamwar.command.TypeMapper;
|
||||||
|
import de.steamwar.command.TypeValidator;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -52,13 +54,13 @@ public class TNTCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(description = "REGION_TNT_HELP")
|
@Register(description = "REGION_TNT_HELP")
|
||||||
public void toggleCommand(@Guard Player p) {
|
public void toggleCommand(@Validator Player p) {
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
tntToggle(region, null, null);
|
tntToggle(region, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register(description = "REGION_TNT_HELP_MODE")
|
@Register(description = "REGION_TNT_HELP_MODE")
|
||||||
public void setCommand(@Guard Player p, TNTMode tntMode) {
|
public void setCommand(@Validator Player p, TNTMode tntMode) {
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
|
|
||||||
String requestedMessage = null;
|
String requestedMessage = null;
|
||||||
@ -147,17 +149,10 @@ public class TNTCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ClassGuard(value = Player.class, local = true)
|
@ClassValidator(value = Player.class, local = true)
|
||||||
public GuardChecker worldGuard() {
|
public TypeValidator<Player> validator() {
|
||||||
return (commandSender, guardCheckType, strings, s) -> {
|
return (commandSender, player, messageSender) -> {
|
||||||
Player player = (Player) commandSender;
|
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "REGION_TNT_NO_PERMS");
|
||||||
if (!Permission.hasPermission(player, Permission.WORLD)) {
|
|
||||||
if (guardCheckType != GuardCheckType.TAB_COMPLETE) {
|
|
||||||
BauSystem.MESSAGE.send("REGION_TNT_NO_PERMS", player);
|
|
||||||
}
|
|
||||||
return GuardResult.DENIED;
|
|
||||||
}
|
|
||||||
return GuardResult.ALLOWED;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,10 @@ import de.steamwar.bausystem.region.Region;
|
|||||||
import de.steamwar.bausystem.region.RegionUtils;
|
import de.steamwar.bausystem.region.RegionUtils;
|
||||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
import de.steamwar.command.*;
|
import de.steamwar.command.SWCommand;
|
||||||
|
import de.steamwar.command.SWCommandUtils;
|
||||||
|
import de.steamwar.command.TypeMapper;
|
||||||
|
import de.steamwar.command.TypeValidator;
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -54,7 +57,7 @@ public class TestblockCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(description = "REGION_TB_HELP_RESET_EXTENSION")
|
@Register(description = "REGION_TB_HELP_RESET_EXTENSION")
|
||||||
public void genericTestblockCommand(@Guard Player p, RegionExtensionType regionExtensionType) {
|
public void genericTestblockCommand(@Validator Player p, RegionExtensionType regionExtensionType) {
|
||||||
Region region = regionCheck(p);
|
Region region = regionCheck(p);
|
||||||
if (region == null) return;
|
if (region == null) return;
|
||||||
try {
|
try {
|
||||||
@ -77,7 +80,7 @@ public class TestblockCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(description = "REGION_TB_HELP_SCHEMATIC_EXTENSION")
|
@Register(description = "REGION_TB_HELP_SCHEMATIC_EXTENSION")
|
||||||
public void schematicTestblockCommand(@Guard Player p, @Mapper("withPublic") SchematicNode node, RegionExtensionType regionExtensionType) {
|
public void schematicTestblockCommand(@Validator Player p, @Mapper("withPublic") SchematicNode node, RegionExtensionType regionExtensionType) {
|
||||||
Region region = regionCheck(p);
|
Region region = regionCheck(p);
|
||||||
if (region == null) return;
|
if (region == null) return;
|
||||||
|
|
||||||
@ -107,17 +110,10 @@ public class TestblockCommand extends SWCommand {
|
|||||||
return SWCommandUtils.createMapper(s -> showModeParameterTypesMap.getOrDefault(s, null), s -> tabCompletes);
|
return SWCommandUtils.createMapper(s -> showModeParameterTypesMap.getOrDefault(s, null), s -> tabCompletes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ClassGuard(value = Player.class, local = true)
|
@ClassValidator(value = Player.class, local = true)
|
||||||
public GuardChecker worldGuard() {
|
public TypeValidator<Player> validator() {
|
||||||
return (commandSender, guardCheckType, strings, s) -> {
|
return (commandSender, player, messageSender) -> {
|
||||||
Player player = (Player) commandSender;
|
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "REGION_TB_NO_PERMS");
|
||||||
if (!Permission.hasPermission(player, Permission.WORLDEDIT)) {
|
|
||||||
if (guardCheckType != GuardCheckType.TAB_COMPLETE) {
|
|
||||||
BauSystem.MESSAGE.send("REGION_TB_NO_PERMS", player);
|
|
||||||
}
|
|
||||||
return GuardResult.DENIED;
|
|
||||||
}
|
|
||||||
return GuardResult.ALLOWED;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren