SteamWar/BauSystem2.0
Archiviert
12
0

Update region features
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-08-18 20:01:09 +02:00
Ursprung 72f0d08808
Commit 028c115731
8 geänderte Dateien mit 67 neuen und 135 gelöschten Zeilen

Datei anzeigen

@ -30,10 +30,8 @@ import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
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.TypeValidator;
import org.bukkit.entity.Player;
import java.io.IOException;
@ -54,7 +52,7 @@ public class ColorCommand extends SWCommand {
}
@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) {
Region.setGlobal(Flag.COLOR, color);
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);
}
@ClassGuard(value = Player.class, local = true)
public GuardChecker loaderGuard() {
return (commandSender, guardCheckType, strings, s) -> {
Player player = (Player) commandSender;
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;
@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");
};
}

Datei anzeigen

@ -19,7 +19,6 @@
package de.steamwar.bausystem.features.region;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.linkage.LinkageType;
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.flags.Flag;
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.TypeValidator;
import org.bukkit.entity.Player;
@Linked(LinkageType.COMMAND)
@ -41,7 +38,7 @@ public class FireCommand extends SWCommand {
}
@Register(description = "REGION_FIRE_HELP")
public void toggleCommand(@Guard Player p) {
public void toggleCommand(@Validator Player p) {
Region region = Region.getRegion(p.getLocation());
if (toggle(region)) {
RegionUtils.actionBar(region, getEnableMessage());
@ -74,17 +71,10 @@ public class FireCommand extends SWCommand {
}
}
@ClassGuard(value = Player.class, local = true)
public GuardChecker guard() {
return (commandSender, guardCheckType, strings, s) -> {
Player player = (Player) commandSender;
if (!Permission.hasPermission(player, Permission.WORLD)) {
if (guardCheckType != GuardCheckType.TAB_COMPLETE) {
BauSystem.MESSAGE.send(getNoPermMessage(), player);
}
return GuardResult.DENIED;
}
return GuardResult.ALLOWED;
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> validator() {
return (commandSender, player, messageSender) -> {
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), getNoPermMessage());
};
}
}

Datei anzeigen

@ -19,7 +19,6 @@
package de.steamwar.bausystem.features.region;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.linkage.LinkageType;
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.flags.Flag;
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.TypeValidator;
import org.bukkit.entity.Player;
@Linked(LinkageType.COMMAND)
@ -41,7 +38,7 @@ public class FreezeCommand extends SWCommand {
}
@Register(description = "REGION_FREEZE_HELP")
public void toggleCommand(@Guard Player p) {
public void toggleCommand(@Validator Player p) {
Region region = Region.getRegion(p.getLocation());
if (toggle(region)) {
RegionUtils.actionBar(region, getEnableMessage());
@ -74,17 +71,10 @@ public class FreezeCommand extends SWCommand {
}
}
@ClassGuard(value = Player.class, local = true)
public GuardChecker guard() {
return (commandSender, guardCheckType, strings, s) -> {
Player player = (Player) commandSender;
if (!Permission.hasPermission(player, Permission.WORLD)) {
if (guardCheckType != GuardCheckType.TAB_COMPLETE) {
BauSystem.MESSAGE.send(getNoPermMessage(), player);
}
return GuardResult.DENIED;
}
return GuardResult.ALLOWED;
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> validator() {
return (commandSender, player, messageSender) -> {
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), getNoPermMessage());
};
}
}

Datei anzeigen

@ -27,10 +27,8 @@ import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.flags.Flag;
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.TypeValidator;
import org.bukkit.entity.Player;
@Linked(LinkageType.COMMAND)
@ -41,7 +39,7 @@ public class ProtectCommand extends SWCommand {
}
@Register(description = "REGION_PROTECT_HELP")
public void genericProtectCommand(@Guard Player p) {
public void genericProtectCommand(@Validator Player p) {
Region region = regionCheck(p);
if (region == null) return;
switch (region.getPlain(Flag.PROTECT, ProtectMode.class)) {
@ -57,17 +55,10 @@ public class ProtectCommand extends SWCommand {
}
}
@ClassGuard(value = Player.class, local = true)
public GuardChecker guard() {
return (commandSender, guardCheckType, strings, s) -> {
Player player = (Player) commandSender;
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;
@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");
};
}

Datei anzeigen

@ -30,7 +30,9 @@ import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
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 net.md_5.bungee.api.chat.ClickEvent;
import org.bukkit.Bukkit;
@ -66,7 +68,7 @@ public class RegionCommand extends SWCommand {
}
@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());
if (checkGlobalRegion(region, p)) return;
@ -78,7 +80,7 @@ public class RegionCommand extends SWCommand {
}
@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());
if (checkGlobalRegion(region, p)) {
return;
@ -92,7 +94,7 @@ public class RegionCommand extends SWCommand {
}
@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());
if(checkGlobalRegion(region, p)) return;
@ -106,7 +108,7 @@ public class RegionCommand extends SWCommand {
}
@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());
if (checkGlobalRegion(region, p)) return;
@ -165,7 +167,7 @@ public class RegionCommand extends SWCommand {
@Register(value = "changetype", description = "REGION_REGION_HELP_CHANGETYPE")
@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());
if (checkGlobalRegion(region, p)) {
return;
@ -199,7 +201,7 @@ public class RegionCommand extends SWCommand {
@Register(value = "changeskin", description = "REGION_REGION_HELP_CHANGESKIN")
@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());
if (checkGlobalRegion(region, p)) {
return;
@ -256,31 +258,17 @@ public class RegionCommand extends SWCommand {
};
}
@Guard(value = "WORLD", local = true)
public GuardChecker worldGuard() {
return (commandSender, guardCheckType, strings, s) -> {
Player player = (Player) commandSender;
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;
@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");
};
}
@Guard(value = "WORLD_EDIT", local = true)
public GuardChecker worldEditGuard() {
return (commandSender, guardCheckType, strings, s) -> {
Player player = (Player) commandSender;
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;
@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");
};
}
}

Datei anzeigen

@ -27,10 +27,8 @@ import de.steamwar.bausystem.region.GlobalRegion;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils;
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.TypeValidator;
import de.steamwar.sql.SchematicNode;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@ -46,7 +44,7 @@ public class ResetCommand extends SWCommand {
}
@Register(description = "REGION_RESET_HELP_RESET")
public void genericResetCommand(@Guard Player p) {
public void genericResetCommand(@Validator Player p) {
Region region = regionCheck(p);
if (region == null) return;
try {
@ -59,7 +57,7 @@ public class ResetCommand extends SWCommand {
}
@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);
if (region == null) return;
if (node.isDir()) {
@ -75,17 +73,10 @@ public class ResetCommand extends SWCommand {
}
}
@ClassGuard(value = Player.class, local = true)
public GuardChecker worldGuard() {
return (commandSender, guardCheckType, strings, s) -> {
Player player = (Player) commandSender;
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;
@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");
};
}

Datei anzeigen

@ -28,7 +28,9 @@ import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.TNTMode;
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.entity.Player;
@ -52,13 +54,13 @@ public class TNTCommand extends SWCommand {
}
@Register(description = "REGION_TNT_HELP")
public void toggleCommand(@Guard Player p) {
public void toggleCommand(@Validator Player p) {
Region region = Region.getRegion(p.getLocation());
tntToggle(region, null, null);
}
@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());
String requestedMessage = null;
@ -147,17 +149,10 @@ public class TNTCommand extends SWCommand {
}
}
@ClassGuard(value = Player.class, local = true)
public GuardChecker worldGuard() {
return (commandSender, guardCheckType, strings, s) -> {
Player player = (Player) commandSender;
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;
@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");
};
}
}

Datei anzeigen

@ -27,7 +27,10 @@ import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
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.SteamwarUser;
import org.bukkit.Bukkit;
@ -54,7 +57,7 @@ public class TestblockCommand extends SWCommand {
}
@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);
if (region == null) return;
try {
@ -77,7 +80,7 @@ public class TestblockCommand extends SWCommand {
}
@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);
if (region == null) return;
@ -107,17 +110,10 @@ public class TestblockCommand extends SWCommand {
return SWCommandUtils.createMapper(s -> showModeParameterTypesMap.getOrDefault(s, null), s -> tabCompletes);
}
@ClassGuard(value = Player.class, local = true)
public GuardChecker worldGuard() {
return (commandSender, guardCheckType, strings, s) -> {
Player player = (Player) commandSender;
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;
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> validator() {
return (commandSender, player, messageSender) -> {
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "REGION_TB_NO_PERMS");
};
}