SteamWar/BauSystem2.0
Archiviert
12
0

Merge remote-tracking branch 'origin/master'

Dieser Commit ist enthalten in:
Zeanon 2021-07-05 19:32:32 +02:00
Commit f677ac23c0
9 geänderte Dateien mit 16 neuen und 34 gelöschten Zeilen

Datei anzeigen

@ -68,7 +68,7 @@ public class KillAllCommand extends SWCommand {
entity.remove(); entity.remove();
count.incrementAndGet(); count.incrementAndGet();
}); });
RegionUtils.actionBar(GlobalRegion.getInstance(), BauSystem.MESSAGE.parse("OTHER_KILLALL_GLOBAL", player, count.get())); RegionUtils.actionBar(GlobalRegion.getInstance(), "OTHER_KILLALL_GLOBAL", count.get());
} else { } else {
WORLD.getEntities() WORLD.getEntities()
.stream() .stream()
@ -78,7 +78,7 @@ public class KillAllCommand extends SWCommand {
entity.remove(); entity.remove();
count.incrementAndGet(); count.incrementAndGet();
}); });
RegionUtils.actionBar(region, BauSystem.MESSAGE.parse("OTHER_KILLALL_REGION", player, count.get())); RegionUtils.actionBar(region, "OTHER_KILLALL_REGION", count.get());
} }
} }

Datei anzeigen

@ -49,9 +49,9 @@ public class DamageCommand extends SWCommand {
if (!permissionCheck(p)) return; if (!permissionCheck(p)) return;
Region region = Region.getRegion(p.getLocation()); Region region = Region.getRegion(p.getLocation());
if (toggle(region)) { if (toggle(region)) {
RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getEnableMessage(), p)); RegionUtils.actionBar(region, getEnableMessage());
} else { } else {
RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getDisableMessage(), p)); RegionUtils.actionBar(region, getDisableMessage());
} }
} }

Datei anzeigen

@ -48,9 +48,9 @@ public class FireCommand extends SWCommand {
if (!permissionCheck(p)) return; if (!permissionCheck(p)) return;
Region region = Region.getRegion(p.getLocation()); Region region = Region.getRegion(p.getLocation());
if (toggle(region)) { if (toggle(region)) {
RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getEnableMessage(), p)); RegionUtils.actionBar(region, getEnableMessage());
} else { } else {
RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getDisableMessage(), p)); RegionUtils.actionBar(region, getDisableMessage());
} }
} }

Datei anzeigen

@ -48,9 +48,9 @@ public class FreezeCommand extends SWCommand {
if (!permissionCheck(p)) return; if (!permissionCheck(p)) return;
Region region = Region.getRegion(p.getLocation()); Region region = Region.getRegion(p.getLocation());
if (toggle(region)) { if (toggle(region)) {
RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getEnableMessage(), p)); RegionUtils.actionBar(region, getEnableMessage());
} else { } else {
RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getDisableMessage(), p)); RegionUtils.actionBar(region, getDisableMessage());
} }
} }

Datei anzeigen

@ -52,12 +52,12 @@ public class ProtectCommand extends SWCommand {
switch (region.getPlain(Flag.PROTECT, ProtectMode.class)) { switch (region.getPlain(Flag.PROTECT, ProtectMode.class)) {
case ACTIVE: case ACTIVE:
region.set(Flag.PROTECT, ProtectMode.INACTIVE); region.set(Flag.PROTECT, ProtectMode.INACTIVE);
RegionUtils.actionBar(region, BauSystem.MESSAGE.parse("REGION_PROTECT_DISABLE", p)); RegionUtils.actionBar(region, "REGION_PROTECT_DISABLE");
break; break;
default: default:
case INACTIVE: case INACTIVE:
region.set(Flag.PROTECT, ProtectMode.ACTIVE); region.set(Flag.PROTECT, ProtectMode.ACTIVE);
RegionUtils.actionBar(region, BauSystem.MESSAGE.parse("REGION_PROTECT_ENABLE", p)); RegionUtils.actionBar(region, "REGION_PROTECT_ENABLE");
break; break;
} }
} }

