diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/simulator/SimulatorPreview15.java b/BauSystem_15/src/de/steamwar/bausystem/features/simulator/SimulatorPreview15.java index 200f84ac..f3e38be3 100644 --- a/BauSystem_15/src/de/steamwar/bausystem/features/simulator/SimulatorPreview15.java +++ b/BauSystem_15/src/de/steamwar/bausystem/features/simulator/SimulatorPreview15.java @@ -25,6 +25,6 @@ public class SimulatorPreview15 implements SimulatorPreview { @Override public Record simulate(TNTSimulator tntSimulator) { - return new Record(false); + return new Record(null); } } diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator15.java b/BauSystem_15/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator15.java new file mode 100644 index 00000000..36c53f40 --- /dev/null +++ b/BauSystem_15/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator15.java @@ -0,0 +1,39 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ + +package de.steamwar.bausystem.features.tracer.record; + +import net.minecraft.server.v1_15_R1.EntityTNTPrimed; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; +import org.bukkit.entity.TNTPrimed; + +import java.util.stream.Stream; + +public class TNTPrimedIterator15 implements TNTPrimedIterator { + + private static final CraftWorld WORLD = (CraftWorld) Bukkit.getWorlds().get(0); + + @Override + public Stream iterator() { + return WORLD.getHandle().entitiesById.values().stream() + .filter(EntityTNTPrimed.class::isInstance) + .map(entity -> (TNTPrimed) entity.getBukkitEntity()); + } +} diff --git a/BauSystem_15/src/de/steamwar/bausystem/utils/NMSWrapper15.java b/BauSystem_15/src/de/steamwar/bausystem/utils/NMSWrapper15.java index 9111ee64..15756166 100644 --- a/BauSystem_15/src/de/steamwar/bausystem/utils/NMSWrapper15.java +++ b/BauSystem_15/src/de/steamwar/bausystem/utils/NMSWrapper15.java @@ -118,11 +118,6 @@ public class NMSWrapper15 implements NMSWrapper { ((CraftPlayer) player).getHandle().abilities.canInstantlyBuild = true; } - @Override - public Particle tntPositionParticle() { - return Particle.BARRIER; - } - @Override public Material pathMaterial() { return Material.GRASS_PATH; diff --git a/BauSystem_18/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator18.java b/BauSystem_18/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator18.java new file mode 100644 index 00000000..e6771471 --- /dev/null +++ b/BauSystem_18/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator18.java @@ -0,0 +1,41 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ + +package de.steamwar.bausystem.features.tracer.record; + +import net.minecraft.world.entity.item.EntityTNTPrimed; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_18_R2.CraftWorld; +import org.bukkit.entity.TNTPrimed; + +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +public class TNTPrimedIterator18 implements TNTPrimedIterator { + + private static final CraftWorld WORLD = (CraftWorld) Bukkit.getWorlds().get(0); + + @Override + public Stream iterator() { + return StreamSupport.stream(WORLD.getHandle().H().a().spliterator(), false) + .filter(EntityTNTPrimed.class::isInstance) + .map(entity -> (TNTPrimed) entity.getBukkitEntity()); + } +} + diff --git a/BauSystem_18/src/de/steamwar/bausystem/utils/NMSWrapper18.java b/BauSystem_18/src/de/steamwar/bausystem/utils/NMSWrapper18.java index 9b3878e9..4d14fc01 100644 --- a/BauSystem_18/src/de/steamwar/bausystem/utils/NMSWrapper18.java +++ b/BauSystem_18/src/de/steamwar/bausystem/utils/NMSWrapper18.java @@ -123,11 +123,6 @@ public class NMSWrapper18 implements NMSWrapper { ((CraftPlayer) player).getHandle().fs().e = true; } - @Override - public Particle tntPositionParticle() { - return Particle.BLOCK_MARKER; - } - @Override public Material pathMaterial() { return Material.DIRT_PATH; diff --git a/BauSystem_19/src/de/steamwar/bausystem/entities/TraceEntity19.java b/BauSystem_19/src/de/steamwar/bausystem/entities/TraceEntity19.java index c5e9b714..e70dba55 100644 --- a/BauSystem_19/src/de/steamwar/bausystem/entities/TraceEntity19.java +++ b/BauSystem_19/src/de/steamwar/bausystem/entities/TraceEntity19.java @@ -45,11 +45,11 @@ public class TraceEntity19 extends BaseEntity19 implements AbstractTraceEntity { public void display(Player player, boolean exploded, int ticks) { if (ticks != -1) { this.n(true); - this.a(IChatMutableComponent.a(new LiteralContents(ticks + ""))); + this.b(IChatMutableComponent.a(new LiteralContents(ticks + ""))); } if (!this.exploded && exploded) { this.n(true); - this.a(IChatMutableComponent.a(new LiteralContents("Bumm"))); + this.b(IChatMutableComponent.a(new LiteralContents("Bumm"))); this.exploded = true; if (referenceCounter.increment() > 0) { sendEntityDestroy(player); diff --git a/BauSystem_19/src/de/steamwar/bausystem/features/simulator/SimulatorPreview19.java b/BauSystem_19/src/de/steamwar/bausystem/features/simulator/SimulatorPreview19.java index 34a0b9ea..5a06c342 100644 --- a/BauSystem_19/src/de/steamwar/bausystem/features/simulator/SimulatorPreview19.java +++ b/BauSystem_19/src/de/steamwar/bausystem/features/simulator/SimulatorPreview19.java @@ -39,7 +39,7 @@ public class SimulatorPreview19 implements SimulatorPreview { @Override public Record simulate(TNTSimulator tntSimulator) { if (true) { - return new Record(false); + return new Record(null); } Map>>> result = new HashMap<>(); @@ -66,11 +66,11 @@ public class SimulatorPreview19 implements SimulatorPreview { } }); if (tntCount.get() > 500) { - return new Record(false); + return new Record(null); } List fakeTNT19s = new ArrayList<>(); - Record record = new Record(false); + Record record = new Record(null); Map tntRecords = new HashMap<>(); int maxTickToCalc = maxTick.get() + 160; @@ -120,11 +120,11 @@ public class SimulatorPreview19 implements SimulatorPreview { fakeTNT19.k(spawnList); TNTPrimed tntPrimed = ((TNTPrimed) (fakeTNT19.getBukkitEntity())); if (tntPrimed.getFuseTicks() <= 0) { - tntRecords.computeIfAbsent(fakeTNT19, ignore -> record.spawn()).explode(tntPrimed); + tntRecords.computeIfAbsent(fakeTNT19, ignore -> record.spawn(0)).explode(tntPrimed); fakeTNT19s.remove(i); i--; } else { - tntRecords.computeIfAbsent(fakeTNT19, ignore -> record.spawn()).explode(tntPrimed); + tntRecords.computeIfAbsent(fakeTNT19, ignore -> record.spawn(0)).explode(tntPrimed); } if (!spawnList.isEmpty()) { fakeTNT19s.addAll(i, spawnList); diff --git a/BauSystem_19/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator19.java b/BauSystem_19/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator19.java new file mode 100644 index 00000000..b56e04b3 --- /dev/null +++ b/BauSystem_19/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator19.java @@ -0,0 +1,41 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ + +package de.steamwar.bausystem.features.tracer.record; + +import net.minecraft.world.entity.item.EntityTNTPrimed; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_19_R1.CraftWorld; +import org.bukkit.entity.TNTPrimed; + +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +public class TNTPrimedIterator19 implements TNTPrimedIterator { + + private static final CraftWorld WORLD = (CraftWorld) Bukkit.getWorlds().get(0); + + @Override + public Stream iterator() { + return StreamSupport.stream(WORLD.getHandle().F().a().spliterator(), false) + .filter(EntityTNTPrimed.class::isInstance) + .map(entity -> (TNTPrimed) entity.getBukkitEntity()); + } +} + diff --git a/BauSystem_19/src/de/steamwar/bausystem/utils/NMSWrapper19.java b/BauSystem_19/src/de/steamwar/bausystem/utils/NMSWrapper19.java index 4424f100..4d184f6f 100644 --- a/BauSystem_19/src/de/steamwar/bausystem/utils/NMSWrapper19.java +++ b/BauSystem_19/src/de/steamwar/bausystem/utils/NMSWrapper19.java @@ -123,11 +123,6 @@ public class NMSWrapper19 implements NMSWrapper { ((CraftPlayer) player).getHandle().fB().e = true; } - @Override - public Particle tntPositionParticle() { - return Particle.BLOCK_MARKER; - } - @Override public Material pathMaterial() { return Material.DIRT_PATH; diff --git a/BauSystem_Linkage/build.gradle b/BauSystem_Linkage/build.gradle index 486cb7c7..2169557f 100644 --- a/BauSystem_Linkage/build.gradle +++ b/BauSystem_Linkage/build.gradle @@ -43,27 +43,5 @@ sourceSets { } dependencies { - compileOnly 'org.projectlombok:lombok:1.18.22' - testCompileOnly 'org.projectlombok:lombok:1.18.22' - annotationProcessor 'org.projectlombok:lombok:1.18.22' - testAnnotationProcessor 'org.projectlombok:lombok:1.18.22' - - implementation 'org.atteo.classindex:classindex:3.11' - testImplementation 'org.atteo.classindex:classindex:3.11' - annotationProcessor 'org.atteo.classindex:classindex:3.11' - testAnnotationProcessor 'org.atteo.classindex:classindex:3.11' + compileOnly swdep('SpigotCore') } - -task buildResources { - doLast { - File from = new File("${buildDir}/classes/java/main/META-INF/annotations/de.steamwar.bausystem.linkage.ProcessorImplementation") - File to = new File("${buildDir}/classes/java/main/META-INF/services/javax.annotation.processing.Processor") - to.delete() - to.parentFile.mkdirs() - to.createNewFile() - for (String s : from.readLines()) { - to.append(s + "\n") - } - } -} -classes.finalizedBy(buildResources) \ No newline at end of file diff --git a/BauSystem_Linkage/src/de/steamwar/bausystem/linkage/LinkageProcessor.java b/BauSystem_Linkage/src/de/steamwar/bausystem/linkage/LinkageProcessor.java deleted file mode 100644 index deb7bce7..00000000 --- a/BauSystem_Linkage/src/de/steamwar/bausystem/linkage/LinkageProcessor.java +++ /dev/null @@ -1,265 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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 . - */ - -package de.steamwar.bausystem.linkage; - -import lombok.SneakyThrows; - -import javax.annotation.processing.*; -import javax.lang.model.SourceVersion; -import javax.lang.model.element.*; -import javax.lang.model.type.DeclaredType; -import javax.tools.Diagnostic; -import java.io.Writer; -import java.util.*; -import java.util.stream.Collectors; - -@ProcessorImplementation -@SupportedAnnotationTypes("de.steamwar.bausystem.linkage.Linked") -public class LinkageProcessor extends AbstractProcessor { - - private Messager messager; - private Writer writer; - private boolean processed = false; - - @Override - public SourceVersion getSupportedSourceVersion() { - return SourceVersion.latestSupported(); - } - - @SneakyThrows - @Override - public synchronized void init(ProcessingEnvironment processingEnv) { - super.init(processingEnv); - writer = processingEnv.getFiler().createSourceFile("de.steamwar.bausystem.linkage.LinkageUtils").openWriter(); - messager = processingEnv.getMessager(); - } - - @SneakyThrows - @Override - public boolean process(Set annotations, RoundEnvironment roundEnv) { - if (processed) return false; - processed = true; - List fields = new ArrayList<>(); - Map> linkLines = new HashMap<>(); - List staticLines = new ArrayList<>(); - - Set elements = roundEnv.getElementsAnnotatedWith(Linked.class); - elements.addAll((Set)roundEnv.getElementsAnnotatedWith(Linked.Linkages.class)); - - Map neededFields = new HashMap<>(); - for (Element element : elements) { - if (element.getKind() != ElementKind.CLASS) { - continue; - } - TypeElement typeElement = (TypeElement) element; - Linked[] linkeds = element.getAnnotationsByType(Linked.class); - if (linkeds.length == 0) { - continue; - } - - if (linkeds.length > 1) { - neededFields.put(typeElement.getQualifiedName().toString(), typeElement); - } - - List variableElements = typeElement.getEnclosedElements().stream().filter(e -> e.getKind() == ElementKind.FIELD).map(VariableElement.class::cast).filter(e -> { - return e.getAnnotation(LinkedInstance.class) != null; - }).collect(Collectors.toList()); - if (variableElements.isEmpty()) { - continue; - } - - for (VariableElement variableElement : variableElements) { - if (!variableElement.getModifiers().contains(Modifier.PUBLIC)) { - messager.printMessage(Diagnostic.Kind.ERROR, "Field " + variableElement.getSimpleName() + " must be public", variableElement); - continue; - } - if (variableElement.getModifiers().contains(Modifier.STATIC)) { - messager.printMessage(Diagnostic.Kind.ERROR, "Field " + variableElement.getSimpleName() + " must be non static", variableElement); - continue; - } - if (variableElement.getModifiers().contains(Modifier.FINAL)) { - messager.printMessage(Diagnostic.Kind.ERROR, "Field " + variableElement.getSimpleName() + " must be non final", variableElement); - continue; - } - neededFields.put(typeElement.getQualifiedName().toString(), typeElement); - TypeElement fieldType = (TypeElement) ((DeclaredType) variableElement.asType()).asElement(); - neededFields.put(fieldType.getQualifiedName().toString(), fieldType); - - System.out.println(getElement(typeElement, neededFields) + "." + variableElement.getSimpleName().toString() + " = " + getElement((TypeElement) ((DeclaredType) variableElement.asType()).asElement(), neededFields)); - staticLines.add(getElement(typeElement, neededFields) + "." + variableElement.getSimpleName().toString() + " = " + getElement((TypeElement) ((DeclaredType) variableElement.asType()).asElement(), neededFields)); - } - } - neededFields.forEach((s, typeElement) -> { - fields.add(typeElement.getQualifiedName().toString() + " " + typeElement.getSimpleName().toString()); - }); - - Map eventClasses = new HashMap<>(); - Map> eventMethods = new HashMap<>(); - for (Element element : elements) { - if (element.getKind() != ElementKind.CLASS) { - continue; - } - TypeElement typeElement = (TypeElement) element; - - typeElement.getEnclosedElements().stream().filter(e -> e.getKind() == ElementKind.METHOD).map(ExecutableElement.class::cast).filter(e -> { - return e.getAnnotationMirrors().stream().anyMatch(annotationMirror -> { - return annotationMirror.getAnnotationType().asElement().getSimpleName().toString().equals("EventHandler"); - }); - }).forEach(e -> { - TypeElement current = ((TypeElement)((DeclaredType) e.getParameters().get(0).asType()).asElement()); - eventClasses.put(current.getQualifiedName().toString(), current); - eventMethods.computeIfAbsent(typeElement, k -> new HashMap<>()).put(current, e); - }); - } - if (!eventMethods.isEmpty()) { - List eventLines = new ArrayList<>(); - linkLines.put(LinkageType.LISTENER, eventLines); - eventClasses.forEach((s, typeElement) -> { - eventLines.add("handlerList" + typeElement.getSimpleName().toString() + " = " + typeElement.getQualifiedName().toString() + ".getHandlerList()"); - }); - eventLines.add(""); - eventMethods.forEach((typeElement, map) -> { - String instance = "local" + typeElement.getSimpleName().toString(); - eventLines.add(typeElement.getQualifiedName().toString() + " " + instance + " = " + getElement(typeElement, neededFields)); - map.forEach((typeElement1, executableElement) -> { - AnnotationMirror eventHandler = executableElement.getAnnotationMirrors().stream().filter(annotationMirror -> annotationMirror.getAnnotationType().asElement().getSimpleName().toString().equals("EventHandler")).findFirst().orElse(null); - if (eventHandler == null) { - return; - } - String priority = "NORMAL"; - String ignoreCancelled = "false"; - for (Map.Entry entry : eventHandler.getElementValues().entrySet()) { - if (entry.getKey().getSimpleName().toString().equals("priority")) { - priority = entry.getValue().getValue().toString(); - } else if (entry.getKey().getSimpleName().toString().equals("ignoreCancelled")) { - ignoreCancelled = entry.getValue().getValue().toString(); - } - } - eventLines.add(typeElement1.getSimpleName().toString() + "(" + instance + ", " + instance + "::" + executableElement.getSimpleName().toString() + ", org.bukkit.event.EventPriority." + priority + ", " + ignoreCancelled + ")"); - }); - }); - } - - for (Element element : elements) { - if (element.getKind() != ElementKind.CLASS) { - continue; - } - TypeElement typeElement = (TypeElement) element; - Linked[] linkeds = element.getAnnotationsByType(Linked.class); - if (linkeds.length == 0) { - continue; - } - MinVersion minVersion = element.getAnnotation(MinVersion.class); - - System.out.println("Found element: " + typeElement.getQualifiedName().toString()); - - Arrays.stream(linkeds).map(Linked::value).forEach(linkageType -> { - if (linkageType.toRun == null) return; - if (linkageType.className != null) { - if (!typeElement.getSuperclass().toString().equals(linkageType.className)) { - return; - } - } - if (linkageType.interfaceName != null) { - if (typeElement.getInterfaces().stream().noneMatch(i -> i.toString().equals(linkageType.interfaceName))) { - return; - } - } - List strings = linkLines.computeIfAbsent(linkageType, ignore -> new ArrayList<>()); - if (minVersion != null) { - strings.add("if (de.steamwar.core.Core.getVersion() >= " + minVersion.value() + ") {"); - strings.add(" " + linkageType.toRun.replace("$", getElement(typeElement, neededFields))); - strings.add("}"); - } else { - strings.add(linkageType.toRun.replace("$", getElement(typeElement, neededFields))); - } - }); - } - - writer.write("package de.steamwar.bausystem.linkage;\n\n"); - writer.write("public class LinkageUtils {\n"); - for (String s : fields) { - writer.write(" private static " + s + ";\n"); - } - writer.write("\n"); - for (Map.Entry entry : neededFields.entrySet()) { - String field = entry.getValue().getSimpleName().toString(); - writer.write(" public static " + entry.getValue().getQualifiedName().toString() + " " + field + "() {\n"); - writer.write(" if (" + field + " == null) {\n"); - writer.write(" " + field + " = new " + entry.getValue().getQualifiedName().toString() + "();\n"); - writer.write(" }\n"); - writer.write(" return " + field + ";\n"); - writer.write(" }\n"); - writer.write("\n"); - } - writer.write(" private static final java.util.Set LINKED = new java.util.HashSet<>();\n"); - writer.write("\n"); - writer.write(" static {\n"); - for (String s : staticLines) { - writer.write(" " + s + ";\n"); - } - writer.write(" }\n"); - writer.write("\n"); - writer.write(" public static void run(de.steamwar.bausystem.linkage.LinkageType link) {\n"); - writer.write(" if (!LINKED.add(link)) return;\n"); - writer.write(" switch (link) {\n"); - for (LinkageType type : linkLines.keySet()) { - writer.write(" case " + type.name() + ":\n"); - writer.write(" " + type + "();\n"); - writer.write(" break;\n"); - } - writer.write(" default:\n"); - writer.write(" break;\n"); - writer.write(" }\n"); - writer.write(" }\n"); - writer.write("\n"); - for (Map.Entry> entry : linkLines.entrySet()) { - writer.write(" private static void " + entry.getKey() + "() {\n"); - for (String s : entry.getValue()) { - writer.write(" " + s + ";\n"); - } - writer.write(" }\n"); - writer.write("\n"); - } - for (Map.Entry entry : eventClasses.entrySet()) { - writer.write(" private static org.bukkit.event.HandlerList handlerList" + entry.getValue().getSimpleName().toString() + ";\n"); - writer.write(" private static void " + entry.getValue().getSimpleName().toString() + "(org.bukkit.event.Listener listener, java.util.function.Consumer<" + entry.getKey() + "> consumer, org.bukkit.event.EventPriority eventPriority, boolean ignoreCancelled) {\n"); - writer.write(" org.bukkit.plugin.EventExecutor eventExecutor = (l, event) -> {\n"); - writer.write(" if (event instanceof " + entry.getKey() + ") {\n"); - writer.write(" consumer.accept((" + entry.getKey() + ") event);\n"); - writer.write(" }\n"); - writer.write(" };\n"); - writer.write(" handlerList" + entry.getValue().getSimpleName() + ".register(new org.bukkit.plugin.RegisteredListener(listener, eventExecutor, eventPriority, de.steamwar.bausystem.BauSystem.getInstance(), ignoreCancelled));\n"); - writer.write(" }\n"); - writer.write("\n"); - } - writer.write("}\n"); - writer.flush(); - writer.close(); - return true; - } - - private String getElement(TypeElement typeElement, Map neededFields) { - if (neededFields.containsKey(typeElement.getQualifiedName().toString())) { - return typeElement.getSimpleName().toString() + "()"; - } - return "new " + typeElement.getQualifiedName().toString() + "()"; - } -} diff --git a/BauSystem_Linkage/src/de/steamwar/bausystem/linkage/LinkageType.java b/BauSystem_Linkage/src/de/steamwar/bausystem/linkage/LinkageType.java deleted file mode 100644 index dbb78910..00000000 --- a/BauSystem_Linkage/src/de/steamwar/bausystem/linkage/LinkageType.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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 . - */ - -package de.steamwar.bausystem.linkage; - -public enum LinkageType { - - // NORMAL - COMMAND("$.setMessage(de.steamwar.bausystem.BauSystem.MESSAGE)", "de.steamwar.command.SWCommand"), - ENABLE_LINK("$.enable()", null, "de.steamwar.bausystem.linkage.Enable"), - DISABLE_LINK("$.disable()", null, "de.steamwar.bausystem.linkage.Disable"), - PLAIN("$", null), - LISTENER(), // Is handled internally from LinkageProcessor - UNLINK_LISTENER("org.bukkit.event.HandlerList.unregisterAll($)", null, "org.bukkit.event.Listener"), - - // SPECIFIC - BAU_GUI_ITEM("de.steamwar.bausystem.features.gui.BauGUI.addItem($)", "de.steamwar.bausystem.linkage.specific.BauGuiItem"), - SCRIPT_COMMAND("de.steamwar.bausystem.features.script.ScriptExecutor.SPECIAL_COMMANDS.add($)", null, "de.steamwar.bausystem.features.script.SpecialCommand"), - CONFIG_CONVERTER("de.steamwar.bausystem.configplayer.Config.addConfigConverter($)", null, "de.steamwar.bausystem.configplayer.ConfigConverter"), - SCOREBOARD(null, null, "de.steamwar.bausystem.linkage.specific.ScoreboardItem"), - PANZERN("de.steamwar.bausystem.features.slaves.panzern.Panzern.add($)", null, "de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm"), - SMART_PLACE("de.steamwar.bausystem.features.smartplace.SmartPlaceListener.add($)", null, "de.steamwar.bausystem.features.smartplace.SmartPlaceBehaviour"); - - String toRun = null; - String className = null; - String interfaceName = null; - - LinkageType() { - } - - LinkageType(String toRun, String className) { - this.toRun = toRun; - this.className = className; - } - - LinkageType(String toRun, String className, String interfaceName) { - this.toRun = toRun; - this.className = className; - this.interfaceName = interfaceName; - } -} \ No newline at end of file diff --git a/BauSystem_Linkage/src/de/steamwar/bausystem/linkage/ProcessorImplementation.java b/BauSystem_Linkage/src/de/steamwar/bausystem/linkage/ProcessorImplementation.java deleted file mode 100644 index 96cae2d3..00000000 --- a/BauSystem_Linkage/src/de/steamwar/bausystem/linkage/ProcessorImplementation.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2019,2020,2021 yoyosource - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.steamwar.bausystem.linkage; - -import org.atteo.classindex.IndexAnnotated; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@IndexAnnotated -@Retention(RetentionPolicy.CLASS) -@Target({ElementType.TYPE}) -public @interface ProcessorImplementation { -} diff --git a/BauSystem_Linkage/src/de/steamwar/linkage/types/BauGuiItem_GENERIC.java b/BauSystem_Linkage/src/de/steamwar/linkage/types/BauGuiItem_GENERIC.java new file mode 100644 index 00000000..160a7ca3 --- /dev/null +++ b/BauSystem_Linkage/src/de/steamwar/linkage/types/BauGuiItem_GENERIC.java @@ -0,0 +1,40 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ + +package de.steamwar.linkage.types; + +import de.steamwar.linkage.LinkageType; +import de.steamwar.linkage.plan.BuildPlan; +import de.steamwar.linkage.plan.MethodBuilder; + +import javax.lang.model.element.TypeElement; + +public class BauGuiItem_GENERIC implements LinkageType { + + @Override + public String method() { + return "linkGUIItems"; + } + + @Override + public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) { + buildPlan.addImport("de.steamwar.bausystem.features.gui.BauGUI"); + methodBuilder.addLine("BauGUI.addItem(" + s + ");"); + } +} diff --git a/BauSystem_Linkage/src/de/steamwar/bausystem/linkage/Linked.java b/BauSystem_Linkage/src/de/steamwar/linkage/types/BoundingBoxLoader_GENERIC.java similarity index 56% rename from BauSystem_Linkage/src/de/steamwar/bausystem/linkage/Linked.java rename to BauSystem_Linkage/src/de/steamwar/linkage/types/BoundingBoxLoader_GENERIC.java index 2096d1ac..a86d0cc5 100644 --- a/BauSystem_Linkage/src/de/steamwar/bausystem/linkage/Linked.java +++ b/BauSystem_Linkage/src/de/steamwar/linkage/types/BoundingBoxLoader_GENERIC.java @@ -1,7 +1,7 @@ /* * This file is a part of the SteamWar software. * - * Copyright (C) 2021 SteamWar.de-Serverteam + * Copyright (C) 2022 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 @@ -17,22 +17,23 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.linkage; +package de.steamwar.linkage.types; -import org.atteo.classindex.IndexAnnotated; +import de.steamwar.linkage.LinkageType; +import de.steamwar.linkage.plan.BuildPlan; +import de.steamwar.linkage.plan.MethodBuilder; -import java.lang.annotation.*; +import javax.lang.model.element.TypeElement; -@IndexAnnotated -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.TYPE}) -@Repeatable(Linked.Linkages.class) -public @interface Linked { - LinkageType value(); +public class BoundingBoxLoader_GENERIC implements LinkageType { - @Retention(RetentionPolicy.RUNTIME) - @Target({ElementType.TYPE}) - @interface Linkages { - @SuppressWarnings("unused") Linked[] value() default {}; + @Override + public String method() { + return "linkBoundingBox"; } -} \ No newline at end of file + + @Override + public void generateCode(BuildPlan buildPlan, MethodBuilder method, String instance, TypeElement typeElement) { + method.addLine(instance + ".load();"); + } +} diff --git a/BauSystem_Linkage/src/de/steamwar/linkage/types/ConfigConverter_GENERIC.java b/BauSystem_Linkage/src/de/steamwar/linkage/types/ConfigConverter_GENERIC.java new file mode 100644 index 00000000..58db84e7 --- /dev/null +++ b/BauSystem_Linkage/src/de/steamwar/linkage/types/ConfigConverter_GENERIC.java @@ -0,0 +1,40 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ + +package de.steamwar.linkage.types; + +import de.steamwar.linkage.LinkageType; +import de.steamwar.linkage.plan.BuildPlan; +import de.steamwar.linkage.plan.MethodBuilder; + +import javax.lang.model.element.TypeElement; + +public class ConfigConverter_GENERIC implements LinkageType { + + @Override + public String method() { + return "link"; + } + + @Override + public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) { + buildPlan.addImport("de.steamwar.bausystem.configplayer.Config"); + methodBuilder.addLine("Config.addConfigConverter(" + s + ");"); + } +} diff --git a/BauSystem_Linkage/src/de/steamwar/linkage/types/PanzernAlgorithm_GENERIC.java b/BauSystem_Linkage/src/de/steamwar/linkage/types/PanzernAlgorithm_GENERIC.java new file mode 100644 index 00000000..bf701923 --- /dev/null +++ b/BauSystem_Linkage/src/de/steamwar/linkage/types/PanzernAlgorithm_GENERIC.java @@ -0,0 +1,40 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ + +package de.steamwar.linkage.types; + +import de.steamwar.linkage.LinkageType; +import de.steamwar.linkage.plan.BuildPlan; +import de.steamwar.linkage.plan.MethodBuilder; + +import javax.lang.model.element.TypeElement; + +public class PanzernAlgorithm_GENERIC implements LinkageType { + + @Override + public String method() { + return "linkPanzern"; + } + + @Override + public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) { + buildPlan.addImport("de.steamwar.bausystem.features.slaves.panzern.Panzern"); + methodBuilder.addLine("Panzern.add(" + s + ");"); + } +} diff --git a/BauSystem_Linkage/src/de/steamwar/linkage/types/SmartPlaceBehaviour_GENERIC.java b/BauSystem_Linkage/src/de/steamwar/linkage/types/SmartPlaceBehaviour_GENERIC.java new file mode 100644 index 00000000..0f50ac45 --- /dev/null +++ b/BauSystem_Linkage/src/de/steamwar/linkage/types/SmartPlaceBehaviour_GENERIC.java @@ -0,0 +1,40 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ + +package de.steamwar.linkage.types; + +import de.steamwar.linkage.LinkageType; +import de.steamwar.linkage.plan.BuildPlan; +import de.steamwar.linkage.plan.MethodBuilder; + +import javax.lang.model.element.TypeElement; + +public class SmartPlaceBehaviour_GENERIC implements LinkageType { + + @Override + public String method() { + return "linkSmartPlace"; + } + + @Override + public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) { + buildPlan.addImport("de.steamwar.bausystem.features.smartplace.SmartPlaceListener"); + methodBuilder.addLine("SmartPlaceListener.add(" + s + ");"); + } +} diff --git a/BauSystem_Linkage/src/de/steamwar/linkage/types/SpecialCommand_GENERIC.java b/BauSystem_Linkage/src/de/steamwar/linkage/types/SpecialCommand_GENERIC.java new file mode 100644 index 00000000..97c63276 --- /dev/null +++ b/BauSystem_Linkage/src/de/steamwar/linkage/types/SpecialCommand_GENERIC.java @@ -0,0 +1,40 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ + +package de.steamwar.linkage.types; + +import de.steamwar.linkage.LinkageType; +import de.steamwar.linkage.plan.BuildPlan; +import de.steamwar.linkage.plan.MethodBuilder; + +import javax.lang.model.element.TypeElement; + +public class SpecialCommand_GENERIC implements LinkageType { + + @Override + public String method() { + return "linkScriptCommands"; + } + + @Override + public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) { + buildPlan.addImport("de.steamwar.bausystem.features.script.ScriptExecutor"); + methodBuilder.addLine("ScriptExecutor.SPECIAL_COMMANDS.add(" + s + ");"); + } +} diff --git a/BauSystem_Main/build.gradle b/BauSystem_Main/build.gradle index 713bb47b..3f4576bc 100644 --- a/BauSystem_Main/build.gradle +++ b/BauSystem_Main/build.gradle @@ -51,11 +51,6 @@ dependencies { annotationProcessor 'org.projectlombok:lombok:1.18.22' testAnnotationProcessor 'org.projectlombok:lombok:1.18.22' - implementation 'org.atteo.classindex:classindex:3.11' - testImplementation 'org.atteo.classindex:classindex:3.11' - annotationProcessor 'org.atteo.classindex:classindex:3.11' - testAnnotationProcessor 'org.atteo.classindex:classindex:3.11' - implementation project(":BauSystem_Linkage") annotationProcessor project(":BauSystem_Linkage") @@ -66,4 +61,5 @@ dependencies { compileOnly swdep('Spigot-1.19') compileOnly swdep('WorldEdit-1.15') compileOnly swdep('SpigotCore') + annotationProcessor swdep('SpigotCore') } diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index ca7b8228..903ebb5a 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -681,33 +681,37 @@ TPSLIMIT_INVALID_FROZEN = §c and '0' # Trace TRACE_RECORD=§aon -TRACE_RECORD_AUTO=§aon -TRACE_RECORD_SINGLE=§aon TRACE_IDLE=§coff -TRACE_IDLE_AUTO=§eauto TRACE_IDLE_SINGLE=§esingle -TRACE_MESSAGE_AUTO_RECORD=§cTNT-Tracer must be stopped -TRACE_MESSAGE_AUTO_RECORD_AUTO=§cTNT-Tracer is not allowed to record -TRACE_MESSAGE_AUTO_IDLE=§cAuto-Tracer stopped -TRACE_MESSAGE_AUTO_IDLE_AUTO = §aAuto-Tracer started +TRACE_IDLE_AUTO_EXPLODE=§eauto §8(§7explode§8) +TRACE_IDLE_AUTO_IGNITE=§eauto §8(§7ignite§8) +TRACE_MESSAGE_AUTO_IDLE_EXPLODE = §aAuto-Tracer explode started +TRACE_MESSAGE_AUTO_IDLE_IGNITE = §aAuto-Tracer ignite started TRACE_MESSAGE_START = §aTNT-Tracer started TRACE_MESSAGE_SINGLE = §aSingle-Tracer started TRACE_MESSAGE_STOP = §cTNT-Tracer stopped TRACE_MESSAGE_DELETE = §cAll TNT-positions deleted TRACE_MESSAGE_SHOW = §aAll TNT-positions shown TRACE_MESSAGE_HIDE = §cAll TNT-positions hidden +TRACE_MESSAGE_ISOLATE = §aTNT-positions isolated +TRACE_MESSAGE_UNISOLATE = §cTNT-positions hidden +TRACE_MESSAGE_CLICK_ISOLATE = §eClick to §aisolate§8/§cunisolate TRACE_MESSAGE_DISALLOWED = §cYou are not allowed to use the TNT-Tracer here +TRACE_MESSAGE_NO_REGION = §cYou are not in a region TRACE_COMMAND_HELP_START = §8/§etrace start §8- §7Starts recording of all TNT-positions TRACE_COMMAND_HELP_SINGLE = §8/§etrace single §8- §7Starts a single recording of all TNT-positions TRACE_COMMAND_HELP_STOP = §8/§etrace stop §8- §7Stops the TNT-Tracer TRACE_COMMAND_HELP_AUTO = §8/§etrace toggleauto §8- §7Automatic start of recording -TRACE_COMMAND_HELP_SHOW_GUI = §8/§etrace show gui §8- §7Shows the trace GUI TRACE_COMMAND_HELP_SHOW = §8/§etrace show §8<§eParameter§8> - §7Shows all TNT-positions TRACE_COMMAND_HELP_HIDE = §8/§etrace hide §8- §7Hides all TNT-positions TRACE_COMMAND_HELP_DELETE = §8/§etrace delete §8- §7Deletes all TNT-positions -TRACE_COMMAND_HELP_LIST = §8/§etrace list §8- §7Trace GUI but in the Chat TRACE_COMMAND_HELP_GUI = §8/§etrace gui §8- §7Shows the Trace GUI +TRACE_COMMAND_HELP_REPLAY = §8/§etrace replay §8[§7tick§8] §8- §7Replays your recording +TRACE_COMMAND_HELP_REPLAY_DISABLE = §8/§etrace replay disable §8- §7Stops the replay +TRACE_COMMAND_HELP_REPLAY_NEXT = §8/§etrace replay next §8[§7step§8] §8- §7Jump one§8/§7step tick forward +TRACE_COMMAND_HELP_REPLAY_PREVIOUS = §8/§etrace replay previous §8[§7step§8] §8- §7Jump one§8/§7step tick back +TRACE_COMMAND_HELP_REPLAY_LOOP = §8/§etrace replay loop §8<§7start§8> §8<§7end§8> §8[§7speed§8] §8- §7Loop the replay TRACE_GUI_ITEM_NAME = §eTracer TRACE_GUI_ITEM_LORE = §7Status§8: {0} @@ -717,22 +721,8 @@ TRACE_GUI_TRACE_ACTIVE = §eStop Tracer TRACE_GUI_TRACE_ACTIVE_AUTO = §eAuto-Trace is active TRACE_GUI_AUTO_TRACE_INACTIVE = §eacitvate Auto-Tracer TRACE_GUI_AUTO_TRACE_ACTIVE = §edeactivate Auto-Tracer -TRACE_GUI_SHOW_GUI = §eTrace Show Gui TRACE_GUI_DELETE = §eDelete trace -TRACE_SHOW_GUI_TITLE = Trace Show GUI -TRACE_SHOW_GUI_SHOWN = §aTraces shown -TRACE_SHOW_GUI_HIDDEN = §cTraces hidden -TRACE_SHOW_GUI_WATER_ITEM = §eWater §7positions -TRACE_SHOW_GUI_WATER_LORE1 = §7Shows all TNT which -TRACE_SHOW_GUI_WATER_LORE2 = §7exploded in water. -TRACE_SHOW_GUI_INTERPOLATE_Y_ITEM = §eInterpolation §7Y-Axis -TRACE_SHOW_GUI_INTERPOLATE_Y_LORE1 = §7Shows the interpolation -TRACE_SHOW_GUI_INTERPOLATE_Y_LORE2 = §7on the Y-Axis. -TRACE_SHOW_GUI_INTERPOLATE_XZ_ITEM = §eInterpolation §7XZ-Achsis -TRACE_SHOW_GUI_INTERPOLATE_XZ_LORE1 = §7Shows the interpolation -TRACE_SHOW_GUI_INTERPOLATE_XZ_LORE2 = §7ont the XZ-Achsis. - TRACE_GUI_TITLE = Trace GUI TRACE_GUI_ITEM_BACK = §eBack TRACE_GUI_ITEM = §eTrace §8- §e{0} §7TNT @@ -743,29 +733,9 @@ TRACE_GUI_POSITION_ITEM = §ePosition TRACE_GUI_POSITION_X = §7X§8: §e{0} TRACE_GUI_POSITION_Y = §7Y§8: §e{0} TRACE_GUI_POSITION_Z = §7Z§8: §e{0} +TRACE_GUI_POSITION_SOURCE = §7Source§8: §e{0} TRACE_GUI_POSITION_EXPLODED = §7Exploded§8: §e{0} -TRACE_RECORD_LIST_ELEMENT = §eTrace §8- §e{0} §7TNT -TRACE_RECORD_LIST_ELEMENT_HOVER = §7Shows all §eTNT §7from this trace -TRACE_RECORD_LIST_ELEMENT_DELETE = §7 §cDelete -TRACE_RECORD_LIST_ELEMENT_DELETE_HOVER = §cDelete §7trace -TRACE_RECORD_DELETE = §7Trace deleted -TRACE_RECORD_NOT_FOUND = §7Unknown trace -TRACE_RECORD_ELEMENT = §eTNT §8- §e{0} §7Positions -TRACE_RECORD_ELEMENT_HOVER = §7Shows all §ePositions §7from this TNT -TRACE_RECORD_ELEMENT_DELETE = §7 §cDelete -TRACE_RECORD_ELEMENT_DELETE_HOVER = §cDelete §7trace -TRACE_RECORD_TNT_NOT_FOUND = §7Unknown TNT -TRACE_TNT_ELEMENT = §ePosition §8- §e{0} §7FuseTicks -TRACE_TNT_DELETE = §7TNT deleted -TRACE_TNT_ELEMENT_HOVER = §7Shows information on the §ePosition -TRACE_RECORD_TNT_POSITION_NOT_FOUND = §7Unknown TNT Position -TRACE_CHAT_POSITION_HEAD = §ePosition -TRACE_CHAT_POSITION_X = §7X§8: §e{0} -TRACE_CHAT_POSITION_Y = §7Y§8: §e{0} -TRACE_CHAT_POSITION_Z = §7Z§8: §e{0} -TRACE_CHAT_POSITION_EXPLODED = §7Exploded§8: §e{0} - # Loader LOADER_OFF = §coff LOADER_SETUP = §eSetup @@ -948,6 +918,7 @@ MATERIAL_SEARCH_INTERACTEABLE=§eInteractable MATERIAL_SEARCH_FLAMMABLE=§eFlammable MATERIAL_SEARCH_BURNABLE=§eBurnable MATERIAL_SEARCH_WATERLOGGABLE=§eWaterloggable +MATERIAL_SEARCH_UNMOVEABLE=§eUnmoveable MATERIAL_SEARCH_BLASTRESISTANCE=§eBlast resistance MATERIAL_SEARCH_VALUE=§8: §e{0} MATERIAL_BLAST_RESISTANCE=§8- §eBlast resistance§8: §7{0} @@ -962,6 +933,7 @@ MATERIAL_INTERACTABLE=§8- §eInteractable block MATERIAL_FLAMMABLE=§8- §eFlammable block MATERIAL_BURNABLE=§8- §eBurnable block MATERIAL_WATERLOGGABLE=§8- §eWaterloggable block +MATERIAL_UNMOVABLE=§8- §eUnmovable block # Redstonetester RT_HELP=§8/§eredstonetester §8-§7 Gives you the redstone tester RT_GIVEN=§7Measure the time between activation of components @@ -1103,11 +1075,7 @@ LAUFBAU_NO_PERM = §cYou are not allowed to use the barrel building system here LAUFBAU_NO_WORLDEDIT = §cYou don't have a WorldEdit selection LAUFBAU_STATE_FILTERING_TRACES = Filtering traces LAUFBAU_STATE_PROCESSING_TRACES = Connnecting traces -LAUFBAU_STATE_EXPANDING_TRACES = Expanding traces -LAUFBAU_STATE_SPLITTING_POINTS = Splitting points -LAUFBAU_STATE_SHRINKING_POINTS = Shrinking points -LAUFBAU_STATE_CREATING_INNER_BLOCKS = Creating inner blocks -LAUFBAU_STATE_CREATING_OUTER_BLOCKS = Creating outer blocks +LAUFBAU_STATE_CREATE_LAUF = Create Barrel LAUFBAU_SIMPLE_PROGRESS = §e{0}§8: §e{1}§8/§e{2} §7Time left§8: §e{3} LAUFBAU_DONE = §aDone @@ -1247,6 +1215,7 @@ TNT_CLICK_VELOCITY_X = §7Velocity §eX§8: §e{0} TNT_CLICK_VELOCITY_Y = §7Velocity §eY§8: §e{0} TNT_CLICK_VELOCITY_Z = §7Velocity §eZ§8: §e{0} TNT_CLICK_COUNT = §7Count §8: §e{0} +TNT_CLICK_ISOLATE = §eIsolate SELECT_ITEM_CHOOSE_EXTENSION = Choose extension SELECT_ITEM_CHOOSE_SELECTION = Choose selection diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index be092402..4936643e 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -661,33 +661,37 @@ TPSLIMIT_INVALID_FROZEN = §c und '0' # Trace TRACE_RECORD=§aan -TRACE_RECORD_AUTO=§aan -TRACE_RECORD_SINGLE=§aan TRACE_IDLE=§caus -TRACE_IDLE_AUTO=§eauto TRACE_IDLE_SINGLE=§esingle -TRACE_MESSAGE_AUTO_RECORD=§cTNT-Tracer muss gestoppt werden -TRACE_MESSAGE_AUTO_RECORD_AUTO=§cTNT-Tracer darf nicht aufnehmen -TRACE_MESSAGE_AUTO_IDLE=§cAuto-Tracer gestoppt -TRACE_MESSAGE_AUTO_IDLE_AUTO = §aAuto-Tracer gestartet +TRACE_IDLE_AUTO_EXPLODE=§eauto §8(§7explode§8) +TRACE_IDLE_AUTO_IGNITE=§eauto §8(§7ignite§8) +TRACE_MESSAGE_AUTO_IDLE_EXPLODE = §aAuto-Tracer explode gestartet +TRACE_MESSAGE_AUTO_IDLE_IGNITE = §aAuto-Tracer ignite gestartet TRACE_MESSAGE_START = §aTNT-Tracer gestartet TRACE_MESSAGE_SINGLE = §aSingle-Tracer gestartet TRACE_MESSAGE_STOP = §cTNT-Tracer gestoppt TRACE_MESSAGE_DELETE = §cAlle TNT-Positionen gelöscht TRACE_MESSAGE_SHOW = §aAlle TNT-Positionen angezeigt TRACE_MESSAGE_HIDE = §cAlle TNT-Positionen ausgeblendet +TRACE_MESSAGE_ISOLATE = §aTNT-Positionen isoliert +TRACE_MESSAGE_UNISOLATE = §cTNT-Positionen ausgeblendet +TRACE_MESSAGE_CLICK_ISOLATE = §eKlicken zum §aisolieren§8/§causblenden TRACE_MESSAGE_DISALLOWED = §cDu darfst hier nicht den TNT-Tracer nutzen +TRACE_MESSAGE_NO_REGION = §cDu bist in keiner Region TRACE_COMMAND_HELP_START = §8/§etrace start §8- §7Startet die Aufnahme aller TNT-Positionen TRACE_COMMAND_HELP_SINGLE = §8/§etrace single §8- §7Startet eine einzelne Aufnahme aller TNT-Positionen TRACE_COMMAND_HELP_STOP = §8/§etrace stop §8- §7Stoppt den TNT-Tracer TRACE_COMMAND_HELP_AUTO = §8/§etrace toggleauto §8- §7Automatischer Aufnahmenstart -TRACE_COMMAND_HELP_SHOW_GUI = §8/§etrace show gui §8- §7Zeigt die Trace show gui TRACE_COMMAND_HELP_SHOW = §8/§etrace show §8<§eParameter§8> - §7Zeigt alle TNT-Positionen TRACE_COMMAND_HELP_HIDE = §8/§etrace hide §8- §7Versteckt alle TNT-Positionen TRACE_COMMAND_HELP_DELETE = §8/§etrace delete §8- §7Löscht alle TNT-Positionen -TRACE_COMMAND_HELP_LIST = §8/§etrace list §8- §7Trace GUI nur im Chat TRACE_COMMAND_HELP_GUI = §8/§etrace gui §8- §7Zeigt die Trace Oberfläche an +TRACE_COMMAND_HELP_REPLAY = §8/§etrace replay §8[§7Tick§8] §8- §7Replayes die Aufnahme +TRACE_COMMAND_HELP_REPLAY_DISABLE = §8/§etrace replay disable §8- §7Stoppt das Replay +TRACE_COMMAND_HELP_REPLAY_NEXT = §8/§etrace replay next §8[§7Step§8] §8- §7Springe einen§8/§7step Tick vor +TRACE_COMMAND_HELP_REPLAY_PREVIOUS = §8/§etrace replay previous §8[§7Step§8] §8- §7Springe einen§8/§7step Tick zurück +TRACE_COMMAND_HELP_REPLAY_LOOP = §8/§etrace replay loop §8<§7start§8> §8<§7end§8> §8[§7speed§8] §8- §7Spielt die Aufnahme in einer Schleife ab TRACE_GUI_ITEM_NAME = §eTracer TRACE_GUI_ITEM_LORE = §7Status§8: {0} @@ -697,22 +701,8 @@ TRACE_GUI_TRACE_ACTIVE = §eTracer Stoppen TRACE_GUI_TRACE_ACTIVE_AUTO = §eAuto-Trace ist Aktiv TRACE_GUI_AUTO_TRACE_INACTIVE = §eAuto-Tracer Aktivieren TRACE_GUI_AUTO_TRACE_ACTIVE = §eAuto-Tracer Deaktivieren -TRACE_GUI_SHOW_GUI = §eTrace Show Gui TRACE_GUI_DELETE = §eTrace Löschen -TRACE_SHOW_GUI_TITLE = Trace Show GUI -TRACE_SHOW_GUI_SHOWN = §aTraces angezeigt -TRACE_SHOW_GUI_HIDDEN = §cTraces ausgeblendet -TRACE_SHOW_GUI_WATER_ITEM = §eWasser §7Positionen -TRACE_SHOW_GUI_WATER_LORE1 = §7Zeigt alles TNT, welches -TRACE_SHOW_GUI_WATER_LORE2 = §7im Wasser explodiert ist. -TRACE_SHOW_GUI_INTERPOLATE_Y_ITEM = §eInterpolation §7Y-Achse -TRACE_SHOW_GUI_INTERPOLATE_Y_LORE1 = §7Zeigt die Interpolation -TRACE_SHOW_GUI_INTERPOLATE_Y_LORE2 = §7auf der Y-Achse. -TRACE_SHOW_GUI_INTERPOLATE_XZ_ITEM = §eInterpolation §7XZ-Achse -TRACE_SHOW_GUI_INTERPOLATE_XZ_LORE1 = §7Zeigt die Interpolation -TRACE_SHOW_GUI_INTERPOLATE_XZ_LORE2 = §7auf der XZ-Achse. - TRACE_GUI_TITLE = Trace GUI TRACE_GUI_ITEM_BACK = §eBack TRACE_GUI_ITEM = §eTrace §8- §e{0} §7TNT @@ -723,29 +713,9 @@ TRACE_GUI_POSITION_ITEM = §ePosition TRACE_GUI_POSITION_X = §7X§8: §e{0} TRACE_GUI_POSITION_Y = §7Y§8: §e{0} TRACE_GUI_POSITION_Z = §7Z§8: §e{0} +TRACE_GUI_POSITION_SOURCE = §7Ursprung§8: §e{0} TRACE_GUI_POSITION_EXPLODED = §7Explodiert§8: §e{0} -TRACE_RECORD_LIST_ELEMENT = §eTrace §8- §e{0} §7TNT -TRACE_RECORD_LIST_ELEMENT_HOVER = §7Zeige alle §eTNT §7aus diesem Trace -TRACE_RECORD_LIST_ELEMENT_DELETE = §7 §cLöschen -TRACE_RECORD_LIST_ELEMENT_DELETE_HOVER = §7Trace §clöschen -TRACE_RECORD_DELETE = §7Trace gelöscht -TRACE_RECORD_NOT_FOUND = §7Unbekannter Trace -TRACE_RECORD_ELEMENT = §eTNT §8- §e{0} §7Positionen -TRACE_RECORD_ELEMENT_HOVER = §7Zeige alle §ePositionen §7aus diesem TNT -TRACE_RECORD_ELEMENT_DELETE = §7 §cLöschen -TRACE_RECORD_ELEMENT_DELETE_HOVER = §7Trace §clöschen -TRACE_RECORD_TNT_NOT_FOUND = §7Unbekanntes TNT -TRACE_TNT_ELEMENT = §ePosition §8- §e{0} §7FuseTicks -TRACE_TNT_DELETE = §7TNT gelöscht -TRACE_TNT_ELEMENT_HOVER = §7Zeige Infos zur §ePosition §7an -TRACE_RECORD_TNT_POSITION_NOT_FOUND = §7Unbekannte TNT Position -TRACE_CHAT_POSITION_HEAD = §ePosition -TRACE_CHAT_POSITION_X = §7X§8: §e{0} -TRACE_CHAT_POSITION_Y = §7Y§8: §e{0} -TRACE_CHAT_POSITION_Z = §7Z§8: §e{0} -TRACE_CHAT_POSITION_EXPLODED = §7Explodiert§8: §e{0} - # Loader LOADER_OFF = §caus LOADER_SETUP = §eEinrichtung @@ -1081,11 +1051,7 @@ LAUFBAU_NO_PERM = §cDu darfst hier nicht das Laufbau System verwenden LAUFBAU_NO_WORLDEDIT = §cDu hast keine WorldEdit Selection LAUFBAU_STATE_FILTERING_TRACES = Traces filtern LAUFBAU_STATE_PROCESSING_TRACES = Traces verbinden -LAUFBAU_STATE_EXPANDING_TRACES = Traces aufblähen -LAUFBAU_STATE_SPLITTING_POINTS = Punkte trennen -LAUFBAU_STATE_SHRINKING_POINTS = Punkte ausdünnen -LAUFBAU_STATE_CREATING_INNER_BLOCKS = Innenraum füllen -LAUFBAU_STATE_CREATING_OUTER_BLOCKS = Mantel bauen +LAUFBAU_STATE_CREATE_LAUF = Lauf erstellen LAUFBAU_SIMPLE_PROGRESS = §e{0}§8: §e{1}§8/§e{2} §7Übrige Zeit §8: §e{3} LAUFBAU_DONE = §aZuende gebaut diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index da0ae7bc..565f368f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -21,12 +21,11 @@ package de.steamwar.bausystem; import com.comphenix.tinyprotocol.TinyProtocol; import de.steamwar.bausystem.configplayer.Config; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.LinkageUtils; import de.steamwar.bausystem.region.loader.PrototypeLoader; import de.steamwar.bausystem.region.loader.RegionLoader; import de.steamwar.bausystem.region.loader.Updater; import de.steamwar.bausystem.worlddata.WorldData; +import de.steamwar.bausystem.linkage.LinkageUtils; import de.steamwar.message.Message; import lombok.Getter; import org.bukkit.Bukkit; @@ -73,12 +72,7 @@ public class BauSystem extends JavaPlugin implements Listener { new Updater(PrototypeLoader.file, PrototypeLoader::load); new Updater(RegionLoader.file, RegionLoader::load); - LinkageUtils.run(LinkageType.PLAIN); - LinkageUtils.run(LinkageType.COMMAND); - LinkageUtils.run(LinkageType.ENABLE_LINK); - LinkageUtils.run(LinkageType.LISTENER); - LinkageUtils.run(LinkageType.CONFIG_CONVERTER); - LinkageUtils.run(LinkageType.SCOREBOARD); + LinkageUtils.link(); // This could disable any watchdog stuff. We need to investigate if this is a problem. /* @@ -100,8 +94,7 @@ public class BauSystem extends JavaPlugin implements Listener { @Override public void onDisable() { - LinkageUtils.run(LinkageType.DISABLE_LINK); - LinkageUtils.run(LinkageType.UNLINK_LISTENER); + LinkageUtils.unlink(); WorldData.write(); Config.getInstance().saveAll(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/SWUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/SWUtils.java index cb816cd9..c7c9183f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/SWUtils.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/SWUtils.java @@ -19,6 +19,7 @@ package de.steamwar.bausystem; +import de.steamwar.inventory.SWItem; import lombok.Getter; import lombok.Setter; import lombok.experimental.UtilityClass; @@ -29,6 +30,7 @@ import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.plugin.Plugin; import java.util.function.Function; @@ -59,6 +61,13 @@ public class SWUtils { } } + public static SWItem setCustomModelData(SWItem item, int customModelData) { + ItemMeta itemMeta = item.getItemMeta(); + itemMeta.setCustomModelData(customModelData); + item.setItemMeta(itemMeta); + return item; + } + public static void sendToActionbar(Player p, String message) { p.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message)); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/config/BauServer.java b/BauSystem_Main/src/de/steamwar/bausystem/config/BauServer.java index d644d419..3dc792f0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/config/BauServer.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/config/BauServer.java @@ -19,15 +19,14 @@ package de.steamwar.bausystem.config; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import de.steamwar.providers.BauServerInfo; import de.steamwar.sql.SteamwarUser; import lombok.Getter; import java.util.UUID; -@Linked(LinkageType.PLAIN) +@Linked public class BauServer { @Getter diff --git a/BauSystem_Main/src/de/steamwar/bausystem/configplayer/Config.java b/BauSystem_Main/src/de/steamwar/bausystem/configplayer/Config.java index bc9cde30..2f929687 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/configplayer/Config.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/configplayer/Config.java @@ -20,8 +20,7 @@ package de.steamwar.bausystem.configplayer; import de.steamwar.bausystem.configplayer.serializer.ConfigurationSerializableSerializer; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import de.steamwar.sql.UserConfig; import lombok.Getter; import org.bukkit.Bukkit; @@ -40,7 +39,7 @@ import java.util.Map; import java.util.UUID; import java.util.logging.Level; -@Linked(LinkageType.LISTENER) +@Linked public class Config implements Listener { static { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutoStartCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutoStartCommand.java index 552dd816..8e2b8c1a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutoStartCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutoStartCommand.java @@ -20,12 +20,11 @@ package de.steamwar.bausystem.features.autostart; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class AutoStartCommand extends SWCommand { public AutoStartCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutoStartGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutoStartGuiItem.java index fab4a2f6..a66e3785 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutoStartGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutoStartGuiItem.java @@ -20,15 +20,14 @@ package de.steamwar.bausystem.features.autostart; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class AutoStartGuiItem extends BauGuiItem { public AutoStartGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutostartListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutostartListener.java index c576d0ba..8d254a3a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutostartListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutostartListener.java @@ -21,14 +21,13 @@ package de.steamwar.bausystem.features.autostart; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tpslimit.TPSUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.bausystem.utils.ItemUtils; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import lombok.Getter; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -44,7 +43,7 @@ import java.util.Date; import java.util.HashMap; import java.util.Map; -@Linked(LinkageType.LISTENER) +@Linked public class AutostartListener implements Listener { @Getter diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/backup/BackupCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/backup/BackupCommand.java index 7214bd40..9799b628 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/backup/BackupCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/backup/BackupCommand.java @@ -21,8 +21,6 @@ package de.steamwar.bausystem.features.backup; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.tags.Tag; import de.steamwar.command.SWCommand; @@ -31,6 +29,7 @@ import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeValidator; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; +import de.steamwar.linkage.Linked; import net.md_5.bungee.api.chat.ClickEvent; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -42,7 +41,7 @@ import java.util.Collections; import java.util.List; import java.util.stream.Collectors; -@Linked(LinkageType.COMMAND) +@Linked public class BackupCommand extends SWCommand { public BackupCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/bau/BauCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/bau/BauCommand.java index 3e039a90..69ee7af8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/bau/BauCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/bau/BauCommand.java @@ -19,13 +19,12 @@ package de.steamwar.bausystem.features.bau; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; -import de.steamwar.bausystem.linkage.LinkedInstance; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class BauCommand extends SWCommand { @LinkedInstance diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/bau/BauInfoBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/bau/BauInfoBauGuiItem.java index a9d63e31..7f3c27b9 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/bau/BauInfoBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/bau/BauInfoBauGuiItem.java @@ -22,12 +22,11 @@ package de.steamwar.bausystem.features.bau; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.config.BauServer; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import de.steamwar.sql.SteamwarUser; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -37,7 +36,7 @@ import org.bukkit.inventory.ItemStack; import java.util.ArrayList; import java.util.List; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class BauInfoBauGuiItem extends BauGuiItem { public BauInfoBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/bau/InfoCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/bau/InfoCommand.java index 58b3dc20..b3de2a11 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/bau/InfoCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/bau/InfoCommand.java @@ -3,13 +3,12 @@ package de.steamwar.bausystem.features.bau; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.config.BauServer; import de.steamwar.bausystem.features.tpslimit.TPSWarpUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; -import de.steamwar.bausystem.linkage.LinkedInstance; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.command.SWCommand; import de.steamwar.core.TPSWatcher; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import de.steamwar.sql.BauweltMember; import de.steamwar.sql.SteamwarUser; import org.bukkit.entity.Player; @@ -18,7 +17,7 @@ import java.util.List; import static de.steamwar.bausystem.features.tpslimit.TPSWarpUtils.getTps; -@Linked(LinkageType.COMMAND) +@Linked public class InfoCommand extends SWCommand { @LinkedInstance diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/CountingwandCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/CountingwandCommand.java index 2ffab2ff..c7d9b270 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/CountingwandCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/CountingwandCommand.java @@ -20,13 +20,12 @@ package de.steamwar.bausystem.features.countingwand; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class CountingwandCommand extends SWCommand { public CountingwandCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/CountingwandGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/CountingwandGuiItem.java index dd709d4e..7772f9c7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/CountingwandGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/CountingwandGuiItem.java @@ -20,15 +20,14 @@ package de.steamwar.bausystem.features.countingwand; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class CountingwandGuiItem extends BauGuiItem { public CountingwandGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/CountingwandListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/CountingwandListener.java index ced97677..7233670a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/CountingwandListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/countingwand/CountingwandListener.java @@ -19,9 +19,8 @@ package de.steamwar.bausystem.features.countingwand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Point; +import de.steamwar.linkage.Linked; import org.bukkit.FluidCollisionMode; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -34,7 +33,7 @@ import org.bukkit.util.RayTraceResult; import java.util.Objects; -@Linked(LinkageType.LISTENER) +@Linked public class CountingwandListener implements Listener { @EventHandler diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/DetonatorBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/DetonatorBauGuiItem.java index 628531d6..2207ce45 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/DetonatorBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/DetonatorBauGuiItem.java @@ -20,14 +20,13 @@ package de.steamwar.bausystem.features.detonator; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class DetonatorBauGuiItem extends BauGuiItem { public DetonatorBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/DetonatorCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/DetonatorCommand.java index a016fbd0..bb71245d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/DetonatorCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/DetonatorCommand.java @@ -24,10 +24,9 @@ import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.configplayer.Config; import de.steamwar.bausystem.features.detonator.storage.DetonatorStorage; import de.steamwar.bausystem.features.detonator.storage.ItemStorage; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.utils.ItemUtils; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -35,7 +34,7 @@ import org.bukkit.inventory.meta.ItemMeta; import java.util.Arrays; -@Linked(LinkageType.COMMAND) +@Linked public class DetonatorCommand extends SWCommand { public static ItemStack getWAND(Player player) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/DetonatorListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/DetonatorListener.java index a7d11f69..2e0cbf38 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/DetonatorListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/DetonatorListener.java @@ -25,8 +25,7 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.features.detonator.storage.DetonatorStorage; import de.steamwar.bausystem.features.detonator.storage.ItemStorage; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -42,7 +41,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -@Linked(LinkageType.LISTENER) +@Linked public class DetonatorListener implements Listener { public static final Class useEntity = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInUseEntity"); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUI.java b/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUI.java index f5356018..74a915da 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUI.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUI.java @@ -23,7 +23,6 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.features.gui.editor.BauGuiMapping; -import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.LinkageUtils; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWInventory; @@ -42,7 +41,7 @@ public class BauGUI { private static final Map ITEMS = new HashMap<>(); public static Map getITEMS() { - LinkageUtils.run(LinkageType.BAU_GUI_ITEM); + if (ITEMS.isEmpty()) LinkageUtils.linkGUIItems(); return ITEMS; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUICommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUICommand.java index 30ae286b..f6810ef7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUICommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGUICommand.java @@ -20,13 +20,12 @@ package de.steamwar.bausystem.features.gui; import de.steamwar.bausystem.features.gui.editor.BauGuiEditor; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class BauGUICommand extends SWCommand { public BauGUICommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGuiBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGuiBauGuiItem.java index 06da95d6..c03b458a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGuiBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGuiBauGuiItem.java @@ -21,10 +21,9 @@ package de.steamwar.bausystem.features.gui; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import net.md_5.bungee.api.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -33,7 +32,7 @@ import org.bukkit.inventory.ItemStack; import java.util.Arrays; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class BauGuiBauGuiItem extends BauGuiItem { public BauGuiBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGuiListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGuiListener.java index e8c48493..5895019f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGuiListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/gui/BauGuiListener.java @@ -19,14 +19,13 @@ package de.steamwar.bausystem.features.gui; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; -@Linked(LinkageType.LISTENER) +@Linked public class BauGuiListener implements Listener { @EventHandler diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditor.java b/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditor.java index 18d5b350..06c4a41c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditor.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditor.java @@ -21,11 +21,10 @@ package de.steamwar.bausystem.features.gui.editor; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.gui.BauGUI; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; +import de.steamwar.linkage.Linked; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -46,7 +45,7 @@ import org.bukkit.persistence.PersistentDataType; import java.util.*; -@Linked(LinkageType.LISTENER) +@Linked public class BauGuiEditor implements Listener { @Getter diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditorGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditorGuiItem.java index 56eb6d8f..b1a76041 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditorGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditorGuiItem.java @@ -21,16 +21,15 @@ package de.steamwar.bausystem.features.gui.editor; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class BauGuiEditorGuiItem extends BauGuiItem { public BauGuiEditorGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/hotbar/DefaultHotbar.java b/BauSystem_Main/src/de/steamwar/bausystem/features/hotbar/DefaultHotbar.java index 9fdc9736..25760ccb 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/hotbar/DefaultHotbar.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/hotbar/DefaultHotbar.java @@ -70,7 +70,11 @@ public class DefaultHotbar { if (yapionAnyType instanceof YAPIONValue) { hotbar[integer] = null; } else { - hotbar[integer] = (ItemStack) YAPIONDeserializer.deserialize((YAPIONObject) yapionAnyType); + try { + hotbar[integer] = YAPIONDeserializer.deserialize((YAPIONObject) yapionAnyType); + } catch (Exception e) { + hotbar[integer] = null; + } } }); return hotbar; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/hotbar/HotbarCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/hotbar/HotbarCommand.java index 26b4024b..9b52890c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/hotbar/HotbarCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/hotbar/HotbarCommand.java @@ -20,14 +20,13 @@ package de.steamwar.bausystem.features.hotbar; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; import de.steamwar.inventory.SWInventory; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.COMMAND) +@Linked public class HotbarCommand extends SWCommand { public HotbarCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/hotbar/HotbarListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/hotbar/HotbarListener.java index 9c6f6bbd..de00331f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/hotbar/HotbarListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/hotbar/HotbarListener.java @@ -19,14 +19,13 @@ package de.steamwar.bausystem.features.hotbar; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; -@Linked(LinkageType.LISTENER) +@Linked public class HotbarListener implements Listener { @EventHandler(priority = EventPriority.LOWEST) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFillBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFillBauGuiItem.java index d5b7f70e..7e94710a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFillBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFillBauGuiItem.java @@ -3,12 +3,10 @@ package de.steamwar.bausystem.features.inventoryfiller; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.configplayer.Config; -import de.steamwar.bausystem.features.inventoryfiller.InventoryFillerCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; -import de.steamwar.bausystem.linkage.LinkedInstance; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -16,7 +14,7 @@ import org.bukkit.inventory.ItemStack; import java.util.Collections; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class InventoryFillBauGuiItem extends BauGuiItem { public InventoryFillBauGuiItem() { super(34); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFiller.java b/BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFiller.java index dd7c1b01..f72d08f2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFiller.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFiller.java @@ -21,8 +21,7 @@ package de.steamwar.bausystem.features.inventoryfiller; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.configplayer.Config; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import net.md_5.bungee.api.ChatMessageType; import org.bukkit.Material; import org.bukkit.block.Block; @@ -34,7 +33,7 @@ import org.bukkit.event.player.PlayerItemHeldEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.LISTENER) +@Linked public class InventoryFiller implements Listener { @EventHandler diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFillerCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFillerCommand.java index 8ef0d841..4804a9d7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFillerCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFillerCommand.java @@ -3,12 +3,11 @@ package de.steamwar.bausystem.features.inventoryfiller; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.configplayer.Config; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class InventoryFillerCommand extends SWCommand { public InventoryFillerCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderBauGuiItem.java index 0007bdcf..55370c3f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderBauGuiItem.java @@ -21,20 +21,21 @@ package de.steamwar.bausystem.features.loader; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import java.util.Arrays; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class LoaderBauGuiItem extends BauGuiItem { public LoaderBauGuiItem() { @@ -43,7 +44,7 @@ public class LoaderBauGuiItem extends BauGuiItem { @Override public ItemStack getItem(Player player) { - return new SWItem(Material.FLINT_AND_STEEL, BauSystem.MESSAGE.parse("LOADER_GUI_NAME", player)).getItemStack(); + return SWUtils.setCustomModelData(new SWItem(Material.FLINT_AND_STEEL, BauSystem.MESSAGE.parse("LOADER_GUI_NAME", player)), 1).getItemStack(); } @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderCommand.java index afafed99..ffea7e4f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderCommand.java @@ -21,12 +21,12 @@ package de.steamwar.bausystem.features.loader; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; -import de.steamwar.command.*; +import de.steamwar.command.SWCommand; +import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class LoaderCommand extends SWCommand { public LoaderCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerCommand.java index 29bf67f2..42d5175c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerCommand.java @@ -19,13 +19,12 @@ package de.steamwar.bausystem.features.loadtimer; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class LoadtimerCommand extends SWCommand { public LoadtimerCommand() { super("loadtimer", "lt", "stopuhr"); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerGuiItem.java index 1035fa75..f190d9f0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerGuiItem.java @@ -21,18 +21,17 @@ package de.steamwar.bausystem.features.loadtimer; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.region.Region; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class LoadtimerGuiItem extends BauGuiItem { public LoadtimerGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerListener.java index 89881af9..ddbaed9a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerListener.java @@ -19,9 +19,8 @@ package de.steamwar.bausystem.features.loadtimer; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; @@ -33,7 +32,7 @@ import org.bukkit.event.player.PlayerInteractEvent; import static de.steamwar.bausystem.features.loadtimer.Loadtimer.*; -@Linked(LinkageType.LISTENER) +@Linked public class LoadtimerListener implements Listener { @EventHandler diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/observer/ObserverTracerCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/observer/ObserverTracerCommand.java index 76d99616..fd0df724 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/observer/ObserverTracerCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/observer/ObserverTracerCommand.java @@ -20,12 +20,11 @@ package de.steamwar.bausystem.features.observer; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class ObserverTracerCommand extends SWCommand { public ObserverTracerCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/observer/ObserverTracerListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/observer/ObserverTracerListener.java index 5070a3ba..b841755b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/observer/ObserverTracerListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/observer/ObserverTracerListener.java @@ -20,8 +20,7 @@ package de.steamwar.bausystem.features.observer; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Material; @@ -38,7 +37,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -@Linked(LinkageType.LISTENER) +@Linked public class ObserverTracerListener implements Listener { static Set enabled = new HashSet<>(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstoneTesterGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstoneTesterGuiItem.java index 103c7d5f..eebcf0cc 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstoneTesterGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstoneTesterGuiItem.java @@ -21,10 +21,9 @@ package de.steamwar.bausystem.features.redstonetester; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -32,7 +31,7 @@ import org.bukkit.inventory.ItemStack; import java.util.Arrays; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class RedstoneTesterGuiItem extends BauGuiItem { public RedstoneTesterGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterCommand.java index 9917b313..0e1c7b63 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterCommand.java @@ -21,12 +21,11 @@ package de.steamwar.bausystem.features.redstonetester; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class RedstonetesterCommand extends SWCommand { public RedstonetesterCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RestonetesterListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RestonetesterListener.java index cef31f42..2ab015b9 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RestonetesterListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RestonetesterListener.java @@ -20,9 +20,8 @@ package de.steamwar.bausystem.features.redstonetester; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.utils.ItemUtils; +import de.steamwar.linkage.Linked; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -36,7 +35,7 @@ import org.bukkit.event.player.PlayerQuitEvent; import java.util.Objects; -@Linked(LinkageType.LISTENER) +@Linked public class RestonetesterListener implements Listener { @EventHandler diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ColorCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ColorCommand.java index 7d990231..1213a314 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ColorCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ColorCommand.java @@ -21,9 +21,6 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.config.BauServer; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; -import de.steamwar.bausystem.linkage.LinkedInstance; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.flags.Flag; @@ -32,11 +29,13 @@ import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import org.bukkit.entity.Player; import java.io.IOException; -@Linked(LinkageType.COMMAND) +@Linked public class ColorCommand extends SWCommand { @LinkedInstance diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireCommand.java index 7d49965c..da5b2665 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireCommand.java @@ -20,17 +20,16 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.flagvalues.FireMode; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class FireCommand extends SWCommand { public FireCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireListener.java index 9a303881..43aaf626 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireListener.java @@ -1,16 +1,15 @@ package de.steamwar.bausystem.features.region; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.flagvalues.FireMode; +import de.steamwar.linkage.Linked; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockSpreadEvent; -@Linked(LinkageType.LISTENER) +@Linked public class FireListener implements Listener { @EventHandler diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeCommand.java index a16c705b..303bc49a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeCommand.java @@ -20,17 +20,16 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class FreezeCommand extends SWCommand { public FreezeCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java index 8112cb3e..f8e811aa 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java @@ -1,12 +1,11 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode; import de.steamwar.core.Core; +import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.Block; @@ -21,7 +20,7 @@ import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.inventory.InventoryMoveItemEvent; import org.bukkit.event.player.PlayerInteractEvent; -@Linked(LinkageType.LISTENER) +@Linked public class FreezeListener implements Listener { @EventHandler @@ -176,4 +175,11 @@ public class FreezeListener implements Listener { } } } + + @EventHandler + public void onBlockFade(BlockFadeEvent event) { + if (Region.getRegion(event.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + event.setCancelled(true); + } + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectCommand.java index d4fa972c..3793d3ec 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectCommand.java @@ -21,17 +21,16 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.flagvalues.ProtectMode; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class ProtectCommand extends SWCommand { public ProtectCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectListener.java index b263fcde..e52d1ebb 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectListener.java @@ -1,10 +1,9 @@ package de.steamwar.bausystem.features.region; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.flagvalues.ProtectMode; +import de.steamwar.linkage.Linked; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.event.EventHandler; @@ -14,7 +13,7 @@ import org.bukkit.event.entity.EntityExplodeEvent; import java.util.List; -@Linked(LinkageType.LISTENER) +@Linked public class ProtectListener implements Listener { private void explode(List blockList, Location location) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionCommand.java index 819db4e0..4bd0faf4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionCommand.java @@ -22,9 +22,6 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.features.util.SelectCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; -import de.steamwar.bausystem.linkage.LinkedInstance; import de.steamwar.bausystem.region.Prototype; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; @@ -33,6 +30,8 @@ import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import de.steamwar.sql.SchematicNode; import net.md_5.bungee.api.chat.ClickEvent; import org.bukkit.Bukkit; @@ -46,7 +45,7 @@ import java.util.List; import java.util.logging.Level; import java.util.stream.Collectors; -@Linked(LinkageType.COMMAND) +@Linked public class RegionCommand extends SWCommand { @LinkedInstance diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionListener.java index 5c43f369..38b6532e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionListener.java @@ -20,10 +20,9 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.tags.Tag; +import de.steamwar.linkage.Linked; import org.bukkit.Location; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -38,7 +37,7 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.scheduler.BukkitRunnable; -@Linked(LinkageType.LISTENER) +@Linked public class RegionListener implements Listener { @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ResetCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ResetCommand.java index 38c36463..670facf5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ResetCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ResetCommand.java @@ -21,14 +21,13 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.GlobalRegion; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; import de.steamwar.sql.SchematicNode; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -36,7 +35,7 @@ import org.bukkit.entity.Player; import java.io.IOException; import java.util.logging.Level; -@Linked(LinkageType.COMMAND) +@Linked public class ResetCommand extends SWCommand { public ResetCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java index 9d748221..a7c11223 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java @@ -21,8 +21,6 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.flags.Flag; @@ -31,6 +29,7 @@ import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -39,7 +38,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -@Linked(LinkageType.COMMAND) +@Linked public class TNTCommand extends SWCommand { public TNTCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java index ea90e212..92164545 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java @@ -21,15 +21,14 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.features.script.CustomScriptManager; import de.steamwar.bausystem.features.script.EventType; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; -import de.steamwar.bausystem.linkage.LinkedInstance; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.flagvalues.TNTMode; import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionType; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.block.Block; @@ -43,7 +42,7 @@ import org.bukkit.event.entity.EntityExplodeEvent; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; -@Linked(LinkageType.LISTENER) +@Linked public class TNTListener implements Listener { @LinkedInstance diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java index 26a3727f..80a71346 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java @@ -21,8 +21,6 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.utils.RegionExtensionType; @@ -31,6 +29,7 @@ import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommandUtils; import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SteamwarUser; import org.bukkit.Bukkit; @@ -44,7 +43,7 @@ import java.util.List; import java.util.Map; import java.util.logging.Level; -@Linked(LinkageType.COMMAND) +@Linked public class TestblockCommand extends SWCommand { public TestblockCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ColorBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ColorBauGuiItem.java index b59e23d8..a38c397f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ColorBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ColorBauGuiItem.java @@ -21,8 +21,6 @@ package de.steamwar.bausystem.features.region.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.region.Color; import de.steamwar.bausystem.region.Region; @@ -30,6 +28,7 @@ import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.flagvalues.ColorMode; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -39,7 +38,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class ColorBauGuiItem extends BauGuiItem { public ColorBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/FireBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/FireBauGuiItem.java index 8986e806..01714fba 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/FireBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/FireBauGuiItem.java @@ -21,19 +21,18 @@ package de.steamwar.bausystem.features.region.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.flagvalues.FireMode; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class FireBauGuiItem extends BauGuiItem { public FireBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/FreezeBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/FreezeBauGuiItem.java index a107652e..43d1903f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/FreezeBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/FreezeBauGuiItem.java @@ -21,19 +21,18 @@ package de.steamwar.bausystem.features.region.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class FreezeBauGuiItem extends BauGuiItem { public FreezeBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ProtectBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ProtectBauGuiItem.java index ae4b6bdb..652c2fb2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ProtectBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ProtectBauGuiItem.java @@ -21,19 +21,19 @@ package de.steamwar.bausystem.features.region.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.flagvalues.ProtectMode; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class ProtectBauGuiItem extends BauGuiItem { public ProtectBauGuiItem() { @@ -44,9 +44,9 @@ public class ProtectBauGuiItem extends BauGuiItem { public ItemStack getItem(Player player) { Region region = Region.getRegion(player.getLocation()); if (region.getPlain(Flag.PROTECT, ProtectMode.class) == ProtectMode.ACTIVE) { - return new SWItem(Material.OBSIDIAN, BauSystem.MESSAGE.parse("REGION_ITEM_PROTECT_ALLOW", player)).getItemStack(); + return SWUtils.setCustomModelData(new SWItem(Material.OBSIDIAN, BauSystem.MESSAGE.parse("REGION_ITEM_PROTECT_ALLOW", player)), 1).getItemStack(); } else { - return new SWItem(Material.STONE, BauSystem.MESSAGE.parse("REGION_ITEM_PROTECT_DISALLOW", player)).getItemStack(); + return SWUtils.setCustomModelData(new SWItem(Material.STONE, BauSystem.MESSAGE.parse("REGION_ITEM_PROTECT_DISALLOW", player)), 1).getItemStack(); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ResetBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ResetBauGuiItem.java index 67d7c20d..79f6537a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ResetBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ResetBauGuiItem.java @@ -21,19 +21,19 @@ package de.steamwar.bausystem.features.region.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; +import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.features.region.ResetCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; -import de.steamwar.bausystem.linkage.LinkedInstance; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SchematicSelector; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class ResetBauGuiItem extends BauGuiItem { @LinkedInstance @@ -45,7 +45,7 @@ public class ResetBauGuiItem extends BauGuiItem { @Override public ItemStack getItem(Player player) { - return new SWItem(Material.HEAVY_WEIGHTED_PRESSURE_PLATE, BauSystem.MESSAGE.parse("REGION_ITEM_RESET", player)).getItemStack(); + return SWUtils.setCustomModelData(new SWItem(Material.HEAVY_WEIGHTED_PRESSURE_PLATE, BauSystem.MESSAGE.parse("REGION_ITEM_RESET", player)), 1).getItemStack(); } @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/TestblockBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/TestblockBauGuiItem.java index ed9be915..2b3b863a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/TestblockBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/TestblockBauGuiItem.java @@ -22,18 +22,17 @@ package de.steamwar.bausystem.features.region.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.features.region.TestblockCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; -import de.steamwar.bausystem.linkage.LinkedInstance; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SchematicSelector; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class TestblockBauGuiItem extends BauGuiItem { @LinkedInstance diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/TntBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/TntBauGuiItem.java index 678da86a..f4626cce 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/TntBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/TntBauGuiItem.java @@ -21,20 +21,19 @@ package de.steamwar.bausystem.features.region.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.flagvalues.TNTMode; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class TntBauGuiItem extends BauGuiItem { public TntBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/CustomScriptManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/CustomScriptManager.java index 6b8a58fb..a8bebb34 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/CustomScriptManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/CustomScriptManager.java @@ -22,11 +22,10 @@ package de.steamwar.bausystem.features.script; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.utils.FlatteningWrapper; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; +import de.steamwar.linkage.Linked; import de.steamwar.sql.UserConfig; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -51,7 +50,7 @@ import yapion.parser.YAPIONParser; import java.util.*; import java.util.stream.Collectors; -@Linked(LinkageType.LISTENER) +@Linked public class CustomScriptManager implements Listener { private final Map> playerMap = Collections.synchronizedMap(new HashMap<>()); // new ConcurrentHashMap<>(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptCommand.java index ecf04036..1d19575f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptCommand.java @@ -1,12 +1,11 @@ package de.steamwar.bausystem.features.script; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; -import de.steamwar.bausystem.linkage.LinkedInstance; import de.steamwar.command.SWCommand; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -16,7 +15,7 @@ import java.util.List; import static de.steamwar.bausystem.features.script.ScriptExecutor.SPECIAL_COMMANDS; -@Linked(LinkageType.COMMAND) +@Linked public class ScriptCommand extends SWCommand { public ScriptCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptEventListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptEventListener.java index 32c8d40c..c0852437 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptEventListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptEventListener.java @@ -20,12 +20,11 @@ package de.steamwar.bausystem.features.script; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; -import de.steamwar.bausystem.linkage.LinkedInstance; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionType; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import org.bukkit.Bukkit; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -43,7 +42,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -@Linked(LinkageType.LISTENER) +@Linked public class ScriptEventListener implements Listener { @LinkedInstance diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptExecutor.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptExecutor.java index afb80afb..5e7239a5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptExecutor.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptExecutor.java @@ -4,7 +4,6 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.variables.Constants; import de.steamwar.bausystem.features.script.variables.Context; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.LinkageUtils; import lombok.Getter; import lombok.Setter; @@ -21,7 +20,7 @@ public final class ScriptExecutor { public static final Set SPECIAL_COMMANDS = new HashSet<>(); static { - LinkageUtils.run(LinkageType.SCRIPT_COMMAND); + LinkageUtils.linkScriptCommands(); } private String specialCommand = null; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptListener.java index f2c94291..1c472da6 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptListener.java @@ -1,9 +1,8 @@ package de.steamwar.bausystem.features.script; import de.steamwar.bausystem.features.script.variables.Context; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.utils.FlatteningWrapper; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -20,7 +19,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -@Linked(LinkageType.LISTENER) +@Linked public class ScriptListener implements Listener { private static final Map GLOBAL_CONTEXT = new HashMap<>(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/UnsignCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/UnsignCommand.java index 7140c428..5c4ebb6d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/UnsignCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/UnsignCommand.java @@ -19,15 +19,14 @@ package de.steamwar.bausystem.features.script; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.utils.FlatteningWrapper; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.COMMAND) +@Linked public class UnsignCommand extends SWCommand { public UnsignCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Call.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Call.java index e5f255b4..9a1f65d8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Call.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Call.java @@ -3,11 +3,10 @@ package de.steamwar.bausystem.features.script.command; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Call implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Exit.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Exit.java index 461dd8e2..925d900b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Exit.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Exit.java @@ -2,11 +2,10 @@ package de.steamwar.bausystem.features.script.command; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Exit implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/If.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/If.java index 48f6d04c..b61189fe 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/If.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/If.java @@ -4,11 +4,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class If implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Jump.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Jump.java index b8f7bc10..bab023e4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Jump.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Jump.java @@ -3,11 +3,10 @@ package de.steamwar.bausystem.features.script.command; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Jump implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Return.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Return.java index 031d729f..742c58dc 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Return.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Return.java @@ -3,11 +3,10 @@ package de.steamwar.bausystem.features.script.command; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Return implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Sleep.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Sleep.java index 171e857d..94dd38e6 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Sleep.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Sleep.java @@ -3,12 +3,11 @@ package de.steamwar.bausystem.features.script.command; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Sleep implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Add.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Add.java index 1fec025b..75006f6d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Add.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Add.java @@ -4,11 +4,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Add implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Div.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Div.java index f4f4cbc8..f50b4e34 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Div.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Div.java @@ -4,11 +4,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Div implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Mul.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Mul.java index bdb382fd..cce89be9 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Mul.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Mul.java @@ -4,11 +4,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Mul implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Sub.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Sub.java index c327931b..00d6e694 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Sub.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Sub.java @@ -4,11 +4,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Sub implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Ceil.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Ceil.java index abe38f4b..b138b9ea 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Ceil.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Ceil.java @@ -23,11 +23,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Ceil implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Floor.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Floor.java index 86ee993a..bebf209b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Floor.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Floor.java @@ -23,11 +23,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Floor implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Round.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Round.java index ed037b8c..31a00aec 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Round.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Round.java @@ -23,11 +23,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Round implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echo.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echo.java index e5f0d05e..e403edd8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echo.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echo.java @@ -3,12 +3,11 @@ package de.steamwar.bausystem.features.script.command.io; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import net.md_5.bungee.api.ChatColor; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Echo implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echoactionbar.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echoactionbar.java index 6f45005c..000e1eec 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echoactionbar.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echoactionbar.java @@ -3,12 +3,11 @@ package de.steamwar.bausystem.features.script.command.io; import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import net.md_5.bungee.api.ChatColor; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Echoactionbar implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Input.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Input.java index a18b5055..8b0234b8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Input.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Input.java @@ -4,13 +4,12 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.inventory.SWAnvilInv; +import de.steamwar.linkage.Linked; import org.bukkit.ChatColor; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Input implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/And.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/And.java index bc28ae90..7f0ea700 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/And.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/And.java @@ -4,11 +4,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class And implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Equal.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Equal.java index 97a9a4e4..9ac6d6b1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Equal.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Equal.java @@ -4,11 +4,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Equal implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Greater.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Greater.java index 8a30d5ab..be5e7e3f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Greater.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Greater.java @@ -4,11 +4,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Greater implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Less.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Less.java index 711144a5..3368e9dd 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Less.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Less.java @@ -4,11 +4,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Less implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Not.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Not.java index 6a839005..bc1c0f2d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Not.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Not.java @@ -4,11 +4,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Not implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Or.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Or.java index 040e8d63..bec5950c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Or.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Or.java @@ -4,11 +4,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Or implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Insert.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Insert.java index 74031871..5405ad42 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Insert.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Insert.java @@ -23,11 +23,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Insert implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Length.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Length.java index 6b0f52f7..05a26a53 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Length.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Length.java @@ -23,11 +23,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Length implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Remove.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Remove.java index 043463f0..b1ed2e14 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Remove.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Remove.java @@ -23,11 +23,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Remove implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Replace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Replace.java index 53b29323..ec3b6f13 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Replace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Replace.java @@ -23,11 +23,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Replace implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Substring.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Substring.java index 1a899434..ab5fd935 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Substring.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Substring.java @@ -23,11 +23,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Substring implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Const.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Const.java index 97f85174..f69a6b34 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Const.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Const.java @@ -23,11 +23,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Constants; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Const implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Convert.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Convert.java index 34334454..90413443 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Convert.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Convert.java @@ -22,11 +22,10 @@ package de.steamwar.bausystem.features.script.command.variable; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Convert implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Global.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Global.java index b1620146..ec9fdcbb 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Global.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Global.java @@ -3,11 +3,10 @@ package de.steamwar.bausystem.features.script.command.variable; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Global implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Isset.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Isset.java index a9d779f7..b246eb83 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Isset.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Isset.java @@ -23,11 +23,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Isset implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unglobal.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unglobal.java index 496874f6..3fbc712b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unglobal.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unglobal.java @@ -3,11 +3,10 @@ package de.steamwar.bausystem.features.script.command.variable; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Unglobal implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unvar.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unvar.java index 0e1b75ef..016ac170 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unvar.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unvar.java @@ -3,11 +3,10 @@ package de.steamwar.bausystem.features.script.command.variable; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Unvar implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Var.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Var.java index 313301a7..bedb88da 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Var.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Var.java @@ -3,11 +3,10 @@ package de.steamwar.bausystem.features.script.command.variable; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Var implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Vartype.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Vartype.java index 5ad79466..46680548 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Vartype.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Vartype.java @@ -23,11 +23,10 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class Vartype implements SpecialCommand { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/world/GetMaterial.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/world/GetMaterial.java index cfbe46b6..60dd9243 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/world/GetMaterial.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/world/GetMaterial.java @@ -23,13 +23,12 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.World; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class GetMaterial implements SpecialCommand { private final World world = Bukkit.getWorlds().get(0); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/world/SetMaterial.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/world/SetMaterial.java index 18b4ffe2..12dd41c2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/world/SetMaterial.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/world/SetMaterial.java @@ -22,13 +22,12 @@ package de.steamwar.bausystem.features.script.command.world; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.script.ScriptExecutor; import de.steamwar.bausystem.features.script.SpecialCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.World; -@Linked(LinkageType.SCRIPT_COMMAND) +@Linked public class SetMaterial implements SpecialCommand { private final World world = Bukkit.getWorlds().get(0); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/items/ScriptMenuBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/items/ScriptMenuBauGuiItem.java index 04c13668..437b4760 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/items/ScriptMenuBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/items/ScriptMenuBauGuiItem.java @@ -21,16 +21,15 @@ package de.steamwar.bausystem.features.script.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class ScriptMenuBauGuiItem extends BauGuiItem { public ScriptMenuBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/variables/Constants.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/variables/Constants.java index ed242ace..a47b3231 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/variables/Constants.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/variables/Constants.java @@ -1,6 +1,8 @@ package de.steamwar.bausystem.features.script.variables; -import de.steamwar.bausystem.features.tracer.record.RecordStateMachine; +import de.steamwar.bausystem.features.tracer.record.ActiveTracer; +import de.steamwar.bausystem.features.tracer.record.AutoTraceRecorder; +import de.steamwar.bausystem.features.tracer.record.Recorder; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.flagvalues.FireMode; @@ -218,10 +220,18 @@ public class Constants { static { CONSTANTS.put("trace", player -> { - return new ConstantBooleanValue(RecordStateMachine.getRecordStatus()::isTracing); + Region region = Region.getRegion(player.getLocation()); + if (region.isGlobal()) { + return new ConstantBooleanValue(() -> false); + } + return new ConstantBooleanValue(() -> Recorder.INSTANCE.get(region) instanceof ActiveTracer); }); CONSTANTS.put("autotrace", player -> { - return new ConstantBooleanValue(RecordStateMachine.getRecordStatus()::isAutoTrace); + Region region = Region.getRegion(player.getLocation()); + if (region.isGlobal()) { + return new ConstantBooleanValue(() -> false); + } + return new ConstantBooleanValue(() -> Recorder.INSTANCE.get(region) instanceof AutoTraceRecorder); }); CONSTANTS.put("tnt", player -> { return new ConstantBooleanValue(() -> Region.getRegion(player.getLocation()).getPlain(Flag.TNT, TNTMode.class) != TNTMode.DENY); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorBauGuiItem.java index ae034549..baae7add 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorBauGuiItem.java @@ -21,17 +21,16 @@ package de.steamwar.bausystem.features.simulator; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class SimulatorBauGuiItem extends BauGuiItem { public SimulatorBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java index db38aabe..f8961d81 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java @@ -23,19 +23,18 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.features.simulator.gui.SimulatorSelectionGUI; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.utils.ItemUtils; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import java.util.Collection; -@Linked(LinkageType.COMMAND) +@Linked public class SimulatorCommand extends SWCommand { public SimulatorCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java index 074298d8..8c965f97 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java @@ -22,12 +22,11 @@ package de.steamwar.bausystem.features.simulator; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.features.simulator.tnt.TNTElement; -import de.steamwar.bausystem.linkage.Disable; -import de.steamwar.bausystem.linkage.Enable; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.utils.ItemUtils; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.api.Disable; +import de.steamwar.linkage.api.Enable; import de.steamwar.sql.SteamwarUser; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -49,8 +48,7 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; -@Linked(LinkageType.ENABLE_LINK) -@Linked(LinkageType.DISABLE_LINK) +@Linked public class SimulatorStorage implements Enable, Disable { public static final World WORLD = Bukkit.getWorlds().get(0); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java index 210c66f5..4a92058a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java @@ -27,7 +27,8 @@ import de.steamwar.bausystem.features.simulator.show.SimulatorEntityShowMode; import de.steamwar.bausystem.features.simulator.tnt.SimulatorElement; import de.steamwar.bausystem.features.simulator.tnt.TNTElement; import de.steamwar.bausystem.features.simulator.tnt.TNTGroup; -import de.steamwar.bausystem.features.tracer.record.RecordStateMachine; +import de.steamwar.bausystem.features.tracer.record.Recorder; +import de.steamwar.bausystem.features.tracer.record.SingleTraceRecorder; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.shared.Pair; import lombok.Getter; @@ -228,13 +229,17 @@ public class TNTSimulator { return; } + AtomicBoolean needsAutoTrace = new AtomicBoolean(); playerShowMode.forEach((player, simulatorEntityShowMode) -> { boolean simulatorAutoTrace = Config.getInstance().get(player).getPlainValueOrDefault("simulatorAutoTrace", false); if (simulatorAutoTrace) { - RecordStateMachine.commandSingle(); + needsAutoTrace.set(true); player.performCommand("trace show"); } }); + if (needsAutoTrace.get()) { + Recorder.INSTANCE.set(region, new SingleTraceRecorder(region)); + } AtomicInteger maxTick = new AtomicInteger(0); Map>>> toSpawn = new HashMap<>(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java index 8120bd85..d057fd76 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java @@ -22,10 +22,9 @@ package de.steamwar.bausystem.features.simulator; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.features.simulator.gui.SimulatorSelectionGUI; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.utils.ItemUtils; import de.steamwar.bausystem.utils.RayTraceUtils; +import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -40,7 +39,7 @@ import org.bukkit.util.RayTraceResult; import java.util.function.Function; -@Linked(LinkageType.LISTENER) +@Linked public class TNTSimulatorListener implements Listener { private boolean permissionCheck(Player player) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BlockBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BlockBoundingBox.java index 8201d369..deeb0196 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BlockBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BlockBoundingBox.java @@ -19,6 +19,7 @@ package de.steamwar.bausystem.features.slaves.laufbau; +import de.steamwar.bausystem.linkage.LinkageUtils; import de.steamwar.bausystem.utils.NMSWrapper; import de.steamwar.core.Core; import de.steamwar.inventory.SWItem; @@ -264,7 +265,7 @@ public class BlockBoundingBox { eastTrapDoor.setOpen(true); addPixel(eastTrapDoor, 0, 0, 0, 3, 16, 16, createItem("LAUFBAU_BLOCK_IRON_TRAPDOOR", Material.IRON_TRAPDOOR, "LAUFBAU_FACING_EAST", "LAUFBAU_OPEN")); - LaufbauLazyInit.init(); + LinkageUtils.linkBoundingBox(); } private static void addPixel(BlockData blockData, double xPixel, double yPixel, double zPixel, double dxPixel, double dyPixel, double dzPixel, SWItem swItem) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/linkage/Enable.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BoundingBoxLoader.java similarity index 82% rename from BauSystem_Main/src/de/steamwar/bausystem/linkage/Enable.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BoundingBoxLoader.java index e1c5aa5b..7c2846b2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/linkage/Enable.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BoundingBoxLoader.java @@ -1,7 +1,7 @@ /* * This file is a part of the SteamWar software. * - * Copyright (C) 2021 SteamWar.de-Serverteam + * Copyright (C) 2022 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 @@ -17,8 +17,9 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.linkage; +package de.steamwar.bausystem.features.slaves.laufbau; -public interface Enable { - void enable(); +public interface BoundingBoxLoader { + + void load(); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/Laufbau.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/Laufbau.java index 6c22c4aa..d1e37613 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/Laufbau.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/Laufbau.java @@ -20,8 +20,11 @@ package de.steamwar.bausystem.features.slaves.laufbau; import com.sk89q.worldedit.EditSession; +import de.steamwar.bausystem.features.slaves.laufbau.states.FilteringTracesState; +import de.steamwar.bausystem.features.slaves.laufbau.states.LaufbauState; +import de.steamwar.bausystem.features.slaves.laufbau.states.CreatingLaufState; +import de.steamwar.bausystem.features.slaves.laufbau.states.ProcessingTracesState; import de.steamwar.bausystem.utils.WorldEditUtils; -import de.steamwar.bausystem.features.slaves.laufbau.states.*; import lombok.Getter; import org.bukkit.Location; import org.bukkit.World; @@ -37,15 +40,9 @@ public class Laufbau { private Location pos1; private Location pos2; - private boolean preferingBlastResistance; - private FilteringTracesState filteringTracesState = null; private ProcessingTracesState processingTracesState = null; - private ExpandingTracesState expandingTracesState = null; - private SplittingPointsState splittingPointsState = null; - private ShrinkingOuterPointsState shrinkingOuterPointsState = null; - private CreatingInnerBlocksState creatingInnerBlocksState = null; - private CreatingOuterBlocksState creatingOuterBlocksState = null; + private CreatingLaufState creatingLaufState = null; private List elements; @@ -57,8 +54,6 @@ public class Laufbau { this.pos1 = new Location(world, Math.min(pos1.getBlockX(), pos2.getBlockX()), Math.min(pos1.getBlockY(), pos2.getBlockY()), Math.min(pos1.getBlockZ(), pos2.getBlockZ())); this.pos2 = new Location(world, Math.max(pos1.getBlockX(), pos2.getBlockX()), Math.max(pos1.getBlockY(), pos2.getBlockY()), Math.max(pos1.getBlockZ(), pos2.getBlockZ())); - this.preferingBlastResistance = preferingBlastResistance; - filteringTracesState = new FilteringTracesState(world, this::inRegion); editSession = WorldEditUtils.getEditSession(world); @@ -86,20 +81,8 @@ public class Laufbau { } private LaufbauState getActive() { - if (creatingOuterBlocksState != null) { - return creatingOuterBlocksState; - } - if (creatingInnerBlocksState != null) { - return creatingInnerBlocksState; - } - if (shrinkingOuterPointsState != null) { - return shrinkingOuterPointsState; - } - if (splittingPointsState != null) { - return splittingPointsState; - } - if (expandingTracesState != null) { - return expandingTracesState; + if (creatingLaufState != null) { + return creatingLaufState; } if (processingTracesState != null) { return processingTracesState; @@ -108,30 +91,14 @@ public class Laufbau { } private void createNextState() { - if (creatingOuterBlocksState != null) { - return; - } - if (creatingInnerBlocksState != null) { - creatingOuterBlocksState = new CreatingOuterBlocksState(shrinkingOuterPointsState.getShrunkOuterPoints(), world, editSession); - return; - } - if (shrinkingOuterPointsState != null) { - creatingInnerBlocksState = new CreatingInnerBlocksState(splittingPointsState.getInnerPoints(), world, splittingPointsState.getIntersectedCuboid(), editSession, elements); - return; - } - if (splittingPointsState != null) { - shrinkingOuterPointsState = new ShrinkingOuterPointsState(splittingPointsState.getOuterPoints(), splittingPointsState.getInnerPoints()); - return; - } - if (expandingTracesState != null) { - splittingPointsState = new SplittingPointsState(expandingTracesState.getBlocks(), processingTracesState.getCuboidList()); + if (creatingLaufState != null) { return; } if (processingTracesState != null) { - expandingTracesState = new ExpandingTracesState(processingTracesState.getCuboidList(), world, this::inRegion); + creatingLaufState = new CreatingLaufState(processingTracesState.getBlocks(), processingTracesState.getCuboidList(), world, editSession, elements); return; } - processingTracesState = new ProcessingTracesState(filteringTracesState.getTntPositions()); + processingTracesState = new ProcessingTracesState(filteringTracesState.getTntPositions(), world, this::inRegion); } public String actionBarMessage(Player p) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauCommand.java index 3de73826..d188e799 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauCommand.java @@ -22,18 +22,17 @@ package de.steamwar.bausystem.features.slaves.laufbau; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.utils.WorldEditUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.shared.Pair; +import de.steamwar.bausystem.utils.WorldEditUtils; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; -@Linked(LinkageType.COMMAND) +@Linked public class LaufbauCommand extends SWCommand { public LaufbauCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauLazyInit.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauLazyInit.java deleted file mode 100644 index d81655a1..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauLazyInit.java +++ /dev/null @@ -1,35 +0,0 @@ -package de.steamwar.bausystem.features.slaves.laufbau; - -import de.steamwar.bausystem.features.slaves.laufbau.boundingboxes.*; -import de.steamwar.core.Core; -import lombok.experimental.UtilityClass; - -@UtilityClass -public class LaufbauLazyInit { - - public static void init() { - } - - static { - new BellBoundingBox().enable(); - new BrewingStandBoundingBox().enable(); - new ChorusPlantBoundingBox().enable(); - new FencesBoundingBox().enable(); - new GrindstoneBoundingBox().enable(); - new HopperBoundingBox().enable(); - new IronBarBoundingBox().enable(); - new LanternBoundingBox().enable(); - new StairBoundingBox().enable(); - new WallBoundingBox().enable(); - new LecternBoundingBox().enable(); - - if (Core.getVersion() >= 19) { - new AmethystBoundingBox().enable(); - new ChainBoundingBox().enable(); - new DripLeafBoundingBox().enable(); - new DragonEggBoundingBox().enable(); - new AzaleaBoundingBox().enable(); - new CandleBoundingBox().enable(); - } - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauUtils.java index d0168103..9a9fb24a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauUtils.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauUtils.java @@ -20,9 +20,8 @@ package de.steamwar.bausystem.features.slaves.laufbau; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import de.steamwar.sql.UserConfig; import lombok.Cleanup; import lombok.SneakyThrows; @@ -45,7 +44,7 @@ import java.util.stream.Collectors; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; -@Linked(LinkageType.LISTENER) +@Linked public class LaufbauUtils implements Listener { private static Map yapionObjectMap = new HashMap<>(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/AmethystBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/AmethystBoundingBox.java index 824c103f..5eec07ca 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/AmethystBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/AmethystBoundingBox.java @@ -20,8 +20,10 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.linkage.Enable; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.MinVersion; import org.bukkit.Material; import org.bukkit.block.BlockFace; import org.bukkit.block.data.type.AmethystCluster; @@ -32,10 +34,12 @@ import java.util.List; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid; -public class AmethystBoundingBox implements Enable { +@Linked +@MinVersion(19) +public class AmethystBoundingBox implements BoundingBoxLoader { @Override - public void enable() { + public void load() { floorSmallAmethystBud(); ceilingSmallAmethystBud(); northSmallAmethystBud(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/AzaleaBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/AzaleaBoundingBox.java index f9ceda2d..8c0409da 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/AzaleaBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/AzaleaBoundingBox.java @@ -20,8 +20,10 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.linkage.Enable; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.MinVersion; import org.bukkit.Material; import org.bukkit.block.data.BlockData; @@ -31,10 +33,12 @@ import java.util.List; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid; -public class AzaleaBoundingBox implements Enable { +@Linked +@MinVersion(19) +public class AzaleaBoundingBox implements BoundingBoxLoader { @Override - public void enable() { + public void load() { BlockData blockData = Material.FLOWERING_AZALEA.createBlockData(); List cuboidList = new ArrayList<>(); cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16)); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/BellBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/BellBoundingBox.java index 4b247104..b5fcbb41 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/BellBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/BellBoundingBox.java @@ -20,8 +20,9 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.linkage.Enable; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.BlockFace; import org.bukkit.block.data.type.Bell; @@ -32,10 +33,11 @@ import java.util.List; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid; -public class BellBoundingBox implements Enable { +@Linked +public class BellBoundingBox implements BoundingBoxLoader { @Override - public void enable() { + public void load() { ceilingBell(); floorNorthBell(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/BrewingStandBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/BrewingStandBoundingBox.java index 8e729de5..765bea3d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/BrewingStandBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/BrewingStandBoundingBox.java @@ -20,8 +20,9 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.linkage.Enable; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.data.type.BrewingStand; @@ -31,10 +32,11 @@ import java.util.List; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid; -public class BrewingStandBoundingBox implements Enable { +@Linked +public class BrewingStandBoundingBox implements BoundingBoxLoader { @Override - public void enable() { + public void load() { BrewingStand brewingStand = (BrewingStand) Material.BREWING_STAND.createBlockData(); List cuboids = new ArrayList<>(); cuboids.add(pixelCuboid(1, 0, 1, 14, 2, 14)); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/CandleBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/CandleBoundingBox.java index 9642ab32..4efaee96 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/CandleBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/CandleBoundingBox.java @@ -20,8 +20,10 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.linkage.Enable; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.MinVersion; import org.bukkit.Material; import org.bukkit.block.data.Lightable; import org.bukkit.block.data.type.Candle; @@ -32,10 +34,12 @@ import java.util.List; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid; -public class CandleBoundingBox implements Enable { +@Linked +@MinVersion(19) +public class CandleBoundingBox implements BoundingBoxLoader { @Override - public void enable() { + public void load() { caked(); single(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/ChainBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/ChainBoundingBox.java index bcc6032b..6dd79442 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/ChainBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/ChainBoundingBox.java @@ -20,8 +20,10 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.linkage.Enable; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.MinVersion; import org.bukkit.Axis; import org.bukkit.Material; import org.bukkit.block.data.Orientable; @@ -32,10 +34,12 @@ import java.util.List; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid; -public class ChainBoundingBox implements Enable { +@Linked +@MinVersion(19) +public class ChainBoundingBox implements BoundingBoxLoader { @Override - public void enable() { + public void load() { bottomTopChain(); northSouthChain(); eastWestChain(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/ChorusPlantBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/ChorusPlantBoundingBox.java index e39231ff..b169a455 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/ChorusPlantBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/ChorusPlantBoundingBox.java @@ -20,8 +20,9 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.linkage.Enable; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.BlockFace; import org.bukkit.block.data.MultipleFacing; @@ -32,10 +33,11 @@ import java.util.List; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid; -public class ChorusPlantBoundingBox implements Enable { +@Linked +public class ChorusPlantBoundingBox implements BoundingBoxLoader { @Override - public void enable() { + public void load() { for (int nx = 0; nx < 2; nx++) { for (int ny = 0; ny < 2; ny++) { for (int nz = 0; nz < 2; nz++) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/DragonEggBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/DragonEggBoundingBox.java index ab3668ad..2bd6a6bb 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/DragonEggBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/DragonEggBoundingBox.java @@ -20,8 +20,10 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.linkage.Enable; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.MinVersion; import org.bukkit.Material; import org.bukkit.block.data.BlockData; @@ -31,10 +33,12 @@ import java.util.List; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid; -public class DragonEggBoundingBox implements Enable { +@Linked +@MinVersion(19) +public class DragonEggBoundingBox implements BoundingBoxLoader { @Override - public void enable() { + public void load() { BlockData blockData = Material.DRAGON_EGG.createBlockData(); List cuboidList = new ArrayList<>(); cuboidList.add(pixelCuboid(1, 0, 1, 14, 16, 14)); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/DripLeafBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/DripLeafBoundingBox.java index 488476bb..30198624 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/DripLeafBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/DripLeafBoundingBox.java @@ -20,8 +20,10 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.linkage.Enable; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.MinVersion; import org.bukkit.Material; import org.bukkit.block.data.type.BigDripleaf; @@ -31,10 +33,12 @@ import java.util.List; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid; -public class DripLeafBoundingBox implements Enable { +@Linked +@MinVersion(19) +public class DripLeafBoundingBox implements BoundingBoxLoader { @Override - public void enable() { + public void load() { tiltNone(); tiltPartial(); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/FencesBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/FencesBoundingBox.java index 3873f923..213a2345 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/FencesBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/FencesBoundingBox.java @@ -20,8 +20,9 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.linkage.Enable; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.BlockFace; import org.bukkit.block.data.type.Fence; @@ -32,10 +33,11 @@ import java.util.List; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid; -public class FencesBoundingBox implements Enable { +@Linked +public class FencesBoundingBox implements BoundingBoxLoader { @Override - public void enable() { + public void load() { for (int nx = 0; nx < 2; nx++) { for (int nz = 0; nz < 2; nz++) { for (int px = 0; px < 2; px++) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/GrindstoneBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/GrindstoneBoundingBox.java index 088a97d6..52fa3557 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/GrindstoneBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/GrindstoneBoundingBox.java @@ -20,8 +20,9 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.linkage.Enable; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.BlockFace; import org.bukkit.block.data.FaceAttachable; @@ -33,10 +34,11 @@ import java.util.List; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid; -public class GrindstoneBoundingBox implements Enable { +@Linked +public class GrindstoneBoundingBox implements BoundingBoxLoader { @Override - public void enable() { + public void load() { floorNorthGrindstone(); floorEastGrindstone(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/HopperBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/HopperBoundingBox.java index 324cc016..19a095b3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/HopperBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/HopperBoundingBox.java @@ -20,8 +20,9 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.linkage.Enable; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.BlockFace; import org.bukkit.block.data.type.Hopper; @@ -32,10 +33,11 @@ import java.util.List; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid; -public class HopperBoundingBox implements Enable { +@Linked +public class HopperBoundingBox implements BoundingBoxLoader { @Override - public void enable() { + public void load() { downHopper(); northHopper(); southHopper(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/IronBarBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/IronBarBoundingBox.java index f7a5147a..e275b7b1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/IronBarBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/IronBarBoundingBox.java @@ -20,8 +20,9 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.linkage.Enable; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.BlockFace; import org.bukkit.block.data.type.Fence; @@ -32,10 +33,11 @@ import java.util.List; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid; -public class IronBarBoundingBox implements Enable { +@Linked +public class IronBarBoundingBox implements BoundingBoxLoader { @Override - public void enable() { + public void load() { for (int nx = 0; nx < 2; nx++) { for (int nz = 0; nz < 2; nz++) { for (int px = 0; px < 2; px++) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/LanternBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/LanternBoundingBox.java index ff54c1c1..3bf275b4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/LanternBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/LanternBoundingBox.java @@ -20,8 +20,9 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.linkage.Enable; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.data.type.Lantern; @@ -31,10 +32,11 @@ import java.util.List; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid; -public class LanternBoundingBox implements Enable { +@Linked +public class LanternBoundingBox implements BoundingBoxLoader { @Override - public void enable() { + public void load() { lantern(); hangingLantern(); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/LecternBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/LecternBoundingBox.java index aa886b36..563b9bc6 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/LecternBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/LecternBoundingBox.java @@ -20,8 +20,9 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.linkage.Enable; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.data.BlockData; @@ -31,10 +32,11 @@ import java.util.List; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid; -public class LecternBoundingBox implements Enable { +@Linked +public class LecternBoundingBox implements BoundingBoxLoader { @Override - public void enable() { + public void load() { BlockData blockData = Material.LECTERN.createBlockData(); List cuboidList = new ArrayList<>(); cuboidList.add(pixelCuboid(0, 0, 0, 16, 2, 16)); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/StairBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/StairBoundingBox.java index d3729a7b..23807176 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/StairBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/StairBoundingBox.java @@ -20,8 +20,9 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.linkage.Enable; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.BlockFace; import org.bukkit.block.data.type.Stairs; @@ -32,10 +33,11 @@ import java.util.List; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid; -public class StairBoundingBox implements Enable { +@Linked +public class StairBoundingBox implements BoundingBoxLoader { @Override - public void enable() { + public void load() { straightBottomNorthStair(); straightBottomSouthStair(); straightBottomEastStair(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/WallBoundingBox.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/WallBoundingBox.java index 20d02366..855fe9b8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/WallBoundingBox.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/boundingboxes/WallBoundingBox.java @@ -20,9 +20,10 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.linkage.Enable; import de.steamwar.core.Core; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.BlockFace; import org.bukkit.block.data.type.Fence; @@ -34,10 +35,11 @@ import java.util.List; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem; import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid; -public class WallBoundingBox implements Enable { +@Linked +public class WallBoundingBox implements BoundingBoxLoader { @Override - public void enable() { + public void load() { if (Core.getVersion() > 15) { v18(); } else { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingInnerBlocksState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingInnerBlocksState.java deleted file mode 100644 index 6e6b3be1..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingInnerBlocksState.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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 . - */ - -package de.steamwar.bausystem.features.slaves.laufbau.states; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; -import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.region.Point; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.entity.Player; - -import java.text.SimpleDateFormat; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class CreatingInnerBlocksState implements LaufbauState { - - private long start = System.currentTimeMillis(); - - private List innerBlocks; - private int index = 0; - - private World world; - private Map> intersectedCuboid; - private EditSession editSession; - private List elements; - - public CreatingInnerBlocksState(List innerBlocks, World world, Map> intersectedCuboid, EditSession editSession, List elements) { - this.innerBlocks = innerBlocks; - this.world = world; - this.intersectedCuboid = intersectedCuboid; - this.editSession = editSession; - this.elements = elements; - } - - @Override - public String actionBarMessage(Player p) { - return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_CREATING_INNER_BLOCKS", p), index, innerBlocks.size(), eta(p, start, index, innerBlocks.size())); - } - - @Override - public boolean hasNext() { - return index < innerBlocks.size(); - } - - @Override - public void next() { - Point point = innerBlocks.get(index); - index++; - - List neededCuboids = intersectedCuboid.get(point); - List blockDataWithBoundingBoxList = new ArrayList<>(); - for (BlockBoundingBox blockDataWithBoundingBox : elements) { - List cuboids = blockDataWithBoundingBox.getCuboidList().stream().map(c -> c.add(point)).collect(Collectors.toList()); - - boolean isInCuboid = false; - for (Cuboid cuboid : neededCuboids) { - if (cuboids.stream().anyMatch(cuboid::intersects)) { - isInCuboid = true; - break; - } - } - if (!isInCuboid) { - blockDataWithBoundingBoxList.add(blockDataWithBoundingBox); - break; - } - } - if (blockDataWithBoundingBoxList.isEmpty()) { - return; - } - - BlockBoundingBox highest = blockDataWithBoundingBoxList.get(0); - Location location = new Location(world, point.getX(), point.getY(), point.getZ()); - if (!location.getBlock().getType().isAir()) { - return; - } - try { - editSession.setBlock(BukkitAdapter.asBlockVector(location), BukkitAdapter.adapt(highest.blockData)); - location.getBlock().setBlockData(highest.blockData, false); - if (highest.blockConsumer != null) highest.blockConsumer.accept(location.getBlock()); - } catch (MaxChangedBlocksException e) { - e.printStackTrace(); - // ignored - } - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingLaufState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingLaufState.java new file mode 100644 index 00000000..be76c5a7 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingLaufState.java @@ -0,0 +1,200 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ + +package de.steamwar.bausystem.features.slaves.laufbau.states; + +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.MaxChangedBlocksException; +import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockTypes; +import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; +import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; +import de.steamwar.bausystem.region.Point; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +public class CreatingLaufState implements LaufbauState { + + private static final Cuboid ONE = new Cuboid(0, 0, 0, 1, 1, 1); + private static final Cuboid ABOVE_HALF = new Cuboid(0, 1, 0, 1, 0.5, 1); + private static final BaseBlock SHELL; + + static { + SHELL = BlockTypes.get("minecraft:end_stone").getDefaultState().toBaseBlock(); + } + + private long start = System.currentTimeMillis(); + + private List blocks; + private List cuboids; + private List outerPoints = new ArrayList<>(); + private Set innerPoints = new HashSet<>(); + private World world; + private EditSession editSession; + private List elements; + + private int operations = 0; + private int totalOperations; + + public CreatingLaufState(Set blocks, List cuboids, World world, EditSession editSession, List elements) { + this.blocks = new ArrayList<>(blocks); + this.cuboids = cuboids; + this.world = world; + this.editSession = editSession; + this.elements = elements; + + totalOperations = blocks.size() * 2; + } + + @Override + public String actionBarMessage(Player p) { + return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_CREATE_LAUF", p), operations, totalOperations, eta(p, start, operations, totalOperations)); + } + + @Override + public boolean hasNext() { + return !blocks.isEmpty() || !outerPoints.isEmpty(); + } + + @Override + public void next() { + operations++; + if (!blocks.isEmpty()) { + Point point = blocks.remove(0); + boolean isInCuboid = false; + Cuboid tempCuboid = ONE.add(point); + Cuboid aboveHalfTempCuboid = ABOVE_HALF.add(point); + List intersectedCuboids = new ArrayList<>(); + for (Cuboid cuboid : cuboids) { + if (cuboid.intersects(tempCuboid)) { + isInCuboid = true; + intersectedCuboids.add(cuboid); + } + if (cuboid.intersects(aboveHalfTempCuboid)) { + intersectedCuboids.add(cuboid); + } + } + if (!isInCuboid) { + if (hasInnerNeighbour(point)) { + operations++; + setShell(point); + } else { + outerPoints.add(point); + } + } else { + innerPoints.add(point); + operations++; + calcInnerBlock(point, intersectedCuboids); + } + } else { + Point point = outerPoints.remove(0); + setShell(point); + } + } + + private void calcInnerBlock(Point point, List neededCuboids) { + List blockDataWithBoundingBoxList = new ArrayList<>(); + for (BlockBoundingBox blockDataWithBoundingBox : elements) { + List cuboids = blockDataWithBoundingBox.getCuboidList().stream().map(c -> c.add(point)).collect(Collectors.toList()); + + boolean isInCuboid = false; + for (Cuboid cuboid : neededCuboids) { + if (cuboids.stream().anyMatch(cuboid::intersects)) { + isInCuboid = true; + break; + } + } + if (!isInCuboid) { + blockDataWithBoundingBoxList.add(blockDataWithBoundingBox); + break; + } + } + if (blockDataWithBoundingBoxList.isEmpty()) { + return; + } + + BlockBoundingBox highest = blockDataWithBoundingBoxList.get(0); + Location location = new Location(world, point.getX(), point.getY(), point.getZ()); + if (!location.getBlock().getType().isAir()) { + return; + } + try { + editSession.setBlock(BukkitAdapter.asBlockVector(location), BukkitAdapter.adapt(highest.blockData)); + location.getBlock().setBlockData(highest.blockData, false); + if (highest.blockConsumer != null) highest.blockConsumer.accept(location.getBlock()); + } catch (MaxChangedBlocksException e) { + e.printStackTrace(); + // ignored + } + } + + private boolean hasInnerNeighbour(Point point) { + Point p1 = new Point(point.getX() - 1, point.getY(), point.getZ()); + if (innerPoints.contains(p1)) { + return true; + } + Point p2 = new Point(point.getX() + 1, point.getY(), point.getZ()); + if (innerPoints.contains(p2)) { + return true; + } + Point p3 = new Point(point.getX(), point.getY() - 1, point.getZ()); + if (innerPoints.contains(p3)) { + return true; + } + Point p4 = new Point(point.getX(), point.getY() + 1, point.getZ()); + if (innerPoints.contains(p4)) { + return true; + } + Point p5 = new Point(point.getX(), point.getY(), point.getZ() - 1); + if (innerPoints.contains(p5)) { + return true; + } + Point p6 = new Point(point.getX(), point.getY(), point.getZ() + 1); + if (innerPoints.contains(p6)) { + return true; + } + return false; + } + + private void setShell(Point point) { + if (hasInnerNeighbour(point)) { + Location location = new Location(world, point.getX(), point.getY(), point.getZ()); + if (!location.getBlock().getType().isAir()) { + return; + } + try { + editSession.setBlock(BukkitAdapter.asBlockVector(location), SHELL); + location.getBlock().setType(Material.END_STONE, false); + } catch (MaxChangedBlocksException e) { + e.printStackTrace(); + // ingored + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingOuterBlocksState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingOuterBlocksState.java deleted file mode 100644 index 991ca014..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingOuterBlocksState.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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 . - */ - -package de.steamwar.bausystem.features.slaves.laufbau.states; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockTypes; -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.region.Point; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.entity.Player; - -import java.util.List; - -public class CreatingOuterBlocksState implements LaufbauState { - - private static final BaseBlock SHELL; - - static { - SHELL = BlockTypes.get("minecraft:end_stone").getDefaultState().toBaseBlock(); - } - - private long start = System.currentTimeMillis(); - - private List outerBlocks; - private int index = 0; - - private World world; - private EditSession editSession; - - public CreatingOuterBlocksState(List outerBlocks, World world, EditSession editSession) { - this.outerBlocks = outerBlocks; - this.world = world; - this.editSession = editSession; - } - - @Override - public String actionBarMessage(Player p) { - return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_CREATING_OUTER_BLOCKS", p), index, outerBlocks.size(), eta(p, start, index, outerBlocks.size())); - } - - @Override - public boolean hasNext() { - return index < outerBlocks.size(); - } - - @Override - public void next() { - Point point = outerBlocks.get(index); - index++; - - Location location = new Location(world, point.getX(), point.getY(), point.getZ()); - if (!location.getBlock().getType().isAir()) { - return; - } - try { - editSession.setBlock(BukkitAdapter.asBlockVector(location), SHELL); - location.getBlock().setType(Material.END_STONE, false); - } catch (MaxChangedBlocksException e) { - e.printStackTrace(); - // ingored - } - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ExpandingTracesState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ExpandingTracesState.java deleted file mode 100644 index 33a9004d..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ExpandingTracesState.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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 . - */ - -package de.steamwar.bausystem.features.slaves.laufbau.states; - -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.region.Point; -import lombok.Getter; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.entity.Player; -import org.bukkit.util.Vector; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.function.BiPredicate; - -public class ExpandingTracesState implements LaufbauState { - - private long start = System.currentTimeMillis(); - - private List cuboidList; - private int totalCuboids; - - private World world; - private BiPredicate inRegionCheck; - - @Getter - private Set blocks = new HashSet<>(); - - public ExpandingTracesState(List cuboidList, World world, BiPredicate inRegionCheck) { - this.cuboidList = new ArrayList<>(cuboidList); - this.totalCuboids = cuboidList.size(); - this.world = world; - this.inRegionCheck = inRegionCheck; - } - - @Override - public String actionBarMessage(Player p) { - return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_EXPANDING_TRACES", p), totalCuboids - cuboidList.size(), totalCuboids, eta(p, start, totalCuboids - cuboidList.size(), totalCuboids)); - } - - @Override - public boolean hasNext() { - return !cuboidList.isEmpty(); - } - - @Override - public void next() { - Cuboid cuboid = cuboidList.remove(0); - for (double x = cuboid.getX() - 2; x < cuboid.getX() + cuboid.getDx() + 2; x++) { - for (double y = cuboid.getY() - 2; y < cuboid.getY() + cuboid.getDy() + 2; y++) { - for (double z = cuboid.getZ() - 2; z < cuboid.getZ() + cuboid.getDz() + 2; z++) { - Location location = new Location(world, x, y, z); - if (inRegionCheck.test(new Vector(location.getBlockX(), location.getBlockY(), location.getBlockZ()), 0)) { - Point point = new Point(location.getBlockX(), location.getBlockY(), location.getBlockZ()); - blocks.add(point); - } - } - } - } - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/LaufbauState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/LaufbauState.java index 3401914d..346332fe 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/LaufbauState.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/LaufbauState.java @@ -22,9 +22,8 @@ package de.steamwar.bausystem.features.slaves.laufbau.states; import de.steamwar.bausystem.BauSystem; import org.bukkit.entity.Player; -import java.text.SimpleDateFormat; -import java.time.Instant; -import java.util.Date; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; public interface LaufbauState { @@ -35,6 +34,8 @@ public interface LaufbauState { void next(); default String eta(Player p, long start, int done, int total) { - return new SimpleDateFormat(BauSystem.MESSAGE.parse("TIME", p)).format(Date.from(Instant.ofEpochMilli((System.currentTimeMillis() - start) / done * total))); + if (total == 0) return ""; + long elapsed = System.currentTimeMillis() - start; + return LocalTime.ofNanoOfDay((long) (elapsed / (done / (double) total) - elapsed) * 1000000).format(DateTimeFormatter.ofPattern(BauSystem.MESSAGE.parse("TIME", p))); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java index ead42c62..bde0c16f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ProcessingTracesState.java @@ -21,56 +21,97 @@ package de.steamwar.bausystem.features.slaves.laufbau.states; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; +import de.steamwar.bausystem.features.slaves.laufbau.states.LaufbauState; import de.steamwar.bausystem.features.tracer.TNTPosition; +import de.steamwar.bausystem.region.Point; import lombok.Getter; +import org.bukkit.Location; +import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.util.Vector; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; +import java.util.function.BiPredicate; public class ProcessingTracesState implements LaufbauState { private long start = System.currentTimeMillis(); - private int totalTNTPositions; + private int totalCuboids; private List tntPositionList; + private World world; + private BiPredicate inRegionCheck; + + private List toExpand = new ArrayList<>(); + @Getter private List cuboidList = new ArrayList<>(); - public ProcessingTracesState(List tntPositionList) { + @Getter + private Set blocks = new HashSet<>(); + + public ProcessingTracesState(List tntPositionList, World world, BiPredicate inRegionCheck) { this.tntPositionList = tntPositionList; - this.totalTNTPositions = tntPositionList.size(); + this.totalCuboids = tntPositionList.stream().mapToInt(tntPosition -> tntPosition.getPreviousLocation() == null ? 1 : 3).sum(); + this.world = world; + this.inRegionCheck = inRegionCheck; } @Override public String actionBarMessage(Player p) { - return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_PROCESSING_TRACES", p), totalTNTPositions - tntPositionList.size(), totalTNTPositions, eta(p, start, totalTNTPositions - tntPositionList.size(), totalTNTPositions)); + return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_PROCESSING_TRACES", p), totalCuboids - cuboidList.size(), totalCuboids, eta(p, start, totalCuboids - cuboidList.size(), totalCuboids)); } @Override public boolean hasNext() { - return !tntPositionList.isEmpty(); + return !tntPositionList.isEmpty() || !toExpand.isEmpty(); } @Override public void next() { - TNTPosition tntPosition = tntPositionList.remove(0); + if (!toExpand.isEmpty()) { + Cuboid cuboid = toExpand.remove(0); + expandCuboid(cuboid); + } else { + TNTPosition tntPosition = tntPositionList.remove(0); + createCuboid(tntPosition); + } + } + + private void createCuboid(TNTPosition tntPosition) { Vector location = tntPosition.getLocation(); Vector previousLocation = tntPosition.getPreviousLocation(); if (previousLocation == null) { - cuboidList.add(new Cuboid(location.getX() - 0.49, location.getY(), location.getZ() - 0.49, 0.98, 0.98, 0.98)); + toExpand.add(new Cuboid(location.getX() - 0.49, location.getY(), location.getZ() - 0.49, 0.98, 0.98, 0.98)); } else { Vector movement = location.clone().subtract(previousLocation); - cuboidList.add(new Cuboid(previousLocation.getX() - 0.49, Math.min(previousLocation.getY(), location.getY()), previousLocation.getZ() - 0.49, 0.98, Math.abs(movement.getY()) + 0.98, 0.98)); + toExpand.add(new Cuboid(previousLocation.getX() - 0.49, Math.min(previousLocation.getY(), location.getY()), previousLocation.getZ() - 0.49, 0.98, Math.abs(movement.getY()) + 0.98, 0.98)); if (Math.abs(tntPosition.getUpdateVelocity().getX()) >= Math.abs(tntPosition.getUpdateVelocity().getZ())) { - cuboidList.add(new Cuboid(Math.min(previousLocation.getX(), location.getX()) - 0.49, location.getY(), previousLocation.getZ() - 0.49, Math.abs(movement.getX()) + 0.98, 0.98, 0.98)); - cuboidList.add(new Cuboid(location.getX() - 0.49, location.getY(), Math.min(previousLocation.getZ(), location.getZ()) - 0.49, 0.98, 0.98, Math.abs(movement.getZ()) + 0.98)); + toExpand.add(new Cuboid(Math.min(previousLocation.getX(), location.getX()) - 0.49, location.getY(), previousLocation.getZ() - 0.49, Math.abs(movement.getX()) + 0.98, 0.98, 0.98)); + toExpand.add(new Cuboid(location.getX() - 0.49, location.getY(), Math.min(previousLocation.getZ(), location.getZ()) - 0.49, 0.98, 0.98, Math.abs(movement.getZ()) + 0.98)); } else { - cuboidList.add(new Cuboid(previousLocation.getX() - 0.49, location.getY(), Math.min(previousLocation.getZ(), location.getZ()) - 0.49, 0.98, 0.98, Math.abs(movement.getZ()) + 0.98)); - cuboidList.add(new Cuboid(Math.min(previousLocation.getX(), location.getX()) - 0.49, location.getY(), location.getZ() - 0.49, Math.abs(movement.getX()) + 0.98, 0.98, 0.98)); + toExpand.add(new Cuboid(previousLocation.getX() - 0.49, location.getY(), Math.min(previousLocation.getZ(), location.getZ()) - 0.49, 0.98, 0.98, Math.abs(movement.getZ()) + 0.98)); + toExpand.add(new Cuboid(Math.min(previousLocation.getX(), location.getX()) - 0.49, location.getY(), location.getZ() - 0.49, Math.abs(movement.getX()) + 0.98, 0.98, 0.98)); + } + } + } + + private void expandCuboid(Cuboid cuboid) { + cuboidList.add(cuboid); + for (double x = cuboid.getX() - 2; x < cuboid.getX() + cuboid.getDx() + 2; x++) { + for (double y = cuboid.getY() - 2; y < cuboid.getY() + cuboid.getDy() + 2; y++) { + for (double z = cuboid.getZ() - 2; z < cuboid.getZ() + cuboid.getDz() + 2; z++) { + Location location = new Location(world, x, y, z); + if (inRegionCheck.test(new Vector(location.getBlockX(), location.getBlockY(), location.getBlockZ()), 0)) { + Point point = new Point(location.getBlockX(), location.getBlockY(), location.getBlockZ()); + blocks.add(point); + } + } } } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ShrinkingOuterPointsState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ShrinkingOuterPointsState.java deleted file mode 100644 index 487b9991..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/ShrinkingOuterPointsState.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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 . - */ - -package de.steamwar.bausystem.features.slaves.laufbau.states; - -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.region.Point; -import lombok.Getter; -import org.bukkit.entity.Player; - -import java.util.ArrayList; -import java.util.List; - -public class ShrinkingOuterPointsState implements LaufbauState { - - private long start = System.currentTimeMillis(); - - private List outerPoints; - private List innerPoints; - private int index = 0; - - @Getter - private List shrunkOuterPoints = new ArrayList<>(); - - public ShrinkingOuterPointsState(List outerPoints, List innerPoints) { - this.outerPoints = outerPoints; - this.innerPoints = innerPoints; - } - - @Override - public String actionBarMessage(Player p) { - return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_SHRINKING_POINTS", p), index, outerPoints.size(), eta(p, start, index, outerPoints.size())); - } - - @Override - public boolean hasNext() { - return index < outerPoints.size(); - } - - @Override - public void next() { - Point point = outerPoints.get(index); - index++; - - Point p1 = new Point(point.getX() - 1, point.getY(), point.getZ()); - if (innerPoints.contains(p1)) { - shrunkOuterPoints.add(point); - return; - } - Point p2 = new Point(point.getX() + 1, point.getY(), point.getZ()); - if (innerPoints.contains(p2)) { - shrunkOuterPoints.add(point); - return; - } - Point p3 = new Point(point.getX(), point.getY() - 1, point.getZ()); - if (innerPoints.contains(p3)) { - shrunkOuterPoints.add(point); - return; - } - Point p4 = new Point(point.getX(), point.getY() + 1, point.getZ()); - if (innerPoints.contains(p4)) { - shrunkOuterPoints.add(point); - return; - } - Point p5 = new Point(point.getX(), point.getY(), point.getZ() - 1); - if (innerPoints.contains(p5)) { - shrunkOuterPoints.add(point); - return; - } - Point p6 = new Point(point.getX(), point.getY(), point.getZ() + 1); - if (innerPoints.contains(p6)) { - shrunkOuterPoints.add(point); - return; - } - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/SplittingPointsState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/SplittingPointsState.java deleted file mode 100644 index 2a61dd44..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/SplittingPointsState.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 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 . - */ - -package de.steamwar.bausystem.features.slaves.laufbau.states; - -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; -import de.steamwar.bausystem.region.Point; -import lombok.Getter; -import org.bukkit.entity.Player; - -import java.util.*; - -public class SplittingPointsState implements LaufbauState { - - private static final Cuboid ONE = new Cuboid(0, 0, 0, 1, 1, 1); - private static final Cuboid ABOVE_HALF = new Cuboid(0, 1, 0, 1, 0.5, 1); - - private long start = System.currentTimeMillis(); - - private List blocks; - private int totalBlocks; - private List cuboidList; - - @Getter - private List innerPoints = new ArrayList<>(); - - @Getter - private List outerPoints = new ArrayList<>(); - - @Getter - private Map> intersectedCuboid = new HashMap<>(); - - public SplittingPointsState(Set blocks, List cuboidList) { - this.blocks = new ArrayList<>(blocks); - this.totalBlocks = blocks.size(); - this.cuboidList = cuboidList; - } - - @Override - public String actionBarMessage(Player p) { - return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_SPLITTING_POINTS", p), totalBlocks - blocks.size(), totalBlocks, eta(p, start, totalBlocks - blocks.size(), totalBlocks)); - } - - @Override - public boolean hasNext() { - return !blocks.isEmpty(); - } - - @Override - public void next() { - Point point = blocks.remove(0); - boolean isInCuboid = false; - Cuboid tempCuboid = ONE.add(point); - Cuboid aboveHalfTempCuboid = ABOVE_HALF.add(point); - List intersectedCuboids = new ArrayList<>(); - for (Cuboid cuboid : cuboidList) { - if (cuboid.intersects(tempCuboid)) { - isInCuboid = true; - intersectedCuboids.add(cuboid); - } - if (cuboid.intersects(aboveHalfTempCuboid)) { - intersectedCuboids.add(cuboid); - } - } - if (!isInCuboid) { - outerPoints.add(point); - } else { - innerPoints.add(point); - intersectedCuboid.put(point, intersectedCuboids); - } - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/Panzern.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/Panzern.java index ca667a8b..f8ade838 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/Panzern.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/Panzern.java @@ -23,9 +23,8 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockTypes; -import de.steamwar.bausystem.utils.WorldEditUtils; -import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.LinkageUtils; +import de.steamwar.bausystem.utils.WorldEditUtils; import lombok.Getter; import lombok.SneakyThrows; import org.bukkit.Location; @@ -41,7 +40,7 @@ public class Panzern { private static List panzernAlgorithmList = new ArrayList<>(); static { - LinkageUtils.run(LinkageType.PANZERN); + LinkageUtils.linkPanzern(); } public static void add(PanzernAlgorithm panzernAlgorithm) { panzernAlgorithmList.add(panzernAlgorithm); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernCommand.java index 83d93f13..9f26830c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernCommand.java @@ -22,13 +22,12 @@ package de.steamwar.bausystem.features.slaves.panzern; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.utils.WorldEditUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.shared.Pair; +import de.steamwar.bausystem.utils.WorldEditUtils; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -41,7 +40,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -@Linked(LinkageType.COMMAND) +@Linked public class PanzernCommand extends SWCommand { public PanzernCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentHoney.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentHoney.java index 3992c3a8..7dd8accd 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentHoney.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentHoney.java @@ -21,8 +21,7 @@ package de.steamwar.bausystem.features.slaves.panzern.algorithms; import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm; import de.steamwar.bausystem.features.slaves.panzern.PanzernResult; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -30,7 +29,7 @@ import org.bukkit.block.BlockFace; import java.util.Map; import java.util.Set; -@Linked(LinkageType.PANZERN) +@Linked public class AdjacentHoney implements PanzernAlgorithm { private PistonLine pistonLine = new PistonLine(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentSlime.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentSlime.java index 21469412..f25c55e4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentSlime.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentSlime.java @@ -21,8 +21,7 @@ package de.steamwar.bausystem.features.slaves.panzern.algorithms; import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm; import de.steamwar.bausystem.features.slaves.panzern.PanzernResult; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -30,7 +29,7 @@ import org.bukkit.block.BlockFace; import java.util.Map; import java.util.Set; -@Linked(LinkageType.PANZERN) +@Linked public class AdjacentSlime implements PanzernAlgorithm { private PistonLine pistonLine = new PistonLine(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/CarpetWalkWay.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/CarpetWalkWay.java index 302e951e..58529f2c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/CarpetWalkWay.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/CarpetWalkWay.java @@ -21,8 +21,7 @@ package de.steamwar.bausystem.features.slaves.panzern.algorithms; import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm; import de.steamwar.bausystem.features.slaves.panzern.PanzernResult; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -30,7 +29,7 @@ import org.bukkit.block.BlockFace; import java.util.Map; import java.util.Set; -@Linked(LinkageType.PANZERN) +@Linked public class CarpetWalkWay implements PanzernAlgorithm { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/LadderWalkWay.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/LadderWalkWay.java index 37ca6002..2a32bd7a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/LadderWalkWay.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/LadderWalkWay.java @@ -21,8 +21,7 @@ package de.steamwar.bausystem.features.slaves.panzern.algorithms; import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm; import de.steamwar.bausystem.features.slaves.panzern.PanzernResult; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -30,7 +29,7 @@ import org.bukkit.block.BlockFace; import java.util.Map; import java.util.Set; -@Linked(LinkageType.PANZERN) +@Linked public class LadderWalkWay implements PanzernAlgorithm { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PistonLine.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PistonLine.java index 653ccec2..3fabd420 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PistonLine.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PistonLine.java @@ -21,9 +21,8 @@ package de.steamwar.bausystem.features.slaves.panzern.algorithms; import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm; import de.steamwar.bausystem.features.slaves.panzern.PanzernResult; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.utils.FlatteningWrapper; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -33,7 +32,7 @@ import org.bukkit.block.data.type.Piston; import java.util.Map; import java.util.Set; -@Linked(LinkageType.PANZERN) +@Linked public class PistonLine implements PanzernAlgorithm { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PowerableActivation.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PowerableActivation.java index 1fa366b1..41b7f69d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PowerableActivation.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PowerableActivation.java @@ -21,8 +21,7 @@ package de.steamwar.bausystem.features.slaves.panzern.algorithms; import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm; import de.steamwar.bausystem.features.slaves.panzern.PanzernResult; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -34,7 +33,7 @@ import org.bukkit.block.data.type.RedstoneWire; import java.util.Map; import java.util.Set; -@Linked(LinkageType.PANZERN) +@Linked public class PowerableActivation implements PanzernAlgorithm { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/SlabOnRedstone.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/SlabOnRedstone.java index 74c2ddf3..207f1d57 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/SlabOnRedstone.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/SlabOnRedstone.java @@ -21,8 +21,7 @@ package de.steamwar.bausystem.features.slaves.panzern.algorithms; import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm; import de.steamwar.bausystem.features.slaves.panzern.PanzernResult; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -30,7 +29,7 @@ import org.bukkit.block.BlockFace; import java.util.Map; import java.util.Set; -@Linked(LinkageType.PANZERN) +@Linked public class SlabOnRedstone implements PanzernAlgorithm { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/SlabOnTorch.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/SlabOnTorch.java index 8050303b..beebb532 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/SlabOnTorch.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/SlabOnTorch.java @@ -21,8 +21,7 @@ package de.steamwar.bausystem.features.slaves.panzern.algorithms; import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm; import de.steamwar.bausystem.features.slaves.panzern.PanzernResult; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -32,7 +31,7 @@ import org.bukkit.block.data.Powerable; import java.util.Map; import java.util.Set; -@Linked(LinkageType.PANZERN) +@Linked public class SlabOnTorch implements PanzernAlgorithm { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/StairWalkWay.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/StairWalkWay.java index ee08a485..1f631afe 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/StairWalkWay.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/StairWalkWay.java @@ -21,8 +21,7 @@ package de.steamwar.bausystem.features.slaves.panzern.algorithms; import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm; import de.steamwar.bausystem.features.slaves.panzern.PanzernResult; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -32,7 +31,7 @@ import org.bukkit.block.data.type.Stairs; import java.util.Map; import java.util.Set; -@Linked(LinkageType.PANZERN) +@Linked public class StairWalkWay implements PanzernAlgorithm { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceCommand.java index 399e21b5..526e59e6 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceCommand.java @@ -22,12 +22,11 @@ package de.steamwar.bausystem.features.smartplace; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.configplayer.Config; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class SmartPlaceCommand extends SWCommand { public SmartPlaceCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java index 98f2c99e..a5ac0456 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java @@ -20,9 +20,8 @@ package de.steamwar.bausystem.features.smartplace; import de.steamwar.bausystem.configplayer.Config; -import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.LinkageUtils; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.GameMode; import org.bukkit.block.data.BlockData; import org.bukkit.block.data.Directional; @@ -36,7 +35,7 @@ import org.bukkit.event.player.PlayerInteractEvent; import java.util.ArrayList; import java.util.List; -@Linked(LinkageType.LISTENER) +@Linked public class SmartPlaceListener implements Listener { private static List smartPlaceBehaviours = new ArrayList<>(); @@ -48,7 +47,7 @@ public class SmartPlaceListener implements Listener { @EventHandler public void onBlockPlace(BlockPlaceEvent event) { if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return; - LinkageUtils.run(LinkageType.SMART_PLACE); + if (smartPlaceBehaviours.isEmpty()) LinkageUtils.linkSmartPlace(); SmartPlaceBehaviour.SmartPlaceResult smartPlaceResult = SmartPlaceBehaviour.SmartPlaceResult.IGNORED; for (SmartPlaceBehaviour smartPlaceBehaviour : smartPlaceBehaviours) { if (smartPlaceBehaviour.getType() == SmartPlaceBehaviour.SmartPlaceType.PLACE) { @@ -63,7 +62,7 @@ public class SmartPlaceListener implements Listener { @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return; - LinkageUtils.run(LinkageType.SMART_PLACE); + if (smartPlaceBehaviours.isEmpty()) LinkageUtils.linkSmartPlace(); if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return; if (event.getPlayer().getGameMode() == GameMode.SPECTATOR) return; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/behaviour/BlockPlaceBehaviour.java b/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/behaviour/BlockPlaceBehaviour.java index 68830598..97b93b94 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/behaviour/BlockPlaceBehaviour.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/behaviour/BlockPlaceBehaviour.java @@ -20,8 +20,7 @@ package de.steamwar.bausystem.features.smartplace.behaviour; import de.steamwar.bausystem.features.smartplace.SmartPlaceBehaviour; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.data.BlockData; @@ -29,7 +28,7 @@ import org.bukkit.block.data.Directional; import org.bukkit.block.data.Rotatable; import org.bukkit.event.block.BlockPlaceEvent; -@Linked(LinkageType.SMART_PLACE) +@Linked public class BlockPlaceBehaviour implements SmartPlaceBehaviour { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/behaviour/BlockRotatingBehaviour.java b/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/behaviour/BlockRotatingBehaviour.java index fc8a2150..eed4df5a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/behaviour/BlockRotatingBehaviour.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/behaviour/BlockRotatingBehaviour.java @@ -20,8 +20,7 @@ package de.steamwar.bausystem.features.smartplace.behaviour; import de.steamwar.bausystem.features.smartplace.SmartPlaceBehaviour; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; @@ -33,7 +32,7 @@ import org.bukkit.event.Event; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.InventoryHolder; -@Linked(LinkageType.SMART_PLACE) +@Linked public class BlockRotatingBehaviour implements SmartPlaceBehaviour { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/behaviour/ReverseRepeaterBehaviour.java b/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/behaviour/ReverseRepeaterBehaviour.java index 2c4a071a..13242417 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/behaviour/ReverseRepeaterBehaviour.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/behaviour/ReverseRepeaterBehaviour.java @@ -20,13 +20,12 @@ package de.steamwar.bausystem.features.smartplace.behaviour; import de.steamwar.bausystem.features.smartplace.SmartPlaceBehaviour; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.data.type.Repeater; import org.bukkit.event.player.PlayerInteractEvent; -@Linked(LinkageType.SMART_PLACE) +@Linked public class ReverseRepeaterBehaviour implements SmartPlaceBehaviour { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/team/LockSchemCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/team/LockSchemCommand.java index daa5200f..05e0c408 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/team/LockSchemCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/team/LockSchemCommand.java @@ -20,16 +20,15 @@ package de.steamwar.bausystem.features.team; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicType; import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.UserGroup; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class LockSchemCommand extends SWCommand { public LockSchemCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/team/SkinCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/team/SkinCommand.java index daea307c..c9e2f80f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/team/SkinCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/team/SkinCommand.java @@ -20,12 +20,11 @@ package de.steamwar.bausystem.features.team; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; +import de.steamwar.linkage.Linked; import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.UserGroup; import net.md_5.bungee.api.chat.ClickEvent; @@ -41,7 +40,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -@Linked(LinkageType.COMMAND) +@Linked public class SkinCommand extends SWCommand { public SkinCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/techhider/TechHiderCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/techhider/TechHiderCommand.java index 4f150ef3..622632fd 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/techhider/TechHiderCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/techhider/TechHiderCommand.java @@ -21,12 +21,11 @@ package de.steamwar.bausystem.features.techhider; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.xray.XrayCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; -import de.steamwar.bausystem.linkage.LinkedInstance; import de.steamwar.bausystem.region.Region; import de.steamwar.command.SWCommand; import de.steamwar.core.CraftbukkitWrapper; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import de.steamwar.techhider.TechHider; import net.md_5.bungee.api.ChatMessageType; import org.bukkit.Material; @@ -41,8 +40,7 @@ import java.io.File; import java.util.*; import java.util.stream.Collectors; -@Linked(LinkageType.COMMAND) -@Linked(LinkageType.LISTENER) +@Linked public class TechHiderCommand extends SWCommand implements Listener { public TechHiderCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/blockcounter/BlockCounterCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/blockcounter/BlockCounterCommand.java index 6d997edd..a31cba2b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/blockcounter/BlockCounterCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/blockcounter/BlockCounterCommand.java @@ -20,12 +20,11 @@ package de.steamwar.bausystem.features.testblock.blockcounter; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class BlockCounterCommand extends SWCommand { public BlockCounterCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/blockcounter/BlockCounterListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/blockcounter/BlockCounterListener.java index f910f935..979e5fe3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/blockcounter/BlockCounterListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/blockcounter/BlockCounterListener.java @@ -19,11 +19,10 @@ package de.steamwar.bausystem.features.testblock.blockcounter; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionType; +import de.steamwar.linkage.Linked; import org.bukkit.block.Block; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -32,7 +31,7 @@ import org.bukkit.event.entity.EntityExplodeEvent; import java.util.List; import java.util.stream.Collectors; -@Linked(LinkageType.LISTENER) +@Linked public class BlockCounterListener implements Listener { @EventHandler diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/depthcounter/DepthCounterCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/depthcounter/DepthCounterCommand.java index 5eaa9399..b8fd1e6c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/depthcounter/DepthCounterCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/depthcounter/DepthCounterCommand.java @@ -20,12 +20,11 @@ package de.steamwar.bausystem.features.testblock.depthcounter; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class DepthCounterCommand extends SWCommand { public DepthCounterCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/depthcounter/DepthCounterListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/depthcounter/DepthCounterListener.java index a98176c9..c48142d2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/depthcounter/DepthCounterListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/depthcounter/DepthCounterListener.java @@ -19,11 +19,10 @@ package de.steamwar.bausystem.features.testblock.depthcounter; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionType; +import de.steamwar.linkage.Linked; import org.bukkit.block.Block; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -34,7 +33,7 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; -@Linked(LinkageType.LISTENER) +@Linked public class DepthCounterListener implements Listener { @EventHandler diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSLimitBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSLimitBauGuiItem.java index 8451bf5a..376f9cd4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSLimitBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSLimitBauGuiItem.java @@ -21,11 +21,10 @@ package de.steamwar.bausystem.features.tpslimit; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -33,7 +32,7 @@ import org.bukkit.inventory.ItemStack; import java.util.Arrays; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class TPSLimitBauGuiItem extends BauGuiItem { public TPSLimitBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSLimitCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSLimitCommand.java index 7950e401..778b6f82 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSLimitCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSLimitCommand.java @@ -22,12 +22,11 @@ package de.steamwar.bausystem.features.tpslimit; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.linkage.Enable; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommandUtils; import de.steamwar.command.TypeMapper; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.api.Enable; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -35,8 +34,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -@Linked(LinkageType.COMMAND) -@Linked(LinkageType.ENABLE_LINK) +@Linked public class TPSLimitCommand extends SWCommand implements Enable { private final List tabCompletions = new ArrayList<>(Arrays.asList("0,5", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20")); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TickCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TickCommand.java index 3f64b398..cf7ca1b3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TickCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TickCommand.java @@ -21,9 +21,8 @@ package de.steamwar.bausystem.features.tpslimit; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; @@ -31,7 +30,7 @@ import org.bukkit.scheduler.BukkitRunnable; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; -@Linked(LinkageType.COMMAND) +@Linked public class TickCommand extends SWCommand { private AtomicInteger ticksLeft = null; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/AbstractTraceEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/AbstractTraceEntity.java index ef0df4aa..10179551 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/AbstractTraceEntity.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/AbstractTraceEntity.java @@ -1,7 +1,7 @@ /* * This file is a part of the SteamWar software. * - * Copyright (C) 2021 SteamWar.de-Serverteam + * Copyright (C) 2022 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 diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPosition.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPosition.java index 09b882ee..38b6f844 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPosition.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPosition.java @@ -1,7 +1,7 @@ /* * This file is a part of the SteamWar software. * - * Copyright (C) 2021 SteamWar.de-Serverteam + * Copyright (C) 2022 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 @@ -53,15 +53,17 @@ public class TNTPosition extends Position { private final Vector previousLocation; private final Vector velocity; private final CachingSupplier updateVelocity; + private final boolean source; private final boolean exploded; - public TNTPosition(Record.TNTRecord record, TNTPrimed entity, Vector previousLocation, Vector velocity, CachingSupplier updateVelocity, boolean exploded) { + public TNTPosition(Record.TNTRecord record, TNTPrimed entity, Vector previousLocation, Vector velocity, CachingSupplier updateVelocity, boolean source, boolean exploded) { super(entity.getLocation().toVector()); this.record = record; this.fuseTicks = entity.getFuseTicks(); this.previousLocation = previousLocation; this.velocity = velocity; this.updateVelocity = updateVelocity; + this.source = source; this.exploded = exploded; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index f6a09b88..ced48fde 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -1,47 +1,40 @@ -/* - 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 . -*/ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ package de.steamwar.bausystem.features.tracer; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.features.tracer.gui.TraceGui; -import de.steamwar.bausystem.features.tracer.gui.TraceShowGui; -import de.steamwar.bausystem.features.tracer.record.RecordStateMachine; +import de.steamwar.bausystem.features.tracer.record.*; import de.steamwar.bausystem.features.tracer.show.Record; import de.steamwar.bausystem.features.tracer.show.*; -import de.steamwar.bausystem.features.tracer.show.mode.BlockShowMode; -import de.steamwar.bausystem.features.tracer.show.mode.ParticleShowMode; import de.steamwar.bausystem.features.tracer.show.mode.RawEntityShowMode; import de.steamwar.bausystem.features.tracer.show.mode.TraceEntityShowMode; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.shared.ShowMode; -import de.steamwar.bausystem.utils.ListChatView; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import lombok.AllArgsConstructor; -import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.ComponentBuilder; -import net.md_5.bungee.api.chat.HoverEvent; -import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -50,13 +43,179 @@ import java.util.function.BiFunction; import java.util.function.Supplier; import java.util.stream.Collectors; -@Linked(LinkageType.COMMAND) +@Linked public class TraceCommand extends SWCommand { public TraceCommand() { super("trace", "trail"); } + @LinkedInstance + public Recorder recorder; + + @Register(value = {"start"}, description = "TRACE_COMMAND_HELP_START") + public void startCommand(@Validator Player p) { + Region region = Region.getRegion(p.getLocation()); + recorder.set(region, new SimpleTraceRecorder()); + BauSystem.MESSAGE.send("TRACE_MESSAGE_START", p); + } + + @Register(value = {"single"}, description = "TRACE_COMMAND_HELP_SINGLE") + public void singleCommand(@Validator Player p) { + Region region = Region.getRegion(p.getLocation()); + recorder.set(region, new SingleTraceRecorder(region)); + BauSystem.MESSAGE.send("TRACE_MESSAGE_SINGLE", p); + } + + @Register(value = {"stop"}, description = "TRACE_COMMAND_HELP_STOP") + public void stopCommand(@Validator Player p) { + Region region = Region.getRegion(p.getLocation()); + recorder.remove(region); + BauSystem.MESSAGE.send("TRACE_MESSAGE_STOP", p); + } + + @Register(value = {"auto"}, description = "TRACE_COMMAND_HELP_AUTO") + @Register({"toggleauto"}) + public void autoCommand(@Validator Player p, @OptionalValue("-explode") @StaticValue({"-explode", "-ignite"}) String type) { + Region region = Region.getRegion(p.getLocation()); + switch (type) { + case "-explode": + recorder.set(region, new AutoExplodeTraceRecorder()); + BauSystem.MESSAGE.send("TRACE_MESSAGE_AUTO_IDLE_EXPLODE", p); + break; + case "-ignite": + recorder.set(region, new AutoIgniteTraceRecorder()); + BauSystem.MESSAGE.send("TRACE_MESSAGE_AUTO_IDLE_IGNITE", p); + break; + default: + break; + } + } + + @Register(value = {"show"}, description = "TRACE_COMMAND_HELP_SHOW") + public void showCommand(@Validator Player p, @OptionalValue("entity") ShowModeType showModeType, ShowModeParameterType... showModeParameterTypes) { + ShowModeParameter showModeParameter = new ShowModeParameter(); + for (ShowModeParameterType showModeParameterType : showModeParameterTypes) { + showModeParameterType.getShowModeParameterConsumer().accept(showModeParameter); + } + TraceShowManager.show(p, showModeType.showModeBiFunction.apply(p, showModeParameter)); + BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", p); + } + + @Register(value = {"hide"}, description = "TRACE_COMMAND_HELP_HIDE") + public void hideCommand(@Validator Player p) { + TraceShowManager.hide(p); + Region region = Region.getRegion(p.getLocation()); + StoredRecords.hideIsolated(region, p); + StoredRecords.removeReplayTime(region, p); + BauSystem.MESSAGE.send("TRACE_MESSAGE_HIDE", p); + } + + @Register(value = {"delete"}, description = "TRACE_COMMAND_HELP_DELETE") + @Register({"clear"}) + public void deleteCommand(@Validator Player p) { + Region region = Region.getRegion(p.getLocation()); + StoredRecords.clear(region); + StoredRecords.hideIsolated(region); + StoredRecords.removeReplayTime(region); + BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", p); + } + + @Register(value = {"gui"}, description = "TRACE_COMMAND_HELP_GUI") + public void guiCommand(@Validator Player p) { + TraceGui.openGui(p); + } + + @Register(value = "isolate", noTabComplete = true) + public void isolate(Player p, String s) { + try { + UUID uuid = UUID.fromString(s); + Record.TNTRecord tntRecord = StoredRecords.getRecord(uuid); + StoredRecords.toggleIsolate(p, tntRecord); + } catch (Exception e) { + // Ignore + } + } + + @Register(value = "replay", description = "TRACE_COMMAND_HELP_REPLAY") + public void replay(@Validator Player p, @OptionalValue("0") int replayTick) { + Region region = Region.getRegion(p.getLocation()); + if (replayTick < 0) replayTick = 0; + StoredRecords.setReplayTime(region, p, replayTick); + } + + @Register(value = {"replay", "disable"}, description = "TRACE_COMMAND_HELP_REPLAY_DISABLE") + public void replayDisable(@Validator Player p) { + Region region = Region.getRegion(p.getLocation()); + StoredRecords.removeReplayTime(region, p); + } + + @Register(value = {"replay", "next"}, description = "TRACE_COMMAND_HELP_REPLAY_NEXT") + public void replayNext(@Validator Player p, @OptionalValue("1") int step) { + Region region = Region.getRegion(p.getLocation()); + int replayTick = StoredRecords.getReplayTime(region, p); + StoredRecords.setReplayTime(region, p, replayTick + step); + } + + @Register(value = {"replay", "previous"}, description = "TRACE_COMMAND_HELP_REPLAY_PREVIOUS") + public void replayPrevious(@Validator Player p, @OptionalValue("1") int step) { + Region region = Region.getRegion(p.getLocation()); + int replayTick = StoredRecords.getReplayTime(region, p) - step; + if (replayTick < 0) replayTick = 0; + StoredRecords.setReplayTime(region, p, replayTick); + } + + @Register(value = {"replay", "loop"}, description = "TRACE_COMMAND_HELP_REPLAY_LOOP") + public void replayLoop(@Validator Player p, int start, int end, @OptionalValue("0") int speed) { + Region region = Region.getRegion(p.getLocation()); + + if (start < 0) start = 0; + if (end < 0) end = 0; + + int initial = StoredRecords.getReplayTime(region, p); + if (!(Math.min(start, end) < initial && Math.max(start, end) > initial)) { + initial = start; + } + int finalInitial = initial; + + int finalStart = start; + int finalEnd = end; + Supplier supplier = new Supplier() { + int temp = speed; + int current = finalInitial; + + @Override + public Integer get() { + if (temp-- > 0) { + return current; + } + temp = speed; + if (finalEnd > finalStart) { + current++; + if (current > finalEnd) { + current = finalStart; + } + } else { + current--; + if (current < finalEnd) { + current = finalStart; + } + } + return current; + } + }; + StoredRecords.setReplayLoop(region, p, supplier); + } + + @AllArgsConstructor + private enum ShowModeType { + ENTITY(TraceEntityShowMode::new, new ShowModeParameterType[]{}), + RAW(RawEntityShowMode::new, new ShowModeParameterType[]{}); + + private BiFunction> showModeBiFunction; + private ShowModeParameterType[] removedTypes; + } + @ClassMapper(value = ShowModeParameterType.class, local = true) public TypeMapper showModeParameterTypesTypeMapper() { Map> showModeParameterTypeListMap = new EnumMap<>(ShowModeParameterType.class); @@ -105,199 +264,19 @@ public class TraceCommand extends SWCommand { }; } - @Register(value = {"gui"}, description = "TRACE_COMMAND_HELP_GUI") - public void guiCommand(@Validator Player p) { - TraceGui.openGui(p); - } - - @Register(value = {"record", "list"}) - @Register(value = {"list"}, description = "TRACE_COMMAND_HELP_LIST") - public void listCommand(@Validator Player player, @OptionalValue("0") int page) { - ListChatView.chatView(player, StoredRecords.getRecords(), page, record -> { - TextComponent component = new TextComponent(); - component.setText(BauSystem.MESSAGE.parse("TRACE_RECORD_LIST_ELEMENT", player, record.size())); - component.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace record " + record.getId())); - component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(BauSystem.MESSAGE.parse("TRACE_RECORD_LIST_ELEMENT_HOVER", player)))); - - TextComponent deleteComponent = new TextComponent(); - deleteComponent.setText(BauSystem.MESSAGE.parse("TRACE_RECORD_LIST_ELEMENT_DELETE", player)); - deleteComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace record delete " + record.getId())); - deleteComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(BauSystem.MESSAGE.parse("TRACE_RECORD_LIST_ELEMENT_DELETE_HOVER", player)))); - component.addExtra(deleteComponent); - return component; - }, (beforePageComponent, beforePage) -> { - beforePageComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(BauSystem.MESSAGE.parse("LIST_PREVIOUS_PAGE", player)).create())); - beforePageComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace record list " + beforePage)); - }, (afterPageComponent, afterPage) -> { - afterPageComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(BauSystem.MESSAGE.parse("LIST_NEXT_PAGE", player)).create())); - afterPageComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace record list " + afterPage)); - }); - } - - @Register(value = {"record", "delete"}, noTabComplete = true) - public void recordDelete(@Validator Player p, int id) { - StoredRecords.remove(id); - BauSystem.MESSAGE.send("TRACE_RECORD_DELETE", p); - } - - @Register(value = "record", noTabComplete = true) - public void recordList(@Validator Player player, int recordID, @OptionalValue("0") int page) { - Record traceRecord = StoredRecords.get(recordID); - if (traceRecord == null) { - BauSystem.MESSAGE.send("TRACE_RECORD_NOT_FOUND", player); - return; - } - ListChatView.chatView(player, traceRecord.getTnt(), page, tntRecord -> { - TextComponent component = new TextComponent(); - component.setText(BauSystem.MESSAGE.parse("TRACE_RECORD_ELEMENT", player, tntRecord.getPositions().size())); - component.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace record " + traceRecord.getId() + " tnt " + tntRecord.getId())); - component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(BauSystem.MESSAGE.parse("TRACE_RECORD_ELEMENT_HOVER", player)))); - - TextComponent deleteComponent = new TextComponent(); - deleteComponent.setText(BauSystem.MESSAGE.parse("TRACE_RECORD_ELEMENT_DELETE", player)); - deleteComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace record tnt delete " + traceRecord.getId() + " " + tntRecord.getId())); - deleteComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(BauSystem.MESSAGE.parse("TRACE_RECORD_ELEMENT_DELETE_HOVER", player)))); - component.addExtra(deleteComponent); - return component; - }, (beforePageComponent, beforePage) -> { - beforePageComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(BauSystem.MESSAGE.parse("LIST_PREVIOUS_PAGE", player)).create())); - beforePageComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace record " + traceRecord.getId() + " " + beforePage)); - }, (afterPageComponent, afterPage) -> { - afterPageComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(BauSystem.MESSAGE.parse("LIST_NEXT_PAGE", player)).create())); - afterPageComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace record " + traceRecord.getId() + " " + afterPage)); - }); - } - - @Register(value = {"record", "tnt", "delete"}, noTabComplete = true) - public void deleteRecordTNT(@Validator Player player, int recordID, int tntID) { - Record record = StoredRecords.get(recordID); - if (record == null) { - BauSystem.MESSAGE.send("TRACE_RECORD_NOT_FOUND", player); - return; - } - record.remove(tntID); - BauSystem.MESSAGE.send("TRACE_TNT_DELETE", player); - } - - @Register(value = "record", noTabComplete = true) - public void recordTNTPositions(@Validator Player player, int recordID, @StaticValue("tnt") String tnt, int tntID, @OptionalValue("0") int page) { - Record record = StoredRecords.get(recordID); - if (record == null) { - BauSystem.MESSAGE.send("TRACE_RECORD_NOT_FOUND", player); - return; - } - Record.TNTRecord tntRecord = record.get(tntID); - if (tntRecord == null) { - BauSystem.MESSAGE.send("TRACE_RECORD_TNT_NOT_FOUND", player); - return; - } - ListChatView.chatView(player, tntRecord.getPositions(), page, tntPosition -> { - TextComponent component = new TextComponent(); - component.setText(BauSystem.MESSAGE.parse("TRACE_TNT_ELEMENT", player, tntPosition.getFuseTicks())); - component.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace record " + record.getId() + " tnt " + tntRecord.getId() + " fuse " + tntPosition.getFuseTicks())); - component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(BauSystem.MESSAGE.parse("TRACE_TNT_ELEMENT_HOVER", player)))); - return component; - }, (beforePageComponent, beforePage) -> { - beforePageComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(BauSystem.MESSAGE.parse("LIST_PREVIOUS_PAGE", player)).create())); - beforePageComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace record " + record.getId() + " tnt " + beforePage)); - }, (afterPageComponent, afterPage) -> { - afterPageComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(BauSystem.MESSAGE.parse("LIST_NEXT_PAGE", player)).create())); - afterPageComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace record " + record.getId() + " tnt " + afterPage)); - }); - } - - @Register(value = "record", noTabComplete = true) - public void recordTNTPositions(@Validator Player player, int recordID, @StaticValue("tnt") String tnt, int tntID, @StaticValue("fuse") String fuse, int fuseTicks) { - Record record = StoredRecords.get(recordID); - if (record == null) { - BauSystem.MESSAGE.send("TRACE_RECORD_NOT_FOUND", player); - return; - } - Record.TNTRecord tntRecord = record.get(tntID); - if (tntRecord == null) { - BauSystem.MESSAGE.send("TRACE_RECORD_TNT_NOT_FOUND", player); - return; - } - TNTPosition tntPosition = tntRecord.get(fuseTicks); - if (tntPosition == null) { - BauSystem.MESSAGE.send("TRACE_RECORD_TNT_POSITION_NOT_FOUND", player); - return; - } - BauSystem.MESSAGE.sendPrefixless("TRACE_CHAT_POSITION_HEAD", player); - BauSystem.MESSAGE.sendPrefixless("TRACE_CHAT_POSITION_X", player, tntPosition.getLocation().getX()); - BauSystem.MESSAGE.sendPrefixless("TRACE_CHAT_POSITION_Y", player, tntPosition.getLocation().getY()); - BauSystem.MESSAGE.sendPrefixless("TRACE_CHAT_POSITION_Z", player, tntPosition.getLocation().getZ()); - BauSystem.MESSAGE.sendPrefixless("TRACE_CHAT_POSITION_EXPLODED", player, tntPosition.isExploded()); - } - - @Register(value = {"start"}, description = "TRACE_COMMAND_HELP_START") - public void startCommand(@Validator Player p) { - RecordStateMachine.commandStart(); - BauSystem.MESSAGE.send("TRACE_MESSAGE_START", p); - } - - @Register(value = {"single"}, description = "TRACE_COMMAND_HELP_SINGLE") - public void singleCommand(@Validator Player p) { - RecordStateMachine.commandSingle(); - BauSystem.MESSAGE.send("TRACE_MESSAGE_SINGLE", p); - } - - @Register(value = {"stop"}, description = "TRACE_COMMAND_HELP_STOP") - public void stopCommand(@Validator Player p) { - RecordStateMachine.commandStop(); - BauSystem.MESSAGE.send("TRACE_MESSAGE_STOP", p); - } - - @Register(value = {"auto"}, description = "TRACE_COMMAND_HELP_AUTO") - @Register({"toggleauto"}) - public void autoCommand(@Validator Player p) { - RecordStateMachine.commandAuto(); - BauSystem.MESSAGE.send(RecordStateMachine.getRecordStatus().getAutoMessage(), p); - } - - @Register(value = {"delete"}, description = "TRACE_COMMAND_HELP_DELETE") - @Register({"clear"}) - public void deleteCommand(@Validator Player p) { - StoredRecords.clear(); - BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", p); - } - - @Register(value = {"show"}, description = "TRACE_COMMAND_HELP_SHOW") - public void showCommand(@Validator Player p, @OptionalValue("entity") ShowModeType showModeType, ShowModeParameterType... showModeParameterTypes) { - ShowModeParameter showModeParameter = new ShowModeParameter(); - for (ShowModeParameterType showModeParameterType : showModeParameterTypes) { - showModeParameterType.getShowModeParameterConsumer().accept(showModeParameter); - } - TraceShowManager.show(p, showModeType.showModeBiFunction.apply(p, showModeParameter)); - BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", p); - } - - @AllArgsConstructor - private enum ShowModeType { - ENTITY(TraceEntityShowMode::new, new ShowModeParameterType[]{}), - RAW(RawEntityShowMode::new, new ShowModeParameterType[]{}), - PARTICLE(ParticleShowMode::new, new ShowModeParameterType[]{ShowModeParameterType.TICKS}), - BLOCK(BlockShowMode::new, new ShowModeParameterType[]{ShowModeParameterType.TICKS}); - - private BiFunction> showModeBiFunction; - private ShowModeParameterType[] removedTypes; - } - - @Register(value = {"show", "gui"}, description = "TRACE_COMMAND_HELP_SHOW_GUI") - public void showGuiCommand(@Validator Player p) { - TraceShowGui.openGui(p); - } - - @Register(value = {"hide"}, description = "TRACE_COMMAND_HELP_HIDE") - public void hideCommand(@Validator Player p) { - TraceShowManager.hide(p); - BauSystem.MESSAGE.send("TRACE_MESSAGE_HIDE", p); - } - @ClassValidator(value = Player.class, local = true) public TypeValidator validator() { return (commandSender, player, messageSender) -> { - return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "TRACE_MESSAGE_DISALLOWED"); + if (!Permission.hasPermission(player, Permission.WORLD)) { + messageSender.send("TRACE_MESSAGE_DISALLOWED", player); + return false; + } + Region region = Region.getRegion(player.getLocation()); + if (region.isGlobal()) { + messageSender.send("TRACE_MESSAGE_NO_REGION", player); + return false; + } + return true; }; } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceTNTClickListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceTNTClickListener.java index d6f1c472..5974d50e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceTNTClickListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceTNTClickListener.java @@ -23,9 +23,10 @@ import com.comphenix.tinyprotocol.Reflection; import com.comphenix.tinyprotocol.TinyProtocol; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tracer.show.TraceShowManager; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.utils.RayTraceUtils; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.api.Plain; +import net.md_5.bungee.api.chat.ClickEvent; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.util.RayTraceResult; @@ -33,8 +34,8 @@ import org.bukkit.util.RayTraceResult; import java.util.HashSet; import java.util.Set; -@Linked(LinkageType.PLAIN) -public class TraceTNTClickListener { +@Linked +public class TraceTNTClickListener implements Plain { private static final Class useEntity = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInUseEntity"); @@ -42,8 +43,8 @@ public class TraceTNTClickListener { Set playerSet = new HashSet<>(); TinyProtocol.instance.addFilter(useEntity, (player, o) -> { - if (!playerSet.add(player)) return o; Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { + if (!playerSet.add(player)) return; RayTraceResult rayTraceResult = RayTraceUtils.trace(player, player.getLocation(), TraceShowManager.getEntities(player)); if (rayTraceResult == null) return; if (rayTraceResult.getHitEntity() == null) return; @@ -58,8 +59,11 @@ public class TraceTNTClickListener { BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_X", player, tntPosition.getVelocity().getX() + ""); BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Y", player, tntPosition.getVelocity().getY() + ""); BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Z", player, tntPosition.getVelocity().getZ() + ""); - playerSet.remove(player); + BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_ISOLATE", player, BauSystem.MESSAGE.parse("TRACE_MESSAGE_CLICK_ISOLATE", player), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace isolate " + tntPosition.getRecord().getId())); }, 1); + Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { + playerSet.remove(player); + }, 2); return o; }); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TracerBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TracerBauGuiItem.java index f0d7b156..d309b132 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TracerBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TracerBauGuiItem.java @@ -1,7 +1,7 @@ /* * This file is a part of the SteamWar software. * - * Copyright (C) 2021 SteamWar.de-Serverteam + * Copyright (C) 2022 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 @@ -21,22 +21,22 @@ package de.steamwar.bausystem.features.tracer; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.features.tracer.record.RecordStateMachine; -import de.steamwar.bausystem.features.tracer.record.RecordStatus; -import de.steamwar.bausystem.features.tracer.show.TraceShowManager; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.bausystem.SWUtils; +import de.steamwar.bausystem.features.tracer.record.*; import de.steamwar.bausystem.linkage.specific.BauGuiItem; +import de.steamwar.bausystem.region.Region; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; import java.util.Arrays; +import java.util.Collections; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class TracerBauGuiItem extends BauGuiItem { public TracerBauGuiItem() { @@ -45,15 +45,21 @@ public class TracerBauGuiItem extends BauGuiItem { @Override public ItemStack getItem(Player player) { - return new SWItem(Material.OBSERVER, BauSystem.MESSAGE.parse("TRACE_GUI_ITEM_NAME", player), Arrays.asList(BauSystem.MESSAGE.parse("TRACE_GUI_ITEM_LORE", player, BauSystem.MESSAGE.parse(RecordStateMachine.getRecordStatus().getName(), player))), false, clickType -> { - }).getItemStack(); + Region region = Region.getRegion(player.getLocation()); + if (region.isGlobal()) { + return SWUtils.setCustomModelData(new SWItem(Material.OBSERVER, BauSystem.MESSAGE.parse("TRACE_GUI_ITEM_NAME", player), Collections.emptyList(), false, clickType -> { + }), 1).getItemStack(); + } + return SWUtils.setCustomModelData(new SWItem(Material.OBSERVER, BauSystem.MESSAGE.parse("TRACE_GUI_ITEM_NAME", player), Arrays.asList(BauSystem.MESSAGE.parse("TRACE_GUI_ITEM_LORE", player, Recorder.INSTANCE.get(region).scoreboard(player))), false, clickType -> { + }), 1).getItemStack(); } private static void open(Player p) { - RecordStatus status = RecordStateMachine.getRecordStatus(); + Region region = Region.getRegion(p.getLocation()); + TraceRecorder traceRecorder = Recorder.INSTANCE.get(region); SWInventory inv = new SWInventory(p, 9, BauSystem.MESSAGE.parse("TRACE_GUI_NAME", p)); - if (status.isTracing()) { - if (status.isAutoTrace()) { + if (traceRecorder instanceof ActiveTracer) { + if (traceRecorder instanceof AutoTraceRecorder) { inv.setItem(1, new SWItem(Material.GRAY_DYE, BauSystem.MESSAGE.parse("TRACE_GUI_TRACE_ACTIVE_AUTO", p))); } else { inv.setItem(1, new SWItem(Material.GREEN_DYE, BauSystem.MESSAGE.parse("TRACE_GUI_TRACE_ACTIVE", p), clickType -> { @@ -67,7 +73,7 @@ public class TracerBauGuiItem extends BauGuiItem { open(p); })); } - if (status.isAutoTrace()) { + if (traceRecorder instanceof AutoTraceRecorder) { inv.setItem(3, new SWItem(Material.ENDER_EYE, BauSystem.MESSAGE.parse("TRACE_GUI_AUTO_TRACE_ACTIVE", p), clickType -> { p.performCommand("trace auto"); open(p); @@ -78,15 +84,6 @@ public class TracerBauGuiItem extends BauGuiItem { open(p); })); } - if (TraceShowManager.hasActiveShow(p)) { - inv.setItem(5, new SWItem(Material.TNT, BauSystem.MESSAGE.parse("TRACE_GUI_SHOW_GUI", p), clickType -> { - p.performCommand("trace show gui"); - })); - } else { - inv.setItem(5, new SWItem(Material.GLASS, BauSystem.MESSAGE.parse("TRACE_GUI_SHOW_GUI", p), clickType -> { - p.performCommand("trace show gui"); - })); - } inv.setItem(7, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("TRACE_GUI_DELETE", p), clickType -> { p.performCommand("trace delete"); open(p); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/gui/TraceGui.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/gui/TraceGui.java index 1b87bbf4..fc4500af 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/gui/TraceGui.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/gui/TraceGui.java @@ -1,7 +1,7 @@ /* * This file is a part of the SteamWar software. * - * Copyright (C) 2021 SteamWar.de-Serverteam + * Copyright (C) 2022 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 @@ -24,6 +24,7 @@ import de.steamwar.bausystem.features.tracer.TNTPosition; import de.steamwar.bausystem.features.tracer.show.Record; import de.steamwar.bausystem.features.tracer.show.StoredRecords; import de.steamwar.bausystem.features.tracer.show.TraceShowManager; +import de.steamwar.bausystem.region.Region; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; import lombok.experimental.UtilityClass; @@ -38,8 +39,9 @@ import java.util.List; public class TraceGui { public static void openGui(Player player) { + Region region = Region.getRegion(player.getLocation()); List> recordList = new ArrayList<>(); - StoredRecords.getRecords().forEach(record -> { + StoredRecords.getRecords(region).forEach(record -> { if (record.getTnt().isEmpty()) { return; } @@ -49,34 +51,37 @@ public class TraceGui { SWListInv recordSWListInv = new SWListInv<>(player, BauSystem.MESSAGE.parse("TRACE_GUI_TITLE", player), false, recordList, (clickType, record) -> { openRecordGui(player, record); }); - recordSWListInv.setItem(48, new SWItem(Material.BUCKET, BauSystem.MESSAGE.parse("TRACE_GUI_CLEAR", player), clickType -> { - StoredRecords.clear(); + recordSWListInv.setItem(49, new SWItem(Material.BUCKET, BauSystem.MESSAGE.parse("TRACE_GUI_CLEAR", player), clickType -> { + StoredRecords.clear(region); player.getOpenInventory().close(); })); - recordSWListInv.setItem(50, new SWItem(Material.GLASS, "§e" + BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_TITLE", player), clickType -> { - TraceShowGui.openGui(player); - })); recordSWListInv.open(); } public static void openRecordGui(Player player, Record record) { + Region region = Region.getRegion(player.getLocation()); List> recordList = new ArrayList<>(); record.getTnt().forEach(tntRecord -> { - SWItem swItem = new SWItem(Material.TNT_MINECART, BauSystem.MESSAGE.parse("TRACE_GUI_RECORD_ITEM", player, tntRecord.getPositions().size())); + SWItem swItem = new SWItem(Material.TNT_MINECART, BauSystem.MESSAGE.parse("TRACE_GUI_RECORD_ITEM", player, tntRecord.getPositions().size()), new ArrayList<>(), StoredRecords.isIsolated(player, tntRecord), clickType -> { + }); recordList.add(new SWListInv.SWListEntry<>(swItem, tntRecord)); }); SWListInv tntRecordSWListInv = new SWListInv<>(player, BauSystem.MESSAGE.parse("TRACE_GUI_TITLE", player), false, recordList, (clickType, tntRecord) -> { - openTntGui(player, record, tntRecord); + if (clickType.isShiftClick()) { + StoredRecords.toggleIsolate(player, tntRecord); + openRecordGui(player, record); + } else { + openTntGui(player, record, tntRecord); + } }); tntRecordSWListInv.setItem(48, new SWItem(Material.BUCKET, BauSystem.MESSAGE.parse("TRACE_GUI_RECORD_CLEAR", player), clickType -> { - StoredRecords.getRecords().remove(record); - TraceShowManager.reshow(); + StoredRecords.remove(region, record); + TraceShowManager.reshow(region); openGui(player); })); - tntRecordSWListInv.setItem(49, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("TRACE_GUI_ITEM_BACK", player), clickType -> { + tntRecordSWListInv.setItem(50, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("TRACE_GUI_ITEM_BACK", player), clickType -> { openGui(player); })); - // 48, 51 tntRecordSWListInv.open(); } @@ -88,7 +93,9 @@ public class TraceGui { BauSystem.MESSAGE.parse("TRACE_GUI_POSITION_X", player, tntPosition.getLocation().getX()), BauSystem.MESSAGE.parse("TRACE_GUI_POSITION_Y", player, tntPosition.getLocation().getY()), BauSystem.MESSAGE.parse("TRACE_GUI_POSITION_Z", player, tntPosition.getLocation().getZ()), - BauSystem.MESSAGE.parse("TRACE_GUI_POSITION_EXPLODED", player, tntPosition.isExploded()))); + BauSystem.MESSAGE.parse("TRACE_GUI_POSITION_SOURCE", player, tntPosition.isSource()), + BauSystem.MESSAGE.parse("TRACE_GUI_POSITION_EXPLODED", player, tntPosition.isExploded()) + )); positionList.add(new SWListInv.SWListEntry<>(swItem, tntPosition)); }); SWListInv tntPositionSWListInv = new SWListInv<>(player, BauSystem.MESSAGE.parse("TRACE_GUI_TITLE", player), false, positionList, (clickType, tntPosition) -> { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/gui/TraceShowGui.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/gui/TraceShowGui.java deleted file mode 100644 index 2fdc1c5a..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/gui/TraceShowGui.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2021 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 . - */ - -package de.steamwar.bausystem.features.tracer.gui; - -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.tracer.show.ShowModeParameter; -import de.steamwar.bausystem.features.tracer.show.TraceShowManager; -import de.steamwar.bausystem.features.tracer.show.mode.TraceEntityShowMode; -import de.steamwar.bausystem.utils.FlatteningWrapper; -import de.steamwar.inventory.SWInventory; -import de.steamwar.inventory.SWItem; -import lombok.experimental.UtilityClass; -import org.bukkit.Material; -import org.bukkit.entity.Player; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -@UtilityClass -public class TraceShowGui { - - private static final Map ShowModeParameterMap = new HashMap<>(); - - public static void openGui(Player player) { - ShowModeParameter playerShowMode = new ShowModeParameter(); - playerShowMode.setInterpolate_Y(false); - playerShowMode.setInterpolate_XZ(false); - ShowModeParameterMap.put(player, playerShowMode); - - SWInventory swInventory = new SWInventory(player, 9, BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_TITLE", player)); - swInventory.addCloseCallback(clickType -> ShowModeParameterMap.remove(player)); - setActiveShow(player, swInventory); - - SWItem water = new SWItem(Material.TNT, BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_WATER_ITEM", player), Arrays.asList(BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_WATER_LORE1", player), BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_WATER_LORE2", player)), false, clickType -> { - }); - swInventory.setItem(5, water); - swInventory.setCallback(5, clickType -> toggleHideTNTinWaterExploded(player, swInventory, water)); - - SWItem interpolateY = new SWItem(Material.QUARTZ_STAIRS, BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_INTERPOLATE_Y_ITEM", player), Arrays.asList(BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_INTERPOLATE_Y_LORE1", player), BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_INTERPOLATE_Y_LORE2", player)), false, clickType -> { - }); - swInventory.setItem(6, interpolateY); - swInventory.setCallback(6, clickType -> toggleInterpolateYPosition(player, swInventory, interpolateY)); - - Material xzMaterial = FlatteningWrapper.impl.getTraceXZMaterial(); - SWItem interpolateXZ = new SWItem(xzMaterial, (byte) 7, BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_INTERPOLATE_XZ_ITEM", player), Arrays.asList(BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_INTERPOLATE_XZ_LORE1", player), BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_INTERPOLATE_XZ_LORE2", player)), false, clickType -> { - }); - swInventory.setItem(7, interpolateXZ); - swInventory.setCallback(7, clickType -> toggleInterpolateXZPosition(player, swInventory, interpolateXZ)); - // Water Bucket (-water) - // TNT (-water-exploded) - // Quartz_Stair (-interpolate-y) - // Quartz_Slab (-interpolate-xz) - swInventory.open(); - } - - private static void setActiveShow(Player player, SWInventory swInventory) { - if (TraceShowManager.hasActiveShow(player)) { - Material showMaterial = FlatteningWrapper.impl.getTraceShowMaterial(); - SWItem shown = new SWItem(showMaterial, BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_SHOWN", player), new ArrayList<>(), false, clickType -> { - TraceShowManager.hide(player); - BauSystem.MESSAGE.send("TRACE_MESSAGE_HIDE", player); - setActiveShow(player, swInventory); - }); - swInventory.setItem(1, shown); - } else { - Material hideMaterial = FlatteningWrapper.impl.getTraceHideMaterial(); - SWItem hidden = new SWItem(hideMaterial, BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_HIDDEN", player), new ArrayList<>(), false, clickType -> { - show(player); - BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", player); - setActiveShow(player, swInventory); - }); - swInventory.setItem(1, hidden); - } - } - - private static void toggleHideTNTinWaterExploded(Player player, SWInventory swInventory, SWItem swItem) { - ShowModeParameter showModeParameter = ShowModeParameterMap.get(player); - showModeParameter.setWater(!showModeParameter.isWater()); - show(player); - - swItem.setEnchanted(showModeParameter.isWater()); - swInventory.setItem(5, swItem); - swInventory.setCallback(5, clickType -> toggleHideTNTinWaterExploded(player, swInventory, swItem)); - } - - private static void toggleInterpolateYPosition(Player player, SWInventory swInventory, SWItem swItem) { - ShowModeParameter showModeParameter = ShowModeParameterMap.get(player); - showModeParameter.setInterpolate_Y(!showModeParameter.isInterpolate_Y()); - show(player); - - swItem.setEnchanted(showModeParameter.isInterpolate_Y()); - swInventory.setItem(6, swItem); - swInventory.setCallback(6, clickType -> toggleInterpolateYPosition(player, swInventory, swItem)); - } - - private static void toggleInterpolateXZPosition(Player player, SWInventory swInventory, SWItem swItem) { - ShowModeParameter showModeParameter = ShowModeParameterMap.get(player); - showModeParameter.setInterpolate_XZ(!showModeParameter.isInterpolate_XZ()); - show(player); - - swItem.setEnchanted(showModeParameter.isInterpolate_XZ()); - swInventory.setItem(7, swItem); - swInventory.setCallback(7, clickType -> toggleInterpolateXZPosition(player, swInventory, swItem)); - } - - private static void show(Player player) { - TraceShowManager.show(player, new TraceEntityShowMode(player, ShowModeParameterMap.get(player))); - } - -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/linkage/Disable.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/ActiveTracer.java similarity index 84% rename from BauSystem_Main/src/de/steamwar/bausystem/linkage/Disable.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/ActiveTracer.java index ef3377d4..b0dfeeed 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/linkage/Disable.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/ActiveTracer.java @@ -1,7 +1,7 @@ /* * This file is a part of the SteamWar software. * - * Copyright (C) 2021 SteamWar.de-Serverteam + * Copyright (C) 2022 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 @@ -17,8 +17,7 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.linkage; +package de.steamwar.bausystem.features.tracer.record; -public interface Disable { - void disable(); +public interface ActiveTracer { } diff --git a/BauSystem_Linkage/src/de/steamwar/bausystem/linkage/MinVersion.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoExplodeTraceRecorder.java similarity index 68% rename from BauSystem_Linkage/src/de/steamwar/bausystem/linkage/MinVersion.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoExplodeTraceRecorder.java index b72e5fe0..7e24f441 100644 --- a/BauSystem_Linkage/src/de/steamwar/bausystem/linkage/MinVersion.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoExplodeTraceRecorder.java @@ -17,15 +17,17 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.linkage; +package de.steamwar.bausystem.features.tracer.record; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; +public class AutoExplodeTraceRecorder extends AutoTraceRecorder { -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.TYPE}) -public @interface MinVersion { - int value(); + @Override + protected String getInactivityMessage() { + return "TRACE_IDLE_AUTO_EXPLODE"; + } + + @Override + protected boolean shouldStartRecording(StartType startType) { + return startType == StartType.EXPLODE; + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoIgniteTraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoIgniteTraceRecorder.java new file mode 100644 index 00000000..45988d3e --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoIgniteTraceRecorder.java @@ -0,0 +1,33 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ + +package de.steamwar.bausystem.features.tracer.record; + +public class AutoIgniteTraceRecorder extends AutoTraceRecorder implements ActiveTracer { + + @Override + protected String getInactivityMessage() { + return "TRACE_IDLE_AUTO_IGNITE"; + } + + @Override + protected boolean shouldStartRecording(StartType startType) { + return startType == StartType.IGNITE; + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoTraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoTraceRecorder.java new file mode 100644 index 00000000..90e436ee --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/AutoTraceRecorder.java @@ -0,0 +1,124 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ + +package de.steamwar.bausystem.features.tracer.record; + +import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.features.tpslimit.TPSUtils; +import de.steamwar.bausystem.features.tracer.show.Record; +import org.bukkit.entity.Player; +import org.bukkit.entity.TNTPrimed; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Supplier; + +public abstract class AutoTraceRecorder implements TraceRecorder { + + private boolean recording = false; + private long startTime = TPSUtils.currentTick.get(); + private long lastExplosion = 0; + + private final Map recordMap = new HashMap<>(); + private Record record; + private Supplier recordSupplier; + + private Record.TNTRecord getRecord(TNTPrimed tntPrimed) { + return recordMap.computeIfAbsent(tntPrimed, __ -> record.spawn(TPSUtils.currentTick.get() - startTime)); + } + + protected abstract String getInactivityMessage(); + protected abstract boolean shouldStartRecording(StartType startType); + protected void stoppedRecording() { + } + + @Override + public final String scoreboard(Player player) { + if (recording) { + return BauSystem.MESSAGE.parse("TRACE_RECORD", player) + " §8| §e" + (TPSUtils.currentTick.get() - startTime) + " §7" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE_TICKS", player); + } else { + return BauSystem.MESSAGE.parse(getInactivityMessage(), player); + } + } + + private void startRecording() { + lastExplosion = 0; + startTime = TPSUtils.currentTick.get(); + record = recordSupplier.get(); + recording = true; + } + + @Override + public void recordSupplier(Supplier recordSupplier) { + this.recordSupplier = recordSupplier; + } + + @Override + public Record postClear() { + recordMap.clear(); + record = recordSupplier.get(); + return record; + } + + @Override + public final void spawn(TNTPrimed tntPrimed) { + if (!recording && shouldStartRecording(StartType.IGNITE)) { + startRecording(); + } + if (recording) { + getRecord(tntPrimed).source(tntPrimed); + } + } + + @Override + public final void tick(TNTPrimed tntPrimed) { + if (recording) { + getRecord(tntPrimed).location(tntPrimed); + } + } + + @Override + public final void explode(TNTPrimed tntPrimed, boolean inBuildRegion) { + if (!recording && shouldStartRecording(StartType.EXPLODE)) { + startRecording(); + } + if (recording) { + Record.TNTRecord tntRecord = getRecord(tntPrimed); + if (inBuildRegion) tntRecord.setInBuildArea(true); + tntRecord.explode(tntPrimed); + } + lastExplosion = 0; + } + + @Override + public final void tick() { + lastExplosion++; + if (recording && lastExplosion > 80) { + recording = false; + recordMap.clear(); + record = null; + stoppedRecording(); + } + } + + protected enum StartType { + IGNITE, + EXPLODE + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/RecordStateMachine.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/RecordStateMachine.java deleted file mode 100644 index 0a22711a..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/RecordStateMachine.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - 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 . -*/ - -package de.steamwar.bausystem.features.tracer.record; - -import lombok.experimental.UtilityClass; - -@UtilityClass -public class RecordStateMachine { - private static final TraceAutoHandler autoHandler = new TraceAutoHandler(); - - private static RecordStatus recordStatus = RecordStatus.IDLE; - private static Recorder recorder = null; - - public static void commandStart() { - autoHandler.disable(); - recordStart(); - recordStatus = RecordStatus.RECORD; - } - - public static void commandStop() { - autoHandler.disable(); - recordStop(); - recordStatus = RecordStatus.IDLE; - } - - public static void commandAuto() { - if (recordStatus.isTracing()) - return; - - if (recordStatus == RecordStatus.IDLE_AUTO) { - recordStatus = RecordStatus.IDLE; - autoHandler.disable(); - } else { - recordStatus = RecordStatus.IDLE_AUTO; - autoHandler.enable(); - } - } - - public static void commandSingle() { - if (recordStatus.isTracing()) - return; - - if (recordStatus != RecordStatus.IDLE_SINGLE) { - recordStatus = RecordStatus.IDLE_SINGLE; - autoHandler.enable(); - } - } - - static void autoRecord() { - recordStart(); - if (recordStatus == RecordStatus.IDLE_AUTO) { - recordStatus = RecordStatus.RECORD_AUTO; - } else { - recordStatus = RecordStatus.RECORD_SINGLE; - } - } - - static void autoIdle() { - recordStop(); - if (recordStatus == RecordStatus.RECORD_AUTO) { - recordStatus = RecordStatus.IDLE_AUTO; - } else { - autoHandler.disable(); - recordStatus = RecordStatus.IDLE; - } - } - - private static void recordStart() { - if (recordStatus.isTracing()) return; - recorder = new Recorder(); - } - - private static void recordStop() { - if (!recordStatus.isTracing()) return; - recorder.stopRecording(); - } - - public static RecordStatus getRecordStatus() { - return recordStatus; - } - - public static int size() { - if (recorder == null) return 0; - return recorder.size(); - } - - public static long getStartTime() { - if (recorder == null) return 0; - return recorder.getStartTime(); - } - - public static void postClear() { - if (recorder == null) return; - recorder.postClear(); - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/RecordStatus.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/RecordStatus.java deleted file mode 100644 index 2cab4679..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/RecordStatus.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - 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 . -*/ - -package de.steamwar.bausystem.features.tracer.record; - -public enum RecordStatus { - - RECORD("TRACE_RECORD", true, "TRACE_MESSAGE_AUTO_RECORD"), - RECORD_AUTO("TRACE_RECORD_AUTO", true, "TRACE_MESSAGE_AUTO_RECORD_AUTO"), - RECORD_SINGLE("TRACE_RECORD_SINGLE", true, "TRACE_MESSAGE_AUTO_RECORD"), - IDLE("TRACE_IDLE", false, "TRACE_MESSAGE_AUTO_IDLE"), - IDLE_AUTO("TRACE_IDLE_AUTO", false, "TRACE_MESSAGE_AUTO_IDLE_AUTO"), - IDLE_SINGLE("TRACE_IDLE_SINGLE", false, "TRACE_MESSAGE_AUTO_IDLE"); - - String name; - boolean tracing; - String autoMessage; - - RecordStatus(String value, boolean tracing, String autoMessage) { - this.name = value; - this.tracing = tracing; - this.autoMessage = autoMessage; - } - - public String getName() { - return name; - } - - public boolean isTracing() { - return tracing; - } - - public boolean isAutoTrace() { - return this == RECORD_AUTO || this == IDLE_AUTO; - } - - public String getAutoMessage() { - return autoMessage; - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/Recorder.java index ca49bb9e..d24d8a1c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/Recorder.java @@ -1,96 +1,175 @@ /* - 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 . -*/ + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ package de.steamwar.bausystem.features.tracer.record; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tracer.show.Record; import de.steamwar.bausystem.features.tracer.show.StoredRecords; +import de.steamwar.bausystem.region.Region; +import de.steamwar.bausystem.region.utils.RegionExtensionType; +import de.steamwar.bausystem.region.utils.RegionType; +import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.World; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; -import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.scheduler.BukkitTask; +import org.bukkit.event.entity.EntitySpawnEvent; -import java.util.HashMap; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; +@Linked public class Recorder implements Listener { - private static final World world = Bukkit.getWorlds().get(0); + public static Recorder INSTANCE; - private final Map recordMap = new HashMap<>(); - private final BukkitTask task; - private final Record record; - - Recorder() { - Bukkit.getPluginManager().registerEvents(this, BauSystem.getInstance()); - task = Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), this::run, 1, 1); - record = new Record(); - - // To trace TNT initial positions with AutoTracer - run(); + { + INSTANCE = this; } - void stopRecording() { - HandlerList.unregisterAll(this); - task.cancel(); + private static class NoopTraceRecorder implements TraceRecorder { + @Override + public String scoreboard(Player player) { + return null; + } + + @Override + public void spawn(TNTPrimed tntPrimed) { + } + + @Override + public void tick(TNTPrimed tntPrimed) { + } + + @Override + public void explode(TNTPrimed tntPrimed, boolean b) { + } + } + private static final NoopTraceRecorder NOOP = new NoopTraceRecorder(); + + private static class DisabledTracerRecorder implements TraceRecorder { + @Override + public String scoreboard(Player player) { + return BauSystem.MESSAGE.parse("TRACE_IDLE", player); + } + + @Override + public void spawn(TNTPrimed tntPrimed) { + } + + @Override + public void tick(TNTPrimed tntPrimed) { + } + + @Override + public void explode(TNTPrimed tntPrimed, boolean b) { + } + } + private static final DisabledTracerRecorder DISABLED = new DisabledTracerRecorder(); + + static Recorder instance; + + { + instance = this; } - int size() { - return record.size(); + private final World world = Bukkit.getWorlds().get(0); + + private Map regionTraceRecorderMap = new HashMap<>(); + private Map tntTraceRecorderMap = new HashMap<>(); + + private TraceRecorder get(TNTPrimed tntPrimed) { + return get(tntTraceRecorderMap.computeIfAbsent(tntPrimed, e -> Region.getRegion(e.getLocation()))); } - long getStartTime() { - return record.getStartTime(); + public TraceRecorder get(Region region) { + return regionTraceRecorderMap.getOrDefault(region, region.isGlobal() ? NOOP : DISABLED); } - void postClear() { - record.clear(); - recordMap.clear(); - StoredRecords.add(record); + public void set(Region region, TraceRecorder traceRecorder) { + regionTraceRecorderMap.put(region, traceRecorder); + traceRecorder.recordSupplier(() -> { + Record record = new Record(region); + StoredRecords.add(region, record); + return record; + }); + tntTraceRecorderMap.forEach((tntPrimed, region1) -> { + if (region1 == region) { + traceRecorder.spawn(tntPrimed); + } + }); } - private void run() { - world.getEntitiesByClass(TNTPrimed.class).forEach(tntPrimed -> get(tntPrimed).add(tntPrimed)); + public void remove(Region region) { + regionTraceRecorderMap.remove(region); + } + + public void postClear(Region region) { + TraceRecorder traceRecorder = get(region); + Record record = traceRecorder.postClear(); + if (record != null) { + StoredRecords.add(region, record); + } + } + + @EventHandler + public void onEntitySpawn(EntitySpawnEvent event) { + Entity entity = event.getEntity(); + if (!(entity instanceof TNTPrimed)) { + return; + } + get((TNTPrimed) entity).spawn((TNTPrimed) entity); + } + + { + Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> { + tick(); + tntTraceRecorderMap.keySet() + .stream() + .filter(e -> !e.isValid()) + .collect(Collectors.toList()) + .forEach(tntTraceRecorderMap::remove); + new ArrayList<>(regionTraceRecorderMap.values()).forEach(TraceRecorder::tick); + }, 1, 1); + } + + private void tick() { + TNTPrimedIterator.impl.iterator().forEach(tntPrimed -> { + get(tntPrimed).tick(tntPrimed); + }); } @EventHandler public void onEntityExplode(EntityExplodeEvent event) { - if (!(event.getEntity() instanceof TNTPrimed)) + Entity entity = event.getEntity(); + if (!(entity instanceof TNTPrimed)) { return; - TNTPrimed tntPrimed = (TNTPrimed) event.getEntity(); - - get(tntPrimed).explode(tntPrimed); - recordMap.remove(tntPrimed); - } - - private Record.TNTRecord get(TNTPrimed tntPrimed) { - Record.TNTRecord tntRecord = recordMap.get(tntPrimed); - if (tntRecord != null) - return tntRecord; - - tntRecord = this.record.spawn(); - recordMap.put(tntPrimed, tntRecord); - return tntRecord; + } + TraceRecorder traceRecorder = get((TNTPrimed) entity); + Region region = tntTraceRecorderMap.get((TNTPrimed) entity); + traceRecorder.explode((TNTPrimed) entity, !event.blockList().isEmpty() && region.inRegion(event.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)); + tntTraceRecorderMap.remove(entity); + tick(); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SimpleTraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SimpleTraceRecorder.java new file mode 100644 index 00000000..edd6dd48 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SimpleTraceRecorder.java @@ -0,0 +1,75 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ + +package de.steamwar.bausystem.features.tracer.record; + +import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.features.tpslimit.TPSUtils; +import de.steamwar.bausystem.features.tracer.show.Record; +import org.bukkit.entity.Player; +import org.bukkit.entity.TNTPrimed; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Supplier; + +public class SimpleTraceRecorder implements TraceRecorder, ActiveTracer { + + private final long startTime = TPSUtils.currentTick.get(); + private final Map recordMap = new HashMap<>(); + private Record record; + + @Override + public String scoreboard(Player player) { + return BauSystem.MESSAGE.parse("TRACE_RECORD", player) + " §8| §e" + (TPSUtils.currentTick.get() - startTime) + " §7" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE_TICKS", player); + } + + @Override + public void recordSupplier(Supplier recordSupplier) { + record = recordSupplier.get(); + } + + @Override + public Record postClear() { + recordMap.clear(); + return record; + } + + private Record.TNTRecord getRecord(TNTPrimed tntPrimed) { + return recordMap.computeIfAbsent(tntPrimed, __ -> record.spawn(TPSUtils.currentTick.get() - startTime)); + } + + @Override + public void spawn(TNTPrimed tntPrimed) { + getRecord(tntPrimed).source(tntPrimed); + } + + @Override + public void tick(TNTPrimed tntPrimed) { + getRecord(tntPrimed).location(tntPrimed); + } + + @Override + public void explode(TNTPrimed tntPrimed, boolean inBuildRegion) { + Record.TNTRecord tntRecord = getRecord(tntPrimed); + if (inBuildRegion) tntRecord.setInBuildArea(true); + tntRecord.explode(tntPrimed); + recordMap.remove(tntPrimed); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SingleTraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SingleTraceRecorder.java new file mode 100644 index 00000000..6df0716f --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SingleTraceRecorder.java @@ -0,0 +1,46 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ + +package de.steamwar.bausystem.features.tracer.record; + +import de.steamwar.bausystem.region.Region; + +public class SingleTraceRecorder extends AutoTraceRecorder { + + private Region region; + + public SingleTraceRecorder(Region region) { + this.region = region; + } + + @Override + protected String getInactivityMessage() { + return "TRACE_IDLE_SINGLE"; + } + + @Override + protected boolean shouldStartRecording(StartType startType) { + return startType == StartType.EXPLODE; + } + + @Override + protected void stoppedRecording() { + Recorder.INSTANCE.remove(region); + } +} diff --git a/BauSystem_Linkage/src/de/steamwar/bausystem/linkage/LinkedInstance.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator.java similarity index 64% rename from BauSystem_Linkage/src/de/steamwar/bausystem/linkage/LinkedInstance.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator.java index 5c26ea4f..a6f05b5e 100644 --- a/BauSystem_Linkage/src/de/steamwar/bausystem/linkage/LinkedInstance.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TNTPrimedIterator.java @@ -1,7 +1,7 @@ /* * This file is a part of the SteamWar software. * - * Copyright (C) 2021 SteamWar.de-Serverteam + * Copyright (C) 2022 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 @@ -17,14 +17,16 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.linkage; +package de.steamwar.bausystem.features.tracer.record; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; +import de.steamwar.bausystem.BauSystem; +import de.steamwar.core.VersionDependent; +import org.bukkit.entity.TNTPrimed; -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.FIELD}) -public @interface LinkedInstance { +import java.util.stream.Stream; + +public interface TNTPrimedIterator { + TNTPrimedIterator impl = VersionDependent.getVersionImpl(BauSystem.getInstance()); + + Stream iterator(); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceAutoHandler.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceAutoHandler.java deleted file mode 100644 index 298dde87..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceAutoHandler.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - 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 . -*/ - -package de.steamwar.bausystem.features.tracer.record; - -import de.steamwar.bausystem.BauSystem; -import org.bukkit.Bukkit; -import org.bukkit.entity.TNTPrimed; -import org.bukkit.event.EventHandler; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.scheduler.BukkitTask; - -public class TraceAutoHandler implements Listener { - /* This listener handles the en- and disabling of the Tracer in AUTO mode */ - - private BukkitTask task; - private int lastExplosion = 0; // Time since the last explosion in ticks - - public void enable() { - Bukkit.getPluginManager().registerEvents(this, BauSystem.getInstance()); - } - - public void disable() { - HandlerList.unregisterAll(this); - if (task != null) { - task.cancel(); - task = null; - } - } - - @EventHandler - public void onEntityExplode(EntityExplodeEvent event) { - if (!(event.getEntity() instanceof TNTPrimed)) - return; - - lastExplosion = 0; - if (task == null) { - RecordStateMachine.autoRecord(); - task = Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), this::run, 1, 1); - } - } - - private void run() { - lastExplosion++; - - if (lastExplosion > 80) { - RecordStateMachine.autoIdle(); - if (task != null) { - task.cancel(); - task = null; - } - } - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceRecorder.java new file mode 100644 index 00000000..f89562ef --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/TraceRecorder.java @@ -0,0 +1,41 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ + +package de.steamwar.bausystem.features.tracer.record; + +import de.steamwar.bausystem.features.tracer.show.Record; +import org.bukkit.entity.Player; +import org.bukkit.entity.TNTPrimed; + +import java.util.function.Supplier; + +public interface TraceRecorder { + + String scoreboard(Player player); + default void recordSupplier(Supplier recordSupplier) { + } + default Record postClear() { + return null; + } + void spawn(TNTPrimed tntPrimed); + void tick(TNTPrimed tntPrimed); + void explode(TNTPrimed tntPrimed, boolean inBuildRegion); + default void tick() { + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java index 8ed2061b..71b19f1d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java @@ -1,69 +1,54 @@ /* - 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 . -*/ + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ package de.steamwar.bausystem.features.tracer.show; -import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.features.tracer.TNTPosition; +import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.shared.ShowMode; import lombok.Getter; import lombok.RequiredArgsConstructor; +import lombok.Setter; import org.bukkit.entity.TNTPrimed; import org.bukkit.util.Vector; import java.util.ArrayList; import java.util.List; +import java.util.UUID; -@Getter +@RequiredArgsConstructor public class Record { - private static long idNumber = 0; - - private final long id = idNumber++; - private final long startTime = TPSUtils.currentTick.get(); + @Getter private final List tnt = new ArrayList<>(); - - private final boolean trace; + private final Region region; public int size() { return tnt.size(); } - public void showAll(ShowMode mode) { - for (TNTRecord record : tnt) - record.showAll(mode); + public void showAll(ShowMode traceShowMode) { + tnt.forEach(tntRecord -> tntRecord.getPositions().forEach(traceShowMode::show)); } - /* The following methods should only be called by a recorder */ - public Record() { - this(true); - } - - public Record(boolean trace) { - if (trace) { - StoredRecords.add(this); - } - this.trace = trace; - } - - public TNTRecord spawn() { - TNTRecord record = new TNTRecord(trace); + public TNTRecord spawn(long offset) { + TNTRecord record = new TNTRecord(offset, region); tnt.add(record); return record; } @@ -72,46 +57,45 @@ public class Record { tnt.clear(); } - public TNTRecord get(long id) { - for (TNTRecord record : tnt) { - if (record.getId() == id) return record; - } - return null; - } - - public void remove(long id) { - tnt.removeIf(record -> record.getId() == id); - } - - @Getter - @RequiredArgsConstructor public static class TNTRecord { - private final long id = idNumber++; - private final List positions = new ArrayList<>(41); - private final boolean trace; + @Getter + private final UUID id = UUID.randomUUID(); - public void showAll(ShowMode mode) { - for (TNTPosition position : positions) - mode.show(position); + @Getter + private final long offset; + + @Getter + private final Region region; + + @Getter + private final List positions = new ArrayList<>(82); + + @Getter + @Setter + private boolean inBuildArea = false; + + public TNTRecord(long offset, Region region) { + this.offset = offset; + this.region = region; } - public TNTPosition get(int fuseTicks) { - for (TNTPosition position : positions) { - if (position.getFuseTicks() == fuseTicks) return position; - } - return null; + public void source(TNTPrimed tntPrimed) { + add(tntPrimed, true, false); } - /* The following methods should only be called by a recorder */ - public void add(TNTPrimed tntPrimed) { - add(tntPrimed, false); + public void location(TNTPrimed tntPrimed) { + add(tntPrimed, false, false); } - private void add(TNTPrimed tntPrimed, boolean exploded) { + public void explode(TNTPrimed tntPrimed) { + add(tntPrimed, false, true); + } + + private void add(TNTPrimed tntPrimed, boolean source, boolean exploded) { TNTPosition position; if (positions.isEmpty()) { - position = new TNTPosition(this, tntPrimed, null, tntPrimed.getVelocity(), new TNTPosition.CachingSupplier<>(() -> null), exploded); + position = new TNTPosition(this, tntPrimed, null, tntPrimed.getVelocity(), new TNTPosition.CachingSupplier<>(() -> null), source, exploded); } else { int currentSize = positions.size() + 1; TNTPosition.CachingSupplier velocitySupplier = new TNTPosition.CachingSupplier<>(() -> { @@ -125,16 +109,10 @@ public class Record { } return current; }); - position = new TNTPosition(this, tntPrimed, positions.get(positions.size() - 1).getLocation(), tntPrimed.getVelocity(), velocitySupplier, exploded); + position = new TNTPosition(this, tntPrimed, positions.get(positions.size() - 1).getLocation(), tntPrimed.getVelocity(), velocitySupplier, source, exploded); } positions.add(position); - if (trace) { - TraceShowManager.show(position); - } - } - - public void explode(TNTPrimed tntPrimed) { - add(tntPrimed, true); + TraceShowManager.show(region, position); } } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameter.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameter.java index 2663d947..100e58c3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameter.java @@ -1,35 +1,61 @@ /* + * This file is a part of the SteamWar software. * - * This file is a part of the SteamWar software. + * Copyright (C) 2022 SteamWar.de-Serverteam * - * 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 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. * - * 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 . - * / + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ package de.steamwar.bausystem.features.tracer.show; import lombok.Getter; -import lombok.Setter; @Getter -@Setter public class ShowModeParameter { private boolean water = false; - private boolean interpolate_Y = false; - private boolean interpolate_XZ = false; + private boolean interpolateY = false; + private boolean interpolateXZ = false; + private boolean sourceOnly = false; private boolean explodeOnly = false; private boolean ticks = false; + private boolean buildDestroyOnly = false; + + public void enableWater() { + this.water = true; + } + + public void enableInterpolateY() { + this.interpolateY = true; + } + + public void enableInterpolateXZ() { + this.interpolateXZ = true; + } + + public void enableSourceOnly() { + this.sourceOnly = true; + } + + public void enableExplodeOnly() { + this.explodeOnly = true; + } + + public void enableTicks() { + this.ticks = true; + } + + public void enableBuildDestroyOnly() { + this.buildDestroyOnly = true; + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameterType.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameterType.java index 8fe05406..5f4bcb46 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameterType.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameterType.java @@ -1,7 +1,7 @@ /* * This file is a part of the SteamWar software. * - * Copyright (C) 2020 SteamWar.de-Serverteam + * Copyright (C) 2022 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 @@ -29,15 +29,17 @@ import java.util.function.Supplier; public enum ShowModeParameterType { - WATER(showModeParameter -> showModeParameter.setWater(true), Arrays.asList("-water"), "EXPLODE"), - INTERPOLATE_Y(showModeParameter -> showModeParameter.setInterpolate_Y(true), Arrays.asList("-interpolatey", "-interpolate-y", "-interpolate_y", "-y"), "ADVANCED"), - INTERPOLATE_XZ(showModeParameter -> showModeParameter.setInterpolate_XZ(true), Arrays.asList("-interpolatex", "-interpolate-x", "-interpolate_x", "-x", "-interpolatez", "-interpolate-z", "-interpolate_z", "-z", "-interpolatexz", "-interpolate-xz", "-interpolate_xz", "-xz"), "ADVANCED"), + WATER(ShowModeParameter::enableWater, Arrays.asList("-water"), "EXPLODE", "SOURCE", "BUILD_DESTROY_ONLY"), + INTERPOLATE_Y(ShowModeParameter::enableInterpolateY, Arrays.asList("-interpolatey", "-interpolate-y", "-interpolate_y", "-y"), "ADVANCED"), + INTERPOLATE_XZ(ShowModeParameter::enableInterpolateXZ, Arrays.asList("-interpolatex", "-interpolate-x", "-interpolate_x", "-x", "-interpolatez", "-interpolate-z", "-interpolate_z", "-z", "-interpolatexz", "-interpolate-xz", "-interpolate_xz", "-xz"), "ADVANCED"), ADVANCED(showModeParameter -> { - showModeParameter.setInterpolate_Y(true); - showModeParameter.setInterpolate_XZ(true); + showModeParameter.enableInterpolateY(); + showModeParameter.enableInterpolateXZ(); }, Arrays.asList("-advanced", "-a", "advanced"), "INTERPOLATE_Y", "INTERPOLATE_XZ"), - EXPLODE(showModeParameter -> showModeParameter.setExplodeOnly(true), Arrays.asList("-explode", "-explodeonly"), "WATER", "TICKS"), - TICKS(showModeParameter -> showModeParameter.setTicks(true), Arrays.asList("-ticks", "-t"), "EXPLODE"); + SOURCE(ShowModeParameter::enableSourceOnly, Arrays.asList("-source", "-sourceonly"), "TICKS", "ADVANCED", "INTERPOLATE_Y", "INTERPOLATE_XZ", "WATER"), + EXPLODE(ShowModeParameter::enableExplodeOnly, Arrays.asList("-explode", "-explodeonly"), "TICKS", "ADVANCED", "INTERPOLATE_Y", "INTERPOLATE_XZ", "WATER"), + TICKS(ShowModeParameter::enableTicks, Arrays.asList("-ticks", "-t"), "EXPLODE", "SOURCE"), + BUILD_DESTROY_ONLY(ShowModeParameter::enableBuildDestroyOnly, Arrays.asList("-builddestroy", "-builddestoryonly"), "WATER"); @Getter private final Consumer showModeParameterConsumer; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/StoredRecords.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/StoredRecords.java index beaf1c1e..ce90aad7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/StoredRecords.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/StoredRecords.java @@ -1,63 +1,199 @@ /* - 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 . -*/ + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ package de.steamwar.bausystem.features.tracer.show; +import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tracer.TNTPosition; -import de.steamwar.bausystem.features.tracer.record.RecordStateMachine; +import de.steamwar.bausystem.features.tracer.record.Recorder; +import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.shared.ShowMode; -import lombok.Getter; +import lombok.experimental.UtilityClass; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; -import java.util.ArrayList; -import java.util.List; +import java.util.*; +import java.util.function.Predicate; +import java.util.function.Supplier; +import java.util.stream.Collectors; +@UtilityClass public class StoredRecords { - @Getter - private static final List records = new ArrayList<>(); + private static final Map>> isolatedTNT = new HashMap<>(); + private static final Map> replayTime = new HashMap<>(); + private static final Map>> replayLoops = new HashMap<>(); + private static final Map> records = new HashMap<>(); - public static void add(Record record) { - records.add(record); + static { + Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> { + replayLoops.forEach((region, playerSupplierMap) -> { + playerSupplierMap.forEach((player, integerSupplier) -> { + int tick = integerSupplier.get(); + replayTime.computeIfAbsent(region, __ -> new HashMap<>()).put(player, tick); + TraceShowManager.reshow(region, player); + }); + }); + }, 1, 1); } - public static void remove(Record record) { - records.remove(record); + static void cleanup(Player player) { + isolatedTNT.forEach((region, playerListMap) -> playerListMap.remove(player)); + replayTime.forEach((region, playerIntegerMap) -> playerIntegerMap.remove(player)); + replayLoops.forEach((region, playerIntegerMap) -> playerIntegerMap.remove(player)); } - public static void remove(long id) { - records.removeIf(record -> record.getId() == id); + public static void add(Region region, Record record) { + records.computeIfAbsent(region, k -> new ArrayList<>()).add(record); } - public static Record get(long id) { - for (Record record : records) { - if (record.getId() == id) return record; + public static void remove(Region region, Record record) { + records.computeIfAbsent(region, k -> new ArrayList<>()).remove(record); + } + + public static void clear(Region region) { + records.remove(region); + TraceShowManager.clear(region); + Recorder.INSTANCE.postClear(region); + } + + public static List getRecords() { + return records.values().stream() + .flatMap(Collection::stream) + .collect(Collectors.toList()); + } + + public static List getRecords(Region region) { + return records.getOrDefault(region, Collections.emptyList()); + } + + public Record.TNTRecord getRecord(UUID id) { + return records.values().stream() + .flatMap(Collection::stream) + .map(Record::getTnt) + .flatMap(Collection::stream) + .filter(tntRecord -> tntRecord.getId().equals(id)) + .findFirst() + .orElse(null); + } + + public static boolean isIsolated(Player p, Record.TNTRecord tntRecord) { + return isolatedTNT.values() + .stream() + .filter(map -> map.containsKey(p)) + .anyMatch(map -> map.get(p).contains(tntRecord)); + } + + public static void toggleIsolate(Player p, Record.TNTRecord tntRecord) { + List tntRecords = isolatedTNT.computeIfAbsent(tntRecord.getRegion(), k -> new HashMap<>()) + .computeIfAbsent(p, k -> new ArrayList<>()); + if (tntRecords.contains(tntRecord)) { + tntRecords.remove(tntRecord); + if (tntRecords.isEmpty()) { + isolatedTNT.get(tntRecord.getRegion()).remove(p); + if (isolatedTNT.get(tntRecord.getRegion()).isEmpty()) { + isolatedTNT.remove(tntRecord.getRegion()); + } + } + } else { + tntRecords.add(tntRecord); } - return null; + TraceShowManager.reshow(tntRecord.getRegion(), p); } - public static void showAll(ShowMode mode) { - for (Record record : records) record.showAll(mode); + public static void hideIsolated(Region region) { + isolatedTNT.remove(region); } - public static void clear() { - records.clear(); - TraceShowManager.clear(); - RecordStateMachine.postClear(); + public static void hideIsolated(Region region, Player player) { + Map> regionalIsolatedTNT = isolatedTNT.get(region); + if (regionalIsolatedTNT == null) { + return; + } + regionalIsolatedTNT.remove(player); + } + + public static int getReplayTime(Region region, Player player) { + return replayTime.computeIfAbsent(region, k -> new HashMap<>()).getOrDefault(player, -1); + } + + public static void removeReplayTime(Region region) { + replayTime.remove(region); + replayLoops.remove(region); + } + + public static void removeReplayTime(Region region, Player player) { + Map regionalReplayTime = replayTime.get(region); + if (regionalReplayTime != null) { + regionalReplayTime.remove(player); + } + Map> regionalReplayLoops = replayLoops.get(region); + if (regionalReplayLoops != null) { + regionalReplayLoops.remove(player); + } + } + + public static void setReplayTime(Region region, Player player, int time) { + if (time < 0) { + removeReplayTime(region, player); + return; + } + replayTime.computeIfAbsent(region, k -> new HashMap<>()).put(player, time); + TraceShowManager.reshow(region, player); + + Map> regionalReplayLoops = replayLoops.get(region); + if (regionalReplayLoops != null) { + regionalReplayLoops.remove(player); + } + } + + public static void setReplayLoop(Region region, Player player, Supplier loop) { + replayLoops.computeIfAbsent(region, k -> new HashMap<>()).put(player, loop); + } + + static Predicate replayTimeFilter(Region region, Player player) { + Predicate replayTimeFilter = tntPosition -> true; + if (replayTime.containsKey(region) && replayTime.get(region).containsKey(player)) { + int time = replayTime.get(region).get(player); + replayTimeFilter = tntPosition -> (80 - tntPosition.getFuseTicks()) + tntPosition.getRecord().getOffset() == time; + } + return replayTimeFilter; + } + + static void show(Region region, Player player, ShowMode traceShowMode) { + Predicate replayTimeFilter = replayTimeFilter(region, player); + if (isolatedTNT.containsKey(region) && isolatedTNT.get(region).containsKey(player)) { + isolatedTNT.get(region).get(player).forEach(record -> { + record.getPositions() + .stream() + .filter(replayTimeFilter) + .forEach(traceShowMode::show); + }); + } else { + records.getOrDefault(region, new ArrayList<>()).forEach(record -> { + record.getTnt().forEach(tntRecord -> { + tntRecord.getPositions() + .stream() + .filter(replayTimeFilter) + .forEach(traceShowMode::show); + }); + }); + } } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/TraceShowManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/TraceShowManager.java index cdb176cf..565db661 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/TraceShowManager.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/TraceShowManager.java @@ -1,7 +1,27 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 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 . + */ + package de.steamwar.bausystem.features.tracer.show; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tracer.TNTPosition; +import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.shared.ShowMode; import org.bukkit.Bukkit; import org.bukkit.entity.Entity; @@ -14,28 +34,52 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Predicate; public class TraceShowManager implements Listener { private TraceShowManager() { } - private static final Map> showModes = new HashMap<>(); + private static final Map>> showModes = new HashMap<>(); public static void show(Player player, ShowMode traceShowMode) { hide(player); - showModes.put(player, traceShowMode); - StoredRecords.showAll(traceShowMode); + + Region region = Region.getRegion(player.getLocation()); + if (region.isGlobal()) { + return; + } + Map> regionalShowModes = showModes.computeIfAbsent(region, __ -> new HashMap<>()); + regionalShowModes.put(player, traceShowMode); + StoredRecords.show(region, player, traceShowMode); } public static void hide(Player player) { - ShowMode traceShowMode = showModes.remove(player); - if (traceShowMode == null) + Region region = Region.getRegion(player.getLocation()); + if (region.isGlobal()) { return; - traceShowMode.hide(); + } + Map> regionalShowModes = showModes.get(region); + if (regionalShowModes == null) { + return; + } + ShowMode showMode = regionalShowModes.get(player); + if (showMode == null) { + return; + } + showMode.hide(); } public static List getEntities(Player player) { - ShowMode showMode = showModes.get(player); + Region region = Region.getRegion(player.getLocation()); + if (region.isGlobal()) { + return Collections.emptyList(); + } + Map> regionalShowModes = showModes.get(region); + if (regionalShowModes == null) { + return Collections.emptyList(); + } + ShowMode showMode = regionalShowModes.get(player); if (showMode == null) { return Collections.emptyList(); } @@ -46,7 +90,15 @@ public class TraceShowManager implements Listener { } public static TNTPosition getTNTPosition(Player player, Entity entity) { - ShowMode showMode = showModes.get(player); + Region region = Region.getRegion(player.getLocation()); + if (region.isGlobal()) { + return null; + } + Map> regionalShowModes = showModes.get(region); + if (regionalShowModes == null) { + return null; + } + ShowMode showMode = regionalShowModes.get(player); if (showMode == null) { return null; } @@ -56,21 +108,49 @@ public class TraceShowManager implements Listener { return null; } - public static void reshow() { - Map> current = new HashMap<>(showModes); - current.forEach(TraceShowManager::show); + public static void reshow(Region region, Player p) { + Map> regionalShowModes = showModes.get(region); + if (regionalShowModes == null) { + return; + } + ShowMode showMode = regionalShowModes.get(p); + if (showMode == null) { + return; + } + showMode.hide(); + StoredRecords.show(region, p, showMode); + } + + public static void reshow(Region region) { + Map> regionalShowModes = showModes.get(region); + if (regionalShowModes == null) { + return; + } + for (Map.Entry> entry : regionalShowModes.entrySet()) { + entry.getValue().hide(); + StoredRecords.show(region, entry.getKey(), entry.getValue()); + } } /* Only to be called by record */ - static void show(TNTPosition tnt) { - for (ShowMode mode : showModes.values()) - mode.show(tnt); + static void show(Region region, TNTPosition tnt) { + Map> regionalShowModes = showModes.get(region); + if (regionalShowModes == null) { + return; + } + regionalShowModes.forEach((player, tntPositionShowMode) -> { + Predicate replayTimeFilter = StoredRecords.replayTimeFilter(region, player); + if (replayTimeFilter.test(tnt)) tntPositionShowMode.show(tnt); + }); } /* Only to be called by StoredRecords */ - static void clear() { - for (ShowMode mode : showModes.values()) - mode.hide(); + static void clear(Region region) { + Map> regionalShowModes = showModes.get(region); + if (regionalShowModes == null) { + return; + } + regionalShowModes.values().forEach(ShowMode::hide); } /* Internal if player leaves*/ @@ -80,11 +160,13 @@ public class TraceShowManager implements Listener { @EventHandler public void onLeave(PlayerQuitEvent event) { - showModes.remove(event.getPlayer()); + Region region = Region.getRegion(event.getPlayer().getLocation()); + if (!region.isGlobal()) { + Map> regionalShowModes = showModes.get(region); + if (regionalShowModes != null) { + regionalShowModes.remove(event.getPlayer()); + } + } + StoredRecords.cleanup(event.getPlayer()); } - - public static boolean hasActiveShow(Player player) { - return showModes.containsKey(player); - } - } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/mode/BlockShowMode.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/mode/BlockShowMode.java deleted file mode 100644 index 3cfe1f38..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/mode/BlockShowMode.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2021 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 . - */ - -package de.steamwar.bausystem.features.tracer.show.mode; - -import de.steamwar.bausystem.features.tracer.TNTPosition; -import de.steamwar.bausystem.features.tracer.show.ShowModeParameter; -import de.steamwar.bausystem.region.Point; -import de.steamwar.bausystem.shared.ShowMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.entity.Player; - -import java.util.HashSet; -import java.util.Set; - -public class BlockShowMode implements ShowMode { - - protected final Player player; - protected final ShowModeParameter showModeParameter; - - private Set positionSet = new HashSet<>(); - - public BlockShowMode(Player player, ShowModeParameter showModeParameter) { - this.player = player; - this.showModeParameter = showModeParameter; - } - - @Override - public void show(TNTPosition position) { - if (showModeParameter.isExplodeOnly() && !position.isExploded()) { - return; - } - Location location = position.getLocation().toLocation(player.getWorld()); - Point point = Point.fromLocation(location); - if (positionSet.contains(point)) { - return; - } - positionSet.add(point); - player.sendBlockChange(location, Material.RED_STAINED_GLASS.createBlockData()); - } - - @Override - public void hide() { - positionSet.forEach(point -> { - Location location = point.toLocation(player.getWorld()); - player.sendBlockChange(location, location.getBlock().getBlockData()); - }); - positionSet.clear(); - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/mode/FactoredEntityShowMode.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/mode/FactoredEntityShowMode.java index 523fc92d..93dbaa0c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/mode/FactoredEntityShowMode.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/mode/FactoredEntityShowMode.java @@ -55,14 +55,27 @@ public abstract class FactoredEntityShowMode implements EntityTraceShowMode { @Override public void show(TNTPosition position) { + if (showModeParameter.isBuildDestroyOnly() && !position.getRecord().isInBuildArea()) { + return; + } if (showModeParameter.isExplodeOnly()) { - if (!position.isExploded()) { + if (position.isExploded()) { + RoundedPosition roundedPosition = new RoundedPosition(position, factor); + AbstractTraceEntity entity = tntEntityMap.computeIfAbsent(roundedPosition, pos -> createEntity(player, position.getLocation(), true)); + tntPositionMap.put(entity.getBukkitEntity(), position); + entity.display(player, position.isExploded(), showModeParameter.isTicks() ? position.getFuseTicks() : -1); + } + if (!showModeParameter.isSourceOnly()) { return; } - RoundedPosition roundedPosition = new RoundedPosition(position, factor); - AbstractTraceEntity entity = tntEntityMap.computeIfAbsent(roundedPosition, pos -> createEntity(player, position.getLocation(), true)); - tntPositionMap.put(entity.getBukkitEntity(), position); - entity.display(player, position.isExploded(), showModeParameter.isTicks() ? position.getFuseTicks() : -1); + } + if (showModeParameter.isSourceOnly()) { + if (position.isSource()) { + RoundedPosition roundedPosition = new RoundedPosition(position, factor); + AbstractTraceEntity entity = tntEntityMap.computeIfAbsent(roundedPosition, pos -> createEntity(player, position.getLocation(), true)); + tntPositionMap.put(entity.getBukkitEntity(), position); + entity.display(player, position.isExploded(), showModeParameter.isTicks() ? position.getFuseTicks() : -1); + } return; } if (!showModeParameter.isWater() && position.isExploded() && checkWater(position.getLocation())) { @@ -107,14 +120,14 @@ public abstract class FactoredEntityShowMode implements EntityTraceShowMode { private void applyOnPosition(TNTPosition position, Consumer function) { if (position.getPreviousLocation() == null) return; - if (showModeParameter.isInterpolate_Y()) { + if (showModeParameter.isInterpolateY()) { Vector updatePointY = position.getPreviousLocation().clone().setY(position.getLocation().getY()); if (!position.getLocation().equals(updatePointY)) { function.accept(updatePointY); } } - if (showModeParameter.isInterpolate_XZ()) { + if (showModeParameter.isInterpolateXZ()) { Vector updatePointXZ = Math.abs(position.getUpdateVelocity().getX()) >= Math.abs(position.getUpdateVelocity().getZ()) ? position.getLocation().clone().setZ(position.getPreviousLocation().getZ()) : position.getLocation().clone().setX(position.getPreviousLocation().getX()); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/mode/ParticleShowMode.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/mode/ParticleShowMode.java deleted file mode 100644 index d897b45c..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/mode/ParticleShowMode.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2021 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 . - */ - -package de.steamwar.bausystem.features.tracer.show.mode; - -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.tracer.TNTPosition; -import de.steamwar.bausystem.features.tracer.show.ShowModeParameter; -import de.steamwar.bausystem.shared.ShowMode; -import de.steamwar.bausystem.utils.NMSWrapper; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitTask; -import org.bukkit.util.Vector; - -import java.util.HashSet; -import java.util.Set; - -public class ParticleShowMode implements ShowMode { - - protected final Player player; - protected final ShowModeParameter showModeParameter; - - private Set positionSet = new HashSet<>(); - - private BukkitTask bukkitTask; - - public ParticleShowMode(Player player, ShowModeParameter showModeParameter) { - this.player = player; - this.showModeParameter = showModeParameter; - } - - @Override - public void show(TNTPosition position) { - if (showModeParameter.isExplodeOnly() && !position.isExploded()) { - return; - } - if (positionSet.contains(position.getLocation())) { - return; - } - positionSet.add(position.getLocation()); - if (bukkitTask == null) { - bukkitTask = Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> { - positionSet.forEach(p -> player.spawnParticle(NMSWrapper.impl.tntPositionParticle(), p.toLocation(player.getWorld()), 1, 0, 0, 0, 0)); - }, 40L, 40L); - } - } - - @Override - public void hide() { - positionSet.clear(); - if (bukkitTask != null) { - bukkitTask.cancel(); - } - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/BookReplaceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/BookReplaceCommand.java index 34a06d2a..290223a2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/BookReplaceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/BookReplaceCommand.java @@ -1,8 +1,7 @@ package de.steamwar.bausystem.features.util; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BookMeta; @@ -10,7 +9,7 @@ import org.bukkit.inventory.meta.ItemMeta; import java.util.List; -@Linked(LinkageType.COMMAND) +@Linked public class BookReplaceCommand extends SWCommand { public BookReplaceCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/ClearCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/ClearCommand.java index 8da2f7bb..3e8899d6 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/ClearCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/ClearCommand.java @@ -21,15 +21,14 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.COMMAND) +@Linked public class ClearCommand extends SWCommand { public ClearCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/DebugStickCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/DebugStickCommand.java index d7f7ab4e..e2de740f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/DebugStickCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/DebugStickCommand.java @@ -20,14 +20,13 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.COMMAND) +@Linked public class DebugStickCommand extends SWCommand { public DebugStickCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/DeclutterCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/DeclutterCommand.java index a684bab9..7d3f5938 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/DeclutterCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/DeclutterCommand.java @@ -20,9 +20,8 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; @@ -30,7 +29,7 @@ import org.bukkit.inventory.ItemStack; import java.util.HashSet; import java.util.Set; -@Linked(LinkageType.COMMAND) +@Linked public class DeclutterCommand extends SWCommand { public DeclutterCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/GamemodeCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/GamemodeCommand.java index 2682d5f9..876586a2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/GamemodeCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/GamemodeCommand.java @@ -19,13 +19,12 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.GameMode; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class GamemodeCommand extends SWCommand { public GamemodeCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/KillAllCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/KillAllCommand.java index 736494be..49654a05 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/KillAllCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/KillAllCommand.java @@ -21,8 +21,6 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.GlobalRegion; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; @@ -30,13 +28,14 @@ import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionSelectionType; import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.entity.Player; import java.util.concurrent.atomic.AtomicLong; -@Linked(LinkageType.COMMAND) +@Linked public class KillAllCommand extends SWCommand { private static final World WORLD = Bukkit.getWorlds().get(0); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/MaterialCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/MaterialCommand.java index 8d5f82d1..dd221bae 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/MaterialCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/MaterialCommand.java @@ -20,8 +20,6 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.shared.EnumDisplay; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; @@ -29,6 +27,7 @@ import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; +import de.steamwar.linkage.Linked; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; @@ -44,8 +43,7 @@ import java.util.*; import java.util.function.BiConsumer; import java.util.function.Predicate; -@Linked(LinkageType.COMMAND) -@Linked(LinkageType.LISTENER) +@Linked public class MaterialCommand extends SWCommand implements Listener { public MaterialCommand() { @@ -65,6 +63,7 @@ public class MaterialCommand extends SWCommand implements Listener { SearchType flammable = SearchType.IGNORE; SearchType burnable = SearchType.IGNORE; SearchType waterloggable = SearchType.IGNORE; + SearchType unmoveable = SearchType.IGNORE; String blastResistance = ">=0"; String name = ""; @@ -112,6 +111,7 @@ public class MaterialCommand extends SWCommand implements Listener { elements.put("-flammable", (search, searchType) -> search.flammable = searchType); elements.put("-burnable", (search, searchType) -> search.burnable = searchType); elements.put("-waterloggable", (search, searchType) -> search.waterloggable = searchType); + elements.put("-unmoveable", (search, searchType) -> search.unmoveable = searchType); } @Register @@ -237,7 +237,11 @@ public class MaterialCommand extends SWCommand implements Listener { search.waterloggable = search.waterloggable.next(); searchGUI(p); })); - swInventory.setItem(30, new SWItem(Material.NETHER_BRICK, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_BLASTRESISTANCE", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.blastResistance), clickType -> { + swInventory.setItem(29, new SWItem(Material.PISTON, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_UNMOVEABLE", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, BauSystem.MESSAGE.parse(search.unmoveable.getChatValue(), p)), clickType -> { + search.unmoveable = search.unmoveable.next(); + searchGUI(p); + })); + swInventory.setItem(34, new SWItem(Material.NETHER_BRICK, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_BLASTRESISTANCE", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.blastResistance), clickType -> { SWAnvilInv swAnvilInv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_BLASTRESISTANCE", p), search.blastResistance); swAnvilInv.setCallback(s -> { if (s.isEmpty() || s.matches("((([><]=?)|!|=)\\d+(\\.|,\\d+)?)( ((([><]=?)|!|=)\\d+(\\.|,\\d+)?))*")) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/MaterialLazyInit.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/MaterialLazyInit.java index 05732896..8beb38b1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/MaterialLazyInit.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/MaterialLazyInit.java @@ -22,7 +22,11 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; +import org.bukkit.Bukkit; import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.PistonMoveReaction; +import org.bukkit.block.TileState; import org.bukkit.block.data.BlockData; import org.bukkit.block.data.Waterlogged; import org.bukkit.entity.Player; @@ -62,6 +66,7 @@ public class MaterialLazyInit { private boolean flammable; private boolean burnable; private boolean waterloggable; + private boolean unmoveable; public MaterialData(Material material) { this.originalMaterial = material; @@ -78,6 +83,11 @@ public class MaterialLazyInit { burnable = material.isBurnable(); BlockData blockData = material.createBlockData(); waterloggable = blockData instanceof Waterlogged; + if (material.isBlock()) { + Block block = Bukkit.getWorlds().get(0).getBlockAt(0, 0, 0); + block.setType(material); + unmoveable = block.getPistonMoveReaction() == PistonMoveReaction.BLOCK || block.getPistonMoveReaction() == PistonMoveReaction.IGNORE || block.getState() instanceof TileState; + } if (material.isItem() && material != Material.AIR) { this.material = material; @@ -115,6 +125,9 @@ public class MaterialLazyInit { if (waterloggable) { lore.add(BauSystem.MESSAGE.parse("MATERIAL_WATERLOGGABLE", p)); } + if (unmoveable) { + lore.add(BauSystem.MESSAGE.parse("MATERIAL_UNMOVABLE", p)); + } return new SWListInv.SWListEntry<>(new SWItem(material, "§e" + name, lore, false, clickType -> { }), originalMaterial); } @@ -129,6 +142,7 @@ public class MaterialLazyInit { result &= search.flammable.test(flammable); result &= search.burnable.test(burnable); result &= search.waterloggable.test(waterloggable); + result &= search.unmoveable.test(unmoveable); if (!result) { return false; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/NightVisionCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/NightVisionCommand.java index 1b28d0fd..0308846d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/NightVisionCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/NightVisionCommand.java @@ -21,9 +21,8 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.configplayer.Config; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import net.md_5.bungee.api.ChatMessageType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -33,8 +32,7 @@ import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import yapion.hierarchy.types.YAPIONObject; -@Linked(LinkageType.COMMAND) -@Linked(LinkageType.LISTENER) +@Linked public class NightVisionCommand extends SWCommand implements Listener { public NightVisionCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/NoClipCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/NoClipCommand.java index 9b1589d9..46fdf535 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/NoClipCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/NoClipCommand.java @@ -24,12 +24,11 @@ import com.comphenix.tinyprotocol.TinyProtocol; import com.mojang.authlib.GameProfile; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tpslimit.TPSUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.utils.NMSWrapper; import de.steamwar.bausystem.utils.ProtocolWrapper; import de.steamwar.command.SWCommand; import de.steamwar.core.Core; +import de.steamwar.linkage.Linked; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.GameMode; @@ -44,8 +43,7 @@ import org.bukkit.event.player.PlayerToggleFlightEvent; import java.util.*; import java.util.function.BiFunction; -@Linked(LinkageType.COMMAND) -@Linked(LinkageType.LISTENER) +@Linked public class NoClipCommand extends SWCommand implements Listener { public static final Class playerInfoPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutPlayerInfo"); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculator.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculator.java index 41a7050d..281b159f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculator.java @@ -20,8 +20,7 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.ToString; @@ -44,7 +43,7 @@ import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; -@Linked(LinkageType.LISTENER) +@Linked public class PistonCalculator implements Listener { @EventHandler diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculatorCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculatorCommand.java index 1ededcee..8aef617f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculatorCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculatorCommand.java @@ -20,12 +20,11 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class PistonCalculatorCommand extends SWCommand { public PistonCalculatorCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/SelectCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/SelectCommand.java index 5987968e..ce859ec6 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/SelectCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/SelectCommand.java @@ -2,8 +2,6 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Point; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.utils.RegionExtensionType; @@ -11,9 +9,10 @@ import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.bausystem.utils.FlatteningWrapper; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class SelectCommand extends SWCommand { public SelectCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/SkullCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/SkullCommand.java index c24c54b5..8ff194a0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/SkullCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/SkullCommand.java @@ -21,11 +21,10 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -35,7 +34,7 @@ import org.bukkit.inventory.meta.SkullMeta; import java.util.List; import java.util.stream.Collectors; -@Linked(LinkageType.COMMAND) +@Linked public class SkullCommand extends SWCommand { public SkullCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/SlotCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/SlotCommand.java index c0dafe18..4ea5d62b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/SlotCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/SlotCommand.java @@ -21,11 +21,10 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommandUtils; import de.steamwar.command.TypeMapper; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; @@ -33,7 +32,7 @@ import org.bukkit.inventory.ItemStack; import java.util.Arrays; -@Linked(LinkageType.COMMAND) +@Linked public class SlotCommand extends SWCommand { public SlotCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/SpeedCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/SpeedCommand.java index a2eef6df..31308830 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/SpeedCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/SpeedCommand.java @@ -20,12 +20,11 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class SpeedCommand extends SWCommand { public SpeedCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/StructureVoidCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/StructureVoidCommand.java index 4146329c..277eb59a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/StructureVoidCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/StructureVoidCommand.java @@ -20,14 +20,13 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.COMMAND) +@Linked public class StructureVoidCommand extends SWCommand { public StructureVoidCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/TNTClickListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/TNTClickListener.java index 7a2f0a67..9bb8368f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/TNTClickListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/TNTClickListener.java @@ -20,8 +20,7 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.entity.Entity; import org.bukkit.entity.TNTPrimed; @@ -30,7 +29,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.inventory.EquipmentSlot; -@Linked(LinkageType.LISTENER) +@Linked public class TNTClickListener implements Listener { @EventHandler diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/TeleportCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/TeleportCommand.java index 047a94e2..9294eb20 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/TeleportCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/TeleportCommand.java @@ -20,15 +20,14 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerTeleportEvent; import java.util.Random; -@Linked(LinkageType.COMMAND) +@Linked public class TeleportCommand extends SWCommand { private static final Random RAND = new Random(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/TimeCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/TimeCommand.java index 82eee50c..15f48590 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/TimeCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/TimeCommand.java @@ -21,16 +21,15 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.*; +import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import java.util.Arrays; import java.util.List; -@Linked(LinkageType.COMMAND) +@Linked public class TimeCommand extends SWCommand { private static final List tabCompletions = Arrays.asList("0", "6000", "12000", "18000"); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/TpsCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/TpsCommand.java index 877c0da1..302dd7e9 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/TpsCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/TpsCommand.java @@ -21,13 +21,12 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tpslimit.TPSWarpUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; import de.steamwar.core.TPSWatcher; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class TpsCommand extends SWCommand { public TpsCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/ClearBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/ClearBauGuiItem.java index ec39cb33..607b7398 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/ClearBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/ClearBauGuiItem.java @@ -21,16 +21,15 @@ package de.steamwar.bausystem.features.util.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class ClearBauGuiItem extends BauGuiItem { public ClearBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/DebugstickBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/DebugstickBauGuiItem.java index d16a6577..725d75b1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/DebugstickBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/DebugstickBauGuiItem.java @@ -22,15 +22,14 @@ package de.steamwar.bausystem.features.util.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.linkage.specific.BauGuiItem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class DebugstickBauGuiItem extends BauGuiItem { public DebugstickBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/DeclutterBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/DeclutterBauGuiItem.java index 9ed5a67f..55bd6a02 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/DeclutterBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/DeclutterBauGuiItem.java @@ -22,17 +22,16 @@ package de.steamwar.bausystem.features.util.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.features.util.DeclutterCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; -import de.steamwar.bausystem.linkage.LinkedInstance; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class DeclutterBauGuiItem extends BauGuiItem { @LinkedInstance diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/GamemodeBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/GamemodeBauGuiItem.java index fb8bf022..42900af8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/GamemodeBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/GamemodeBauGuiItem.java @@ -21,10 +21,9 @@ package de.steamwar.bausystem.features.util.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -33,7 +32,7 @@ import org.bukkit.inventory.ItemStack; import java.util.Arrays; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class GamemodeBauGuiItem extends BauGuiItem { public GamemodeBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/KillAllBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/KillAllBauGuiItem.java index 0e66a163..42a4588a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/KillAllBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/KillAllBauGuiItem.java @@ -22,12 +22,11 @@ package de.steamwar.bausystem.features.util.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.features.util.KillAllCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; -import de.steamwar.bausystem.linkage.LinkedInstance; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.region.utils.RegionSelectionType; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -35,7 +34,7 @@ import org.bukkit.inventory.ItemStack; import java.util.Arrays; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class KillAllBauGuiItem extends BauGuiItem { @LinkedInstance diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/NavWandBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/NavWandBauGuiItem.java index e35da4b8..30ac88a2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/NavWandBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/NavWandBauGuiItem.java @@ -21,10 +21,9 @@ package de.steamwar.bausystem.features.util.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -32,7 +31,7 @@ import org.bukkit.inventory.ItemStack; import java.util.Arrays; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class NavWandBauGuiItem extends BauGuiItem { public NavWandBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/NightVisionBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/NightVisionBauGuiItem.java index 70c652ca..d9cab51e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/NightVisionBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/NightVisionBauGuiItem.java @@ -21,10 +21,10 @@ package de.steamwar.bausystem.features.util.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -33,7 +33,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.potion.PotionEffectType; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class NightVisionBauGuiItem extends BauGuiItem { public NightVisionBauGuiItem() { @@ -48,10 +48,11 @@ public class NightVisionBauGuiItem extends BauGuiItem { meta.setColor(PotionEffectType.NIGHT_VISION.getColor()); meta.setDisplayName(BauSystem.MESSAGE.parse("NIGHT_VISION_ITEM_ON", player)); meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); + meta.setCustomModelData(1); itemStack.setItemMeta(meta); return itemStack; } else { - return new SWItem(Material.GLASS_BOTTLE, BauSystem.MESSAGE.parse("NIGHT_VISION_ITEM_OFF", player)).getItemStack(); + return SWUtils.setCustomModelData(new SWItem(Material.GLASS_BOTTLE, BauSystem.MESSAGE.parse("NIGHT_VISION_ITEM_OFF", player)), 1).getItemStack(); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/SelectBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/SelectBauGuiItem.java index 4cc20aef..2e90be13 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/SelectBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/SelectBauGuiItem.java @@ -21,13 +21,12 @@ package de.steamwar.bausystem.features.util.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import lombok.AllArgsConstructor; import lombok.Getter; import org.bukkit.Material; @@ -40,7 +39,7 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class SelectBauGuiItem extends BauGuiItem { private static final Map LAST_SELECT_MAP = new HashMap<>(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/SkullBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/SkullBauGuiItem.java index ed74b2dd..f9ec57c8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/SkullBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/SkullBauGuiItem.java @@ -21,17 +21,16 @@ package de.steamwar.bausystem.features.util.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class SkullBauGuiItem extends BauGuiItem { public SkullBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/SpeedBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/SpeedBauGuiItem.java index 33fdd3ee..d24eedf6 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/SpeedBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/SpeedBauGuiItem.java @@ -21,11 +21,10 @@ package de.steamwar.bausystem.features.util.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -33,7 +32,7 @@ import org.bukkit.inventory.ItemStack; import java.util.Arrays; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class SpeedBauGuiItem extends BauGuiItem { public SpeedBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/TeleportBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/TeleportBauGuiItem.java index a190b0d6..4569ae47 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/TeleportBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/TeleportBauGuiItem.java @@ -21,11 +21,10 @@ package de.steamwar.bausystem.features.util.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; +import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -34,7 +33,7 @@ import org.bukkit.inventory.ItemStack; import java.util.UUID; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class TeleportBauGuiItem extends BauGuiItem { public TeleportBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/WorldEditBauGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/WorldEditBauGuiItem.java index 2da651fb..ddfa66d7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/WorldEditBauGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/items/WorldEditBauGuiItem.java @@ -21,10 +21,9 @@ package de.steamwar.bausystem.features.util.items; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -32,7 +31,7 @@ import org.bukkit.inventory.ItemStack; import java.util.Arrays; -@Linked(LinkageType.BAU_GUI_ITEM) +@Linked public class WorldEditBauGuiItem extends BauGuiItem { public WorldEditBauGuiItem() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpCommand.java index c2ae7528..cf44f51f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpCommand.java @@ -21,13 +21,15 @@ package de.steamwar.bausystem.features.warp; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.Disable; -import de.steamwar.bausystem.linkage.Enable; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.utils.ListChatView; import de.steamwar.bausystem.worlddata.WorldData; -import de.steamwar.command.*; +import de.steamwar.command.SWCommand; +import de.steamwar.command.SWCommandUtils; +import de.steamwar.command.TypeMapper; +import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.api.Disable; +import de.steamwar.linkage.api.Enable; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; @@ -38,9 +40,7 @@ import yapion.hierarchy.types.YAPIONObject; import java.util.ArrayList; -@Linked(LinkageType.COMMAND) -@Linked(LinkageType.DISABLE_LINK) -@Linked(LinkageType.ENABLE_LINK) +@Linked public class WarpCommand extends SWCommand implements Disable, Enable { private static final String[] FORBIDDEN_NAMES = new String[]{ @@ -129,7 +129,7 @@ public class WarpCommand extends SWCommand implements Disable, Enable { }; } - @Linked(LinkageType.COMMAND) + @Linked public static class WarpsLink extends SWCommand { public WarpsLink() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpListener.java index 406b8c5e..33f437c4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpListener.java @@ -19,10 +19,9 @@ package de.steamwar.bausystem.features.warp; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.utils.NMSWrapper; +import de.steamwar.linkage.Linked; import org.bukkit.*; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -36,7 +35,7 @@ import org.bukkit.util.Vector; import java.util.*; import java.util.function.Consumer; -@Linked(LinkageType.LISTENER) +@Linked public class WarpListener implements Listener { private Map> warpsShown = new HashMap<>(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/AFKStopperListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/AFKStopperListener.java index de20516f..426d26bc 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/AFKStopperListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/AFKStopperListener.java @@ -20,15 +20,14 @@ package de.steamwar.bausystem.features.world; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerMoveEvent; -@Linked(LinkageType.LISTENER) +@Linked public class AFKStopperListener implements Listener { private int minutesAfk = 0; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/AutoShutdownListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/AutoShutdownListener.java index edba5698..54a8bd82 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/AutoShutdownListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/AutoShutdownListener.java @@ -21,8 +21,7 @@ package de.steamwar.bausystem.features.world; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tpslimit.TPSLimitUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import de.steamwar.scoreboard.SWScoreboard; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -34,7 +33,7 @@ import org.bukkit.scheduler.BukkitTask; import java.util.logging.Level; -@Linked(LinkageType.LISTENER) +@Linked public class AutoShutdownListener implements Listener { private BukkitTask autoShutdown; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java index eb3144d2..d44a3cb0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java @@ -4,15 +4,14 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.loader.Loader; import de.steamwar.bausystem.features.tpslimit.FreezeUtils; import de.steamwar.bausystem.features.tpslimit.TPSLimitUtils; -import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.features.tpslimit.TPSWarpUtils; -import de.steamwar.bausystem.features.tracer.record.RecordStateMachine; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.bausystem.features.tracer.record.Recorder; import de.steamwar.bausystem.region.GlobalRegion; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.core.TPSWatcher; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import de.steamwar.scoreboard.SWScoreboard; import de.steamwar.scoreboard.ScoreboardCallback; import org.bukkit.entity.Player; @@ -26,9 +25,12 @@ import java.util.Calendar; import java.util.HashMap; import java.util.List; -@Linked(LinkageType.LISTENER) +@Linked public class BauScoreboard implements Listener { + @LinkedInstance + public Recorder recorder; + @EventHandler public void handlePlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); @@ -75,12 +77,10 @@ public class BauScoreboard implements Listener { } strings.add("§3"); - StringBuilder st = new StringBuilder(); - st.append(colorCode).append(BauSystem.MESSAGE.parse("SCOREBOARD_TRACE", p)).append("§8: ").append(BauSystem.MESSAGE.parse(RecordStateMachine.getRecordStatus().getName(), p)); - if (RecordStateMachine.getRecordStatus().isTracing()) { - st.append(" §8| §e").append(traceTicks()).append(" §7").append(BauSystem.MESSAGE.parse("SCOREBOARD_TRACE_TICKS", p)); + String traceScore = recorder.get(region).scoreboard(p); + if (traceScore != null) { + strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE", p) + "§8: " + traceScore); } - strings.add(st.toString()); Loader loader = Loader.getLoader(p); strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_LOADER", p) + "§8: " + BauSystem.MESSAGE.parse(loader != null ? loader.getStage().getChatValue() : "LOADER_OFF", p)); @@ -100,10 +100,6 @@ public class BauScoreboard implements Listener { return result; } - private long traceTicks() { - return TPSUtils.currentTick.get() - RecordStateMachine.getStartTime(); - } - private String tpsColor() { double tps = TPSWarpUtils.getTps(TPSWatcher.TPSType.ONE_SECOND); if (tps > TPSLimitUtils.getCurrentTPSLimit() * 0.9) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/ClipboardListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/ClipboardListener.java index 03dd9a31..ccdf99cb 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/ClipboardListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/ClipboardListener.java @@ -19,8 +19,7 @@ package de.steamwar.bausystem.features.world; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import de.steamwar.sql.SchematicData; import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SteamwarUser; @@ -29,7 +28,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; -@Linked(LinkageType.LISTENER) +@Linked public class ClipboardListener implements Listener { private static final String CLIPBOARD_SCHEMNAME = "//copy"; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/InventoryListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/InventoryListener.java index 42f25029..6970eed7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/InventoryListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/InventoryListener.java @@ -19,9 +19,8 @@ package de.steamwar.bausystem.features.world; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.utils.NMSWrapper; +import de.steamwar.linkage.Linked; import org.bukkit.attribute.Attribute; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; @@ -33,7 +32,7 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -@Linked(LinkageType.LISTENER) +@Linked public class InventoryListener implements Listener { @EventHandler diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/ItemFrameListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/ItemFrameListener.java index 3858b4cf..9a294708 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/ItemFrameListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/ItemFrameListener.java @@ -20,8 +20,7 @@ package de.steamwar.bausystem.features.world; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.ItemFrame; import org.bukkit.entity.Player; @@ -30,7 +29,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.inventory.ItemStack; -@Linked(LinkageType.LISTENER) +@Linked public class ItemFrameListener implements Listener { @EventHandler diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/KickallCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/KickallCommand.java index ad5407dc..ee9ace1b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/KickallCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/KickallCommand.java @@ -20,15 +20,14 @@ package de.steamwar.bausystem.features.world; import de.steamwar.bausystem.config.BauServer; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; -import de.steamwar.bausystem.linkage.LinkedInstance; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class KickallCommand extends SWCommand { @LinkedInstance diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/NoCreativeKnockback.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/NoCreativeKnockback.java index 08d1d51b..83b33d42 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/NoCreativeKnockback.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/NoCreativeKnockback.java @@ -21,13 +21,13 @@ package de.steamwar.bausystem.features.world; import com.comphenix.tinyprotocol.Reflection; import com.comphenix.tinyprotocol.TinyProtocol; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.utils.NMSWrapper; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.api.Plain; import org.bukkit.GameMode; -@Linked(LinkageType.PLAIN) -public class NoCreativeKnockback { +@Linked +public class NoCreativeKnockback implements Plain { public NoCreativeKnockback() { TinyProtocol.instance.addFilter(Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion"), (player, o) -> { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/ReducedDebugInfo.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/ReducedDebugInfo.java index fb1f8499..c3def14b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/ReducedDebugInfo.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/ReducedDebugInfo.java @@ -19,13 +19,12 @@ package de.steamwar.bausystem.features.world; -import de.steamwar.bausystem.linkage.Enable; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.api.Enable; import org.bukkit.Bukkit; import org.bukkit.GameRule; -@Linked(LinkageType.ENABLE_LINK) +@Linked public class ReducedDebugInfo implements Enable { @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/RestartCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/RestartCommand.java index 20aec025..cf868a9d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/RestartCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/RestartCommand.java @@ -19,11 +19,10 @@ package de.steamwar.bausystem.features.world; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; -@Linked(LinkageType.COMMAND) +@Linked public class RestartCommand extends SWCommand { public RestartCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignEdit.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignEdit.java index cb4cd3b8..2f8e154e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignEdit.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignEdit.java @@ -22,8 +22,7 @@ package de.steamwar.bausystem.features.world; import com.comphenix.tinyprotocol.Reflection; import com.comphenix.tinyprotocol.TinyProtocol; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -35,7 +34,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; -@Linked(LinkageType.LISTENER) +@Linked public class SignEdit implements Listener { private static final Class blockPosition = Reflection.getClass("{nms.core}.BlockPosition"); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignListener.java index 36058c83..40ad9a66 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignListener.java @@ -19,14 +19,13 @@ package de.steamwar.bausystem.features.world; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.linkage.Linked; import org.bukkit.ChatColor; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.SignChangeEvent; -@Linked(LinkageType.LISTENER) +@Linked public class SignListener implements Listener { @EventHandler diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/StopCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/StopCommand.java index d9536619..e71b294e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/StopCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/StopCommand.java @@ -22,16 +22,15 @@ package de.steamwar.bausystem.features.world; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeValidator; +import de.steamwar.linkage.Linked; import de.steamwar.sql.SteamwarUser; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@Linked(LinkageType.COMMAND) +@Linked public class StopCommand extends SWCommand { public StopCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/WorldEditListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/WorldEditListener.java index 2509c16c..f6f25f33 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/WorldEditListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/WorldEditListener.java @@ -21,9 +21,8 @@ package de.steamwar.bausystem.features.world; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.utils.FlatteningWrapper; +import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -32,7 +31,7 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import java.util.HashSet; import java.util.Set; -@Linked(LinkageType.LISTENER) +@Linked public class WorldEditListener implements Listener { @EventHandler diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/ColorReplaceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/ColorReplaceCommand.java index 4f829158..48ceff8a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/ColorReplaceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/ColorReplaceCommand.java @@ -27,13 +27,12 @@ import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import de.steamwar.bausystem.features.world.WorldEditListener; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Color; import de.steamwar.bausystem.shared.Pair; import de.steamwar.bausystem.utils.WorldEditUtils; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; +import de.steamwar.linkage.Linked; import lombok.SneakyThrows; import org.bukkit.Material; import org.bukkit.World; @@ -43,7 +42,7 @@ import org.bukkit.entity.Player; import java.util.*; import java.util.stream.Collectors; -@Linked(LinkageType.COMMAND) +@Linked public class ColorReplaceCommand extends SWCommand { public ColorReplaceCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/TypeReplaceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/TypeReplaceCommand.java index 0940516d..a81cdf96 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/TypeReplaceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/TypeReplaceCommand.java @@ -27,13 +27,12 @@ import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import de.steamwar.bausystem.features.world.WorldEditListener; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; -import de.steamwar.bausystem.linkage.MinVersion; import de.steamwar.bausystem.shared.Pair; import de.steamwar.bausystem.utils.WorldEditUtils; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.MinVersion; import lombok.AllArgsConstructor; import lombok.SneakyThrows; import org.bukkit.Material; @@ -52,7 +51,7 @@ import java.util.stream.Collectors; import static org.bukkit.Material.*; -@Linked(value = LinkageType.COMMAND) +@Linked @MinVersion(18) public class TypeReplaceCommand extends SWCommand { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java index 1011bb13..22c19b67 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java @@ -23,13 +23,12 @@ import com.comphenix.tinyprotocol.Reflection; import com.comphenix.tinyprotocol.TinyProtocol; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.techhider.TechHiderCommand; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; -import de.steamwar.bausystem.linkage.LinkedInstance; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.utils.PlayerMovementWrapper; import de.steamwar.command.SWCommand; import de.steamwar.core.CraftbukkitWrapper; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.LinkedInstance; import de.steamwar.techhider.TechHider; import net.md_5.bungee.api.ChatMessageType; import org.bukkit.Bukkit; @@ -47,8 +46,7 @@ import java.io.File; import java.util.*; import java.util.function.BiFunction; -@Linked(LinkageType.COMMAND) -@Linked(LinkageType.LISTENER) +@Linked public class XrayCommand extends SWCommand implements Listener { public XrayCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/BackupScheduler.java b/BauSystem_Main/src/de/steamwar/bausystem/region/BackupScheduler.java index dccde9c9..44b57332 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/BackupScheduler.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/BackupScheduler.java @@ -20,16 +20,15 @@ package de.steamwar.bausystem.region; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.linkage.Enable; -import de.steamwar.bausystem.linkage.LinkageType; -import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.tags.Tag; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.api.Enable; import org.bukkit.scheduler.BukkitRunnable; import java.util.Iterator; -@Linked(LinkageType.ENABLE_LINK) +@Linked public class BackupScheduler implements Enable { private static final long INITIAL = 20 * 60 * 5; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java index fef81fa4..74adf167 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java @@ -593,7 +593,7 @@ public class Region { public File gameModeConfig() { File baseFile = new File(BauSystem.getInstance().getDataFolder().getParentFile(), "FightSystem"); for (int version = Core.getVersion(); version >= 15; version--) { - File specific = new File(baseFile, getDisplayName() + version + ".yml"); + File specific = new File(baseFile, prototype.getDisplayName() + version + ".yml"); if (specific.exists()) return specific; } return null; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/utils/NMSWrapper.java b/BauSystem_Main/src/de/steamwar/bausystem/utils/NMSWrapper.java index 24fe02f6..c3062009 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/utils/NMSWrapper.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/utils/NMSWrapper.java @@ -48,7 +48,6 @@ public interface NMSWrapper { void setGameStateChangeReason(Object packet); void setPlayerBuildAbilities(Player player); - Particle tntPositionParticle(); Material pathMaterial(); boolean checkItemStack(ItemStack item);