updated adminmarker
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
package eu.mhsl.craftattack.spawn.craftattack.appliances.metaGameplay.adminMarker;
|
||||
package eu.mhsl.craftattack.spawn.common.appliances.metaGameplay.adminMarker;
|
||||
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.Appliance;
|
||||
import eu.mhsl.craftattack.spawn.common.appliances.metaGameplay.displayName.DisplayName;
|
@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Teams extends Appliance implements DisplayName.Prefixed, DisplayName.Colored {
|
||||
public class Teams extends Appliance implements DisplayName.Prefixed {
|
||||
private final List<VaroTeam> teams = new ArrayList<>();
|
||||
|
||||
public Teams() {
|
||||
@ -166,11 +166,6 @@ public class Teams extends Appliance implements DisplayName.Prefixed, DisplayNam
|
||||
if(team != null) team.kickTeam(disconnectInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable TextColor getNameColor(Player player) {
|
||||
return NamedTextColor.WHITE ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Component getNamePrefix(Player player) {
|
||||
VaroTeam team = this.getTeamFromPlayer(player.getUniqueId());
|
||||
|
@ -1,39 +0,0 @@
|
||||
package eu.mhsl.craftattack.spawn.varo.appliances.tooling.adminInvisibility;
|
||||
|
||||
import eu.mhsl.craftattack.spawn.core.Main;
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.Appliance;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AdminInvisibility extends Appliance {
|
||||
public void updateVisibility(PlayerJoinEvent event) {
|
||||
Player target = event.getPlayer();
|
||||
boolean shouldBeHidden = target.isOp();
|
||||
for (Player viewer : Bukkit.getOnlinePlayers()) {
|
||||
if (viewer.equals(target)) continue;
|
||||
|
||||
if (shouldBeHidden) {
|
||||
viewer.hidePlayer(Main.instance(), target);
|
||||
} else {
|
||||
viewer.showPlayer(Main.instance(), target);
|
||||
}
|
||||
}
|
||||
|
||||
if(shouldBeHidden) {
|
||||
target.playerListName(Component.empty());
|
||||
event.joinMessage(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Listener> listeners() {
|
||||
return List.of(new OnAdminJoinListener());
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package eu.mhsl.craftattack.spawn.varo.appliances.tooling.adminInvisibility;
|
||||
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceListener;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
class OnAdminJoinListener extends ApplianceListener<AdminInvisibility> {
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent event) {
|
||||
this.getAppliance().updateVisibility(event);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user