2026-04-03 23:08:30 +00:00
|
|
|
package com.alttd.easter.glow;
|
|
|
|
|
|
|
|
|
|
import com.alttd.easter.egg.EggType;
|
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
|
import org.bukkit.entity.Entity;
|
|
|
|
|
import org.bukkit.scoreboard.Scoreboard;
|
|
|
|
|
import org.bukkit.scoreboard.Team;
|
|
|
|
|
|
|
|
|
|
public class GlowManager {
|
|
|
|
|
|
|
|
|
|
private final Scoreboard scoreboard;
|
|
|
|
|
|
|
|
|
|
public GlowManager(org.bukkit.plugin.Plugin plugin) {
|
|
|
|
|
this.scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void applyGlow(Entity entity, EggType type) {
|
|
|
|
|
String teamName = ("easter_" + type.name()).toLowerCase();
|
|
|
|
|
Team team = scoreboard.getTeam(teamName);
|
|
|
|
|
if (team == null) {
|
|
|
|
|
team = scoreboard.registerNewTeam(teamName);
|
|
|
|
|
team.setCanSeeFriendlyInvisibles(false);
|
|
|
|
|
team.setAllowFriendlyFire(true);
|
|
|
|
|
team.setColor(colorFor(type));
|
|
|
|
|
}
|
|
|
|
|
String entry = entity.getUniqueId().toString();
|
2026-04-03 23:09:18 +00:00
|
|
|
if (!team.hasEntry(entry)) {
|
|
|
|
|
team.addEntry(entry);
|
|
|
|
|
}
|
2026-04-03 23:08:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ChatColor colorFor(EggType type) {
|
|
|
|
|
switch (type) {
|
2026-04-03 23:09:18 +00:00
|
|
|
case BROWN_HUSK:
|
|
|
|
|
return ChatColor.DARK_RED; // closest
|
|
|
|
|
case RED_SPIDER:
|
|
|
|
|
return ChatColor.RED;
|
|
|
|
|
case ORANGE_BLAZE:
|
|
|
|
|
return ChatColor.GOLD;
|
|
|
|
|
case YELLOW_PIGLIN:
|
|
|
|
|
return ChatColor.YELLOW;
|
|
|
|
|
case LIME_CREEPER:
|
|
|
|
|
return ChatColor.GREEN;
|
|
|
|
|
case GREEN_ZOMBIE:
|
|
|
|
|
return ChatColor.DARK_GREEN;
|
|
|
|
|
case LIGHT_BLUE_STRAY:
|
|
|
|
|
return ChatColor.AQUA;
|
|
|
|
|
case CYAN_GUARDIAN:
|
|
|
|
|
return ChatColor.DARK_AQUA;
|
|
|
|
|
case BLUE_WARDEN:
|
|
|
|
|
return ChatColor.BLUE;
|
|
|
|
|
case PURPLE_ENDER_DRAGON:
|
|
|
|
|
return ChatColor.DARK_PURPLE;
|
|
|
|
|
case MAGENTA_ENDERMAN:
|
|
|
|
|
return ChatColor.LIGHT_PURPLE;
|
|
|
|
|
case PINK_HOGLIN:
|
|
|
|
|
return ChatColor.LIGHT_PURPLE;
|
|
|
|
|
case WHITE_SKELETON:
|
|
|
|
|
return ChatColor.WHITE;
|
|
|
|
|
case LIGHT_GRAY_SILVERFISH:
|
|
|
|
|
return ChatColor.GRAY;
|
|
|
|
|
case GRAY_WITHER:
|
|
|
|
|
return ChatColor.DARK_GRAY;
|
|
|
|
|
case BLACK_WITHER_SKELETON:
|
|
|
|
|
return ChatColor.BLACK;
|
|
|
|
|
default:
|
|
|
|
|
return ChatColor.WHITE;
|
2026-04-03 23:08:30 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|