Removed Unused Stuff
Dieser Commit ist enthalten in:
Ursprung
24131e5bbe
Commit
5ccf3ddf3c
@ -68,9 +68,9 @@ class AutoLoader_12 {
|
|||||||
Material material = block.getType();
|
Material material = block.getType();
|
||||||
if(material == Material.LEVER){
|
if(material == Material.LEVER){
|
||||||
if((block.getData() & 8) == 8) {
|
if((block.getData() & 8) == 8) {
|
||||||
return new Detoloader("Hebel", 0).setActiv(false);
|
return new Detoloader("Hebel", 0).setActive(false);
|
||||||
}else{
|
}else{
|
||||||
return new Detoloader("Hebel", 0).setActiv(true);
|
return new Detoloader("Hebel", 0).setActive(true);
|
||||||
}
|
}
|
||||||
}else if(material == Material.STONE_BUTTON){
|
}else if(material == Material.STONE_BUTTON){
|
||||||
return new Detoloader("Knopf", 20);
|
return new Detoloader("Knopf", 20);
|
||||||
|
@ -95,9 +95,9 @@ class AutoLoader_15 {
|
|||||||
|
|
||||||
if (material == Material.LEVER) {
|
if (material == Material.LEVER) {
|
||||||
if (powerable.isPowered()) {
|
if (powerable.isPowered()) {
|
||||||
return new Detoloader("Hebel", 0).setActiv(false);
|
return new Detoloader("Hebel", 0).setActive(false);
|
||||||
} else {
|
} else {
|
||||||
return new Detoloader("Hebel", 0).setActiv(true);
|
return new Detoloader("Hebel", 0).setActive(true);
|
||||||
}
|
}
|
||||||
} else if (material == Material.STONE_BUTTON) {
|
} else if (material == Material.STONE_BUTTON) {
|
||||||
return new Detoloader("Knopf", 20);
|
return new Detoloader("Knopf", 20);
|
||||||
|
@ -19,11 +19,13 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.world;
|
package de.steamwar.bausystem.world;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
public class Detoloader {
|
public class Detoloader {
|
||||||
|
|
||||||
String message;
|
String message;
|
||||||
int activation;
|
int activation;
|
||||||
boolean activ, addBack = true, useActive = false;
|
boolean active, addBack = true, useActive = false;
|
||||||
|
|
||||||
public Detoloader(String message, int activation) {
|
public Detoloader(String message, int activation) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
@ -42,13 +44,13 @@ public class Detoloader {
|
|||||||
return activation;
|
return activation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isActiv() {
|
public boolean isActive() {
|
||||||
return activ;
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Detoloader setActiv(boolean activ) {
|
public Detoloader setActive(boolean active) {
|
||||||
useActive = true;
|
useActive = true;
|
||||||
this.activ = activ;
|
this.active = active;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,4 +62,19 @@ public class Detoloader {
|
|||||||
this.addBack = addBack;
|
this.addBack = addBack;
|
||||||
return this;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
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<DetonatorActivation> 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -39,8 +39,7 @@ public class CommandDetonatorTabCompleter implements TabCompleter {
|
|||||||
List<String> tabComplete = new ArrayList<>();
|
List<String> tabComplete = new ArrayList<>();
|
||||||
tabComplete.add("wand");
|
tabComplete.add("wand");
|
||||||
tabComplete.add("reset");
|
tabComplete.add("reset");
|
||||||
tabComplete.add("list");
|
tabComplete.add("detonate");
|
||||||
tabComplete.add("tp");
|
|
||||||
|
|
||||||
if (args.length >= 2) {
|
if (args.length >= 2) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
@ -38,12 +38,12 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class Detonator extends IDetonator implements Listener {
|
public class Detonator implements Listener {
|
||||||
|
|
||||||
public static final ItemStack WAND;
|
public static final ItemStack WAND;
|
||||||
private static final Map<Player, Detonator> players = new HashMap<>();
|
private static final Map<Player, Detonator> players = new HashMap<>();
|
||||||
|
|
||||||
private final Set<DetonatorActivation> locs = new HashSet<>();
|
private final Set<Detoloader.DetonatorActivation> locs = new HashSet<>();
|
||||||
private final Player player;
|
private final Player player;
|
||||||
|
|
||||||
|
|
||||||
@ -77,10 +77,9 @@ public class Detonator extends IDetonator implements Listener {
|
|||||||
players.remove(player);
|
players.remove(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute() {
|
public void execute() {
|
||||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§a" + locs.size() + " Punkt(e) ausgelöst!"));
|
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;
|
Boolean powered;
|
||||||
if(activation.activation == -1) switch (Core.getVersion()) {
|
if(activation.activation == -1) switch (Core.getVersion()) {
|
||||||
@ -132,17 +131,17 @@ public class Detonator extends IDetonator implements Listener {
|
|||||||
});
|
});
|
||||||
}else {
|
}else {
|
||||||
if(detoloader.getActivation() == 0) {
|
if(detoloader.getActivation() == 0) {
|
||||||
locs.add(new DetonatorActivation(event.getClickedBlock().getLocation()));
|
locs.add(new Detoloader.DetonatorActivation(event.getClickedBlock().getLocation()));
|
||||||
}else {
|
}else {
|
||||||
locs.add(new DetonatorActivation(detoloader.getActivation(), event.getClickedBlock().getLocation()));
|
locs.add(new Detoloader.DetonatorActivation(detoloader.getActivation(), event.getClickedBlock().getLocation()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
locs.clear();
|
locs.clear();
|
||||||
if(detoloader.getActivation() == 0) {
|
if(detoloader.getActivation() == 0) {
|
||||||
locs.add(new DetonatorActivation(event.getClickedBlock().getLocation()));
|
locs.add(new Detoloader.DetonatorActivation(event.getClickedBlock().getLocation()));
|
||||||
}else {
|
}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" :
|
print(detoloader.addBack ? "§e" + detoloader.getBlock() + " hinzugefügt" :
|
||||||
@ -161,12 +160,10 @@ public class Detonator extends IDetonator implements Listener {
|
|||||||
players.remove(event.getPlayer());
|
players.remove(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
Set<Detoloader.DetonatorActivation> getLocations() {
|
||||||
Set<DetonatorActivation> getLocations() {
|
|
||||||
return locs;
|
return locs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
boolean setRedstone(Location location, boolean active) {
|
boolean setRedstone(Location location, boolean active) {
|
||||||
switch(Core.getVersion()){
|
switch(Core.getVersion()){
|
||||||
case 15:
|
case 15:
|
||||||
@ -176,8 +173,14 @@ public class Detonator extends IDetonator implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
Player getPlayer() {
|
Player getPlayer() {
|
||||||
return player;
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren