diff --git a/BauSystem_12/src/de/steamwar/bausystem/world/AutoLoader_12.java b/BauSystem_12/src/de/steamwar/bausystem/world/AutoLoader_12.java index ce874dd..4ab81c5 100644 --- a/BauSystem_12/src/de/steamwar/bausystem/world/AutoLoader_12.java +++ b/BauSystem_12/src/de/steamwar/bausystem/world/AutoLoader_12.java @@ -68,9 +68,9 @@ class AutoLoader_12 { Material material = block.getType(); if(material == Material.LEVER){ if((block.getData() & 8) == 8) { - return new Detoloader("Hebel", 0).setActiv(false); + return new Detoloader("Hebel", 0).setActive(false); }else{ - return new Detoloader("Hebel", 0).setActiv(true); + return new Detoloader("Hebel", 0).setActive(true); } }else if(material == Material.STONE_BUTTON){ return new Detoloader("Knopf", 20); diff --git a/BauSystem_15/src/de/steamwar/bausystem/world/AutoLoader_15.java b/BauSystem_15/src/de/steamwar/bausystem/world/AutoLoader_15.java index 11ff749..38d1ca2 100644 --- a/BauSystem_15/src/de/steamwar/bausystem/world/AutoLoader_15.java +++ b/BauSystem_15/src/de/steamwar/bausystem/world/AutoLoader_15.java @@ -95,9 +95,9 @@ class AutoLoader_15 { if (material == Material.LEVER) { if (powerable.isPowered()) { - return new Detoloader("Hebel", 0).setActiv(false); + return new Detoloader("Hebel", 0).setActive(false); } else { - return new Detoloader("Hebel", 0).setActiv(true); + return new Detoloader("Hebel", 0).setActive(true); } } else if (material == Material.STONE_BUTTON) { return new Detoloader("Knopf", 20); diff --git a/BauSystem_API/src/de/steamwar/bausystem/world/Detoloader.java b/BauSystem_API/src/de/steamwar/bausystem/world/Detoloader.java index 5f588e0..9e16e10 100644 --- a/BauSystem_API/src/de/steamwar/bausystem/world/Detoloader.java +++ b/BauSystem_API/src/de/steamwar/bausystem/world/Detoloader.java @@ -19,11 +19,13 @@ package de.steamwar.bausystem.world; +import org.bukkit.Location; + public class Detoloader { String message; int activation; - boolean activ, addBack = true, useActive = false; + boolean active, addBack = true, useActive = false; public Detoloader(String message, int activation) { this.message = message; @@ -42,13 +44,13 @@ public class Detoloader { return activation; } - public boolean isActiv() { - return activ; + public boolean isActive() { + return active; } - public Detoloader setActiv(boolean activ) { + public Detoloader setActive(boolean active) { useActive = true; - this.activ = activ; + this.active = active; return this; } @@ -60,4 +62,19 @@ public class Detoloader { this.addBack = addBack; return this; } + + static class DetonatorActivation { + + int activation = -1; + Location location; + + public DetonatorActivation(Location location) { + this.location = location; + } + + public DetonatorActivation(int activation, Location location) { + this.activation = activation; + this.location = location; + } + } } diff --git a/BauSystem_API/src/de/steamwar/bausystem/world/IDetonator.java b/BauSystem_API/src/de/steamwar/bausystem/world/IDetonator.java deleted file mode 100644 index 138e581..0000000 --- a/BauSystem_API/src/de/steamwar/bausystem/world/IDetonator.java +++ /dev/null @@ -1,60 +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.world; - -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.chat.TextComponent; -import org.bukkit.Location; -import org.bukkit.entity.Player; - -import java.util.Set; - -abstract class IDetonator { - - - abstract Set getLocations(); - abstract boolean setRedstone(Location location, boolean active); - abstract Player getPlayer(); - abstract void execute(); - - - - void print(String message, boolean withSize){ - if(withSize) - getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message + " §8" + getLocations().size())); - else - getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message)); - } - - static class DetonatorActivation { - - int activation = -1; - Location location; - - public DetonatorActivation(Location location) { - this.location = location; - } - - public DetonatorActivation(int activation, Location location) { - this.activation = activation; - this.location = location; - } - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandDetonatorTabCompleter.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandDetonatorTabCompleter.java index fb57e72..32d98ec 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandDetonatorTabCompleter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandDetonatorTabCompleter.java @@ -39,8 +39,7 @@ public class CommandDetonatorTabCompleter implements TabCompleter { List tabComplete = new ArrayList<>(); tabComplete.add("wand"); tabComplete.add("reset"); - tabComplete.add("list"); - tabComplete.add("tp"); + tabComplete.add("detonate"); if (args.length >= 2) { return new ArrayList<>(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java b/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java index a17b174..86d49b4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java @@ -38,12 +38,12 @@ import org.bukkit.inventory.meta.ItemMeta; import java.util.*; import java.util.stream.Collectors; -public class Detonator extends IDetonator implements Listener { +public class Detonator implements Listener { public static final ItemStack WAND; private static final Map players = new HashMap<>(); - private final Set locs = new HashSet<>(); + private final Set locs = new HashSet<>(); private final Player player; @@ -77,10 +77,9 @@ public class Detonator extends IDetonator implements Listener { players.remove(player); } - @Override public void execute() { player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§a" + locs.size() + " Punkt(e) ausgelöst!")); - for (DetonatorActivation activation: getLocations()) { + for (Detoloader.DetonatorActivation activation: getLocations()) { Boolean powered; if(activation.activation == -1) switch (Core.getVersion()) { @@ -132,17 +131,17 @@ public class Detonator extends IDetonator implements Listener { }); }else { if(detoloader.getActivation() == 0) { - locs.add(new DetonatorActivation(event.getClickedBlock().getLocation())); + locs.add(new Detoloader.DetonatorActivation(event.getClickedBlock().getLocation())); }else { - locs.add(new DetonatorActivation(detoloader.getActivation(), event.getClickedBlock().getLocation())); + locs.add(new Detoloader.DetonatorActivation(detoloader.getActivation(), event.getClickedBlock().getLocation())); } } }else { locs.clear(); if(detoloader.getActivation() == 0) { - locs.add(new DetonatorActivation(event.getClickedBlock().getLocation())); + locs.add(new Detoloader.DetonatorActivation(event.getClickedBlock().getLocation())); }else { - locs.add(new DetonatorActivation(detoloader.getActivation(), event.getClickedBlock().getLocation())); + locs.add(new Detoloader.DetonatorActivation(detoloader.getActivation(), event.getClickedBlock().getLocation())); } } print(detoloader.addBack ? "§e" + detoloader.getBlock() + " hinzugefügt" : @@ -161,12 +160,10 @@ public class Detonator extends IDetonator implements Listener { players.remove(event.getPlayer()); } - @Override - Set getLocations() { + Set getLocations() { return locs; } - @Override boolean setRedstone(Location location, boolean active) { switch(Core.getVersion()){ case 15: @@ -176,8 +173,14 @@ public class Detonator extends IDetonator implements Listener { } } - @Override Player getPlayer() { return player; } + + void print(String message, boolean withSize){ + if(withSize) + getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message + " §8" + getLocations().size())); + else + getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message)); + } }