diff --git a/BauSystem_12/pom.xml b/BauSystem_12/pom.xml
new file mode 100644
index 0000000..50651db
--- /dev/null
+++ b/BauSystem_12/pom.xml
@@ -0,0 +1,49 @@
+
+
+ 4.0.0
+
+
+ steamwar
+ BauSystem
+ 1.0
+
+
+ BauSystem_12
+ 1.0
+
+
+ src
+
+
+ src
+
+ **/*.java
+ **/*.kt
+
+
+
+
+
+
+
+ steamwar
+ Spigot
+ 1.12
+ provided
+
+
+ steamwar
+ BauSystem_API
+ 1.0
+ compile
+
+
+ steamwar
+ FAWE
+ 1.0
+ provided
+
+
+
\ No newline at end of file
diff --git a/BauSystem_12/src/de/steamwar/bausystem/commands/CommandInfo_12.java b/BauSystem_12/src/de/steamwar/bausystem/commands/CommandInfo_12.java
new file mode 100644
index 0000000..b27aa41
--- /dev/null
+++ b/BauSystem_12/src/de/steamwar/bausystem/commands/CommandInfo_12.java
@@ -0,0 +1,11 @@
+package de.steamwar.bausystem.commands;
+
+import net.minecraft.server.v1_12_R1.MinecraftServer;
+
+class CommandInfo_12 {
+ private CommandInfo_12(){}
+
+ static double[] getTps(){
+ return MinecraftServer.getServer().recentTps;
+ }
+}
diff --git a/BauSystem_12/src/de/steamwar/bausystem/world/AutoLoader_12.java b/BauSystem_12/src/de/steamwar/bausystem/world/AutoLoader_12.java
new file mode 100644
index 0000000..1060d6a
--- /dev/null
+++ b/BauSystem_12/src/de/steamwar/bausystem/world/AutoLoader_12.java
@@ -0,0 +1,72 @@
+package de.steamwar.bausystem.world;
+
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.event.block.Action;
+import org.bukkit.event.player.PlayerInteractEvent;
+
+
+class AutoLoader_12 {
+ private AutoLoader_12(){}
+
+ static boolean tntPlaceActionPerform(Location location){
+ Material m = location.getBlock().getType();
+ if(m != Material.AIR && m != Material.STATIONARY_WATER && m != Material.WATER)
+ return false;
+
+ location.getBlock().setType(Material.TNT);
+ return true;
+ }
+
+ @SuppressWarnings("deprecation")
+ static boolean setRedstone(Location location, boolean active){
+ Block block = location.getBlock();
+ Material material = block.getType();
+ if(material == Material.LEVER || material == Material.STONE_BUTTON || material == Material.WOOD_BUTTON){
+ if(active)
+ block.setData((byte)(block.getData() | 8));
+ else
+ block.setData((byte)(block.getData() & -9));
+ }else if(material == Material.STONE_PLATE || material == Material.WOOD_PLATE){
+ if(active)
+ block.setData((byte)1);
+ else
+ block.setData((byte)0);
+ }else{
+ return false;
+ }
+ block.getState().update(true);
+ return true;
+ }
+
+ @SuppressWarnings("deprecation")
+ static void onPlayerInteract(IAutoLoader loader, PlayerInteractEvent event){
+ if(event.getAction() == Action.RIGHT_CLICK_BLOCK){
+ Block block = event.getClickedBlock();
+ Material material = block.getType();
+ if(material == Material.LEVER){
+ if((block.getData() & 8) == 8) {
+ new IAutoLoader.RedstoneActivation(loader, block.getLocation(), loader.getLastActivation(), false);
+ loader.print("§eHebel zurückgesetzt", true);
+ }else{
+ new IAutoLoader.RedstoneActivation(loader, block.getLocation(), 1, true);
+ loader.print("§eHebel betätigt", true);
+ }
+ }else if(material == Material.STONE_BUTTON){
+ new IAutoLoader.TemporaryActivation(loader, block.getLocation(), 20);
+ loader.print("§eKnopf betätigt", true);
+ }else if(material == Material.WOOD_BUTTON){
+ new IAutoLoader.TemporaryActivation(loader, block.getLocation(), 30);
+ loader.print("§eKnopf betätigt", true);
+ }
+ }else if(event.getAction() == Action.PHYSICAL){
+ Block block = event.getClickedBlock();
+ Material material = block.getType();
+ if(material == Material.STONE_PLATE || material == Material.WOOD_PLATE){
+ new IAutoLoader.TemporaryActivation(loader, block.getLocation(), 20);
+ loader.print("§eDruckplatte betätigt", true);
+ }
+ }
+ }
+}
diff --git a/BauSystem_12/src/de/steamwar/bausystem/world/Region_12.java b/BauSystem_12/src/de/steamwar/bausystem/world/Region_12.java
new file mode 100644
index 0000000..1255353
--- /dev/null
+++ b/BauSystem_12/src/de/steamwar/bausystem/world/Region_12.java
@@ -0,0 +1,15 @@
+package de.steamwar.bausystem.world;
+
+import com.boydti.fawe.object.schematic.Schematic;
+import com.sk89q.worldedit.Vector;
+import com.sk89q.worldedit.bukkit.BukkitWorld;
+import com.sk89q.worldedit.math.transform.AffineTransform;
+import org.bukkit.Bukkit;
+
+public class Region_12 {
+ private Region_12(){}
+
+ static void paste(Schematic schem, Vector v, AffineTransform aT){
+ schem.paste(new BukkitWorld(Bukkit.getWorlds().get(0)), v, false, true, aT).flushQueue();
+ }
+}
diff --git a/src/de/steamwar/bausystem/world/TNTTracer.java b/BauSystem_12/src/de/steamwar/bausystem/world/TNTTracer_12.java
similarity index 71%
rename from src/de/steamwar/bausystem/world/TNTTracer.java
rename to BauSystem_12/src/de/steamwar/bausystem/world/TNTTracer_12.java
index 54f0b0b..291c68b 100644
--- a/src/de/steamwar/bausystem/world/TNTTracer.java
+++ b/BauSystem_12/src/de/steamwar/bausystem/world/TNTTracer_12.java
@@ -1,6 +1,5 @@
package de.steamwar.bausystem.world;
-import de.steamwar.bausystem.BauSystem;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -9,91 +8,65 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.material.Step;
-import org.bukkit.scheduler.BukkitTask;
import java.util.*;
@SuppressWarnings("deprecation")
-public class TNTTracer {
+class TNTTracer_12 {
+ private TNTTracer_12(){}
private static final byte BRICK_STEP = new Step(Material.BRICK).getData();
private static final byte INVERTED_BRICK_STEP = (byte)(BRICK_STEP + 8);
+ private static final World world = Bukkit.getWorlds().get(0);
- private static BukkitTask task;
- private static final Set printedLocs = new HashSet<>();
- private static final Map> locations = new HashMap<>();
- private static World world;
-
- static Status getStatus() {
- return status;
- }
-
- private static Status status = Status.IDLE;
-
- static void remove(TNTPrimed tnt){
+ static void remove(Map> locations, TNTPrimed tnt){
Material material = tnt.getLocation().getBlock().getType();
if(material == Material.WATER || material == Material.STATIONARY_WATER)
locations.remove(tnt);
}
- public static void start(){
- if(status == Status.RECORD)
- return;
- stop();
- locations.clear();
- world = Bukkit.getWorlds().get(0);
-
- status = Status.RECORD;
- task = Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), TNTTracer::run, 1, 1);
- }
-
- public static int show(){
- if(status == Status.SHOW)
- return printedLocs.size();
- stop();
- status = Status.SHOW;
+ static int show(Map> locations, Set printedLocs){
for(LinkedList tntTrace : locations.values()){
if(tntTrace.size() == 1)
- printLocation(tntTrace.getFirst());
+ printLocation(tntTrace.getFirst(), printedLocs);
else if(tntTrace.size() > 1)
- interpolate(tntTrace);
+ interpolate(tntTrace, printedLocs);
}
locations.clear();
return printedLocs.size();
}
- public static void stop(){
- status = Status.IDLE;
- if(task != null)
- task.cancel();
+ static boolean airOrBrick(Block block){
+ Material material = block.getType();
+ if(material == Material.AIR || material == Material.BRICK)
+ return true;
+ if(material != Material.STEP)
+ return false;
- for(Location l : printedLocs){
- Block b = world.getBlockAt(l);
- if(airOrBrick(b))
- b.setType(Material.AIR);
- }
- printedLocs.clear();
+ byte data = block.getData();
+ return data == BRICK_STEP || data == INVERTED_BRICK_STEP;
}
- private static void interpolate(LinkedList trace){
+ private static void interpolate(LinkedList trace, Set printedLocs){
ListIterator it = trace.listIterator();
Location previous = it.next();
- printLocation(previous);
+ printLocation(previous, printedLocs);
while(it.hasNext()){
Location actual = it.next();
Set xSteps = getSteps(previous.getX(), actual.getX());
Set ySteps = getSteps(previous.getY(), actual.getY());
Set zSteps = getSteps(previous.getZ(), actual.getZ());
for(double y : ySteps)
- printLocation(new Location(world, previous.getX(), y, previous.getZ()));
+ printLocation(new Location(world, previous.getX(), y, previous.getZ()), printedLocs);
for(double x : xSteps)
- printLocation(new Location(world, x, actual.getY(), previous.getZ()));
+ printLocation(new Location(world, x, actual.getY(), previous.getZ()), printedLocs);
for(double z : zSteps)
- printLocation(new Location(world, actual.getX(), actual.getY(), z));
+ printLocation(new Location(world, actual.getX(), actual.getY(), z), printedLocs);
previous = actual;
}
}
+
private static Set getSteps(double previous, double actual){
Set steps = new HashSet<>();
if(actual < previous){
@@ -111,7 +84,7 @@ public class TNTTracer {
}
return steps;
}
- private static void printLocation(Location l){
+ private static void printLocation(Location l, Set printedLocs){
Block block = l.getBlock();
double rx = l.getX() - Math.floor(l.getX());
double ry = l.getY() - Math.floor(l.getY());
@@ -161,22 +134,23 @@ public class TNTTracer {
}
}
- setBlock(block, main);
- setBlock(block.getRelative(BlockFace.UP), upper);
+ setBlock(block, main, printedLocs);
+ setBlock(block.getRelative(BlockFace.UP), upper, printedLocs);
if(nearX != null){
- setBlock(nearX, main);
- setBlock(nearX.getRelative(BlockFace.UP), upper);
+ setBlock(nearX, main, printedLocs);
+ setBlock(nearX.getRelative(BlockFace.UP), upper, printedLocs);
}
if(nearZ != null){
- setBlock(nearZ, main);
- setBlock(nearZ.getRelative(BlockFace.UP), upper);
+ setBlock(nearZ, main, printedLocs);
+ setBlock(nearZ.getRelative(BlockFace.UP), upper, printedLocs);
}
if(nearCross != null){
- setBlock(nearCross, main);
- setBlock(nearCross.getRelative(BlockFace.UP), upper);
+ setBlock(nearCross, main, printedLocs);
+ setBlock(nearCross.getRelative(BlockFace.UP), upper, printedLocs);
}
}
- private static void setBlock(Block block, BlockStatus status){
+
+ private static void setBlock(Block block, BlockStatus status, Set printedLocs){
if(status == BlockStatus.NONE)
return;
@@ -199,28 +173,6 @@ public class TNTTracer {
}
}
}
- private static boolean airOrBrick(Block block){
- Material material = block.getType();
- if(material == Material.AIR || material == Material.BRICK)
- return true;
- if(material != Material.STEP)
- return false;
-
- byte data = block.getData();
- return data == BRICK_STEP || data == INVERTED_BRICK_STEP;
- }
-
- private static void run() {
- for(TNTPrimed tnt : world.getEntitiesByClass(TNTPrimed.class)){
- locations.computeIfAbsent(tnt, k -> new LinkedList<>()).add(tnt.getLocation());
- }
- }
-
- enum Status{
- RECORD,
- SHOW,
- IDLE
- }
enum BlockStatus{
NONE(Material.AIR, 0),
@@ -241,5 +193,4 @@ public class TNTTracer {
b.setTypeIdAndData(material.getId(), data, true);
}
}
-
}
diff --git a/BauSystem_14/pom.xml b/BauSystem_14/pom.xml
new file mode 100644
index 0000000..8d99b7d
--- /dev/null
+++ b/BauSystem_14/pom.xml
@@ -0,0 +1,48 @@
+
+
+ 4.0.0
+
+
+ steamwar
+ BauSystem
+ 1.0
+
+
+ BauSystem_14
+ 1.0
+
+
+ src
+
+
+ src
+
+ **/*.java
+ **/*.kt
+
+
+
+
+
+
+
+ steamwar
+ Spigot
+ 1.14
+ provided
+
+
+ steamwar
+ BauSystem_API
+ 1.0
+
+
+ steamwar
+ FAWE
+ 1.14
+ provided
+
+
+
\ No newline at end of file
diff --git a/BauSystem_14/src/de/steamwar/bausystem/commands/CommandInfo_14.java b/BauSystem_14/src/de/steamwar/bausystem/commands/CommandInfo_14.java
new file mode 100644
index 0000000..db914ad
--- /dev/null
+++ b/BauSystem_14/src/de/steamwar/bausystem/commands/CommandInfo_14.java
@@ -0,0 +1,11 @@
+package de.steamwar.bausystem.commands;
+
+import net.minecraft.server.v1_14_R1.MinecraftServer;
+
+public class CommandInfo_14 {
+ private CommandInfo_14(){}
+
+ static double[] getTps(){
+ return MinecraftServer.getServer().recentTps;
+ }
+}
diff --git a/BauSystem_14/src/de/steamwar/bausystem/world/AutoLoader_14.java b/BauSystem_14/src/de/steamwar/bausystem/world/AutoLoader_14.java
new file mode 100644
index 0000000..a4c990c
--- /dev/null
+++ b/BauSystem_14/src/de/steamwar/bausystem/world/AutoLoader_14.java
@@ -0,0 +1,27 @@
+package de.steamwar.bausystem.world;
+
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.event.player.PlayerInteractEvent;
+
+class AutoLoader_14 {
+ private AutoLoader_14(){}
+
+ static boolean tntPlaceActionPerform(Location location){
+ Material m = location.getBlock().getType();
+ if(m != Material.AIR && m != Material.WATER)
+ return false;
+
+ location.getBlock().setType(Material.TNT);
+ return true;
+ }
+
+ static boolean setRedstone(Location location, boolean active){
+ return true;
+ }
+
+ @SuppressWarnings("deprecation")
+ static void onPlayerInteract(IAutoLoader loader, PlayerInteractEvent event){
+ loader.print("§cDer AutoLoader ist in der 1.14 noch nicht fertig implementiert", false);
+ }
+}
diff --git a/BauSystem_14/src/de/steamwar/bausystem/world/Region_14.java b/BauSystem_14/src/de/steamwar/bausystem/world/Region_14.java
new file mode 100644
index 0000000..aa9ff59
--- /dev/null
+++ b/BauSystem_14/src/de/steamwar/bausystem/world/Region_14.java
@@ -0,0 +1,16 @@
+package de.steamwar.bausystem.world;
+
+import com.boydti.fawe.object.schematic.Schematic;
+import com.sk89q.worldedit.Vector;
+import com.sk89q.worldedit.bukkit.BukkitWorld;
+import com.sk89q.worldedit.math.BlockVector3;
+import com.sk89q.worldedit.math.transform.AffineTransform;
+import org.bukkit.Bukkit;
+
+public class Region_14 {
+ private Region_14(){}
+
+ static void paste(Schematic schem, Vector v, AffineTransform aT){
+ schem.paste(new BukkitWorld(Bukkit.getWorlds().get(0)), BlockVector3.at(v.getX(), v.getY(), v.getZ()), false, true, aT).flushQueue();
+ }
+}
diff --git a/BauSystem_14/src/de/steamwar/bausystem/world/TNTTracer_14.java b/BauSystem_14/src/de/steamwar/bausystem/world/TNTTracer_14.java
new file mode 100644
index 0000000..586e125
--- /dev/null
+++ b/BauSystem_14/src/de/steamwar/bausystem/world/TNTTracer_14.java
@@ -0,0 +1,36 @@
+package de.steamwar.bausystem.world;
+
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.entity.TNTPrimed;
+
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+
+class TNTTracer_14 {
+ private TNTTracer_14(){}
+
+ static void remove(Map> locations, TNTPrimed tnt){
+ Material material = tnt.getLocation().getBlock().getType();
+ if(material == Material.WATER)
+ locations.remove(tnt);
+ }
+
+ static int show(Map> locations, Set printedLocs){
+
+ for(LinkedList tntTrace : locations.values()){
+ for(Location location : tntTrace){
+ if(location.getBlock().getType() == Material.AIR)
+ location.getBlock().setType(Material.RED_STAINED_GLASS);
+ }
+ }
+ locations.clear();
+ return printedLocs.size();
+ }
+
+ static boolean airOrBrick(Block block){
+ return block.getType() == Material.RED_STAINED_GLASS;
+ }
+}
diff --git a/BauSystem_API/pom.xml b/BauSystem_API/pom.xml
new file mode 100644
index 0000000..4619796
--- /dev/null
+++ b/BauSystem_API/pom.xml
@@ -0,0 +1,37 @@
+
+
+ 4.0.0
+
+
+ steamwar
+ BauSystem
+ 1.0
+
+
+ BauSystem_API
+ 1.0
+
+
+ src
+
+
+ src
+
+ **/*.java
+ **/*.kt
+
+
+
+
+
+
+
+ steamwar
+ Spigot
+ 1.12
+ provided
+
+
+
\ No newline at end of file
diff --git a/BauSystem_API/src/de/steamwar/bausystem/world/IAutoLoader.java b/BauSystem_API/src/de/steamwar/bausystem/world/IAutoLoader.java
new file mode 100644
index 0000000..da617ec
--- /dev/null
+++ b/BauSystem_API/src/de/steamwar/bausystem/world/IAutoLoader.java
@@ -0,0 +1,94 @@
+package de.steamwar.bausystem.world;
+
+import net.md_5.bungee.api.ChatMessageType;
+import net.md_5.bungee.api.chat.TextComponent;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+
+import java.util.LinkedList;
+
+abstract class IAutoLoader {
+
+ abstract Player getPlayer();
+ abstract boolean setRedstone(Location location, boolean active);
+ abstract LinkedList getActions();
+ abstract void resetLastActivation();
+ abstract int getLastActivation();
+
+ void print(String message, boolean withSize){
+ if(withSize)
+ getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message + " §8" + getActions().size()));
+ else
+ getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message));
+ }
+
+ abstract static class LoaderAction {
+
+ final Location location;
+ final IAutoLoader loader;
+
+ LoaderAction(IAutoLoader loader, Location location){
+ this.location = location;
+ this.loader = loader;
+ loader.getActions().add(this);
+ loader.resetLastActivation();
+ }
+
+ abstract boolean perform();
+ abstract int ticks();
+ }
+
+ static class RedstoneActivation extends LoaderAction{
+
+ final boolean active;
+ final int length;
+
+ RedstoneActivation(IAutoLoader loader, Location location, int ticks, boolean active){
+ super(loader, location);
+ this.length = ticks;
+ this.active = active;
+ }
+
+ @Override
+ public boolean perform() {
+ return loader.setRedstone(location, active);
+ }
+
+ @Override
+ int ticks() {
+ return length;
+ }
+ }
+
+ static class TemporaryActivation extends LoaderAction{
+
+ final int length;
+ int status;
+
+ TemporaryActivation(IAutoLoader loader, Location location, int ticks){
+ super(loader, location);
+ this.length = ticks;
+ status = 0;
+ }
+
+ @Override
+ public boolean perform() {
+ if(status == 0){
+ if(!loader.setRedstone(location, true))
+ return false;
+ }else if(status == length){
+ if(!loader.setRedstone(location, false))
+ return false;
+ status = 0;
+ return true;
+ }
+ status++;
+ return false;
+ }
+
+ @Override
+ int ticks() {
+ return 1;
+ }
+ }
+}
diff --git a/BauSystem_Main/pom.xml b/BauSystem_Main/pom.xml
new file mode 100644
index 0000000..927706b
--- /dev/null
+++ b/BauSystem_Main/pom.xml
@@ -0,0 +1,79 @@
+
+
+ 4.0.0
+
+
+ steamwar
+ BauSystem
+ 1.0
+
+
+ BauSystem_Main
+ 1.0
+
+
+ src
+
+
+ src
+
+ **/*.java
+ **/*.kt
+
+
+
+
+
+ maven-assembly-plugin
+
+
+ package
+
+ single
+
+
+
+
+
+ jar-with-dependencies
+
+
+
+
+
+
+
+
+ steamwar
+ BauSystem_12
+ 1.0
+ compile
+
+
+ steamwar
+ BauSystem_14
+ 1.0
+ compile
+
+
+ steamwar
+ BauSystem_API
+ 1.0
+ compile
+
+
+ steamwar
+ Spigot
+ 1.14
+ provided
+
+
+ steamwar
+ FAWE
+ 1.0
+ provided
+
+
+
\ No newline at end of file
diff --git a/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java
similarity index 100%
rename from src/de/steamwar/bausystem/BauSystem.java
rename to BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java
diff --git a/src/de/steamwar/bausystem/Permission.java b/BauSystem_Main/src/de/steamwar/bausystem/Permission.java
similarity index 100%
rename from src/de/steamwar/bausystem/Permission.java
rename to BauSystem_Main/src/de/steamwar/bausystem/Permission.java
diff --git a/src/de/steamwar/bausystem/commands/CommandBau.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandBau.java
similarity index 100%
rename from src/de/steamwar/bausystem/commands/CommandBau.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/CommandBau.java
diff --git a/src/de/steamwar/bausystem/commands/CommandFire.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandFire.java
similarity index 100%
rename from src/de/steamwar/bausystem/commands/CommandFire.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/CommandFire.java
diff --git a/src/de/steamwar/bausystem/commands/CommandFreeze.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandFreeze.java
similarity index 100%
rename from src/de/steamwar/bausystem/commands/CommandFreeze.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/CommandFreeze.java
diff --git a/src/de/steamwar/bausystem/commands/CommandGamemode.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGamemode.java
similarity index 100%
rename from src/de/steamwar/bausystem/commands/CommandGamemode.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGamemode.java
diff --git a/src/de/steamwar/bausystem/commands/CommandInfo.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandInfo.java
similarity index 88%
rename from src/de/steamwar/bausystem/commands/CommandInfo.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/CommandInfo.java
index b6bfa75..d3e70e7 100644
--- a/src/de/steamwar/bausystem/commands/CommandInfo.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandInfo.java
@@ -1,9 +1,9 @@
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
+import de.steamwar.core.Core;
import de.steamwar.sql.BauweltMember;
import de.steamwar.sql.SteamwarUser;
-import net.minecraft.server.v1_12_R1.MinecraftServer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -31,8 +31,14 @@ public class CommandInfo implements CommandExecutor {
}
sender.sendMessage(membermessage.toString());
-
- double[] tps = MinecraftServer.getServer().recentTps;
+ double[] tps;
+ switch(Core.getVersion()){
+ case 14:
+ tps = CommandInfo_14.getTps();
+ break;
+ default:
+ tps = CommandInfo_12.getTps();
+ }
StringBuilder tpsmessage = new StringBuilder().append(BauSystem.PREFIX).append("TPS:§e");
for(double t : tps){
tpsmessage.append(String.format(" %.1f", t));
diff --git a/src/de/steamwar/bausystem/commands/CommandInjector.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandInjector.java
similarity index 100%
rename from src/de/steamwar/bausystem/commands/CommandInjector.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/CommandInjector.java
diff --git a/src/de/steamwar/bausystem/commands/CommandLoader.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandLoader.java
similarity index 100%
rename from src/de/steamwar/bausystem/commands/CommandLoader.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/CommandLoader.java
diff --git a/src/de/steamwar/bausystem/commands/CommandNV.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandNV.java
similarity index 100%
rename from src/de/steamwar/bausystem/commands/CommandNV.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/CommandNV.java
diff --git a/src/de/steamwar/bausystem/commands/CommandProtect.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandProtect.java
similarity index 100%
rename from src/de/steamwar/bausystem/commands/CommandProtect.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/CommandProtect.java
diff --git a/src/de/steamwar/bausystem/commands/CommandReset.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandReset.java
similarity index 100%
rename from src/de/steamwar/bausystem/commands/CommandReset.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/CommandReset.java
diff --git a/src/de/steamwar/bausystem/commands/CommandSkull.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSkull.java
similarity index 88%
rename from src/de/steamwar/bausystem/commands/CommandSkull.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSkull.java
index e581e85..df90f84 100644
--- a/src/de/steamwar/bausystem/commands/CommandSkull.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSkull.java
@@ -1,7 +1,7 @@
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
-import org.bukkit.Material;
+import de.steamwar.inventory.SWItem;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -23,7 +23,7 @@ public class CommandSkull implements CommandExecutor {
return false;
}
- ItemStack is = new ItemStack(Material.SKULL_ITEM, 1, (short)0, (byte)3);
+ ItemStack is = new ItemStack(SWItem.getMaterial("SKULL_ITEM"), 1, (short)0, (byte)3);
SkullMeta sm = (SkullMeta)is.getItemMeta();
sm.setOwner(args[0]);
sm.setDisplayName("§e" + args[0] + "§8s Kopf");
diff --git a/src/de/steamwar/bausystem/commands/CommandSpeed.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSpeed.java
similarity index 96%
rename from src/de/steamwar/bausystem/commands/CommandSpeed.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSpeed.java
index f32fde1..cd2db01 100644
--- a/src/de/steamwar/bausystem/commands/CommandSpeed.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandSpeed.java
@@ -21,7 +21,7 @@ public class CommandSpeed implements CommandExecutor {
float speed;
try{
- speed = Float.valueOf(args[0]);
+ speed = Float.parseFloat(args[0]);
}catch(NumberFormatException e){
player.sendMessage(BauSystem.PREFIX + "§cBitte gib eine Zahl zwischen 0 und 10 an");
return false;
diff --git a/src/de/steamwar/bausystem/commands/CommandTNT.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTNT.java
similarity index 100%
rename from src/de/steamwar/bausystem/commands/CommandTNT.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTNT.java
diff --git a/src/de/steamwar/bausystem/commands/CommandTeleport.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTeleport.java
similarity index 100%
rename from src/de/steamwar/bausystem/commands/CommandTeleport.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTeleport.java
diff --git a/src/de/steamwar/bausystem/commands/CommandTestblock.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java
similarity index 100%
rename from src/de/steamwar/bausystem/commands/CommandTestblock.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java
diff --git a/src/de/steamwar/bausystem/commands/CommandTime.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTime.java
similarity index 100%
rename from src/de/steamwar/bausystem/commands/CommandTime.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTime.java
diff --git a/src/de/steamwar/bausystem/commands/CommandTrace.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java
similarity index 100%
rename from src/de/steamwar/bausystem/commands/CommandTrace.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java
diff --git a/src/de/steamwar/bausystem/commands/ToggleCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/ToggleCommand.java
similarity index 100%
rename from src/de/steamwar/bausystem/commands/ToggleCommand.java
rename to BauSystem_Main/src/de/steamwar/bausystem/commands/ToggleCommand.java
diff --git a/src/de/steamwar/bausystem/world/ArenaSection.java b/BauSystem_Main/src/de/steamwar/bausystem/world/ArenaSection.java
similarity index 91%
rename from src/de/steamwar/bausystem/world/ArenaSection.java
rename to BauSystem_Main/src/de/steamwar/bausystem/world/ArenaSection.java
index d097468..98b339a 100644
--- a/src/de/steamwar/bausystem/world/ArenaSection.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/world/ArenaSection.java
@@ -3,11 +3,8 @@ package de.steamwar.bausystem.world;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.object.schematic.Schematic;
import com.sk89q.worldedit.Vector;
-import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.math.transform.AffineTransform;
-import com.sk89q.worldedit.world.World;
import de.steamwar.bausystem.BauSystem;
-import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -54,7 +51,6 @@ public class ArenaSection extends Region {
e.printStackTrace();
return;
}
- World w = new BukkitWorld(Bukkit.getWorlds().get(0));
Vector dimensions = schem.getClipboard().getDimensions();
Vector v = new Vector(minX + sizeX/2, testblock.minY-1, minZ + sizeZ/2);
Vector offset = new Vector(schem.getClipboard().getRegion().getMinimumPoint()).subtract(schem.getClipboard().getOrigin());
@@ -65,6 +61,6 @@ public class ArenaSection extends Region {
}else{
v = v.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()/2 - dimensions.getZ()%2).subtract(offset);
}
- schem.paste(w, v, false, true, aT).flushQueue();
+ Region.paste(schem, v, aT);
}
}
diff --git a/src/de/steamwar/bausystem/world/AutoLoader.java b/BauSystem_Main/src/de/steamwar/bausystem/world/AutoLoader.java
similarity index 51%
rename from src/de/steamwar/bausystem/world/AutoLoader.java
rename to BauSystem_Main/src/de/steamwar/bausystem/world/AutoLoader.java
index af1418a..0873c6a 100644
--- a/src/de/steamwar/bausystem/world/AutoLoader.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/world/AutoLoader.java
@@ -1,17 +1,14 @@
package de.steamwar.bausystem.world;
import de.steamwar.bausystem.BauSystem;
-import net.md_5.bungee.api.ChatMessageType;
-import net.md_5.bungee.api.chat.TextComponent;
+import de.steamwar.core.Core;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
-import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
-import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@@ -22,7 +19,7 @@ import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map;
-public class AutoLoader implements Listener {
+public class AutoLoader extends IAutoLoader implements Listener {
private static final Map players = new HashMap<>();
@@ -132,42 +129,19 @@ public class AutoLoader implements Listener {
if(event.getBlock().getType() != Material.TNT)
return;
- new TNTPlaceAction(event.getBlock().getLocation());
+ new TNTPlaceAction(this, event.getBlock().getLocation());
print("§eTNT platziert", true);
}
//BlockRedstoneEvent?
@EventHandler
- @SuppressWarnings("deprecation")
public void onPlayerInteract(PlayerInteractEvent event){
if(!setup || !event.getPlayer().equals(player))
return;
- if(event.getAction() == Action.RIGHT_CLICK_BLOCK){
- Block block = event.getClickedBlock();
- Material material = block.getType();
- if(material == Material.LEVER){
- if((block.getData() & 8) == 8) {
- new RedstoneActivation(block.getLocation(), lastActivation, false);
- print("§eHebel zurückgesetzt", true);
- }else{
- new RedstoneActivation(block.getLocation(), 1, true);
- print("§eHebel betätigt", true);
- }
- }else if(material == Material.STONE_BUTTON){
- new TemporaryActivation(block.getLocation(), 20);
- print("§eKnopf betätigt", true);
- }else if(material == Material.WOOD_BUTTON){
- new TemporaryActivation(block.getLocation(), 30);
- print("§eKnopf betätigt", true);
- }
- }else if(event.getAction() == Action.PHYSICAL){
- Block block = event.getClickedBlock();
- Material material = block.getType();
- if(material == Material.STONE_PLATE || material == Material.WOOD_PLATE){
- new TemporaryActivation(block.getLocation(), 20);
- print("§eDruckplatte betätigt", true);
- }
+ switch(Core.getVersion()){
+ default:
+ AutoLoader_12.onPlayerInteract(this, event);
}
}
@@ -200,62 +174,46 @@ public class AutoLoader implements Listener {
}
}
- private void print(String message, boolean withSize){
- if(withSize)
- player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message + " §8" + actions.size()));
- else
- player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message));
+ @Override
+ Player getPlayer() {
+ return player;
}
- @SuppressWarnings("deprecation")
- private boolean setRedstone(Location location, boolean active){
- Block block = location.getBlock();
- Material material = block.getType();
- if(material == Material.LEVER || material == Material.STONE_BUTTON || material == Material.WOOD_BUTTON){
- if(active)
- block.setData((byte)(block.getData() | 8));
- else
- block.setData((byte)(block.getData() & -9));
- }else if(material == Material.STONE_PLATE || material == Material.WOOD_PLATE){
- if(active)
- block.setData((byte)1);
- else
- block.setData((byte)0);
- }else{
- return false;
+ @Override
+ boolean setRedstone(Location location, boolean active){
+ switch(Core.getVersion()){
+ default:
+ return AutoLoader_12.setRedstone(location, active);
}
- block.getState().update(true);
- return true;
}
- private abstract class LoaderAction {
-
- final Location location;
-
- LoaderAction(Location location){
- this.location = location;
- actions.add(this);
- lastActivation = 0;
- }
-
- abstract boolean perform();
- abstract int ticks();
+ @Override
+ LinkedList getActions() {
+ return actions;
}
- private class TNTPlaceAction extends LoaderAction{
+ @Override
+ void resetLastActivation() {
+ lastActivation = 0;
+ }
- TNTPlaceAction(Location location){
- super(location);
+ @Override
+ int getLastActivation() {
+ return lastActivation;
+ }
+
+ class TNTPlaceAction extends IAutoLoader.LoaderAction {
+
+ TNTPlaceAction(IAutoLoader loader, Location location){
+ super(loader, location);
}
@Override
public boolean perform() {
- Material m = location.getBlock().getType();
- if(m != Material.AIR && m != Material.STATIONARY_WATER)
- return false;
-
- location.getBlock().setType(Material.TNT);
- return true;
+ switch(Core.getVersion()){
+ default:
+ return AutoLoader_12.tntPlaceActionPerform(location);
+ }
}
@Override
@@ -263,58 +221,4 @@ public class AutoLoader implements Listener {
return ticksBetweenBlocks;
}
}
-
- private class RedstoneActivation extends LoaderAction{
-
- final boolean active;
- final int length;
-
- RedstoneActivation(Location location, int ticks, boolean active){
- super(location);
- this.length = ticks;
- this.active = active;
- }
-
- @Override
- public boolean perform() {
- return setRedstone(location, active);
- }
-
- @Override
- int ticks() {
- return length;
- }
- }
-
- private class TemporaryActivation extends LoaderAction{
-
- final int length;
- int status;
-
- TemporaryActivation(Location location, int ticks){
- super(location);
- this.length = ticks;
- status = 0;
- }
-
- @Override
- public boolean perform() {
- if(status == 0){
- if(!setRedstone(location, true))
- return false;
- }else if(status == length){
- if(!setRedstone(location, false))
- return false;
- status = 0;
- return true;
- }
- status++;
- return false;
- }
-
- @Override
- int ticks() {
- return 1;
- }
- }
}
diff --git a/src/de/steamwar/bausystem/world/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java
similarity index 87%
rename from src/de/steamwar/bausystem/world/Region.java
rename to BauSystem_Main/src/de/steamwar/bausystem/world/Region.java
index 5ecdbe0..7ff96d6 100644
--- a/src/de/steamwar/bausystem/world/Region.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java
@@ -3,11 +3,9 @@ package de.steamwar.bausystem.world;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.object.schematic.Schematic;
import com.sk89q.worldedit.Vector;
-import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.math.transform.AffineTransform;
-import com.sk89q.worldedit.world.World;
import de.steamwar.bausystem.BauSystem;
-import org.bukkit.Bukkit;
+import de.steamwar.core.Core;
import org.bukkit.Location;
import org.bukkit.configuration.ConfigurationSection;
@@ -54,7 +52,6 @@ public class Region {
e.printStackTrace();
return;
}
- World w = new BukkitWorld(Bukkit.getWorlds().get(0));
Vector dimensions = schem.getClipboard().getDimensions();
Vector v = new Vector(minX + sizeX/2, minY, minZ + sizeZ/2);
Vector offset = new Vector(schem.getClipboard().getRegion().getMinimumPoint()).subtract(schem.getClipboard().getOrigin());
@@ -65,6 +62,15 @@ public class Region {
}else{
v = v.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()/2 - dimensions.getZ()%2).subtract(offset);
}
- schem.paste(w, v, false, true, aT).flushQueue();
+ paste(schem, v, aT);
+ }
+
+ static void paste(Schematic schem, Vector v, AffineTransform aT){
+ switch(Core.getVersion()){
+ case 14:
+ Region_14.paste(schem, v, aT);
+ default:
+ Region_12.paste(schem, v, aT);
+ }
}
}
diff --git a/src/de/steamwar/bausystem/world/RegionListener.java b/BauSystem_Main/src/de/steamwar/bausystem/world/RegionListener.java
similarity index 97%
rename from src/de/steamwar/bausystem/world/RegionListener.java
rename to BauSystem_Main/src/de/steamwar/bausystem/world/RegionListener.java
index b16790c..4dc88c6 100644
--- a/src/de/steamwar/bausystem/world/RegionListener.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/world/RegionListener.java
@@ -61,6 +61,8 @@ public class RegionListener implements Listener {
public void onSignChange(SignChangeEvent event) {
for(int i = 0; i <= 3; ++i) {
String line = event.getLine(i);
+ if(line == null)
+ continue;
line = ChatColor.translateAlternateColorCodes('&', line);
event.setLine(i, line);
}
diff --git a/src/de/steamwar/bausystem/world/TNTListener.java b/BauSystem_Main/src/de/steamwar/bausystem/world/TNTListener.java
similarity index 100%
rename from src/de/steamwar/bausystem/world/TNTListener.java
rename to BauSystem_Main/src/de/steamwar/bausystem/world/TNTListener.java
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/TNTTracer.java b/BauSystem_Main/src/de/steamwar/bausystem/world/TNTTracer.java
new file mode 100644
index 0000000..980790f
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/world/TNTTracer.java
@@ -0,0 +1,96 @@
+package de.steamwar.bausystem.world;
+
+import de.steamwar.bausystem.BauSystem;
+import de.steamwar.core.Core;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.World;
+import org.bukkit.block.Block;
+import org.bukkit.entity.TNTPrimed;
+import org.bukkit.scheduler.BukkitTask;
+
+import java.util.*;
+
+public class TNTTracer {
+
+ private static BukkitTask task;
+ private static final Set printedLocs = new HashSet<>();
+ private static final Map> locations = new HashMap<>();
+ private static final World world = Bukkit.getWorlds().get(0);
+
+ static Status getStatus() {
+ return status;
+ }
+
+ private static Status status = Status.IDLE;
+
+ static void remove(TNTPrimed tnt){
+ switch (Core.getVersion()){
+ case 14:
+ TNTTracer_14.remove(locations, tnt);
+ break;
+ default:
+ TNTTracer_12.remove(locations, tnt);
+ }
+ }
+
+ public static void start(){
+ if(status == Status.RECORD)
+ return;
+ stop();
+ locations.clear();
+
+ status = Status.RECORD;
+ task = Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), TNTTracer::run, 1, 1);
+ }
+
+ public static int show(){
+ if(status == Status.SHOW)
+ return printedLocs.size();
+ stop();
+ status = Status.SHOW;
+
+ switch (Core.getVersion()){
+ case 14:
+ return TNTTracer_14.show(locations, printedLocs);
+ default:
+ return TNTTracer_12.show(locations, printedLocs);
+ }
+ }
+
+ public static void stop(){
+ status = Status.IDLE;
+ if(task != null)
+ task.cancel();
+
+ for(Location l : printedLocs){
+ Block b = world.getBlockAt(l);
+ if(airOrBrick(b))
+ b.setType(Material.AIR);
+ }
+ printedLocs.clear();
+ }
+
+ private static boolean airOrBrick(Block block){
+ switch(Core.getVersion()){
+ case 14:
+ return TNTTracer_14.airOrBrick(block);
+ default:
+ return TNTTracer_12.airOrBrick(block);
+ }
+ }
+
+ private static void run() {
+ for(TNTPrimed tnt : world.getEntitiesByClass(TNTPrimed.class)){
+ locations.computeIfAbsent(tnt, k -> new LinkedList<>()).add(tnt.getLocation());
+ }
+ }
+
+ enum Status{
+ RECORD,
+ SHOW,
+ IDLE
+ }
+
+}
diff --git a/src/de/steamwar/bausystem/world/Welt.java b/BauSystem_Main/src/de/steamwar/bausystem/world/Welt.java
similarity index 100%
rename from src/de/steamwar/bausystem/world/Welt.java
rename to BauSystem_Main/src/de/steamwar/bausystem/world/Welt.java
diff --git a/src/plugin.yml b/BauSystem_Main/src/plugin.yml
similarity index 100%
rename from src/plugin.yml
rename to BauSystem_Main/src/plugin.yml
diff --git a/pom.xml b/pom.xml
index 8aa7bdb..96bc0c3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,9 +4,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- de.steamwar
+ steamwar
BauSystem
1.0
+ pom
UTF-8
@@ -14,26 +15,17 @@
- maven
- https://steamwar.de/maven/
+ steamwar
+ https://steamwar.de:81/maven/
- src
-
-
- src
-
- **/*.java
- **/*.kt
-
-
-
org.apache.maven.plugins
maven-compiler-plugin
+ 3.6.1
8
@@ -42,13 +34,14 @@
+
+ BauSystem_12
+ BauSystem_14
+ BauSystem_Main
+ BauSystem_API
+
+
-
- steamwar
- Spigot
- 1.0
- provided
-
steamwar
SpigotCore
@@ -61,12 +54,6 @@
1.0
provided
-
- steamwar
- FAWE
- 1.0
- provided
-
steamwar
F3NPerm