SteamWar/BauSystem2.0
Archiviert
12
0

Update TechHiderCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-07-29 23:12:58 +02:00
Ursprung 4773ba970d
Commit 5784cdc446
3 geänderte Dateien mit 18 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -1266,3 +1266,9 @@ STOP_HELP = §8/§estop §8- §7Stops the server
STOP_NO_PERMS = §cYou do not have the permission to stop the server STOP_NO_PERMS = §cYou do not have the permission to stop the server
STOP_MESSAGE = §eServer is stopping STOP_MESSAGE = §eServer is stopping
WORLD_EDIT_NO_PERMS = §cYou do not have the permission to use WorldEdit WORLD_EDIT_NO_PERMS = §cYou do not have the permission to use WorldEdit
# Techhider
TECHHIDER_HELP = §8/§etechhider §8- §7Toggle Techhider
TECHHIDER_GLOBAL = §cNo techhider in global region
TECHHIDER_ON = §aTechhider activated
TECHHIDER_OFF = §aTechhider deactivated

Datei anzeigen

@ -1246,3 +1246,9 @@ STOP_HELP = §8/§estop §8- §7Stoppt den Server
STOP_NO_PERMS = §cDu hast keine Rechte den Server zu stoppen STOP_NO_PERMS = §cDu hast keine Rechte den Server zu stoppen
STOP_MESSAGE = §eDer Server wird gestoppt STOP_MESSAGE = §eDer Server wird gestoppt
WORLD_EDIT_NO_PERMS = §cDu darfst hier kein WorldEdit benutzen WORLD_EDIT_NO_PERMS = §cDu darfst hier kein WorldEdit benutzen
# Techhider
TECHHIDER_HELP = §8/§etechhider §8- §7Techhider umschalten
TECHHIDER_GLOBAL = §cKein Techhider in der globalen region
TECHHIDER_ON = §aTechhider aktiviert
TECHHIDER_OFF = §aTechHider deaktiviert

Datei anzeigen

@ -19,12 +19,14 @@
package de.steamwar.bausystem.features.techhider; package de.steamwar.bausystem.features.techhider;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.core.CraftbukkitWrapper; import de.steamwar.core.CraftbukkitWrapper;
import de.steamwar.techhider.TechHider; import de.steamwar.techhider.TechHider;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
@ -48,10 +50,11 @@ public class TechHiderCommand extends SWCommand implements Listener {
private Map<Region, Optional<TechHider>> techHiders = new HashMap<>(); private Map<Region, Optional<TechHider>> techHiders = new HashMap<>();
private Map<Region, Set<Player>> hidden = new HashMap<>(); private Map<Region, Set<Player>> hidden = new HashMap<>();
@Register @Register(description = "TECHHIDER_HELP")
public void toggleHider(Player player) { public void toggleHider(Player player) {
Region region = Region.getRegion(player.getLocation()); Region region = Region.getRegion(player.getLocation());
if (region.isGlobal()) { if (region.isGlobal()) {
BauSystem.MESSAGE.send("TECHHIDER_GLOBAL", player);
return; return;
} }
@ -83,8 +86,10 @@ public class TechHiderCommand extends SWCommand implements Listener {
if (hidden.get(region).contains(player)) { if (hidden.get(region).contains(player)) {
hidden.get(region).remove(player); hidden.get(region).remove(player);
BauSystem.MESSAGE.send("TECHHIDER_OFF", player, ChatMessageType.ACTION_BAR);
} else { } else {
hidden.get(region).add(player); hidden.get(region).add(player);
BauSystem.MESSAGE.send("TECHHIDER_ON", player, ChatMessageType.ACTION_BAR);
} }
region.forEachChunk((x, z) -> { region.forEachChunk((x, z) -> {
CraftbukkitWrapper.impl.sendChunk(player, x, z); CraftbukkitWrapper.impl.sendChunk(player, x, z);