SteamWar/BauSystem
Archiviert
13
0
Dieser Commit ist enthalten in:
jojo 2021-02-03 15:38:12 +01:00
Ursprung 16ad0ad5e6
Commit 168819e5c8
4 geänderte Dateien mit 11 neuen und 19 gelöschten Zeilen

Datei anzeigen

@ -26,10 +26,6 @@ import org.bukkit.event.block.BlockSpreadEvent;
public class CommandFire extends RegionToggleCommand {
public CommandFire() {
super();
}
@Override
String getNoPermMessage() {
return "§cDu darfst hier nicht Feuerschaden (de-)aktivieren";

Datei anzeigen

@ -32,10 +32,6 @@ import org.bukkit.event.inventory.InventoryMoveItemEvent;
public class CommandFreeze extends RegionToggleCommand {
public CommandFreeze(){
super();
}
@Override
String getNoPermMessage() {
return "§cDu darfst diese Welt nicht einfrieren";

Datei anzeigen

@ -36,7 +36,7 @@ public class CommandTNT implements CommandExecutor, Listener {
public enum TNTMode {
ON("§aan"),
ONLY_TB("§7nur §eTestblock"),
ONLY_TB("§7Kein §eBaurahmen"),
OFF("§caus");
private String name;
@ -112,28 +112,28 @@ public class CommandTNT implements CommandExecutor, Listener {
Region region = Region.getRegion(player.getLocation());
if (region == null) {
tntGlobalToggle(player, requestedMode, requestedMessage);
tntGlobalToggle(requestedMode, requestedMessage);
return false;
}
tntToggle(region, requestedMode, requestedMessage);
return false;
}
private void tntGlobalToggle(Player player, TNTMode requestedMode, String requestedMessage) {
private void tntGlobalToggle(TNTMode requestedMode, String requestedMessage) {
if (requestedMode != null && requestedMode != TNTMode.ONLY_TB) {
Region.NoRegion.tnt = requestedMode;
RegionToggleCommand.actionBar(player, requestedMessage);
RegionToggleCommand.actionBar(requestedMessage);
return;
}
switch (Region.NoRegion.tnt) {
case ON:
case ONLY_TB:
Region.NoRegion.tnt = TNTMode.OFF;
RegionToggleCommand.actionBar(player, getDisableMessage());
RegionToggleCommand.actionBar(getDisableMessage());
break;
case OFF:
Region.NoRegion.tnt = TNTMode.ON;
RegionToggleCommand.actionBar(player, getEnableMessage());
RegionToggleCommand.actionBar(getEnableMessage());
break;
}
}

Datei anzeigen

@ -36,7 +36,7 @@ import org.bukkit.event.Listener;
public abstract class RegionToggleCommand implements CommandExecutor, Listener {
RegionToggleCommand() {
public RegionToggleCommand() {
Bukkit.getPluginManager().registerEvents(this, BauSystem.getPlugin());
}
@ -54,9 +54,9 @@ public abstract class RegionToggleCommand implements CommandExecutor, Listener {
Region region = Region.getRegion(player.getLocation());
if (region == null) {
if (toggleGlobal()) {
actionBar(player, getEnableMessage());
actionBar(getEnableMessage());
} else {
actionBar(player, getDisableMessage());
actionBar(getDisableMessage());
}
return false;
}
@ -72,8 +72,8 @@ public abstract class RegionToggleCommand implements CommandExecutor, Listener {
Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation())).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
}
public static void actionBar(Player player, String s) {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s));
public static void actionBar(String s) {
Bukkit.getOnlinePlayers().stream().filter(player -> Region.getRegion(player.getLocation()) == null).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
}
abstract String getNoPermMessage();