SteamWar/BauSystem2.0
Archiviert
12
0

Add ObserverTracerCommand

Simplify ObserverTracer
Fix ObserverTracerListener

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-06-20 08:58:49 +02:00
Ursprung 1fec4f7e7c
Commit cde43bb968
4 geänderte Dateien mit 53 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -310,6 +310,11 @@ LOADTIMER_SUMARY_TIMES_LAST=§7\\/
LOADTIMER_SUMARY_STATS_HEAD=§7Kanonen-Stats§8: LOADTIMER_SUMARY_STATS_HEAD=§7Kanonen-Stats§8:
LOADTIMER_SUMARY_STATS_TNT=§7TNT: §e{0} LOADTIMER_SUMARY_STATS_TNT=§7TNT: §e{0}
LOADTIMER_SUMARY_STATS_FREQ=§7Belade Frequenz: §e{0}/m§8, §7Schuss Frequenz: §e{1}/m LOADTIMER_SUMARY_STATS_FREQ=§7Belade Frequenz: §e{0}/m§8, §7Schuss Frequenz: §e{1}/m
# Observer
OBSERVER_HELP = §7Rechts-Klicke einen Observer um den Trace zu bekommen. Hierfür müssen Flammenpartikel an sein. Die Partikel werden im Block angezeigt.
OBSERVER_DELETE = §7Observer Trace gelöscht
# Other # Other
OTHER_ITEMS_TELEPORT_NAME=§eTeleporter OTHER_ITEMS_TELEPORT_NAME=§eTeleporter
OTHER_ITEMS_TELEPORT_GUI-NAME=Teleportieren OTHER_ITEMS_TELEPORT_GUI-NAME=Teleportieren

Datei anzeigen

@ -63,10 +63,6 @@ public class ObserverTracer {
} }
} }
public boolean shouldHide(Location location) {
return seen.contains(location);
}
public void trace() { public void trace() {
if (block.getType() != Material.OBSERVER) { if (block.getType() != Material.OBSERVER) {
return; return;

Datei anzeigen

@ -0,0 +1,47 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
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 org.bukkit.entity.Player;
@Linked(LinkageType.COMMAND)
public class ObserverTracerCommand extends SWCommand {
public ObserverTracerCommand() {
super("observertracer", "observer");
}
@Register(help = true)
public void genericHelp(Player p, String... args) {
BauSystem.MESSAGE.sendPrefixless("COMMAND_HELP_HEAD", p, "Observer Tracer");
BauSystem.MESSAGE.sendPrefixless("OBSERVER_HELP", p);
}
@Register(value = "delete")
public void hide(Player p) {
ObserverTracerListener.observerTracerMap.remove(p);
BauSystem.MESSAGE.send("OBSERVER_DELETE", p);
}
}

Datei anzeigen

@ -37,7 +37,7 @@ import java.util.Map;
@Linked(LinkageType.LISTENER) @Linked(LinkageType.LISTENER)
public class ObserverTracerListener implements Listener { public class ObserverTracerListener implements Listener {
private Map<Player, ObserverTracer> observerTracerMap = new HashMap<>(); static Map<Player, ObserverTracer> observerTracerMap = new HashMap<>();
public ObserverTracerListener() { public ObserverTracerListener() {
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> { Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> {