Datei anzeigen

@ -76,7 +76,7 @@ public class TNTCommand extends SWCommand {
requestedMessage = getTestblockEnableMessage(); requestedMessage = getTestblockEnableMessage();
break; break;
} }
tntToggle(region, tntMode, BauSystem.MESSAGE.parse(requestedMessage, p)); tntToggle(region, tntMode, requestedMessage);
} }
@ClassMapper(value = TNTMode.class, local = true) @ClassMapper(value = TNTMode.class, local = true)

Datei anzeigen

@ -47,11 +47,11 @@ public class TNTListener implements Listener {
return false; return false;
} }
if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.NORMAL)) { if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.NORMAL)) {
RegionUtils.actionBarNew(region, "REGION_TNT_BUILD"); RegionUtils.actionBar(region, "REGION_TNT_BUILD");
return true; return true;
} }
if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) { if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) {
RegionUtils.actionBarNew(region, "REGION_TNT_BUILD"); RegionUtils.actionBar(region, "REGION_TNT_BUILD");
return true; return true;
} }
return value == TNTMode.DENY; return value == TNTMode.DENY;

Datei anzeigen

@ -39,15 +39,7 @@ import java.util.function.Function;
@UtilityClass @UtilityClass
public class RegionUtils { public class RegionUtils {
public void actionBar(Region region, String s) { public void actionBar(Region region, String s, Object... objects) {
Bukkit.getOnlinePlayers()
.stream()
.filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL))
.filter(player -> !region.isGlobal() || Region.getRegion(player.getLocation()).isGlobal())
.forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
}
public void actionBarNew(Region region, String s, Object... objects) {
Bukkit.getOnlinePlayers() Bukkit.getOnlinePlayers()
.stream() .stream()
.filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) .filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL))
@ -55,22 +47,12 @@ public class RegionUtils {
.forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(BauSystem.MESSAGE.parse(s, player, objects)))); .forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(BauSystem.MESSAGE.parse(s, player, objects))));
} }
public static void messageOLD(Region region, String s) {
Bukkit.getOnlinePlayers()
.stream()
.filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL))
.filter(player -> !region.isGlobal() || Region.getRegion(player.getLocation()).isGlobal())
.forEach(player -> player.sendMessage(s));
}
public static void message(Region region, String message, Object... objects) { public static void message(Region region, String message, Object... objects) {
Bukkit.getOnlinePlayers() Bukkit.getOnlinePlayers()
.stream() .stream()
.filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) .filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL))
.filter(player -> !region.isGlobal() || Region.getRegion(player.getLocation()).isGlobal()) .filter(player -> !region.isGlobal() || Region.getRegion(player.getLocation()).isGlobal())
.forEach(player -> { .forEach(player -> BauSystem.MESSAGE.send(message, player, objects));
BauSystem.MESSAGE.send(message, player, objects);
});
} }
public static void message(Region region, Function<Player, String> function) { public static void message(Region region, Function<Player, String> function) {

Datei anzeigen

@ -35,11 +35,11 @@ public class Updater {
if (file.lastModified() > lastUpdate + 10) { if (file.lastModified() > lastUpdate + 10) {
try { try {
updaterCode.run(); updaterCode.run();
lastUpdate = file.lastModified();
Bukkit.getLogger().log(Level.INFO, "Update complete of " + file.getAbsolutePath()); Bukkit.getLogger().log(Level.INFO, "Update complete of " + file.getAbsolutePath());
} catch (Exception e) { } catch (Exception e) {
Bukkit.getLogger().log(Level.INFO, "Error while loading file " + file.getAbsolutePath() + " for config: " + e.getMessage(), e); Bukkit.getLogger().log(Level.INFO, "Error while loading file " + file.getAbsolutePath() + " for config: " + e.getMessage(), e);
} }
lastUpdate = file.lastModified();
} }
}, 20, 20); }, 20, 20);
} }