Update SelectCommand
Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
40c1e13435
Commit
e73f1875af
@ -1054,6 +1054,14 @@ PANZERN_PROGRESS = §e{0} §7Blöcke übrig, §e{1} §7Blöcke pro Sekunde, §e{
|
||||
PANZERN_DONE = §aZuende gepanzert
|
||||
|
||||
# UTILS
|
||||
SELECT_HELP = §8/§eselect §8[§7RegionsTyp§8] §8- §7Wähle einen RegionsTyp aus
|
||||
SELECT_EXTENSION_HELP = §8/§eselect §8[§7RegionsTyp§8] §8[§7Extension§8] §8- §7Wähle einen RegionsTyp aus mit oder ohne Extension
|
||||
SELECT_NO_PERMS = §cDu darfst hier nicht den Select Befehl verwenden
|
||||
SELECT_GLOBAL_REGION = §cDie globale Region kannst du nicht auswählen
|
||||
SELECT_NO_TYPE = §cDiese Region hat keinen {0}
|
||||
SELECT_NO_EXTENSION = §cDiese Region hat keine Ausfahrmaße
|
||||
SELECT_MESSAGE = §7WorldEdit auswahl auf {0}, {1}, {2} und {3}, {4}, {5} gesetzt
|
||||
|
||||
SKULL_HELP = §8/§eskull §8[§eSpieler§8] §8-§7 Gibt einen SpielerKopf
|
||||
SKULL_ITEM = §e{0}§8s Kopf
|
||||
|
||||
|
@ -8,6 +8,9 @@ import de.steamwar.bausystem.region.Point;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
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.core.VersionedRunnable;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -19,65 +22,39 @@ public class SelectCommand extends SWCommand {
|
||||
super("select");
|
||||
}
|
||||
|
||||
@Register(help = true)
|
||||
public void genericHelp(Player p, String... args) {
|
||||
p.sendMessage("§8/§eselect §8[§7RegionsTyp§8] §8- §7Wähle einen RegionsTyp aus");
|
||||
p.sendMessage("§8/§eselect §8[§7RegionsTyp§8] §8[§7Extension§8] §8- §7Wähle einen RegionsTyp aus mit oder ohne Extension");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void baurahmenCommand(Player p, RegionType regionType) {
|
||||
if (!permissionCheck(p)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Register(description = {"SELECT_HELP", "SELECT_EXTENSION_HELP"})
|
||||
public void baurahmenCommand(@Guard Player p, RegionType regionType, @OptionalValue("NORMAL") RegionExtensionType regionExtensionType) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
|
||||
if (region.isGlobal()) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDie globale Region kannst du nicht auswählen");
|
||||
BauSystem.MESSAGE.send("SELECT_GLOBAL_REGION", p);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!region.hasType(regionType)) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDiese Region hat keinen " + BauSystem.MESSAGE.parse(regionType.getChatValue(), p));
|
||||
return;
|
||||
}
|
||||
|
||||
setSelection(regionType, RegionExtensionType.NORMAL, region, p);
|
||||
}
|
||||
|
||||
@Register
|
||||
public void baurahmenCommand(Player p, RegionType regionType, RegionExtensionType regionExtensionType) {
|
||||
if (!permissionCheck(p)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
|
||||
if (region.isGlobal()) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDie globale Region kannst du nicht auswählen");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!region.hasType(regionType)) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDiese Region hat keinen " + BauSystem.MESSAGE.parse(regionType.getChatValue(), p));
|
||||
BauSystem.MESSAGE.send("SELECT_NO_TYPE", p, BauSystem.MESSAGE.parse(regionType.getChatValue(), p));
|
||||
return;
|
||||
}
|
||||
if (regionExtensionType == RegionExtensionType.EXTENSION && !region.hasExtensionType(regionType)) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDiese Region hat keine Ausfahrmaße");
|
||||
BauSystem.MESSAGE.send("SELECT_NO_EXTENSION", p);
|
||||
return;
|
||||
}
|
||||
|
||||
setSelection(regionType, regionExtensionType, region, p);
|
||||
}
|
||||
|
||||
|
||||
private boolean permissionCheck(Player player) {
|
||||
@ClassGuard(value = Player.class, local = true)
|
||||
public GuardChecker guardChecker() {
|
||||
return (commandSender, guardCheckType, strings, s) -> {
|
||||
Player player = (Player) commandSender;
|
||||
if (Permission.hasPermission(player, Permission.WORLDEDIT)) {
|
||||
return true;
|
||||
return GuardResult.ALLOWED;
|
||||
}
|
||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Select Befehl verwenden");
|
||||
return false;
|
||||
if (guardCheckType != GuardCheckType.TAB_COMPLETE) {
|
||||
BauSystem.MESSAGE.send("SELECT_NO_PERMS", player);
|
||||
}
|
||||
return GuardResult.DENIED;
|
||||
};
|
||||
}
|
||||
|
||||
private void setSelection(RegionType regionType, RegionExtensionType regionExtensionType, Region region, Player p) {
|
||||
@ -85,7 +62,6 @@ public class SelectCommand extends SWCommand {
|
||||
Point maxPoint = region.getMaxPoint(regionType, regionExtensionType);
|
||||
|
||||
VersionedRunnable.call(new VersionedRunnable(() -> SelectCommand_15.setSelection(p, minPoint, maxPoint), 15));
|
||||
p.sendMessage(BauSystem.PREFIX + "WorldEdit auswahl auf " + minPoint.getX() + ", " + minPoint.getY() + ", " + minPoint.getZ() + " und " + maxPoint.getX() + ", " + maxPoint.getY() + ", " + maxPoint.getZ() + " gesetzt");
|
||||
BauSystem.MESSAGE.send("SELECT_MESSAGE", p, minPoint.getX(), minPoint.getY(), minPoint.getZ(), maxPoint.getX(), maxPoint.getY(), maxPoint.getZ());
|
||||
}
|
||||
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren