Fix RegionUtils.actionBar
Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
cf750eb95a
Commit
9f202b9798
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
|
@ -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;
|
||||||
|
@ -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,14 +47,6 @@ 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()
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren