forked from SteamWar/SteamWar
Fix many things
This commit is contained in:
+6
-6
@@ -48,12 +48,12 @@ public class DesignEndStone {
|
|||||||
private double maxBlastResistance;
|
private double maxBlastResistance;
|
||||||
|
|
||||||
public DesignEndStone(Region region) {
|
public DesignEndStone(Region region) {
|
||||||
this.minX = region.getMinPointBuild().getX();
|
this.minX = region.getBuildArea().getMinPoint(false).getX();
|
||||||
this.minY = region.getMinPointBuild().getY();
|
this.minY = region.getBuildArea().getMinPoint(false).getY();
|
||||||
this.minZ = region.getMinPointBuild().getZ();
|
this.minZ = region.getBuildArea().getMinPoint(false).getZ();
|
||||||
this.maxX = region.getMaxPointBuild().getX();
|
this.maxX = region.getBuildArea().getMaxPoint(false).getX();
|
||||||
this.maxY = region.getMaxPointBuild().getY();
|
this.maxY = region.getBuildArea().getMaxPoint(false).getY();
|
||||||
this.maxZ = region.getMaxPointBuild().getZ();
|
this.maxZ = region.getBuildArea().getMaxPoint(false).getZ();
|
||||||
wsOrAs = region.getName().startsWith("ws") || region.getName().startsWith("as");
|
wsOrAs = region.getName().startsWith("ws") || region.getName().startsWith("as");
|
||||||
maxBlastResistance = wsOrAs ? 6.1 : 9.0;
|
maxBlastResistance = wsOrAs ? 6.1 : 9.0;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -39,7 +39,7 @@ public class LoadtimerCommand extends SWCommand {
|
|||||||
@Register(value = "start", description = {"LOADTIMER_HELP_START_2", "LOADTIMER_HELP_START_3"})
|
@Register(value = "start", description = {"LOADTIMER_HELP_START_2", "LOADTIMER_HELP_START_3"})
|
||||||
public void start(@Validator Player p, TimerMode mode) {
|
public void start(@Validator Player p, TimerMode mode) {
|
||||||
Region r = Region.getRegion(p.getLocation());
|
Region r = Region.getRegion(p.getLocation());
|
||||||
if (r.isGlobal()) return;
|
if (r.getType().isGlobal()) return;
|
||||||
if (!Loadtimer.hasTimer(r))
|
if (!Loadtimer.hasTimer(r))
|
||||||
Loadtimer.createLoadtimer(r, mode == TimerMode.HALF);
|
Loadtimer.createLoadtimer(r, mode == TimerMode.HALF);
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ public class LoadtimerCommand extends SWCommand {
|
|||||||
@Register(value = "stop", description = "LOADTIMER_HELP_STOP")
|
@Register(value = "stop", description = "LOADTIMER_HELP_STOP")
|
||||||
public void stop(@Validator Player p) {
|
public void stop(@Validator Player p) {
|
||||||
Region r = Region.getRegion(p.getLocation());
|
Region r = Region.getRegion(p.getLocation());
|
||||||
if (r.isGlobal()) return;
|
if (r.getType().isGlobal()) return;
|
||||||
if (Loadtimer.hasTimer(r))
|
if (Loadtimer.hasTimer(r))
|
||||||
Loadtimer.getTimer(r).delete();
|
Loadtimer.getTimer(r).delete();
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -46,7 +46,7 @@ public class LoadtimerGuiItem extends BauGuiItem {
|
|||||||
@Override
|
@Override
|
||||||
public ItemStack getItem(Player player) {
|
public ItemStack getItem(Player player) {
|
||||||
Region r = Region.getRegion(player.getLocation());
|
Region r = Region.getRegion(player.getLocation());
|
||||||
if (r.isGlobal())
|
if (r.getType().isGlobal())
|
||||||
return new SWItem(Material.BOWL, BauSystem.MESSAGE.parse("LOADTIMER_GUI_GLOBAL", player)).getItemStack();
|
return new SWItem(Material.BOWL, BauSystem.MESSAGE.parse("LOADTIMER_GUI_GLOBAL", player)).getItemStack();
|
||||||
if (Loadtimer.hasTimer(r)) {
|
if (Loadtimer.hasTimer(r)) {
|
||||||
return new SWItem(Material.BOW, BauSystem.MESSAGE.parse("LOADTIMER_GUI_STOP", player)).getItemStack();
|
return new SWItem(Material.BOW, BauSystem.MESSAGE.parse("LOADTIMER_GUI_STOP", player)).getItemStack();
|
||||||
@@ -58,7 +58,7 @@ public class LoadtimerGuiItem extends BauGuiItem {
|
|||||||
@Override
|
@Override
|
||||||
public boolean click(ClickType click, Player p) {
|
public boolean click(ClickType click, Player p) {
|
||||||
Region r = Region.getRegion(p.getLocation());
|
Region r = Region.getRegion(p.getLocation());
|
||||||
if (r.isGlobal()) return false;
|
if (r.getType().isGlobal()) return false;
|
||||||
if (Loadtimer.hasTimer(r)) {
|
if (Loadtimer.hasTimer(r)) {
|
||||||
p.performCommand("lt stop");
|
p.performCommand("lt stop");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+6
-6
@@ -31,8 +31,8 @@ import de.steamwar.bausystem.features.util.SelectCommand;
|
|||||||
import de.steamwar.bausystem.region.Point;
|
import de.steamwar.bausystem.region.Point;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.region.RegionUtils;
|
import de.steamwar.bausystem.region.RegionUtils;
|
||||||
import de.steamwar.bausystem.region.flags.Flag;
|
|
||||||
import de.steamwar.bausystem.region.flags.ColorMode;
|
import de.steamwar.bausystem.region.flags.ColorMode;
|
||||||
|
import de.steamwar.bausystem.region.flags.Flag;
|
||||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
import de.steamwar.bausystem.shared.Pair;
|
import de.steamwar.bausystem.shared.Pair;
|
||||||
@@ -220,14 +220,14 @@ public class RegionCommand extends SWCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Point minPoint = region.getMinPoint(RegionType.BUILD, RegionExtensionType.NORMAL);
|
Point minPoint = region.getBuildArea().getMinPoint(false);
|
||||||
Point maxPoint = region.getMaxPoint(RegionType.BUILD, RegionExtensionType.NORMAL);
|
Point maxPoint = region.getBuildArea().getMaxPoint(false);
|
||||||
switch (option) {
|
switch (option) {
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
minPoint = region.getMinPoint(RegionType.BUILD, RegionExtensionType.EXTENSION);
|
minPoint = region.getBuildArea().getMinPoint(true);
|
||||||
maxPoint = region.getMaxPoint(RegionType.BUILD, RegionExtensionType.EXTENSION);
|
maxPoint = region.getBuildArea().getMaxPoint(true);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
Pair<Location, Location> selection = WorldEditUtils.getSelection(p);
|
Pair<Location, Location> selection = WorldEditUtils.getSelection(p);
|
||||||
@@ -312,7 +312,7 @@ public class RegionCommand extends SWCommand {
|
|||||||
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||||
Player p = (Player) commandSender;
|
Player p = (Player) commandSender;
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if (region.isGlobal()) {
|
if (region.getType().isGlobal()) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
return region.getPrototype().getSkinMap().keySet().stream().map(c -> c.replace(' ', '_')).collect(Collectors.toList());
|
return region.getPrototype().getSkinMap().keySet().stream().map(c -> c.replace(' ', '_')).collect(Collectors.toList());
|
||||||
|
|||||||
+2
-1
@@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.script.lua.libs;
|
|||||||
|
|
||||||
import com.google.gson.*;
|
import com.google.gson.*;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
|
import de.steamwar.bausystem.region.RegionSystem;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.api.Disable;
|
import de.steamwar.linkage.api.Disable;
|
||||||
@@ -74,7 +75,7 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
jsonObject.keySet().forEach(key -> {
|
jsonObject.keySet().forEach(key -> {
|
||||||
map.put(key, fromJson(jsonObject.get(key)));
|
map.put(key, fromJson(jsonObject.get(key)));
|
||||||
});
|
});
|
||||||
Region region = Region.getREGION_MAP().get(regionStorage.getName().substring(0, regionStorage.getName().length() - ".json".length()));
|
Region region = RegionSystem.INSTANCE.getRegion(regionStorage.getName().substring(0, regionStorage.getName().length() - ".json".length())).orElse(null);
|
||||||
REGION_STORAGE.put(region, map);
|
REGION_STORAGE.put(region, map);
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -54,7 +54,7 @@ public class ShieldPrintingCommand extends SWCommand implements Listener {
|
|||||||
@Register
|
@Register
|
||||||
public void genericCommand(@Validator Player player, ShieldPrintingState shieldPrintingState) {
|
public void genericCommand(@Validator Player player, ShieldPrintingState shieldPrintingState) {
|
||||||
Region region = Region.getRegion(player.getLocation());
|
Region region = Region.getRegion(player.getLocation());
|
||||||
if (region.isGlobal()) {
|
if (region.getType().isGlobal()) {
|
||||||
BauSystem.MESSAGE.send("SHIELD_PRINTING_NO_REGION", player);
|
BauSystem.MESSAGE.send("SHIELD_PRINTING_NO_REGION", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ public class ShieldPrintingCommand extends SWCommand implements Listener {
|
|||||||
@Register("stop")
|
@Register("stop")
|
||||||
public void stopCommand(@Validator Player player) {
|
public void stopCommand(@Validator Player player) {
|
||||||
Region region = Region.getRegion(player.getLocation());
|
Region region = Region.getRegion(player.getLocation());
|
||||||
if (region.isGlobal()) {
|
if (region.getType().isGlobal()) {
|
||||||
BauSystem.MESSAGE.send("SHIELD_PRINTING_NO_REGION", player);
|
BauSystem.MESSAGE.send("SHIELD_PRINTING_NO_REGION", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@ public class ShieldPrintingCommand extends SWCommand implements Listener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Region region = Region.getRegion(player.getLocation());
|
Region region = Region.getRegion(player.getLocation());
|
||||||
if (region.isGlobal()) {
|
if (region.getType().isGlobal()) {
|
||||||
messageSender.send("SHIELD_PRINTING_NO_REGION", player);
|
messageSender.send("SHIELD_PRINTING_NO_REGION", player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -63,7 +63,7 @@ public class TechHiderCommand extends SWCommand implements Listener, ScoreboardE
|
|||||||
@Register(description = "TECHHIDER_HELP")
|
@Register(description = "TECHHIDER_HELP")
|
||||||
public void toggleHider(@Validator Player player) {
|
public void toggleHider(@Validator Player player) {
|
||||||
Region region = Region.getRegion(player.getLocation());
|
Region region = Region.getRegion(player.getLocation());
|
||||||
if (region.isGlobal()) {
|
if (region.getType().isGlobal()) {
|
||||||
BauSystem.MESSAGE.send("TECHHIDER_GLOBAL", player);
|
BauSystem.MESSAGE.send("TECHHIDER_GLOBAL", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -1,6 +1,7 @@
|
|||||||
package de.steamwar.bausystem.features.tracer;
|
package de.steamwar.bausystem.features.tracer;
|
||||||
|
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
|
import de.steamwar.bausystem.region.RegionSystem;
|
||||||
import lombok.Cleanup;
|
import lombok.Cleanup;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@@ -31,7 +32,8 @@ public class TraceRepository {
|
|||||||
@Cleanup
|
@Cleanup
|
||||||
ObjectInputStream reader = new ObjectInputStream(new GZIPInputStream(new FileInputStream(recordsFile)));
|
ObjectInputStream reader = new ObjectInputStream(new GZIPInputStream(new FileInputStream(recordsFile)));
|
||||||
UUID uuid = UUID.fromString(reader.readUTF());
|
UUID uuid = UUID.fromString(reader.readUTF());
|
||||||
Region region = Region.getREGION_MAP().get(reader.readUTF());
|
Region region = RegionSystem.INSTANCE.getRegion(reader.readUTF()).orElse(null);
|
||||||
|
if (region == null) return null;
|
||||||
Date date = (Date) reader.readObject();
|
Date date = (Date) reader.readObject();
|
||||||
int serialisationVersion = reader.readInt();
|
int serialisationVersion = reader.readInt();
|
||||||
if (serialisationVersion != SERIALISATION_VERSION) {
|
if (serialisationVersion != SERIALISATION_VERSION) {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class XrayCommand extends SWCommand implements Listener, ScoreboardElemen
|
|||||||
@Register(description = "XRAY_HELP")
|
@Register(description = "XRAY_HELP")
|
||||||
public void toggleHider(@Validator Player player) {
|
public void toggleHider(@Validator Player player) {
|
||||||
Region region = Region.getRegion(player.getLocation());
|
Region region = Region.getRegion(player.getLocation());
|
||||||
if (region.isGlobal()) {
|
if (region.getType().isGlobal()) {
|
||||||
BauSystem.MESSAGE.send("XRAY_GLOBAL", player);
|
BauSystem.MESSAGE.send("XRAY_GLOBAL", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,6 +96,11 @@ public interface Region {
|
|||||||
return ZERO;
|
return ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Point getCopyPoint() {
|
||||||
|
return ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean inRegion(Location location, boolean extension) {
|
public boolean inRegion(Location location, boolean extension) {
|
||||||
return false;
|
return false;
|
||||||
@@ -123,6 +128,8 @@ public interface Region {
|
|||||||
|
|
||||||
Point getMaxPoint(boolean extension);
|
Point getMaxPoint(boolean extension);
|
||||||
|
|
||||||
|
Point getCopyPoint();
|
||||||
|
|
||||||
boolean inRegion(Location location, boolean extension);
|
boolean inRegion(Location location, boolean extension);
|
||||||
|
|
||||||
Optional<EditSession> copy(boolean extension);
|
Optional<EditSession> copy(boolean extension);
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ public class BossBarService implements Listener {
|
|||||||
.computeIfAbsent(key, k -> {
|
.computeIfAbsent(key, k -> {
|
||||||
BossBar bossBar = Bukkit.createBossBar("", BarColor.WHITE, BarStyle.SOLID);
|
BossBar bossBar = Bukkit.createBossBar("", BarColor.WHITE, BarStyle.SOLID);
|
||||||
bossBar.addPlayer(player);
|
bossBar.addPlayer(player);
|
||||||
if (region.isGlobal()) {
|
if (region.getType().isGlobal()) {
|
||||||
return new GlobalBossbar(bossBar);
|
return new GlobalBossbar(bossBar);
|
||||||
} else {
|
} else {
|
||||||
return new RegionedBossbar(bossBar, region, player);
|
return new RegionedBossbar(bossBar, region, player);
|
||||||
|
|||||||
Reference in New Issue
Block a user