mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-10 18:38:08 +01:00
Deregister event handlers in deregisterAll(), empty talk item is now equivalent to * talk item
This commit is contained in:
parent
cd21b9fb8a
commit
529855bd6d
@ -11,6 +11,7 @@ import java.util.UUID;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Maps;
|
||||
@ -79,6 +80,7 @@ public class CitizensNPCRegistry implements NPCRegistry {
|
||||
NPC npc = itr.next();
|
||||
npc.despawn(DespawnReason.REMOVAL);
|
||||
for (Trait t : npc.getTraits()) {
|
||||
HandlerList.unregisterAll(t);
|
||||
t.onRemove();
|
||||
}
|
||||
itr.remove();
|
||||
|
@ -183,7 +183,7 @@ public class Util {
|
||||
|
||||
public static boolean matchesItemInHand(Player player, String setting) {
|
||||
String parts = setting;
|
||||
if (parts.contains("*"))
|
||||
if (parts.contains("*") || parts.isEmpty())
|
||||
return true;
|
||||
for (String part : Splitter.on(',').split(parts)) {
|
||||
Material matchMaterial = SpigotUtil.isUsing1_13API() ? Material.matchMaterial(part, true)
|
||||
|
@ -22,6 +22,7 @@ import net.minecraft.server.v1_15_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_15_R1.DamageSource;
|
||||
import net.minecraft.server.v1_15_R1.DataWatcherObject;
|
||||
import net.minecraft.server.v1_15_R1.EntityHorse;
|
||||
import net.minecraft.server.v1_15_R1.EntityHorseAbstract;
|
||||
import net.minecraft.server.v1_15_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_15_R1.GenericAttributes;
|
||||
import net.minecraft.server.v1_15_R1.IBlockData;
|
||||
|
Loading…
Reference in New Issue
Block a user