Merge pull request 'RegionFix' (#240) from RegionFix into master
Reviewed-on: #240 Reviewed-by: Zeanon <thezeanon@gmail.com>
Dieser Commit ist enthalten in:
Commit
20863abd99
@ -18,6 +18,7 @@
|
|||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<defaultGoal>clean verify -U</defaultGoal>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
This file is a part of the SteamWar software.
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
package de.steamwar.bausystem.world.regions;
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.world;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
@ -18,6 +18,7 @@
|
|||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<defaultGoal>clean verify -U</defaultGoal>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
This file is a part of the SteamWar software.
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
package de.steamwar.bausystem.world.regions;
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.world;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
@ -36,6 +36,8 @@ import java.io.File;
|
|||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.world.Color;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
|
||||||
@ -65,9 +67,9 @@ class Region_15 {
|
|||||||
BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||||
if (rotate) {
|
if (rotate) {
|
||||||
ch.setTransform(new AffineTransform().rotateY(180));
|
ch.setTransform(new AffineTransform().rotateY(180));
|
||||||
v = v.add(dimensions.getX() / 2 + dimensions.getX() % 2, 0, dimensions.getZ() / 2 + dimensions.getZ() % 2).subtract(offset.multiply(-1, 1, -1)).subtract(1, 0, 1);
|
v = v.add(dimensions.getX() / 2, 0, dimensions.getZ() / 2).subtract(offset.multiply(-1, 1, -1)).subtract(1, 0, 1);
|
||||||
} else {
|
} else {
|
||||||
v = v.subtract(dimensions.getX() / 2 - dimensions.getX() % 2, 0, dimensions.getZ() / 2 - dimensions.getZ() % 2).subtract(offset);
|
v = v.subtract(dimensions.getX() / 2, 0, dimensions.getZ() / 2).subtract(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
Operations.completeBlindly(ch.createPaste(e).to(v).ignoreAirBlocks(ignoreAir).build());
|
Operations.completeBlindly(ch.createPaste(e).to(v).ignoreAirBlocks(ignoreAir).build());
|
@ -18,6 +18,7 @@
|
|||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<defaultGoal>clean verify -U</defaultGoal>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<defaultGoal>clean verify -U</defaultGoal>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
@ -79,5 +80,11 @@
|
|||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${main.basedir}/lib/WorldEdit-1.15.jar</systemPath>
|
<systemPath>${main.basedir}/lib/WorldEdit-1.15.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.10</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -21,6 +21,7 @@ package de.steamwar.bausystem;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.commands.*;
|
import de.steamwar.bausystem.commands.*;
|
||||||
import de.steamwar.bausystem.world.*;
|
import de.steamwar.bausystem.world.*;
|
||||||
|
import de.steamwar.bausystem.world.regions.Region;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.core.VersionedRunnable;
|
import de.steamwar.core.VersionedRunnable;
|
||||||
import de.steamwar.scoreboard.SWScoreboard;
|
import de.steamwar.scoreboard.SWScoreboard;
|
||||||
@ -93,6 +94,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
|||||||
new CommandGUI();
|
new CommandGUI();
|
||||||
new CommandWorldSpawn();
|
new CommandWorldSpawn();
|
||||||
new CommandRegion();
|
new CommandRegion();
|
||||||
|
new CommandSelect();
|
||||||
|
|
||||||
VersionedRunnable.call(new VersionedRunnable(() -> {
|
VersionedRunnable.call(new VersionedRunnable(() -> {
|
||||||
if (Region.buildAreaEnabled()) {
|
if (Region.buildAreaEnabled()) {
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
package de.steamwar.bausystem;
|
package de.steamwar.bausystem;
|
||||||
|
|
||||||
public enum Permission {
|
public enum Permission {
|
||||||
world,
|
WORLD,
|
||||||
worldedit,
|
WORLDEDIT,
|
||||||
member
|
MEMBER
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public class CommandClear extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if (Welt.noPermission(player, Permission.world)) {
|
if (Welt.noPermission(player, Permission.WORLD)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "$cDu darfst hier keine fremden Inventare leeren.");
|
player.sendMessage(BauSystem.PREFIX + "$cDu darfst hier keine fremden Inventare leeren.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,8 @@ package de.steamwar.bausystem.commands;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.world.Color;
|
import de.steamwar.bausystem.world.Color;
|
||||||
import de.steamwar.bausystem.world.Region;
|
import de.steamwar.bausystem.world.regions.GlobalRegion;
|
||||||
|
import de.steamwar.bausystem.world.regions.Region;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ public class CommandColor extends SWCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if (Region.GlobalRegion.isGlobalRegion(region)) {
|
if (GlobalRegion.isGlobalRegion(region)) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner Region");
|
p.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner Region");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
package de.steamwar.bausystem.commands;
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
|
||||||
import de.steamwar.bausystem.world.Welt;
|
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.core.VersionedRunnable;
|
import de.steamwar.core.VersionedRunnable;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -105,7 +105,7 @@ public class CommandDetonator extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if (Welt.noPermission(player, Permission.world)) {
|
if (Welt.noPermission(player, Permission.WORLD)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Detonator nutzen");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Detonator nutzen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.commands;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.world.Region;
|
import de.steamwar.bausystem.world.regions.Region;
|
||||||
import de.steamwar.bausystem.world.Welt;
|
import de.steamwar.bausystem.world.Welt;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -72,7 +72,7 @@ public class CommandFire extends SWCommand implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if (Welt.noPermission(player, Permission.world)) {
|
if (Welt.noPermission(player, Permission.WORLD)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + getNoPermMessage());
|
player.sendMessage(BauSystem.PREFIX + getNoPermMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.commands;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.world.Region;
|
import de.steamwar.bausystem.world.regions.Region;
|
||||||
import de.steamwar.bausystem.world.Welt;
|
import de.steamwar.bausystem.world.Welt;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
@ -77,7 +77,7 @@ public class CommandFreeze extends SWCommand implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if (Welt.noPermission(player, Permission.world)) {
|
if (Welt.noPermission(player, Permission.WORLD)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + getNoPermMessage());
|
player.sendMessage(BauSystem.PREFIX + getNoPermMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,8 @@ import de.steamwar.bausystem.SWUtils;
|
|||||||
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
|
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
|
||||||
import de.steamwar.bausystem.tracer.show.TraceShowManager;
|
import de.steamwar.bausystem.tracer.show.TraceShowManager;
|
||||||
import de.steamwar.bausystem.world.*;
|
import de.steamwar.bausystem.world.*;
|
||||||
|
import de.steamwar.bausystem.world.regions.GlobalRegion;
|
||||||
|
import de.steamwar.bausystem.world.regions.Region;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.inventory.SWAnvilInv;
|
import de.steamwar.inventory.SWAnvilInv;
|
||||||
@ -95,17 +97,17 @@ public class CommandGUI extends SWCommand implements Listener {
|
|||||||
player.performCommand("gui item");
|
player.performCommand("gui item");
|
||||||
});
|
});
|
||||||
|
|
||||||
ItemStack dtWand = wand(player, Detonator.WAND, "§8/§7dt wand", Permission.world, "§cDu hast keine Worldrechte");
|
ItemStack dtWand = wand(player, Detonator.WAND, "§8/§7dt wand", Permission.WORLD, "§cDu hast keine Worldrechte");
|
||||||
inv.setItem(39, dtWand, clickType -> {
|
inv.setItem(39, dtWand, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
player.performCommand("dt wand");
|
player.performCommand("dt wand");
|
||||||
});
|
});
|
||||||
|
|
||||||
ItemStack simWand = wand(player, TNTSimulator.WAND, "§8/§7sim wand", Permission.world, "§cDu hast keine Worldrechte");
|
ItemStack simWand = wand(player, TNTSimulator.WAND, "§8/§7sim wand", Permission.WORLD, "§cDu hast keine Worldrechte");
|
||||||
inv.setItem(38, simWand, clickType -> {
|
inv.setItem(38, simWand, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
player.performCommand("sim wand");
|
player.performCommand("sim wand");
|
||||||
@ -117,21 +119,21 @@ public class CommandGUI extends SWCommand implements Listener {
|
|||||||
player.performCommand("redstonetester");
|
player.performCommand("redstonetester");
|
||||||
});
|
});
|
||||||
|
|
||||||
inv.setItem(40, getMaterial("WOODEN_AXE", "WOOD_AXE"), "§eWorldedit Axt", getNoPermsLore(Arrays.asList("§8//§7wand"), player, "§cDu hast keine Worldeditrechte", Permission.worldedit), false, clickType -> {
|
inv.setItem(40, getMaterial("WOODEN_AXE", "WOOD_AXE"), "§eWorldedit Axt", getNoPermsLore(Arrays.asList("§8//§7wand"), player, "§cDu hast keine Worldeditrechte", Permission.WORLDEDIT), false, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
player.performCommand("/wand");
|
player.performCommand("/wand");
|
||||||
});
|
});
|
||||||
inv.setItem(41, getMaterial("DEBUG_STICK", "STICK"), "§eDebugstick", getNoPermsLore(Arrays.asList("§8/§7debugstick"), player, "§cDu hast keine Worldrechte", Permission.world), Core.getVersion() < 13, clickType -> {
|
inv.setItem(41, getMaterial("DEBUG_STICK", "STICK"), "§eDebugstick", getNoPermsLore(Arrays.asList("§8/§7debugstick"), player, "§cDu hast keine Worldrechte", Permission.WORLD), Core.getVersion() < 13, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
player.performCommand("debugstick");
|
player.performCommand("debugstick");
|
||||||
});
|
});
|
||||||
|
|
||||||
inv.setItem(20, Material.COMPASS, "§7TPS Limitieren", getNoPermsLore(Arrays.asList("§7Aktuell: §e" + CommandTPSLimiter.getCurrentTPSLimit(), "§8/§7tpslimit §8[§e0,5 - " + (TPSUtils.isWarpAllowed() ? 40 : 20) + "§8]"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(20, Material.COMPASS, "§7TPS Limitieren", getNoPermsLore(Arrays.asList("§7Aktuell: §e" + CommandTPSLimiter.getCurrentTPSLimit(), "§8/§7tpslimit §8[§e0,5 - " + (TPSUtils.isWarpAllowed() ? 40 : 20) + "§8]"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
SWAnvilInv anvilInv = new SWAnvilInv(player, "TPS Limitieren");
|
SWAnvilInv anvilInv = new SWAnvilInv(player, "TPS Limitieren");
|
||||||
anvilInv.setItem(Material.COMPASS);
|
anvilInv.setItem(Material.COMPASS);
|
||||||
@ -166,16 +168,16 @@ public class CommandGUI extends SWCommand implements Listener {
|
|||||||
scriptBooksGUI(player);
|
scriptBooksGUI(player);
|
||||||
});
|
});
|
||||||
|
|
||||||
inv.setItem(21, Material.OBSERVER, "§7Tracer", getNoPermsLore(Arrays.asList("§7Status: §e" + RecordStateMachine.getRecordStatus().getName()), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(21, Material.OBSERVER, "§7Tracer", getNoPermsLore(Arrays.asList("§7Status: §e" + RecordStateMachine.getRecordStatus().getName()), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
OPEN_TRACER_INVS.add(player);
|
OPEN_TRACER_INVS.add(player);
|
||||||
traceGUI(player);
|
traceGUI(player);
|
||||||
});
|
});
|
||||||
|
|
||||||
inv.setItem(22, Material.DISPENSER, "§7Auto-Loader", getNoPermsLore(Arrays.asList("§7Status: " + (AutoLoader.hasLoader(player) ? "§aan" : "§caus")), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(22, Material.DISPENSER, "§7Auto-Loader", getNoPermsLore(Arrays.asList("§7Status: " + (AutoLoader.hasLoader(player) ? "§aan" : "§caus")), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
autoLoaderGUI(player);
|
autoLoaderGUI(player);
|
||||||
@ -188,7 +190,7 @@ public class CommandGUI extends SWCommand implements Listener {
|
|||||||
anvilInv.open();
|
anvilInv.open();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Region.GlobalRegion.isGlobalRegion(region)) {
|
if (GlobalRegion.isGlobalRegion(region)) {
|
||||||
inv.setItem(9, Material.BARRIER, "§eKeine Region", clickType -> {
|
inv.setItem(9, Material.BARRIER, "§eKeine Region", clickType -> {
|
||||||
});
|
});
|
||||||
inv.setItem(18, Material.BARRIER, "§eKeine Region", clickType -> {
|
inv.setItem(18, Material.BARRIER, "§eKeine Region", clickType -> {
|
||||||
@ -196,15 +198,15 @@ public class CommandGUI extends SWCommand implements Listener {
|
|||||||
inv.setItem(27, Material.BARRIER, "§eKeine Region", clickType -> {
|
inv.setItem(27, Material.BARRIER, "§eKeine Region", clickType -> {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
inv.setItem(27, getMaterial("HEAVY_WEIGHTED_PRESSURE_PLATE", "IRON_PLATE"), "§eRegion Reseten", getNoPermsLore(Arrays.asList("§8/§7reset"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(27, getMaterial("HEAVY_WEIGHTED_PRESSURE_PLATE", "IRON_PLATE"), "§eRegion Reseten", getNoPermsLore(Arrays.asList("§8/§7reset"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
confirmationInventory(player, "Region Reseten?", () -> player.performCommand("reset"), () -> openBauGui(player));
|
confirmationInventory(player, "Region Reseten?", () -> player.performCommand("reset"), () -> openBauGui(player));
|
||||||
});
|
});
|
||||||
|
|
||||||
if (region.hasProtection()) {
|
if (region.hasProtection()) {
|
||||||
inv.setItem(18, Material.OBSIDIAN, "§eRegion Protecten", getNoPermsLore(Arrays.asList("§8/§7protect"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(18, Material.OBSIDIAN, "§eRegion Protecten", getNoPermsLore(Arrays.asList("§8/§7protect"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
confirmationInventory(player, "Region Protecten", () -> player.performCommand("protect"), () -> openBauGui(player));
|
confirmationInventory(player, "Region Protecten", () -> player.performCommand("protect"), () -> openBauGui(player));
|
||||||
});
|
});
|
||||||
@ -214,8 +216,8 @@ public class CommandGUI extends SWCommand implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (region.hasTestblock()) {
|
if (region.hasTestblock()) {
|
||||||
inv.setItem(9, getMaterial("END_STONE", "ENDER_STONE"), "§eTestblock erneuern", getNoPermsLore(Arrays.asList("§8/§7testblock"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(9, getMaterial("END_STONE", "ENDER_STONE"), "§eTestblock erneuern", getNoPermsLore(Arrays.asList("§8/§7testblock"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
confirmationInventory(player, "Testblock erneuern", () -> player.performCommand("testblock"), () -> openBauGui(player));
|
confirmationInventory(player, "Testblock erneuern", () -> player.performCommand("testblock"), () -> openBauGui(player));
|
||||||
});
|
});
|
||||||
@ -250,11 +252,11 @@ public class CommandGUI extends SWCommand implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean isBuildArea = region.hasBuildRegion();
|
boolean isBuildArea = region.hasBuildRegion();
|
||||||
List<String> tntLore = getNoPermsLore(Arrays.asList("§8/§7tnt §8[" + (isBuildArea ? "§eTB§7, " : "") + "§eOff §7oder §eOn§7]"), player, "§cDu hast keine Worldrechte", Permission.world);
|
List<String> tntLore = getNoPermsLore(Arrays.asList("§8/§7tnt §8[" + (isBuildArea ? "§eTB§7, " : "") + "§eOff §7oder §eOn§7]"), player, "§cDu hast keine Worldrechte", Permission.WORLD);
|
||||||
switch (region.getTntMode()) {
|
switch (region.getTntMode()) {
|
||||||
case OFF:
|
case OFF:
|
||||||
inv.setItem(23, Material.MINECART, "§7TNT: §eAusgeschaltet", tntLore, false, clickType -> {
|
inv.setItem(23, Material.MINECART, "§7TNT: §eAusgeschaltet", tntLore, false, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
player.performCommand("tnt " + (isBuildArea ? "tb" : "on"));
|
player.performCommand("tnt " + (isBuildArea ? "tb" : "on"));
|
||||||
updateInventories();
|
updateInventories();
|
||||||
@ -262,7 +264,7 @@ public class CommandGUI extends SWCommand implements Listener {
|
|||||||
break;
|
break;
|
||||||
case ONLY_TB:
|
case ONLY_TB:
|
||||||
inv.setItem(23, getMaterial("TNT_MINECART", "EXPLOSIVE_MINECART"), "§7TNT: §enur Testblock", tntLore, false, clickType -> {
|
inv.setItem(23, getMaterial("TNT_MINECART", "EXPLOSIVE_MINECART"), "§7TNT: §enur Testblock", tntLore, false, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
player.performCommand("tnt on");
|
player.performCommand("tnt on");
|
||||||
updateInventories();
|
updateInventories();
|
||||||
@ -270,7 +272,7 @@ public class CommandGUI extends SWCommand implements Listener {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
inv.setItem(23, Material.TNT, "§7TNT: §eEingeschaltet", tntLore, false, clickType -> {
|
inv.setItem(23, Material.TNT, "§7TNT: §eEingeschaltet", tntLore, false, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
player.performCommand("tnt off");
|
player.performCommand("tnt off");
|
||||||
updateInventories();
|
updateInventories();
|
||||||
@ -278,15 +280,15 @@ public class CommandGUI extends SWCommand implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (region.isFreeze()) {
|
if (region.isFreeze()) {
|
||||||
inv.setItem(24, getMaterial("GUNPOWDER", "SULPHUR"), "§7Freeze: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(24, getMaterial("GUNPOWDER", "SULPHUR"), "§7Freeze: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
player.performCommand("freeze");
|
player.performCommand("freeze");
|
||||||
updateInventories();
|
updateInventories();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
inv.setItem(24, Material.REDSTONE, "§7Freeze: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(24, Material.REDSTONE, "§7Freeze: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
player.performCommand("freeze");
|
player.performCommand("freeze");
|
||||||
updateInventories();
|
updateInventories();
|
||||||
@ -294,15 +296,15 @@ public class CommandGUI extends SWCommand implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (region.isFire()) {
|
if (region.isFire()) {
|
||||||
inv.setItem(3, getMaterial("FIREWORK_STAR", "FIREWORK_CHARGE"), "§7Fire: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(3, getMaterial("FIREWORK_STAR", "FIREWORK_CHARGE"), "§7Fire: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
player.performCommand("fire");
|
player.performCommand("fire");
|
||||||
updateInventories();
|
updateInventories();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
inv.setItem(3, getMaterial("FIRE_CHARGE", "FIREBALL"), "§7Fire: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(3, getMaterial("FIRE_CHARGE", "FIREBALL"), "§7Fire: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
player.performCommand("fire");
|
player.performCommand("fire");
|
||||||
updateInventories();
|
updateInventories();
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
package de.steamwar.bausystem.commands;
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.world.Region;
|
import de.steamwar.bausystem.world.regions.Region;
|
||||||
import de.steamwar.bausystem.world.TPSUtils;
|
import de.steamwar.bausystem.world.TPSUtils;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.core.TPSWatcher;
|
import de.steamwar.core.TPSWatcher;
|
||||||
|
@ -21,8 +21,8 @@ package de.steamwar.bausystem.commands;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.world.Region;
|
|
||||||
import de.steamwar.bausystem.world.Welt;
|
import de.steamwar.bausystem.world.Welt;
|
||||||
|
import de.steamwar.bausystem.world.regions.Region;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -44,7 +44,7 @@ public class CommandProtect extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
public void genericTestblockCommand(Player p) {
|
public void genericProtectCommand(Player p) {
|
||||||
if (!permissionCheck(p)) return;
|
if (!permissionCheck(p)) return;
|
||||||
Region region = regionCheck(p);
|
Region region = regionCheck(p);
|
||||||
if (region == null) return;
|
if (region == null) return;
|
||||||
@ -58,7 +58,7 @@ public class CommandProtect extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
public void schematicTestblockCommand(Player p, String s) {
|
public void schematicProtectCommand(Player p, String s) {
|
||||||
if (!permissionCheck(p)) return;
|
if (!permissionCheck(p)) return;
|
||||||
Region region = regionCheck(p);
|
Region region = regionCheck(p);
|
||||||
if (region == null) return;
|
if (region == null) return;
|
||||||
@ -77,7 +77,7 @@ public class CommandProtect extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if (Welt.noPermission(player, Permission.worldedit)) {
|
if (Welt.noPermission(player, Permission.WORLDEDIT)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Boden schützen");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Boden schützen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,11 @@ package de.steamwar.bausystem.commands;
|
|||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.world.Color;
|
import de.steamwar.bausystem.world.Color;
|
||||||
import de.steamwar.bausystem.world.Region;
|
|
||||||
import de.steamwar.bausystem.world.Welt;
|
import de.steamwar.bausystem.world.Welt;
|
||||||
|
import de.steamwar.bausystem.world.regions.GlobalRegion;
|
||||||
|
import de.steamwar.bausystem.world.regions.Region;
|
||||||
|
import de.steamwar.bausystem.world.regions.RegionExtensionType;
|
||||||
|
import de.steamwar.bausystem.world.regions.RegionType;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -26,36 +29,54 @@ public class CommandRegion extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player player, String... args) {
|
public void genericHelp(Player player, String... args) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§8/§7region undo §8- §7Mache die letzten 10 /testblock oder /reset rückgängig");
|
player.sendMessage("§8/§eregion undo §8- §7Mache die letzten 20 /testblock oder /reset rückgängig");
|
||||||
player.sendMessage(BauSystem.PREFIX + "§8/§7region redo §8- §7Wiederhohle die letzten 10 §8/§7rg undo");
|
player.sendMessage("§8/§eregion redo §8- §7Wiederhohle die letzten 20 §8/§7rg undo");
|
||||||
|
player.sendMessage("§8/§eregion restore §8- §7Setzte die Region zurück, ohne das Gebaute zu löschen");
|
||||||
|
player.sendMessage("§8/§eregion select §8[§7RegionsTyp§8] §8- §7Wähle einen RegionsTyp aus");
|
||||||
|
player.sendMessage("§8/§eregion select §8[§7RegionsTyp§8] §8[§7Extension§8] §8- §7Wähle einen RegionsTyp aus mit oder ohne Extension");
|
||||||
|
player.sendMessage("§8/§eregion color §8[§7Color§8] §8- §7Ändere die Regions Farbe");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register("undo")
|
||||||
public void undoCommand(Player p, Action action) {
|
public void undoCommand(Player p) {
|
||||||
if(!permissionCheck(p)) return;
|
if(!permissionCheck(p)) return;
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if(checkGlobalRegion(region, p)) return;
|
if(checkGlobalRegion(region, p)) return;
|
||||||
|
|
||||||
switch (action) {
|
if (region.undo()) {
|
||||||
case UNDO:
|
p.sendMessage(BauSystem.PREFIX + "Letzte Aktion rückgangig gemacht");
|
||||||
if(region.undo()) {
|
} else {
|
||||||
p.sendMessage(BauSystem.PREFIX + "Letzte Aktion rückgangig gemacht");
|
p.sendMessage(BauSystem.PREFIX + "§cNichts zum rückgängig machen");
|
||||||
} else {
|
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cNichts zum rückgängig machen");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case REDO:
|
|
||||||
if(region.redo()) {
|
|
||||||
p.sendMessage(BauSystem.PREFIX + "Letzte Aktion wiederhohlt");
|
|
||||||
} else {
|
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cNichts zum wiederhohlen");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
genericHelp(p);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Register("redo")
|
||||||
|
public void redoCommand(Player p) {
|
||||||
|
if (!permissionCheck(p)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Region region = Region.getRegion(p.getLocation());
|
||||||
|
if (checkGlobalRegion(region, p)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (region.redo()) {
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "Letzte Aktion wiederhohlt");
|
||||||
|
} else {
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§cNichts zum wiederhohlen");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register
|
||||||
|
public void baurahmenCommand(Player p, RegionType regionType) {
|
||||||
|
CommandSelect.getInstance().baurahmenCommand(p, regionType, RegionExtensionType.NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register
|
||||||
|
public void baurahmenCommand(Player p, RegionType regionType, RegionExtensionType regionExtensionType) {
|
||||||
|
CommandSelect.getInstance().baurahmenCommand(p, regionType, regionExtensionType);
|
||||||
|
}
|
||||||
|
|
||||||
@Register("restore")
|
@Register("restore")
|
||||||
public void genericRestoreCommand(Player p) {
|
public void genericRestoreCommand(Player p) {
|
||||||
if (!permissionCheck(p)) return;
|
if (!permissionCheck(p)) return;
|
||||||
@ -99,7 +120,7 @@ public class CommandRegion extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static boolean checkGlobalRegion(Region region, Player p) {
|
static boolean checkGlobalRegion(Region region, Player p) {
|
||||||
if(Region.GlobalRegion.isGlobalRegion(region)) {
|
if (GlobalRegion.isGlobalRegion(region)) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cDu bist in keiner Region");
|
p.sendMessage(BauSystem.PREFIX + "§cDu bist in keiner Region");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -107,15 +128,10 @@ public class CommandRegion extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if (Welt.noPermission(player, Permission.worldedit)) {
|
if (Welt.noPermission(player, Permission.WORLDEDIT)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Region verändern");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Region verändern");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Action {
|
|
||||||
UNDO,
|
|
||||||
REDO
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,9 @@ package de.steamwar.bausystem.commands;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.world.Region;
|
|
||||||
import de.steamwar.bausystem.world.Welt;
|
import de.steamwar.bausystem.world.Welt;
|
||||||
|
import de.steamwar.bausystem.world.regions.GlobalRegion;
|
||||||
|
import de.steamwar.bausystem.world.regions.Region;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -49,7 +50,7 @@ public class CommandReset extends SWCommand {
|
|||||||
Region region = regionCheck(p);
|
Region region = regionCheck(p);
|
||||||
if (region == null) return;
|
if (region == null) return;
|
||||||
try {
|
try {
|
||||||
region.reset(null);
|
region.reset(null, false);
|
||||||
p.sendMessage(BauSystem.PREFIX + "§7Region zurückgesetzt");
|
p.sendMessage(BauSystem.PREFIX + "§7Region zurückgesetzt");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region");
|
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region");
|
||||||
@ -68,7 +69,7 @@ public class CommandReset extends SWCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
region.reset(schem);
|
region.reset(schem, false);
|
||||||
p.sendMessage(BauSystem.PREFIX + "§7Region zurückgesetzt");
|
p.sendMessage(BauSystem.PREFIX + "§7Region zurückgesetzt");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region");
|
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region");
|
||||||
@ -77,7 +78,7 @@ public class CommandReset extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if (Welt.noPermission(player, Permission.world)) {
|
if (Welt.noPermission(player, Permission.WORLD)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Region zurücksetzen");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Region zurücksetzen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -86,7 +87,7 @@ public class CommandReset extends SWCommand {
|
|||||||
|
|
||||||
private Region regionCheck(Player player) {
|
private Region regionCheck(Player player) {
|
||||||
Region region = Region.getRegion(player.getLocation());
|
Region region = Region.getRegion(player.getLocation());
|
||||||
if (region == Region.GlobalRegion.getInstance()) {
|
if (region == GlobalRegion.getInstance()) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner Region");
|
player.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner Region");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
131
BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSelect.java
Normale Datei
131
BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSelect.java
Normale Datei
@ -0,0 +1,131 @@
|
|||||||
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||||
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
|
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
import de.steamwar.bausystem.BauSystem;
|
||||||
|
import de.steamwar.bausystem.Permission;
|
||||||
|
import de.steamwar.bausystem.world.Welt;
|
||||||
|
import de.steamwar.bausystem.world.regions.*;
|
||||||
|
import de.steamwar.command.SWCommand;
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
|
public class CommandSelect extends SWCommand {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private static CommandSelect instance = null;
|
||||||
|
|
||||||
|
public static final WorldEditPlugin WORLDEDIT_PLUGIN = ((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"));
|
||||||
|
public static final World BUKKITWORLD = new BukkitWorld(Bukkit.getWorlds().get(0));
|
||||||
|
|
||||||
|
public CommandSelect() {
|
||||||
|
super("select");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
|
||||||
|
Region region = Region.getRegion(p.getLocation());
|
||||||
|
|
||||||
|
if (GlobalRegion.isGlobalRegion(region)) {
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§cDie globale Region kannst du nicht auswählen");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (regionType == RegionType.TESTBLOCK) {
|
||||||
|
if (!region.hasTestblock()) {
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§cDiese Region hat keinen Testblock");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setSelection(regionType, RegionExtensionType.NORMAL, region, p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (regionType == RegionType.BUILD) {
|
||||||
|
if (!region.hasBuildRegion()) {
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§cDiese Region hat keinen BuildArea");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setSelection(regionType, RegionExtensionType.NORMAL, region, 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 (GlobalRegion.isGlobalRegion(region)) {
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§cDie globale Region kannst du nicht auswählen");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (regionType == RegionType.TESTBLOCK) {
|
||||||
|
if (!region.hasTestblock()) {
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§cDiese Region hat keinen Testblock");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (regionExtensionType == RegionExtensionType.EXTENSION && !region.hasExtensionArea(regionType)) {
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§cDiese Region hat keine Ausfahrmaße");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setSelection(regionType, regionExtensionType, region, p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (regionType == RegionType.BUILD) {
|
||||||
|
if (!region.hasBuildRegion()) {
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§cDiese Region hat keinen BuildArea");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (regionExtensionType == RegionExtensionType.EXTENSION && !region.hasExtensionArea(regionType)) {
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§cDiese Region hat keine Ausfahrmaße");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setSelection(regionType, regionExtensionType, region, p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setSelection(regionType, regionExtensionType, region, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private boolean permissionCheck(Player player) {
|
||||||
|
if (Welt.noPermission(player, Permission.WORLDEDIT)) {
|
||||||
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Select verwenden");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setSelection(RegionType regionType, RegionExtensionType regionExtensionType, Region region, Player p) {
|
||||||
|
Point minPoint = region.getMinPoint(regionType, regionExtensionType);
|
||||||
|
Point maxPoint = region.getMaxPoint(regionType, regionExtensionType);
|
||||||
|
|
||||||
|
WORLDEDIT_PLUGIN.getSession(p).setRegionSelector(BUKKITWORLD, new CuboidRegionSelector(BUKKITWORLD, minPoint.toBlockVector3(), maxPoint.toBlockVector3()));
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "WorldEdit auswahl auf " + minPoint.getX() + ", " + minPoint.getY() + ", " + minPoint.getZ() + " und " + maxPoint.getX() + ", " + maxPoint.getY() + ", " + maxPoint.getZ() + " gesetzt");
|
||||||
|
}
|
||||||
|
}
|
@ -67,7 +67,7 @@ public class CommandSimulator extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if (Welt.noPermission(player, Permission.world)) {
|
if (Welt.noPermission(player, Permission.WORLD)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Simulator nutzen");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Simulator nutzen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,10 @@ package de.steamwar.bausystem.commands;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.world.Region;
|
import de.steamwar.bausystem.world.regions.Region;
|
||||||
import de.steamwar.bausystem.world.Welt;
|
import de.steamwar.bausystem.world.Welt;
|
||||||
|
import de.steamwar.bausystem.world.regions.RegionExtensionType;
|
||||||
|
import de.steamwar.bausystem.world.regions.RegionType;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.command.SWCommandUtils;
|
import de.steamwar.command.SWCommandUtils;
|
||||||
import de.steamwar.command.TypeMapper;
|
import de.steamwar.command.TypeMapper;
|
||||||
@ -94,7 +96,7 @@ public class CommandTNT extends SWCommand implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean permissionCheck(Player p) {
|
private boolean permissionCheck(Player p) {
|
||||||
if (Welt.noPermission(p, Permission.world)) {
|
if (Welt.noPermission(p, Permission.WORLD)) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht TNT-Schaden (de-)aktivieren");
|
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht TNT-Schaden (de-)aktivieren");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -157,11 +159,11 @@ public class CommandTNT extends SWCommand implements Listener {
|
|||||||
event.blockList().removeIf(block -> {
|
event.blockList().removeIf(block -> {
|
||||||
Region region = Region.getRegion(block.getLocation());
|
Region region = Region.getRegion(block.getLocation());
|
||||||
if (region.getTntMode() == TNTMode.ON) return false;
|
if (region.getTntMode() == TNTMode.ON) return false;
|
||||||
if (region.hasBuildRegion() && region.inBuildRegion(block.getLocation())) {
|
if (region.hasBuildRegion() && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.NORMAL)) {
|
||||||
RegionUtils.actionBar(region, "§cEine Explosion hätte Blöcke im Baubereich zerstört");
|
RegionUtils.actionBar(region, "§cEine Explosion hätte Blöcke im Baubereich zerstört");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (region.hasBuildRegion() && region.inBuildRegionExtension(block.getLocation())) {
|
if (region.hasBuildRegion() && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) {
|
||||||
RegionUtils.actionBar(region, "§cEine Explosion hätte Blöcke im Ausfahrbereich zerstört");
|
RegionUtils.actionBar(region, "§cEine Explosion hätte Blöcke im Ausfahrbereich zerstört");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ public class CommandTPSLimiter extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if (Welt.noPermission(player, Permission.world)) {
|
if (Welt.noPermission(player, Permission.WORLD)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den TPS-Limiter nutzen");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den TPS-Limiter nutzen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.commands;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.world.Region;
|
import de.steamwar.bausystem.world.regions.Region;
|
||||||
import de.steamwar.bausystem.world.Welt;
|
import de.steamwar.bausystem.world.Welt;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
@ -77,7 +77,7 @@ public class CommandTestblock extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if (Welt.noPermission(player, Permission.worldedit)) {
|
if (Welt.noPermission(player, Permission.WORLDEDIT)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Testblock zurücksetzen");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Testblock zurücksetzen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ public class CommandTime extends SWCommand {
|
|||||||
|
|
||||||
@Register
|
@Register
|
||||||
public void genericCommand(Player p, int time) {
|
public void genericCommand(Player p, int time) {
|
||||||
if (Welt.noPermission(p, Permission.world)) {
|
if (Welt.noPermission(p, Permission.WORLD)) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Zeit ändern");
|
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Zeit ändern");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ public class CommandTime extends SWCommand {
|
|||||||
|
|
||||||
@Register
|
@Register
|
||||||
public void genericCommand(Player p, Time time) {
|
public void genericCommand(Player p, Time time) {
|
||||||
if (Welt.noPermission(p, Permission.world)) {
|
if (Welt.noPermission(p, Permission.WORLD)) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Zeit ändern");
|
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Zeit ändern");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ public class CommandTrace extends SWCommand {
|
|||||||
|
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if (Welt.noPermission(player, Permission.world)) {
|
if (Welt.noPermission(player, Permission.WORLD)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den TNT-Tracer nutzen");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den TNT-Tracer nutzen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -19,18 +19,23 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.commands;
|
package de.steamwar.bausystem.commands;
|
||||||
|
|
||||||
import de.steamwar.bausystem.world.Region;
|
import de.steamwar.bausystem.world.regions.GlobalRegion;
|
||||||
|
import de.steamwar.bausystem.world.regions.Region;
|
||||||
|
import de.steamwar.bausystem.world.regions.RegionExtensionType;
|
||||||
|
import de.steamwar.bausystem.world.regions.RegionType;
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
@UtilityClass
|
||||||
public class RegionUtils {
|
public class RegionUtils {
|
||||||
|
|
||||||
public static void actionBar(Region region, String s) {
|
public static void actionBar(Region region, String s) {
|
||||||
if (Region.GlobalRegion.isGlobalRegion(region)) {
|
if (GlobalRegion.isGlobalRegion(region)) {
|
||||||
Bukkit.getOnlinePlayers().stream().filter(player -> Region.getRegion(player.getLocation()) == null).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
|
Bukkit.getOnlinePlayers().stream().filter(player -> Region.getRegion(player.getLocation()) == null).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
|
||||||
} else {
|
} else {
|
||||||
Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation())).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
|
Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ package de.steamwar.bausystem.world;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.commands.CommandTPSLimiter;
|
import de.steamwar.bausystem.commands.CommandTPSLimiter;
|
||||||
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
|
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
|
||||||
|
import de.steamwar.bausystem.world.regions.Region;
|
||||||
import de.steamwar.core.TPSWatcher;
|
import de.steamwar.core.TPSWatcher;
|
||||||
import de.steamwar.scoreboard.SWScoreboard;
|
import de.steamwar.scoreboard.SWScoreboard;
|
||||||
import de.steamwar.scoreboard.ScoreboardCallback;
|
import de.steamwar.scoreboard.ScoreboardCallback;
|
||||||
|
@ -21,7 +21,7 @@ public class DetonatorListener implements Listener {
|
|||||||
if (VersionedCallable.call(new VersionedCallable<>(() -> event.getItem().isSimilar(Detonator.WAND), 12),
|
if (VersionedCallable.call(new VersionedCallable<>(() -> event.getItem().isSimilar(Detonator.WAND), 12),
|
||||||
new VersionedCallable<>(() -> event.getItem().getItemMeta().getPersistentDataContainer().has(new NamespacedKey(BauSystem.getPlugin(), "deto"), PersistentDataType.BYTE), 15))) {
|
new VersionedCallable<>(() -> event.getItem().getItemMeta().getPersistentDataContainer().has(new NamespacedKey(BauSystem.getPlugin(), "deto"), PersistentDataType.BYTE), 15))) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (Welt.noPermission(player, Permission.world)) {
|
if (Welt.noPermission(player, Permission.WORLD)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Detonator nutzen");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Detonator nutzen");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ import com.comphenix.protocol.events.PacketEvent;
|
|||||||
import com.comphenix.protocol.wrappers.BlockPosition;
|
import com.comphenix.protocol.wrappers.BlockPosition;
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.core.VersionedCallable;
|
import de.steamwar.core.VersionedCallable;
|
||||||
import de.steamwar.core.VersionedRunnable;
|
import de.steamwar.core.VersionedRunnable;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -53,7 +52,7 @@ public class RegionListener implements Listener {
|
|||||||
|
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
|
|
||||||
if (Welt.noPermission(p, Permission.worldedit)) {
|
if (Welt.noPermission(p, Permission.WORLDEDIT)) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier kein WorldEdit benutzen");
|
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier kein WorldEdit benutzen");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import de.steamwar.bausystem.BauSystem;
|
|||||||
import de.steamwar.bausystem.commands.CommandScript;
|
import de.steamwar.bausystem.commands.CommandScript;
|
||||||
import de.steamwar.bausystem.commands.CommandTNT;
|
import de.steamwar.bausystem.commands.CommandTNT;
|
||||||
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
|
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
|
||||||
|
import de.steamwar.bausystem.world.regions.Region;
|
||||||
import de.steamwar.core.VersionedCallable;
|
import de.steamwar.core.VersionedCallable;
|
||||||
import de.steamwar.inventory.SWAnvilInv;
|
import de.steamwar.inventory.SWAnvilInv;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -38,7 +38,7 @@ public class TNTSimulatorListener implements Listener {
|
|||||||
private static final Vector HALF = new Vector(0.5, 0, 0.5);
|
private static final Vector HALF = new Vector(0.5, 0, 0.5);
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if (Welt.noPermission(player, Permission.world)) {
|
if (Welt.noPermission(player, Permission.WORLD)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Simulator nutzen");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Simulator nutzen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -40,11 +40,11 @@ public class Welt {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
switch (perm) {
|
switch (perm) {
|
||||||
case worldedit:
|
case WORLDEDIT:
|
||||||
return !member1.isWorldEdit();
|
return !member1.isWorldEdit();
|
||||||
case world:
|
case WORLD:
|
||||||
return !member1.isWorld();
|
return !member1.isWorld();
|
||||||
case member:
|
case MEMBER:
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
|
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.world.regions;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class GlobalRegion extends Region {
|
||||||
|
|
||||||
|
private static final GlobalRegion GLOBAL_REGION = new GlobalRegion();
|
||||||
|
|
||||||
|
public static GlobalRegion getInstance() {
|
||||||
|
return GLOBAL_REGION;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isGlobalRegion(Region region) {
|
||||||
|
return region == GLOBAL_REGION;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GlobalRegion() {
|
||||||
|
super("Global");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean inRegion(Location l, RegionType regionType, RegionExtensionType regionExtensionType) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasBuildRegion() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasTestblock() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasProtection() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasExtensionArea(RegionType regionType) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
37
BauSystem_Main/src/de/steamwar/bausystem/world/regions/Point.java
Normale Datei
37
BauSystem_Main/src/de/steamwar/bausystem/world/regions/Point.java
Normale Datei
@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.world.regions;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class Point {
|
||||||
|
|
||||||
|
final int x;
|
||||||
|
final int y;
|
||||||
|
final int z;
|
||||||
|
|
||||||
|
public BlockVector3 toBlockVector3() {
|
||||||
|
return BlockVector3.at(this.x, this.y, this.z);
|
||||||
|
}
|
||||||
|
}
|
194
BauSystem_Main/src/de/steamwar/bausystem/world/regions/Prototype.java
Normale Datei
194
BauSystem_Main/src/de/steamwar/bausystem/world/regions/Prototype.java
Normale Datei
@ -0,0 +1,194 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.world.regions;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
|
import de.steamwar.bausystem.world.Color;
|
||||||
|
import de.steamwar.core.VersionedCallable;
|
||||||
|
import de.steamwar.sql.NoClipboardException;
|
||||||
|
import de.steamwar.sql.Schematic;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class Prototype {
|
||||||
|
static final Map<String, Prototype> prototypes = new HashMap<>();
|
||||||
|
|
||||||
|
private final int sizeX;
|
||||||
|
private final int sizeY;
|
||||||
|
private final int sizeZ;
|
||||||
|
|
||||||
|
private final int offsetX;
|
||||||
|
private final int offsetY;
|
||||||
|
private final int offsetZ;
|
||||||
|
|
||||||
|
private final int extensionPositiveZ;
|
||||||
|
private final int extensionNegativeZ;
|
||||||
|
private final int extensionPositiveY;
|
||||||
|
private final int extensionAxisX;
|
||||||
|
final boolean extensionPrototypeArea;
|
||||||
|
|
||||||
|
private final int waterLevel;
|
||||||
|
|
||||||
|
private final String schematic;
|
||||||
|
private final boolean rotate;
|
||||||
|
|
||||||
|
final Prototype testblock; //nullable
|
||||||
|
final Prototype buildArea; //nullable
|
||||||
|
|
||||||
|
private final String protectSchematic; //nullable
|
||||||
|
|
||||||
|
Prototype(ConfigurationSection config) {
|
||||||
|
sizeX = config.getInt("sizeX");
|
||||||
|
sizeY = config.getInt("sizeY");
|
||||||
|
sizeZ = config.getInt("sizeZ");
|
||||||
|
schematic = config.getString("schematic");
|
||||||
|
offsetX = config.getInt("offsetX", 0);
|
||||||
|
offsetY = config.getInt("offsetY", 0);
|
||||||
|
offsetZ = config.getInt("offsetZ", 0);
|
||||||
|
extensionPositiveZ = config.getInt("extensionPositiveZ", 0);
|
||||||
|
extensionNegativeZ = config.getInt("extensionNegativeZ", 0);
|
||||||
|
extensionPositiveY = config.getInt("extensionPositiveY", 0);
|
||||||
|
extensionAxisX = config.getInt("extensionAxisX", 0);
|
||||||
|
if (config.contains("extensionPositiveZ") || config.contains("extensionNegativeZ") || config.contains("extensionPositiveY") || config.contains("extensionAxisX")) {
|
||||||
|
Region.extensionArea = true;
|
||||||
|
}
|
||||||
|
extensionPrototypeArea = extensionNegativeZ != 0 || extensionPositiveZ != 0 || extensionPositiveY != 0 || extensionAxisX != 0;
|
||||||
|
waterLevel = config.getInt("waterLevel", 0);
|
||||||
|
rotate = config.getBoolean("rotate", false);
|
||||||
|
|
||||||
|
ConfigurationSection testblockSection = config.getConfigurationSection("testblock");
|
||||||
|
testblock = testblockSection != null ? new Prototype(testblockSection) : null;
|
||||||
|
|
||||||
|
ConfigurationSection buildAreaSection = config.getConfigurationSection("buildArea");
|
||||||
|
buildArea = buildAreaSection != null ? new Prototype(buildAreaSection) : null;
|
||||||
|
if (buildArea != null) {
|
||||||
|
Region.buildArea = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protectSchematic = config.getString("protection", null);
|
||||||
|
|
||||||
|
if (!config.getName().equals("testblock") && !config.getName().equals("buildArea"))
|
||||||
|
prototypes.put(config.getName(), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Point getMinPoint(Region region, RegionExtensionType regionExtensionType) {
|
||||||
|
switch (regionExtensionType) {
|
||||||
|
case EXTENSION:
|
||||||
|
return new Point(
|
||||||
|
region.minPoint.getX() + offsetX - extensionAxisX,
|
||||||
|
region.minPoint.getY() + offsetY,
|
||||||
|
region.minPoint.getZ() + offsetZ - extensionNegativeZ
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
case NORMAL:
|
||||||
|
return new Point(
|
||||||
|
region.minPoint.getX() + offsetX,
|
||||||
|
region.minPoint.getY() + offsetY,
|
||||||
|
region.minPoint.getZ() + offsetZ
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Point getMaxPoint(Region region, RegionExtensionType regionExtensionType) {
|
||||||
|
switch (regionExtensionType) {
|
||||||
|
case EXTENSION:
|
||||||
|
return new Point(
|
||||||
|
region.minPoint.getX() + offsetX - extensionAxisX + (sizeX + extensionAxisX * 2) - 1,
|
||||||
|
region.minPoint.getY() + offsetY + sizeY + extensionPositiveY - 1,
|
||||||
|
region.minPoint.getZ() + offsetZ - extensionNegativeZ + (sizeZ + extensionNegativeZ + extensionPositiveZ) - 1
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
case NORMAL:
|
||||||
|
return new Point(
|
||||||
|
region.minPoint.getX() + offsetX + sizeX - 1,
|
||||||
|
region.minPoint.getY() + offsetY + sizeY - 1,
|
||||||
|
region.minPoint.getZ() + offsetZ + sizeZ - 1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean inRegion(Region region, Location l, RegionExtensionType regionExtensionType) {
|
||||||
|
switch (regionExtensionType) {
|
||||||
|
case EXTENSION:
|
||||||
|
return inRange(l.getX(), region.minPoint.getX() + offsetX - extensionAxisX, sizeX + extensionAxisX * 2) &&
|
||||||
|
inRange(l.getY(), region.minPoint.getY() + offsetY, sizeY + extensionPositiveY) &&
|
||||||
|
inRange(l.getZ(), region.minPoint.getZ() + offsetZ - extensionNegativeZ, sizeZ + extensionNegativeZ + extensionPositiveZ);
|
||||||
|
default:
|
||||||
|
case NORMAL:
|
||||||
|
return inRange(l.getX(), region.minPoint.getX() + offsetX, sizeX) &&
|
||||||
|
inRange(l.getY(), region.minPoint.getY() + offsetY, sizeY) &&
|
||||||
|
inRange(l.getZ(), region.minPoint.getZ() + offsetZ, sizeZ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public EditSession reset(Region region, Schematic schem, boolean ignoreAir, Color color) throws IOException, NoClipboardException {
|
||||||
|
int x = region.minPoint.getX() + offsetX + sizeX / 2;
|
||||||
|
int y = region.minPoint.getY() + offsetY;
|
||||||
|
int z = region.minPoint.getZ() + offsetZ + sizeZ / 2;
|
||||||
|
if (schem == null) {
|
||||||
|
return paste(new File(schematic), x, y, z, rotate, ignoreAir, color);
|
||||||
|
} else {
|
||||||
|
return paste(schem.load(), x, y, z, rotate, ignoreAir, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasProtection() {
|
||||||
|
return protectSchematic != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EditSession protect(Region region, Schematic schem) throws IOException, NoClipboardException {
|
||||||
|
int x = region.minPoint.getX() + offsetX + sizeX / 2;
|
||||||
|
int y = region.minPoint.getY() + testblock.offsetY - 1;
|
||||||
|
int z = region.minPoint.getZ() + offsetZ + sizeZ / 2;
|
||||||
|
if (schem == null) {
|
||||||
|
return paste(new File(protectSchematic), x, y, z, rotate, false, Color.YELLOW);
|
||||||
|
} else {
|
||||||
|
return paste(schem.load(), x, y, z, rotate, false, Color.YELLOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasTestblock() {
|
||||||
|
return testblock != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EditSession resetTestblock(Region region, Schematic schem, Color color) throws IOException, NoClipboardException {
|
||||||
|
return testblock.reset(region, schem, false, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean inRange(double l, int min, int size) {
|
||||||
|
return min <= l && l < min + size;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static EditSession paste(File file, int x, int y, int z, boolean rotate, boolean ignoreAir, Color color) { //Type of protect
|
||||||
|
return (EditSession) VersionedCallable.call(new VersionedCallable(() -> Region_12.paste(file, x, y, z, rotate, ignoreAir), 8),
|
||||||
|
new VersionedCallable(() -> Region_15.paste(file, x, y, z, rotate, ignoreAir, color), 15));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static EditSession paste(Clipboard clipboard, int x, int y, int z, boolean rotate, boolean ignoreAir, Color color) {
|
||||||
|
return (EditSession) VersionedCallable.call(new VersionedCallable(() -> Region_12.paste(clipboard, x, y, z, rotate, ignoreAir), 8),
|
||||||
|
new VersionedCallable(() -> Region_15.paste(clipboard, x, y, z, rotate, ignoreAir, color), 15));
|
||||||
|
}
|
||||||
|
}
|
@ -1,32 +1,32 @@
|
|||||||
/*
|
/*
|
||||||
This file is a part of the SteamWar software.
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
package de.steamwar.bausystem.world.regions;
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.world;
|
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
import com.google.gson.JsonPrimitive;
|
import com.google.gson.JsonPrimitive;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
|
||||||
import de.steamwar.bausystem.commands.CommandTNT.TNTMode;
|
import de.steamwar.bausystem.commands.CommandTNT.TNTMode;
|
||||||
import de.steamwar.core.VersionedCallable;
|
import de.steamwar.bausystem.world.Color;
|
||||||
|
import de.steamwar.bausystem.world.SizedStack;
|
||||||
import de.steamwar.sql.NoClipboardException;
|
import de.steamwar.sql.NoClipboardException;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -39,15 +39,17 @@ import java.io.File;
|
|||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class Region {
|
public class Region {
|
||||||
|
|
||||||
private static final List<Region> regions = new ArrayList<>();
|
private static final List<Region> regions = new ArrayList<>();
|
||||||
private static boolean buildArea = false;
|
static boolean buildArea = false;
|
||||||
private static boolean extensionArea = false;
|
static boolean extensionArea = false;
|
||||||
private static JsonObject regionsObject = new JsonObject();
|
private static JsonObject regionsObject = new JsonObject();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -90,7 +92,9 @@ public class Region {
|
|||||||
|
|
||||||
public static Region getRegion(Location location) {
|
public static Region getRegion(Location location) {
|
||||||
for (Region region : regions) {
|
for (Region region : regions) {
|
||||||
if (region.inRegion(location)) return region;
|
if (region.inRegion(location, RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
||||||
|
return region;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return GlobalRegion.getInstance();
|
return GlobalRegion.getInstance();
|
||||||
}
|
}
|
||||||
@ -120,9 +124,7 @@ public class Region {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final int minX;
|
final Point minPoint;
|
||||||
private final int minY;
|
|
||||||
private final int minZ;
|
|
||||||
private final Prototype prototype;
|
private final Prototype prototype;
|
||||||
private final String optionsLinkedWith; // nullable
|
private final String optionsLinkedWith; // nullable
|
||||||
private Region linkedRegion = null; // nullable
|
private Region linkedRegion = null; // nullable
|
||||||
@ -139,6 +141,24 @@ public class Region {
|
|||||||
|
|
||||||
private Region(ConfigurationSection config) {
|
private Region(ConfigurationSection config) {
|
||||||
name = config.getName();
|
name = config.getName();
|
||||||
|
minPoint = new Point(config.getInt("minX"), config.getInt("minY"), config.getInt("minZ"));
|
||||||
|
prototype = Prototype.prototypes.get(config.getString("prototype"));
|
||||||
|
optionsLinkedWith = config.getString("optionsLinkedWith", null);
|
||||||
|
if (!hasTestblock()) tntMode = TNTMode.OFF;
|
||||||
|
regions.add(this);
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Region(String name) {
|
||||||
|
this.name = name;
|
||||||
|
this.minPoint = new Point(0, 0, 0);
|
||||||
|
this.prototype = null;
|
||||||
|
this.optionsLinkedWith = null;
|
||||||
|
tntMode = TNTMode.OFF;
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void load() {
|
||||||
if (regionsObject.has(name)) {
|
if (regionsObject.has(name)) {
|
||||||
regionOptions = regionsObject.getAsJsonObject(name);
|
regionOptions = regionsObject.getAsJsonObject(name);
|
||||||
if (regionOptions.has("tnt")) {
|
if (regionOptions.has("tnt")) {
|
||||||
@ -169,24 +189,6 @@ public class Region {
|
|||||||
} else {
|
} else {
|
||||||
regionsObject.add(name, regionOptions);
|
regionsObject.add(name, regionOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
minX = config.getInt("minX");
|
|
||||||
minY = config.getInt("minY");
|
|
||||||
minZ = config.getInt("minZ");
|
|
||||||
prototype = Prototype.prototypes.get(config.getString("prototype"));
|
|
||||||
optionsLinkedWith = config.getString("optionsLinkedWith", null);
|
|
||||||
if (!hasTestblock()) tntMode = TNTMode.OFF;
|
|
||||||
regions.add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Region(String name) {
|
|
||||||
this.name = name;
|
|
||||||
this.minX = 0;
|
|
||||||
this.minY = 0;
|
|
||||||
this.minZ = 0;
|
|
||||||
this.prototype = null;
|
|
||||||
this.optionsLinkedWith = null;
|
|
||||||
tntMode = TNTMode.OFF;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color getColor() {
|
public Color getColor() {
|
||||||
@ -245,26 +247,46 @@ public class Region {
|
|||||||
regionOptions.add("fire", new JsonPrimitive(fire));
|
regionOptions.add("fire", new JsonPrimitive(fire));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean inRegion(Location l) {
|
public Point getMinPoint(RegionType regionType, RegionExtensionType regionExtensionType) {
|
||||||
return prototype.inRegion(this, l);
|
switch (regionType) {
|
||||||
|
case BUILD:
|
||||||
|
return prototype.buildArea.getMinPoint(this, regionExtensionType);
|
||||||
|
case TESTBLOCK:
|
||||||
|
return prototype.testblock.getMinPoint(this, regionExtensionType);
|
||||||
|
default:
|
||||||
|
case NORMAL:
|
||||||
|
return prototype.getMinPoint(this, regionExtensionType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Point getMaxPoint(RegionType regionType, RegionExtensionType regionExtensionType) {
|
||||||
|
switch (regionType) {
|
||||||
|
case BUILD:
|
||||||
|
return prototype.buildArea.getMaxPoint(this, regionExtensionType);
|
||||||
|
case TESTBLOCK:
|
||||||
|
return prototype.testblock.getMaxPoint(this, regionExtensionType);
|
||||||
|
default:
|
||||||
|
case NORMAL:
|
||||||
|
return prototype.getMaxPoint(this, regionExtensionType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean inRegion(Location l, RegionType regionType, RegionExtensionType regionExtensionType) {
|
||||||
|
switch (regionType) {
|
||||||
|
case BUILD:
|
||||||
|
return prototype.buildArea.inRegion(this, l, regionExtensionType);
|
||||||
|
case TESTBLOCK:
|
||||||
|
return prototype.testblock.inRegion(this, l, regionExtensionType);
|
||||||
|
default:
|
||||||
|
case NORMAL:
|
||||||
|
return prototype.inRegion(this, l, regionExtensionType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasBuildRegion() {
|
public boolean hasBuildRegion() {
|
||||||
return prototype.buildArea != null;
|
return prototype.buildArea != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean inBuildRegion(Location l) {
|
|
||||||
return prototype.buildArea.inRegion(this, l);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean inBuildRegionExtension(Location l) {
|
|
||||||
return prototype.buildArea.inRegionExtension(this, l);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void reset(Schematic schem) throws IOException, NoClipboardException {
|
|
||||||
reset(schem, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void reset(Schematic schem, boolean ignoreAir) throws IOException, NoClipboardException {
|
public void reset(Schematic schem, boolean ignoreAir) throws IOException, NoClipboardException {
|
||||||
initSessions();
|
initSessions();
|
||||||
undosessions.push(prototype.reset(this, schem, ignoreAir, color));
|
undosessions.push(prototype.reset(this, schem, ignoreAir, color));
|
||||||
@ -288,16 +310,20 @@ public class Region {
|
|||||||
undosessions.push(prototype.protect(this, schem));
|
undosessions.push(prototype.protect(this, schem));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasExtensionAreaRegistered() {
|
public boolean hasExtensionArea(RegionType regionType) {
|
||||||
return prototype.extensionPrototypeArea;
|
switch (regionType) {
|
||||||
}
|
case BUILD:
|
||||||
|
return prototype.buildArea.extensionPrototypeArea;
|
||||||
public boolean hasTestblockExtensionAreaRegistered() {
|
case TESTBLOCK:
|
||||||
return prototype.testblock.extensionPrototypeArea;
|
return prototype.testblock.extensionPrototypeArea;
|
||||||
|
default:
|
||||||
|
case NORMAL:
|
||||||
|
return prototype.extensionPrototypeArea;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initSessions() {
|
private void initSessions() {
|
||||||
if(undosessions == null) {
|
if (undosessions == null) {
|
||||||
undosessions = new SizedStack<>(20);
|
undosessions = new SizedStack<>(20);
|
||||||
redosessions = new SizedStack<>(20);
|
redosessions = new SizedStack<>(20);
|
||||||
}
|
}
|
||||||
@ -308,8 +334,9 @@ public class Region {
|
|||||||
EditSession session = null;
|
EditSession session = null;
|
||||||
try {
|
try {
|
||||||
session = undosessions.pop();
|
session = undosessions.pop();
|
||||||
if(session == null)
|
if (session == null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
session.undo(session);
|
session.undo(session);
|
||||||
redosessions.push(session);
|
redosessions.push(session);
|
||||||
return true;
|
return true;
|
||||||
@ -325,8 +352,9 @@ public class Region {
|
|||||||
EditSession session = null;
|
EditSession session = null;
|
||||||
try {
|
try {
|
||||||
session = redosessions.pop();
|
session = redosessions.pop();
|
||||||
if(session == null)
|
if (session == null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
session.redo(session);
|
session.redo(session);
|
||||||
undosessions.push(session);
|
undosessions.push(session);
|
||||||
return true;
|
return true;
|
||||||
@ -337,167 +365,4 @@ public class Region {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class GlobalRegion extends Region {
|
|
||||||
|
|
||||||
private static final GlobalRegion GLOBAL_REGION = new GlobalRegion();
|
|
||||||
|
|
||||||
public static GlobalRegion getInstance() {
|
|
||||||
return GLOBAL_REGION;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isGlobalRegion(Region region) {
|
|
||||||
return region == GLOBAL_REGION;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GlobalRegion() {
|
|
||||||
super("Global");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean inRegion(Location l) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasBuildRegion() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasTestblock() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasProtection() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasExtensionAreaRegistered() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasTestblockExtensionAreaRegistered() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Prototype {
|
|
||||||
private static final Map<String, Prototype> prototypes = new HashMap<>();
|
|
||||||
|
|
||||||
private final int sizeX;
|
|
||||||
private final int sizeY;
|
|
||||||
private final int sizeZ;
|
|
||||||
|
|
||||||
private final int offsetX;
|
|
||||||
private final int offsetY;
|
|
||||||
private final int offsetZ;
|
|
||||||
|
|
||||||
private final int extensionPositiveZ;
|
|
||||||
private final int extensionNegativeZ;
|
|
||||||
private final int extensionPositiveY;
|
|
||||||
private final int extensionAxisX;
|
|
||||||
private final boolean extensionPrototypeArea;
|
|
||||||
|
|
||||||
private final String schematic;
|
|
||||||
private final boolean rotate;
|
|
||||||
|
|
||||||
private final Prototype testblock; //nullable
|
|
||||||
private final Prototype buildArea; //nullable
|
|
||||||
|
|
||||||
private final String protectSchematic; //nullable
|
|
||||||
|
|
||||||
private Prototype(ConfigurationSection config) {
|
|
||||||
sizeX = config.getInt("sizeX");
|
|
||||||
sizeY = config.getInt("sizeY");
|
|
||||||
sizeZ = config.getInt("sizeZ");
|
|
||||||
schematic = config.getString("schematic");
|
|
||||||
offsetX = config.getInt("offsetX", 0);
|
|
||||||
offsetY = config.getInt("offsetY", 0);
|
|
||||||
offsetZ = config.getInt("offsetZ", 0);
|
|
||||||
extensionPositiveZ = config.getInt("extensionPositiveZ", 0);
|
|
||||||
extensionNegativeZ = config.getInt("extensionNegativeZ", 0);
|
|
||||||
extensionPositiveY = config.getInt("extensionPositiveY", 0);
|
|
||||||
extensionAxisX = config.getInt("extensionAxisX", 0);
|
|
||||||
if (config.contains("extensionPositiveZ") || config.contains("extensionNegativeZ") || config.contains("extensionPositiveY") || config.contains("extensionAxisX")) {
|
|
||||||
extensionArea = true;
|
|
||||||
}
|
|
||||||
extensionPrototypeArea = extensionNegativeZ != 0 || extensionPositiveZ != 0 || extensionPositiveY != 0 || extensionAxisX != 0;
|
|
||||||
rotate = config.getBoolean("rotate", false);
|
|
||||||
|
|
||||||
ConfigurationSection testblockSection = config.getConfigurationSection("testblock");
|
|
||||||
testblock = testblockSection != null ? new Prototype(testblockSection) : null;
|
|
||||||
|
|
||||||
ConfigurationSection buildAreaSection = config.getConfigurationSection("buildArea");
|
|
||||||
buildArea = buildAreaSection != null ? new Prototype(buildAreaSection) : null;
|
|
||||||
if (buildArea != null) {
|
|
||||||
Region.buildArea = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protectSchematic = config.getString("protection", null);
|
|
||||||
|
|
||||||
if (!config.getName().equals("testblock") && !config.getName().equals("buildArea"))
|
|
||||||
prototypes.put(config.getName(), this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean inRegion(Region region, Location l) {
|
|
||||||
return inRange(l.getX(), region.minX + offsetX, sizeX) &&
|
|
||||||
inRange(l.getY(), region.minY + offsetY, sizeY) &&
|
|
||||||
inRange(l.getZ(), region.minZ + offsetZ, sizeZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean inRegionExtension(Region region, Location l) {
|
|
||||||
return inRange(l.getX(), region.minX + offsetX - extensionAxisX, sizeX + extensionAxisX * 2) &&
|
|
||||||
inRange(l.getY(), region.minY + offsetY, sizeY + extensionPositiveY) &&
|
|
||||||
inRange(l.getZ(), region.minZ + offsetZ - extensionNegativeZ, sizeZ + extensionNegativeZ + extensionPositiveZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
public EditSession reset(Region region, Schematic schem, boolean ignoreAir, Color color) throws IOException, NoClipboardException {
|
|
||||||
int x = region.minX + offsetX + sizeX / 2;
|
|
||||||
int y = region.minY + offsetY;
|
|
||||||
int z = region.minZ + offsetZ + sizeZ / 2;
|
|
||||||
if (schem == null)
|
|
||||||
return paste(new File(schematic), x, y, z, rotate, ignoreAir, color);
|
|
||||||
else
|
|
||||||
return paste(schem.load(), x, y, z, rotate, ignoreAir, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasProtection() {
|
|
||||||
return protectSchematic != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EditSession protect(Region region, Schematic schem) throws IOException, NoClipboardException {
|
|
||||||
int x = region.minX + offsetX + sizeX / 2;
|
|
||||||
int y = region.minY + testblock.offsetY - 1;
|
|
||||||
int z = region.minZ + offsetZ + sizeZ / 2;
|
|
||||||
if (schem == null)
|
|
||||||
return paste(new File(protectSchematic), x, y, z, rotate, false, Color.YELLOW);
|
|
||||||
else
|
|
||||||
return paste(schem.load(), x, y, z, rotate, false, Color.YELLOW);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasTestblock() {
|
|
||||||
return testblock != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EditSession resetTestblock(Region region, Schematic schem, Color color) throws IOException, NoClipboardException {
|
|
||||||
return testblock.reset(region, schem, false, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean inRange(double l, int min, int size) {
|
|
||||||
return min <= l && l < min + size;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static EditSession paste(File file, int x, int y, int z, boolean rotate, boolean ignoreAir, Color color) { //Type of protect
|
|
||||||
return (EditSession) VersionedCallable.call(new VersionedCallable(() -> Region_12.paste(file, x, y, z, rotate, ignoreAir), 8),
|
|
||||||
new VersionedCallable(() -> Region_15.paste(file, x, y, z, rotate, ignoreAir, color), 15));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static EditSession paste(Clipboard clipboard, int x, int y, int z, boolean rotate, boolean ignoreAir, Color color) {
|
|
||||||
return (EditSession) VersionedCallable.call(new VersionedCallable(() -> Region_12.paste(clipboard, x, y, z, rotate, ignoreAir), 8),
|
|
||||||
new VersionedCallable(() -> Region_15.paste(clipboard, x, y, z, rotate, ignoreAir, color), 15));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.world.regions;
|
||||||
|
|
||||||
|
public enum RegionExtensionType {
|
||||||
|
NORMAL,
|
||||||
|
EXTENSION
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.world.regions;
|
||||||
|
|
||||||
|
public enum RegionType {
|
||||||
|
NORMAL,
|
||||||
|
BUILD,
|
||||||
|
TESTBLOCK
|
||||||
|
}
|
1
pom.xml
1
pom.xml
@ -15,6 +15,7 @@
|
|||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<defaultGoal>clean verify -U</defaultGoal>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren