Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
15559b500d
Commit
72f0d08808
@ -25,7 +25,10 @@ import de.steamwar.bausystem.linkage.LinkageType;
|
|||||||
import de.steamwar.bausystem.linkage.Linked;
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.region.tags.Tag;
|
import de.steamwar.bausystem.region.tags.Tag;
|
||||||
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.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.inventory.SWListInv;
|
import de.steamwar.inventory.SWListInv;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
@ -55,7 +58,7 @@ public class BackupCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "create", description = "BACKUP_HELP_CREATE")
|
@Register(value = "create", description = "BACKUP_HELP_CREATE")
|
||||||
public void backupCreate(@Guard Player p) {
|
public void backupCreate(@Validator Player p) {
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if (checkGlobalRegion(region, p)) {
|
if (checkGlobalRegion(region, p)) {
|
||||||
return;
|
return;
|
||||||
@ -72,7 +75,7 @@ public class BackupCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "load", description = "BACKUP_HELP_LOAD")
|
@Register(value = "load", description = "BACKUP_HELP_LOAD")
|
||||||
public void backupLoad(@Guard Player p, @Mapper("backupName") String backupName) {
|
public void backupLoad(@Validator Player p, @Mapper("backupName") String backupName) {
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if (checkGlobalRegion(region, p)) {
|
if (checkGlobalRegion(region, p)) {
|
||||||
return;
|
return;
|
||||||
@ -127,17 +130,10 @@ public class BackupCommand extends SWCommand {
|
|||||||
return SWCommandUtils.createMapper(s -> s, (commandSender, s) -> listBackup((Player) commandSender));
|
return SWCommandUtils.createMapper(s -> s, (commandSender, s) -> listBackup((Player) commandSender));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ClassGuard(value = Player.class, local = true)
|
@ClassValidator(value = Player.class, local = true)
|
||||||
public GuardChecker backupGuard() {
|
public TypeValidator<Player> backupValidator() {
|
||||||
return (commandSender, guardCheckType, strings, s) -> {
|
return (commandSender, player, messageSender) -> {
|
||||||
Player player = (Player) commandSender;
|
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "BACKUP_NO_PERMS");
|
||||||
if (Permission.hasPermission(player, Permission.WORLDEDIT)) {
|
|
||||||
return GuardResult.ALLOWED;
|
|
||||||
}
|
|
||||||
if (guardCheckType != GuardCheckType.TAB_COMPLETE) {
|
|
||||||
BauSystem.MESSAGE.send("BACKUP_NO_PERMS", player);
|
|
||||||
}
|
|
||||||
return GuardResult.DENIED;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,23 +19,15 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.bau;
|
package de.steamwar.bausystem.features.bau;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
|
||||||
import de.steamwar.bausystem.config.BauServer;
|
|
||||||
import de.steamwar.bausystem.linkage.LinkageType;
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
import de.steamwar.bausystem.linkage.Linked;
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
import de.steamwar.bausystem.linkage.LinkedInstance;
|
import de.steamwar.bausystem.linkage.LinkedInstance;
|
||||||
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 org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@Linked(LinkageType.COMMAND)
|
@Linked(LinkageType.COMMAND)
|
||||||
public class BauCommand extends SWCommand {
|
public class BauCommand extends SWCommand {
|
||||||
|
|
||||||
@LinkedInstance
|
|
||||||
private BauServer bauServer;
|
|
||||||
|
|
||||||
@LinkedInstance
|
@LinkedInstance
|
||||||
private InfoCommand infoCommand;
|
private InfoCommand infoCommand;
|
||||||
|
|
||||||
@ -47,18 +39,4 @@ public class BauCommand extends SWCommand {
|
|||||||
public void infoCommand(Player p) {
|
public void infoCommand(Player p) {
|
||||||
infoCommand.sendBauInfo(p);
|
infoCommand.sendBauInfo(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ClassGuard(value = Player.class, local = true)
|
|
||||||
public GuardChecker bauGuard() {
|
|
||||||
return (commandSender, guardCheckType, strings, s) -> {
|
|
||||||
Player p = (Player) commandSender;
|
|
||||||
if (!bauServer.getOwner().equals(p.getUniqueId())) {
|
|
||||||
if (guardCheckType != GuardCheckType.TAB_COMPLETE) {
|
|
||||||
BauSystem.MESSAGE.send("BAU_NO_WORLD", p);
|
|
||||||
}
|
|
||||||
return GuardResult.DENIED;
|
|
||||||
}
|
|
||||||
return GuardResult.ALLOWED;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -75,5 +75,4 @@ public class InfoCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
p.sendMessage(tpsMessage.toString());
|
p.sendMessage(tpsMessage.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,10 +23,7 @@ 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;
|
||||||
import de.steamwar.command.GuardCheckType;
|
import de.steamwar.command.*;
|
||||||
import de.steamwar.command.GuardChecker;
|
|
||||||
import de.steamwar.command.GuardResult;
|
|
||||||
import de.steamwar.command.SWCommand;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@Linked(LinkageType.COMMAND)
|
@Linked(LinkageType.COMMAND)
|
||||||
@ -47,7 +44,7 @@ public class LoaderCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "setup", description = "LOADER_HELP_SETUP")
|
@Register(value = "setup", description = "LOADER_HELP_SETUP")
|
||||||
public void setupLoader(@Guard Player p) {
|
public void setupLoader(@Validator Player p) {
|
||||||
if (Loader.getLoader(p) != null) {
|
if (Loader.getLoader(p) != null) {
|
||||||
Loader.getLoader(p).setup();
|
Loader.getLoader(p).setup();
|
||||||
BauSystem.MESSAGE.send("LOADER_BACK_SETUP", p);
|
BauSystem.MESSAGE.send("LOADER_BACK_SETUP", p);
|
||||||
@ -59,7 +56,7 @@ public class LoaderCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "start", description = "LOADER_HELP_START")
|
@Register(value = "start", description = "LOADER_HELP_START")
|
||||||
public void startLoader(@Guard Player p) {
|
public void startLoader(@Validator Player p) {
|
||||||
Loader loader = Loader.getLoader(p);
|
Loader loader = Loader.getLoader(p);
|
||||||
if (loaderNullCheck(loader, p)) {
|
if (loaderNullCheck(loader, p)) {
|
||||||
return;
|
return;
|
||||||
@ -69,7 +66,7 @@ public class LoaderCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "stop", description = "LOADER_HELP_STOP")
|
@Register(value = "stop", description = "LOADER_HELP_STOP")
|
||||||
public void stopLoader(@Guard Player p) {
|
public void stopLoader(@Validator Player p) {
|
||||||
Loader loader = Loader.getLoader(p);
|
Loader loader = Loader.getLoader(p);
|
||||||
if (loaderNullCheck(loader, p)) {
|
if (loaderNullCheck(loader, p)) {
|
||||||
return;
|
return;
|
||||||
@ -79,7 +76,7 @@ public class LoaderCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "pause", description = "LOADER_HELP_PAUSE")
|
@Register(value = "pause", description = "LOADER_HELP_PAUSE")
|
||||||
public void pauseLoader(@Guard Player p) {
|
public void pauseLoader(@Validator Player p) {
|
||||||
Loader loader = Loader.getLoader(p);
|
Loader loader = Loader.getLoader(p);
|
||||||
if (loaderNullCheck(loader, p)) {
|
if (loaderNullCheck(loader, p)) {
|
||||||
return;
|
return;
|
||||||
@ -89,7 +86,7 @@ public class LoaderCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "resume", description = "LOADER_HELP_RESUME")
|
@Register(value = "resume", description = "LOADER_HELP_RESUME")
|
||||||
public void resumeLoader(@Guard Player p) {
|
public void resumeLoader(@Validator Player p) {
|
||||||
Loader loader = Loader.getLoader(p);
|
Loader loader = Loader.getLoader(p);
|
||||||
if (loaderNullCheck(loader, p)) {
|
if (loaderNullCheck(loader, p)) {
|
||||||
return;
|
return;
|
||||||
@ -99,7 +96,7 @@ public class LoaderCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "wait", description = "LOADER_HELP_WAIT")
|
@Register(value = "wait", description = "LOADER_HELP_WAIT")
|
||||||
public void shotDelayLoader(@Guard Player p, int delay) {
|
public void shotDelayLoader(@Validator Player p, int delay) {
|
||||||
if (delay < 1) {
|
if (delay < 1) {
|
||||||
BauSystem.MESSAGE.send("LOADER_SMALL_TIME", p);
|
BauSystem.MESSAGE.send("LOADER_SMALL_TIME", p);
|
||||||
return;
|
return;
|
||||||
@ -113,7 +110,7 @@ public class LoaderCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "speed", description = "LOADER_HELP_SPEED")
|
@Register(value = "speed", description = "LOADER_HELP_SPEED")
|
||||||
public void speedLoader(@Guard Player p, int delay) {
|
public void speedLoader(@Validator Player p, int delay) {
|
||||||
if (delay < 0) {
|
if (delay < 0) {
|
||||||
BauSystem.MESSAGE.send("LOADER_SMALL_TIME", p);
|
BauSystem.MESSAGE.send("LOADER_SMALL_TIME", p);
|
||||||
return;
|
return;
|
||||||
@ -127,7 +124,7 @@ public class LoaderCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "undo", description = "LOADER_HELP_UNDO")
|
@Register(value = "undo", description = "LOADER_HELP_UNDO")
|
||||||
public void undoLast(@Guard Player p) {
|
public void undoLast(@Validator Player p) {
|
||||||
Loader loader = Loader.getLoader(p);
|
Loader loader = Loader.getLoader(p);
|
||||||
if (loaderNullCheck(loader, p)) {
|
if (loaderNullCheck(loader, p)) {
|
||||||
return;
|
return;
|
||||||
@ -137,7 +134,7 @@ public class LoaderCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "clear", description = "LOADER_HELP_CLEAR")
|
@Register(value = "clear", description = "LOADER_HELP_CLEAR")
|
||||||
public void clearLoader(@Guard Player p) {
|
public void clearLoader(@Validator Player p) {
|
||||||
Loader loader = Loader.getLoader(p);
|
Loader loader = Loader.getLoader(p);
|
||||||
if (loaderNullCheck(loader, p)) {
|
if (loaderNullCheck(loader, p)) {
|
||||||
return;
|
return;
|
||||||
@ -146,7 +143,7 @@ public class LoaderCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "single", description = "LOADER_HELP_SINGLE")
|
@Register(value = "single", description = "LOADER_HELP_SINGLE")
|
||||||
public void singleLoader(@Guard Player p) {
|
public void singleLoader(@Validator Player p) {
|
||||||
Loader loader = Loader.getLoader(p);
|
Loader loader = Loader.getLoader(p);
|
||||||
if (loaderNullCheck(loader, p)) {
|
if (loaderNullCheck(loader, p)) {
|
||||||
return;
|
return;
|
||||||
@ -155,17 +152,10 @@ public class LoaderCommand extends SWCommand {
|
|||||||
BauSystem.MESSAGE.send("LOADER_SINGLE", p);
|
BauSystem.MESSAGE.send("LOADER_SINGLE", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ClassGuard(value = Player.class, local = true)
|
@ClassValidator(value = Player.class, local = true)
|
||||||
public GuardChecker loaderGuard() {
|
public TypeValidator<Player> loaderValidator() {
|
||||||
return (commandSender, guardCheckType, strings, s) -> {
|
return (commandSender, player, messageSender) -> {
|
||||||
Player player = (Player) commandSender;
|
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "LOADER_PERMS");
|
||||||
if (!Permission.hasPermission(player, Permission.WORLD)) {
|
|
||||||
if (guardCheckType != GuardCheckType.TAB_COMPLETE) {
|
|
||||||
BauSystem.MESSAGE.send("LOADER_PERMS", player);
|
|
||||||
}
|
|
||||||
return GuardResult.DENIED;
|
|
||||||
}
|
|
||||||
return GuardResult.ALLOWED;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren