Skip to content

Commit

Permalink
Make listener names consistent and tag withers on proper priority
Browse files Browse the repository at this point in the history
  • Loading branch information
minoneer committed Dec 30, 2024
1 parent bd879b9 commit bcf06ab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private void checkWitherLeash(@NotNull Wither shooter, @Nullable String withersI

private @Nullable String getOwningIsland(@NotNull Wither wither) {
PersistentDataContainer container = wither.getPersistentDataContainer();
NamespacedKey key = new NamespacedKey(plugin, WitherTagListener.ENTITY_ORIGIN_METADATA);
NamespacedKey key = new NamespacedKey(plugin, WitherTagEvents.ENTITY_ORIGIN_METADATA);
if (container.has(key, PersistentDataType.STRING)) {
return container.get(key, PersistentDataType.STRING);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Wither;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.persistence.PersistentDataType;
import us.talabrek.ultimateskyblock.api.IslandInfo;
import us.talabrek.ultimateskyblock.uSkyBlock;

public class WitherTagListener implements Listener {
public class WitherTagEvents implements Listener {

static final String ENTITY_ORIGIN_METADATA = "from-island";
private final uSkyBlock plugin;

public WitherTagListener(uSkyBlock plugin) {
public WitherTagEvents(uSkyBlock plugin) {
this.plugin = plugin;
}

@EventHandler(ignoreCancelled = true)
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onCreatureSpawn(CreatureSpawnEvent event) {
if (event.getSpawnReason() == CreatureSpawnEvent.SpawnReason.BUILD_WITHER
&& event.getEntity() instanceof Wither wither) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public void registerEvents() {
manager.registerEvents(new PlayerEvents(this), this);
manager.registerEvents(new MenuEvents(this), this);
manager.registerEvents(new ExploitEvents(this), this);
manager.registerEvents(new WitherTagListener(this), this);
manager.registerEvents(new WitherTagEvents(this), this);
if (getConfig().getBoolean("options.protection.enabled", true)) {
manager.registerEvents(new GriefEvents(this), this);
if (getConfig().getBoolean("options.protection.item-drops", true)) {
Expand Down

0 comments on commit bcf06ab

Please sign in to comment.