Dieser Commit ist enthalten in:
Ursprung
6e9693d838
Commit
96b84a798b
@ -29,6 +29,7 @@ LIST_NEXT_PAGE=§eNext page
|
||||
|
||||
# Permissions
|
||||
NO_PERMISSION = You are not allowed to use that here
|
||||
SPECTATOR = §fSpectator
|
||||
|
||||
# Scoreboard
|
||||
SCOREBOARD_TIME = Time
|
||||
|
@ -29,6 +29,7 @@ LIST_NEXT_PAGE=§eNächste Seite
|
||||
|
||||
# Permission
|
||||
NO_PERMISSION = Du darfst dies hier nicht nutzen
|
||||
SPECTATOR = §fZuschauer
|
||||
|
||||
# Scoreboard
|
||||
SCOREBOARD_TIME = Uhrzeit
|
||||
|
@ -21,12 +21,18 @@ package de.steamwar.bausystem.features.world;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.region.Color;
|
||||
import de.steamwar.bausystem.region.GlobalRegion;
|
||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
|
||||
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.network.packets.PacketHandler;
|
||||
import de.steamwar.network.packets.server.BaumemberUpdatePacket;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -61,6 +67,7 @@ public class BauMemberUpdate extends PacketHandler implements Listener {
|
||||
Permission.removeForceOnlySpectator(player);
|
||||
newSpectator.add(player);
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, -1, 1, false,false, false));
|
||||
showSpectatorNotice(player);
|
||||
}
|
||||
} else {
|
||||
if (Permission.SUPERVISOR.hasPermission(player)) {
|
||||
@ -70,6 +77,7 @@ public class BauMemberUpdate extends PacketHandler implements Listener {
|
||||
SPECTATORS.remove(player);
|
||||
newBuilder.add(player);
|
||||
player.removePotionEffect(PotionEffectType.GLOWING);
|
||||
BossBarService.instance.remove(player, GlobalRegion.getInstance(), "spectator");
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -81,11 +89,20 @@ public class BauMemberUpdate extends PacketHandler implements Listener {
|
||||
if (Permission.SPECTATOR.hasPermission(event.getPlayer())) {
|
||||
SPECTATORS.add(event.getPlayer());
|
||||
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, -1, 1, false,false, false));
|
||||
showSpectatorNotice(event.getPlayer());
|
||||
} else {
|
||||
event.getPlayer().removePotionEffect(PotionEffectType.GLOWING);
|
||||
}
|
||||
}
|
||||
|
||||
private static void showSpectatorNotice(Player player) {
|
||||
BauSystemBossbar bossbar = BossBarService.instance.get(player, GlobalRegion.getInstance(), "spectator");
|
||||
bossbar.setTitle(BauSystem.MESSAGE.parse("SPECTATOR", player));
|
||||
bossbar.setColor(BarColor.WHITE);
|
||||
bossbar.setStyle(BarStyle.SOLID);
|
||||
bossbar.setProgress(1.0);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
SPECTATORS.remove(event.getPlayer());
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren