Implement API, check for invalid Player references, remove Text min/max-cooldown settings and fix Text delay/right click cancellations, make SitTrait work with npc#teleport

This commit is contained in:
fullwall 2023-01-01 15:26:35 +08:00
parent a669a8a256
commit b8e79b20cf
688 changed files with 2924 additions and 2966 deletions

Binary file not shown.

View File

@ -96,7 +96,6 @@ import net.citizensnpcs.trait.CommandTrait;
import net.citizensnpcs.trait.Controllable; import net.citizensnpcs.trait.Controllable;
import net.citizensnpcs.trait.CurrentLocation; import net.citizensnpcs.trait.CurrentLocation;
import net.citizensnpcs.trait.ShopTrait; import net.citizensnpcs.trait.ShopTrait;
import net.citizensnpcs.trait.SitTrait;
import net.citizensnpcs.util.ChunkCoord; import net.citizensnpcs.util.ChunkCoord;
import net.citizensnpcs.util.Messages; import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
@ -237,7 +236,7 @@ public class EventListen implements Listener {
npc = CitizensAPI.getNPCRegistry().getNPC(((EntityDamageByEntityEvent) event).getDamager()); npc = CitizensAPI.getNPCRegistry().getNPC(((EntityDamageByEntityEvent) event).getDamager());
if (npc == null) if (npc == null)
return; return;
event.setCancelled(!npc.data().get(NPC.DAMAGE_OTHERS_METADATA, true)); event.setCancelled(!npc.data().get(NPC.Metadata.DAMAGE_OTHERS, true));
NPCDamageEntityEvent damageEvent = new NPCDamageEntityEvent(npc, (EntityDamageByEntityEvent) event); NPCDamageEntityEvent damageEvent = new NPCDamageEntityEvent(npc, (EntityDamageByEntityEvent) event);
Bukkit.getPluginManager().callEvent(damageEvent); Bukkit.getPluginManager().callEvent(damageEvent);
} }
@ -278,7 +277,7 @@ public class EventListen implements Listener {
return; return;
} }
if (!npc.data().get(NPC.DROPS_ITEMS_METADATA, false)) { if (!npc.data().get(NPC.Metadata.DROPS_ITEMS, false)) {
event.getDrops().clear(); event.getDrops().clear();
} }
@ -286,7 +285,7 @@ public class EventListen implements Listener {
Bukkit.getPluginManager().callEvent(new NPCDeathEvent(npc, event)); Bukkit.getPluginManager().callEvent(new NPCDeathEvent(npc, event));
npc.despawn(DespawnReason.DEATH); npc.despawn(DespawnReason.DEATH);
int delay = npc.data().get(NPC.RESPAWN_DELAY_METADATA, -1); int delay = npc.data().get(NPC.Metadata.RESPAWN_DELAY, -1);
if (delay < 0) if (delay < 0)
return; return;
int deathAnimationTicks = event.getEntity() instanceof LivingEntity ? 20 : 2; int deathAnimationTicks = event.getEntity() instanceof LivingEntity ? 20 : 2;
@ -323,7 +322,7 @@ public class EventListen implements Listener {
NPC npc = CitizensAPI.getNPCRegistry().getNPC(event.getTarget()); NPC npc = CitizensAPI.getNPCRegistry().getNPC(event.getTarget());
if (npc == null) if (npc == null)
return; return;
event.setCancelled(!npc.data().get(NPC.TARGETABLE_METADATA, !npc.isProtected())); event.setCancelled(!npc.data().get(NPC.Metadata.TARGETABLE, !npc.isProtected()));
Bukkit.getPluginManager().callEvent(new EntityTargetNPCEvent(event, npc)); Bukkit.getPluginManager().callEvent(new EntityTargetNPCEvent(event, npc));
} }
@ -453,7 +452,7 @@ public class EventListen implements Listener {
return; return;
} }
boolean leashProtected = npc.isProtected(); boolean leashProtected = npc.isProtected();
if (npc.data().get(NPC.LEASH_PROTECTED_METADATA, leashProtected)) { if (npc.data().get(NPC.Metadata.LEASH_PROTECTED, leashProtected)) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -486,11 +485,6 @@ public class EventListen implements Listener {
@EventHandler(ignoreCancelled = true) @EventHandler(ignoreCancelled = true)
public void onPlayerTeleport(final PlayerTeleportEvent event) { public void onPlayerTeleport(final PlayerTeleportEvent event) {
NPC npc = CitizensAPI.getNPCRegistry().getNPC(event.getPlayer()); NPC npc = CitizensAPI.getNPCRegistry().getNPC(event.getPlayer());
if (event.getCause() == TeleportCause.PLUGIN && npc != null) {
if (npc.hasTrait(SitTrait.class)) {
npc.getOrAddTrait(SitTrait.class).setSitting(event.getTo());
}
}
if (event.getCause() == TeleportCause.PLUGIN && !event.getPlayer().hasMetadata("citizens-force-teleporting") if (event.getCause() == TeleportCause.PLUGIN && !event.getPlayer().hasMetadata("citizens-force-teleporting")
&& npc != null && Setting.PLAYER_TELEPORT_DELAY.asInt() > 0) { && npc != null && Setting.PLAYER_TELEPORT_DELAY.asInt() > 0) {
event.setCancelled(true); event.setCancelled(true);

View File

@ -166,8 +166,6 @@ public class Settings {
STORAGE_TYPE("storage.type", "yaml"), STORAGE_TYPE("storage.type", "yaml"),
SUBPLUGIN_FOLDER("subplugins.folder", "plugins"), SUBPLUGIN_FOLDER("subplugins.folder", "plugins"),
TABLIST_REMOVE_PACKET_DELAY("npc.tablist.remove-packet-delay", 1), TABLIST_REMOVE_PACKET_DELAY("npc.tablist.remove-packet-delay", 1),
TALK_CLOSE_MAXIMUM_COOLDOWN("npc.text.max-talk-cooldown", 5),
TALK_CLOSE_MINIMUM_COOLDOWN("npc.text.min-talk-cooldown", 10),
TALK_CLOSE_TO_NPCS("npc.chat.options.talk-to-npcs", true), TALK_CLOSE_TO_NPCS("npc.chat.options.talk-to-npcs", true),
TALK_ITEM("npc.text.talk-item", "*"), TALK_ITEM("npc.text.talk-item", "*"),
USE_BOAT_CONTROLS("npc.controllable.use-boat-controls", true), USE_BOAT_CONTROLS("npc.controllable.use-boat-controls", true),

View File

@ -78,6 +78,7 @@ import net.citizensnpcs.api.npc.BlockBreaker;
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration; import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
import net.citizensnpcs.api.npc.MemoryNPCDataStore; import net.citizensnpcs.api.npc.MemoryNPCDataStore;
import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.npc.NPC.NPCUpdate;
import net.citizensnpcs.api.npc.NPCRegistry; import net.citizensnpcs.api.npc.NPCRegistry;
import net.citizensnpcs.api.trait.Trait; import net.citizensnpcs.api.trait.Trait;
import net.citizensnpcs.api.trait.trait.Inventory; import net.citizensnpcs.api.trait.trait.Inventory;
@ -394,11 +395,11 @@ public class NPCCommands {
permission = "citizens.npc.chunkload") permission = "citizens.npc.chunkload")
@Requirements(selected = true, ownership = true) @Requirements(selected = true, ownership = true)
public void chunkload(CommandContext args, CommandSender sender, NPC npc) { public void chunkload(CommandContext args, CommandSender sender, NPC npc) {
boolean enabled = !npc.data().get(NPC.KEEP_CHUNK_LOADED_METADATA, Setting.KEEP_CHUNKS_LOADED.asBoolean()); boolean enabled = !npc.data().get(NPC.Metadata.KEEP_CHUNK_LOADED, Setting.KEEP_CHUNKS_LOADED.asBoolean());
if (args.hasFlag('t')) { if (args.hasFlag('t')) {
npc.data().set(NPC.KEEP_CHUNK_LOADED_METADATA, enabled); npc.data().set(NPC.Metadata.KEEP_CHUNK_LOADED, enabled);
} else { } else {
npc.data().setPersistent(NPC.KEEP_CHUNK_LOADED_METADATA, enabled); npc.data().setPersistent(NPC.Metadata.KEEP_CHUNK_LOADED, enabled);
} }
Messaging.sendTr(sender, enabled ? Messages.CHUNKLOAD_SET : Messages.CHUNKLOAD_UNSET, npc.getName()); Messaging.sendTr(sender, enabled ? Messages.CHUNKLOAD_SET : Messages.CHUNKLOAD_UNSET, npc.getName());
} }
@ -689,7 +690,7 @@ public class NPCCommands {
} }
if (args.hasFlag('s')) { if (args.hasFlag('s')) {
npc.data().set(NPC.SILENT_METADATA, true); npc.data().set(NPC.Metadata.SILENT, true);
} }
if (nameplate != null) { if (nameplate != null) {
@ -1270,11 +1271,11 @@ public class NPCCommands {
flags = "t", flags = "t",
permission = "citizens.npc.leashable") permission = "citizens.npc.leashable")
public void leashable(CommandContext args, CommandSender sender, NPC npc) { public void leashable(CommandContext args, CommandSender sender, NPC npc) {
boolean vulnerable = !npc.data().get(NPC.LEASH_PROTECTED_METADATA, true); boolean vulnerable = !npc.data().get(NPC.Metadata.LEASH_PROTECTED, true);
if (args.hasFlag('t')) { if (args.hasFlag('t')) {
npc.data().set(NPC.LEASH_PROTECTED_METADATA, vulnerable); npc.data().set(NPC.Metadata.LEASH_PROTECTED, vulnerable);
} else { } else {
npc.data().setPersistent(NPC.LEASH_PROTECTED_METADATA, vulnerable); npc.data().setPersistent(NPC.Metadata.LEASH_PROTECTED, vulnerable);
} }
String key = vulnerable ? Messages.LEASHABLE_STOPPED : Messages.LEASHABLE_SET; String key = vulnerable ? Messages.LEASHABLE_STOPPED : Messages.LEASHABLE_SET;
Messaging.sendTr(sender, key, npc.getName()); Messaging.sendTr(sender, key, npc.getName());
@ -1527,15 +1528,15 @@ public class NPCCommands {
Material material = Material.matchMaterial(item); Material material = Material.matchMaterial(item);
if (material == null) if (material == null)
throw new CommandException(); throw new CommandException();
npc.data().setPersistent(NPC.MINECART_ITEM_METADATA, material.name()); npc.data().setPersistent(NPC.Metadata.MINECART_ITEM, material.name());
npc.data().setPersistent(NPC.MINECART_ITEM_DATA_METADATA, data); npc.data().setPersistent(NPC.Metadata.MINECART_ITEM_DATA, data);
} }
if (args.hasValueFlag("offset")) { if (args.hasValueFlag("offset")) {
npc.data().setPersistent(NPC.MINECART_OFFSET_METADATA, args.getFlagInteger("offset")); npc.data().setPersistent(NPC.Metadata.MINECART_OFFSET, args.getFlagInteger("offset"));
} }
Messaging.sendTr(sender, Messages.MINECART_SET, npc.data().get(NPC.MINECART_ITEM_METADATA, ""), Messaging.sendTr(sender, Messages.MINECART_SET, npc.data().get(NPC.Metadata.MINECART_ITEM, ""),
npc.data().get(NPC.MINECART_ITEM_DATA_METADATA, 0), npc.data().get(NPC.MINECART_OFFSET_METADATA, 0)); npc.data().get(NPC.Metadata.MINECART_ITEM_DATA, 0), npc.data().get(NPC.Metadata.MINECART_OFFSET, 0));
} }
@Command( @Command(
@ -1611,9 +1612,9 @@ public class NPCCommands {
public void moveto(CommandContext args, CommandSender sender, NPC npc) throws CommandException { public void moveto(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
if (!npc.isSpawned()) { if (!npc.isSpawned()) {
npc.spawn(npc.getOrAddTrait(CurrentLocation.class).getLocation(), SpawnReason.COMMAND); npc.spawn(npc.getOrAddTrait(CurrentLocation.class).getLocation(), SpawnReason.COMMAND);
} if (!npc.isSpawned()) {
if (!npc.isSpawned()) { throw new CommandException("NPC could not be spawned.");
throw new CommandException("NPC could not be spawned."); }
} }
Location current = npc.getEntity().getLocation(); Location current = npc.getEntity().getLocation();
Location to; Location to;
@ -1671,7 +1672,7 @@ public class NPCCommands {
old = old.equals("hover") ? "true" : "" + !Boolean.parseBoolean(old); old = old.equals("hover") ? "true" : "" + !Boolean.parseBoolean(old);
} }
npc.data().setPersistent(NPC.Metadata.NAMEPLATE_VISIBLE, old); npc.data().setPersistent(NPC.Metadata.NAMEPLATE_VISIBLE, old);
npc.data().set(NPC.Metadata.FORCE_PACKET_UPDATE, true); npc.scheduleUpdate(NPCUpdate.PACKET);
Messaging.sendTr(sender, Messages.NAMEPLATE_VISIBILITY_SET, old); Messaging.sendTr(sender, Messages.NAMEPLATE_VISIBILITY_SET, old);
} }
@ -1767,8 +1768,8 @@ public class NPCCommands {
permission = "citizens.npc.passive") permission = "citizens.npc.passive")
public void passive(CommandContext args, CommandSender sender, NPC npc, @Flag("set") Boolean set) public void passive(CommandContext args, CommandSender sender, NPC npc, @Flag("set") Boolean set)
throws CommandException { throws CommandException {
boolean passive = set != null ? set : !npc.data().get(NPC.DAMAGE_OTHERS_METADATA, true); boolean passive = set != null ? set : !npc.data().get(NPC.Metadata.DAMAGE_OTHERS, true);
npc.data().setPersistent(NPC.DAMAGE_OTHERS_METADATA, passive); npc.data().setPersistent(NPC.Metadata.DAMAGE_OTHERS, passive);
Messaging.sendTr(sender, passive ? Messages.PASSIVE_SET : Messages.PASSIVE_UNSET, npc.getName()); Messaging.sendTr(sender, passive ? Messages.PASSIVE_SET : Messages.PASSIVE_UNSET, npc.getName());
} }
@ -1914,14 +1915,14 @@ public class NPCCommands {
permission = "citizens.npc.playerlist") permission = "citizens.npc.playerlist")
@Requirements(selected = true, ownership = true, types = EntityType.PLAYER) @Requirements(selected = true, ownership = true, types = EntityType.PLAYER)
public void playerlist(CommandContext args, CommandSender sender, NPC npc) { public void playerlist(CommandContext args, CommandSender sender, NPC npc) {
boolean remove = !npc.data().get(NPC.REMOVE_FROM_PLAYERLIST_METADATA, boolean remove = !npc.data().get(NPC.Metadata.REMOVE_FROM_PLAYERLIST,
Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean()); Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());
if (args.hasFlag('a')) { if (args.hasFlag('a')) {
remove = false; remove = false;
} else if (args.hasFlag('r')) { } else if (args.hasFlag('r')) {
remove = true; remove = true;
} }
npc.data().setPersistent(NPC.REMOVE_FROM_PLAYERLIST_METADATA, remove); npc.data().setPersistent(NPC.Metadata.REMOVE_FROM_PLAYERLIST, remove);
if (npc.isSpawned()) { if (npc.isSpawned()) {
npc.despawn(DespawnReason.PENDING_RESPAWN); npc.despawn(DespawnReason.PENDING_RESPAWN);
npc.spawn(npc.getOrAddTrait(CurrentLocation.class).getLocation(), SpawnReason.RESPAWN); npc.spawn(npc.getOrAddTrait(CurrentLocation.class).getLocation(), SpawnReason.RESPAWN);
@ -2184,10 +2185,10 @@ public class NPCCommands {
public void respawn(CommandContext args, CommandSender sender, NPC npc) { public void respawn(CommandContext args, CommandSender sender, NPC npc) {
if (args.argsLength() > 1) { if (args.argsLength() > 1) {
int delay = args.getTicks(1); int delay = args.getTicks(1);
npc.data().setPersistent(NPC.RESPAWN_DELAY_METADATA, delay); npc.data().setPersistent(NPC.Metadata.RESPAWN_DELAY, delay);
Messaging.sendTr(sender, Messages.RESPAWN_DELAY_SET, delay); Messaging.sendTr(sender, Messages.RESPAWN_DELAY_SET, delay);
} else { } else {
Messaging.sendTr(sender, Messages.RESPAWN_DELAY_DESCRIBE, npc.data().get(NPC.RESPAWN_DELAY_METADATA, -1)); Messaging.sendTr(sender, Messages.RESPAWN_DELAY_DESCRIBE, npc.data().get(NPC.Metadata.RESPAWN_DELAY, -1));
} }
} }
@ -2391,21 +2392,17 @@ public class NPCCommands {
if (args.argsLength() == 3) { if (args.argsLength() == 3) {
shop = shops.getShop(args.getString(2).toLowerCase()); shop = shops.getShop(args.getString(2).toLowerCase());
} }
if (action.equalsIgnoreCase("delete")) {
if (args.argsLength() != 3 || shop == null)
throw new CommandUsageException();
if (!sender.hasPermission("citizens.admin") && (!sender.hasPermission("citizens.npc.shop.edit")
|| !sender.hasPermission("citizens.npc.shop.edit." + shop.getName())))
throw new NoPermissionsException();
shops.deleteShop(shop);
return;
}
if (shop == null) if (shop == null)
throw new CommandUsageException(); throw new CommandUsageException();
if (action.equalsIgnoreCase("edit")) {
if (!sender.hasPermission("citizens.admin") && (!sender.hasPermission("citizens.npc.shop.edit") if (action.equalsIgnoreCase("delete")) {
|| !sender.hasPermission("citizens.npc.shop.edit." + shop.getName()))) if (args.argsLength() != 3)
throw new CommandUsageException();
if (!shop.canEdit(npc, sender))
throw new NoPermissionsException();
shops.deleteShop(shop);
} else if (action.equalsIgnoreCase("edit")) {
if (!shop.canEdit(npc, sender))
throw new NoPermissionsException(); throw new NoPermissionsException();
shop.displayEditor(npc == null ? null : npc.getOrAddTrait(ShopTrait.class), sender); shop.displayEditor(npc == null ? null : npc.getOrAddTrait(ShopTrait.class), sender);
} else if (action.equalsIgnoreCase("show")) { } else if (action.equalsIgnoreCase("show")) {
@ -2580,9 +2577,9 @@ public class NPCCommands {
@Requirements(selected = true, ownership = true, livingEntity = true) @Requirements(selected = true, ownership = true, livingEntity = true)
public void sound(CommandContext args, CommandSender sender, NPC npc, @Flag("death") String death, public void sound(CommandContext args, CommandSender sender, NPC npc, @Flag("death") String death,
@Flag("ambient") String ambient, @Flag("hurt") String hurt) throws CommandException { @Flag("ambient") String ambient, @Flag("hurt") String hurt) throws CommandException {
String ambientSound = npc.data().get(NPC.AMBIENT_SOUND_METADATA); String ambientSound = npc.data().get(NPC.Metadata.AMBIENT_SOUND);
String deathSound = npc.data().get(NPC.DEATH_SOUND_METADATA); String deathSound = npc.data().get(NPC.Metadata.DEATH_SOUND);
String hurtSound = npc.data().get(NPC.HURT_SOUND_METADATA); String hurtSound = npc.data().get(NPC.Metadata.HURT_SOUND);
if (args.getValueFlags().size() == 0 && args.getFlags().size() == 0) { if (args.getValueFlags().size() == 0 && args.getFlags().size() == 0) {
Messaging.sendTr(sender, Messages.SOUND_INFO, npc.getName(), ambientSound, hurtSound, deathSound); Messaging.sendTr(sender, Messages.SOUND_INFO, npc.getName(), ambientSound, hurtSound, deathSound);
return; return;
@ -2590,14 +2587,14 @@ public class NPCCommands {
if (args.hasFlag('n')) { if (args.hasFlag('n')) {
ambientSound = deathSound = hurtSound = ""; ambientSound = deathSound = hurtSound = "";
npc.data().setPersistent(NPC.SILENT_METADATA, true); npc.data().setPersistent(NPC.Metadata.SILENT, true);
} }
if (args.hasFlag('s')) { if (args.hasFlag('s')) {
npc.data().setPersistent(NPC.SILENT_METADATA, !npc.data().get(NPC.SILENT_METADATA, false)); npc.data().setPersistent(NPC.Metadata.SILENT, !npc.data().get(NPC.Metadata.SILENT, false));
} }
if (args.hasFlag('d')) { if (args.hasFlag('d')) {
ambientSound = deathSound = hurtSound = null; ambientSound = deathSound = hurtSound = null;
npc.data().setPersistent(NPC.SILENT_METADATA, false); npc.data().setPersistent(NPC.Metadata.SILENT, false);
} else { } else {
if (death != null) { if (death != null) {
deathSound = death.equals("d") ? null : NMS.getSound(death); deathSound = death.equals("d") ? null : NMS.getSound(death);
@ -2610,19 +2607,19 @@ public class NPCCommands {
} }
} }
if (deathSound == null) { if (deathSound == null) {
npc.data().remove(NPC.DEATH_SOUND_METADATA); npc.data().remove(NPC.Metadata.DEATH_SOUND);
} else { } else {
npc.data().setPersistent(NPC.DEATH_SOUND_METADATA, deathSound); npc.data().setPersistent(NPC.Metadata.DEATH_SOUND, deathSound);
} }
if (hurtSound == null) { if (hurtSound == null) {
npc.data().remove(NPC.HURT_SOUND_METADATA); npc.data().remove(NPC.Metadata.HURT_SOUND);
} else { } else {
npc.data().setPersistent(NPC.HURT_SOUND_METADATA, hurtSound); npc.data().setPersistent(NPC.Metadata.HURT_SOUND, hurtSound);
} }
if (ambientSound == null) { if (ambientSound == null) {
npc.data().remove(NPC.AMBIENT_SOUND_METADATA); npc.data().remove(NPC.Metadata.AMBIENT_SOUND);
} else { } else {
npc.data().setPersistent(NPC.AMBIENT_SOUND_METADATA, ambientSound); npc.data().setPersistent(NPC.Metadata.AMBIENT_SOUND, ambientSound);
} }
if (ambientSound != null && ambientSound.isEmpty()) { if (ambientSound != null && ambientSound.isEmpty()) {
@ -2637,7 +2634,7 @@ public class NPCCommands {
if ((!Strings.isNullOrEmpty(ambientSound) && !ambientSound.equals("none")) if ((!Strings.isNullOrEmpty(ambientSound) && !ambientSound.equals("none"))
|| (!Strings.isNullOrEmpty(deathSound) && !deathSound.equals("none")) || (!Strings.isNullOrEmpty(deathSound) && !deathSound.equals("none"))
|| (!Strings.isNullOrEmpty(hurtSound) && !hurtSound.equals("none"))) { || (!Strings.isNullOrEmpty(hurtSound) && !hurtSound.equals("none"))) {
npc.data().setPersistent(NPC.SILENT_METADATA, false); npc.data().setPersistent(NPC.Metadata.SILENT, false);
} }
Messaging.sendTr(sender, Messages.SOUND_SET, npc.getName(), ambientSound, hurtSound, deathSound); Messaging.sendTr(sender, Messages.SOUND_SET, npc.getName(), ambientSound, hurtSound, deathSound);
} }
@ -2717,7 +2714,7 @@ public class NPCCommands {
} else { } else {
Player player = Bukkit.getPlayerExact(target); Player player = Bukkit.getPlayerExact(target);
if (player != null) { if (player != null) {
context.addRecipient((Entity) player); context.addRecipient(player);
} }
} }
} }
@ -2802,11 +2799,11 @@ public class NPCCommands {
flags = "t", flags = "t",
permission = "citizens.npc.targetable") permission = "citizens.npc.targetable")
public void targetable(CommandContext args, CommandSender sender, NPC npc) { public void targetable(CommandContext args, CommandSender sender, NPC npc) {
boolean targetable = !npc.data().get(NPC.TARGETABLE_METADATA, npc.isProtected()); boolean targetable = !npc.data().get(NPC.Metadata.TARGETABLE, npc.isProtected());
if (args.hasFlag('t')) { if (args.hasFlag('t')) {
npc.data().set(NPC.TARGETABLE_METADATA, targetable); npc.data().set(NPC.Metadata.TARGETABLE, targetable);
} else { } else {
npc.data().setPersistent(NPC.TARGETABLE_METADATA, targetable); npc.data().setPersistent(NPC.Metadata.TARGETABLE, targetable);
} }
Messaging.sendTr(sender, targetable ? Messages.TARGETABLE_SET : Messages.TARGETABLE_UNSET, npc.getName()); Messaging.sendTr(sender, targetable ? Messages.TARGETABLE_SET : Messages.TARGETABLE_UNSET, npc.getName());
} }
@ -3021,9 +3018,9 @@ public class NPCCommands {
public void vulnerable(CommandContext args, CommandSender sender, NPC npc) { public void vulnerable(CommandContext args, CommandSender sender, NPC npc) {
boolean vulnerable = !npc.isProtected(); boolean vulnerable = !npc.isProtected();
if (args.hasFlag('t')) { if (args.hasFlag('t')) {
npc.data().set(NPC.DEFAULT_PROTECTED_METADATA, vulnerable); npc.data().set(NPC.Metadata.DEFAULT_PROTECTED, vulnerable);
} else { } else {
npc.data().setPersistent(NPC.DEFAULT_PROTECTED_METADATA, vulnerable); npc.data().setPersistent(NPC.Metadata.DEFAULT_PROTECTED, vulnerable);
} }
String key = vulnerable ? Messages.VULNERABLE_STOPPED : Messages.VULNERABLE_SET; String key = vulnerable ? Messages.VULNERABLE_STOPPED : Messages.VULNERABLE_SET;
Messaging.sendTr(sender, key, npc.getName()); Messaging.sendTr(sender, key, npc.getName());

View File

@ -64,9 +64,9 @@ public class WaypointCommands {
max = 1, max = 1,
permission = "citizens.waypoints.disableteleport") permission = "citizens.waypoints.disableteleport")
public void disableTeleporting(CommandContext args, CommandSender sender, NPC npc) throws CommandException { public void disableTeleporting(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
npc.data().setPersistent(NPC.DISABLE_DEFAULT_STUCK_ACTION_METADATA, npc.data().setPersistent(NPC.Metadata.DISABLE_DEFAULT_STUCK_ACTION,
!npc.data().get(NPC.DISABLE_DEFAULT_STUCK_ACTION_METADATA, false)); !npc.data().get(NPC.Metadata.DISABLE_DEFAULT_STUCK_ACTION, false));
if (npc.data().get(NPC.DISABLE_DEFAULT_STUCK_ACTION_METADATA, false)) { if (npc.data().get(NPC.Metadata.DISABLE_DEFAULT_STUCK_ACTION, false)) {
npc.getNavigator().getDefaultParameters().stuckAction(null); npc.getNavigator().getDefaultParameters().stuckAction(null);
Messaging.sendTr(sender, Messages.WAYPOINT_TELEPORTING_DISABLED, npc.getName()); Messaging.sendTr(sender, Messages.WAYPOINT_TELEPORTING_DISABLED, npc.getName());
} else { } else {
@ -103,8 +103,8 @@ public class WaypointCommands {
max = 1, max = 1,
permission = "citizens.waypoints.opendoors") permission = "citizens.waypoints.opendoors")
public void openDoors(CommandContext args, CommandSender sender, NPC npc) throws CommandException { public void openDoors(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
boolean opensDoors = !npc.data().get(NPC.PATHFINDER_OPEN_DOORS_METADATA, false); boolean opensDoors = !npc.data().get(NPC.Metadata.PATHFINDER_OPEN_DOORS, false);
npc.data().setPersistent(NPC.PATHFINDER_OPEN_DOORS_METADATA, opensDoors); npc.data().setPersistent(NPC.Metadata.PATHFINDER_OPEN_DOORS, opensDoors);
Messaging.sendTr(sender, Messaging.sendTr(sender,
opensDoors ? Messages.PATHFINDER_OPEN_DOORS_ENABLED : Messages.PATHFINDER_OPEN_DOORS_DISABLED, opensDoors ? Messages.PATHFINDER_OPEN_DOORS_ENABLED : Messages.PATHFINDER_OPEN_DOORS_DISABLED,
npc.getName()); npc.getName());

View File

@ -48,6 +48,7 @@ import net.citizensnpcs.trait.CurrentLocation;
import net.citizensnpcs.trait.Gravity; import net.citizensnpcs.trait.Gravity;
import net.citizensnpcs.trait.HologramTrait; import net.citizensnpcs.trait.HologramTrait;
import net.citizensnpcs.trait.ScoreboardTrait; import net.citizensnpcs.trait.ScoreboardTrait;
import net.citizensnpcs.trait.SitTrait;
import net.citizensnpcs.trait.SneakTrait; import net.citizensnpcs.trait.SneakTrait;
import net.citizensnpcs.util.ChunkCoord; import net.citizensnpcs.util.ChunkCoord;
import net.citizensnpcs.util.Messages; import net.citizensnpcs.util.Messages;
@ -79,7 +80,7 @@ public class CitizensNPC extends AbstractNPC {
} }
NPCDespawnEvent event = new NPCDespawnEvent(this, reason); NPCDespawnEvent event = new NPCDespawnEvent(this, reason);
if (reason == DespawnReason.CHUNK_UNLOAD) { if (reason == DespawnReason.CHUNK_UNLOAD) {
event.setCancelled(data().get(NPC.KEEP_CHUNK_LOADED_METADATA, Setting.KEEP_CHUNKS_LOADED.asBoolean())); event.setCancelled(data().get(NPC.Metadata.KEEP_CHUNK_LOADED, Setting.KEEP_CHUNKS_LOADED.asBoolean()));
} }
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled() && reason != DespawnReason.DEATH) { if (event.isCancelled() && reason != DespawnReason.DEATH) {
@ -159,6 +160,13 @@ public class CitizensNPC extends AbstractNPC {
return getEntity() != null && NMS.isValid(getEntity()); return getEntity() != null && NMS.isValid(getEntity());
} }
@Override
public boolean isUpdating(NPCUpdate update) {
return update == NPCUpdate.PACKET
? updateCounter > data().get(NPC.Metadata.PACKET_UPDATE_DELAY, Setting.PACKET_UPDATE_DELAY.asInt())
: false;
}
@Override @Override
public void load(final DataKey root) { public void load(final DataKey root) {
super.load(root); super.load(root);
@ -195,11 +203,18 @@ public class CitizensNPC extends AbstractNPC {
@Override @Override
public void save(DataKey root) { public void save(DataKey root) {
super.save(root); super.save(root);
if (!data().get(NPC.SHOULD_SAVE_METADATA, true)) if (!data().get(NPC.Metadata.SHOULD_SAVE, true))
return; return;
navigator.save(root.getRelative("navigator")); navigator.save(root.getRelative("navigator"));
} }
@Override
public void scheduleUpdate(NPCUpdate update) {
if (update == NPCUpdate.PACKET) {
updateCounter = data().get(NPC.Metadata.PACKET_UPDATE_DELAY, Setting.PACKET_UPDATE_DELAY.asInt()) + 1;
}
}
@Override @Override
public void setBukkitEntityType(EntityType type) { public void setBukkitEntityType(EntityType type) {
EntityController controller = EntityControllers.createForType(type); EntityController controller = EntityControllers.createForType(type);
@ -407,13 +422,16 @@ public class CitizensNPC extends AbstractNPC {
@Override @Override
public void teleport(Location location, TeleportCause reason) { public void teleport(Location location, TeleportCause reason) {
super.teleport(location, reason);
if (!isSpawned()) if (!isSpawned())
return; return;
if (hasTrait(SitTrait.class)) {
getOrAddTrait(SitTrait.class).setSitting(location);
}
Location npcLoc = getEntity().getLocation(CACHE_LOCATION); Location npcLoc = getEntity().getLocation(CACHE_LOCATION);
if (isSpawned() && npcLoc.getWorld() == location.getWorld() && npcLoc.distanceSquared(location) < 1) { if (isSpawned() && npcLoc.getWorld() == location.getWorld() && npcLoc.distance(location) < 1) {
NMS.setHeadYaw(getEntity(), location.getYaw()); NMS.setHeadYaw(getEntity(), location.getYaw());
} }
super.teleport(location, reason);
} }
@Override @Override
@ -463,9 +481,8 @@ public class CitizensNPC extends AbstractNPC {
} }
boolean isLiving = getEntity() instanceof LivingEntity; boolean isLiving = getEntity() instanceof LivingEntity;
int packetUpdateDelay = data().get(NPC.Metadata.PACKET_UPDATE_DELAY, Setting.PACKET_UPDATE_DELAY.asInt()); if (isUpdating(NPCUpdate.PACKET)) {
if (updateCounter++ > packetUpdateDelay || data().has(NPC.Metadata.FORCE_PACKET_UPDATE)) { if (data().get(NPC.Metadata.KEEP_CHUNK_LOADED, Setting.KEEP_CHUNKS_LOADED.asBoolean())) {
if (data().get(NPC.KEEP_CHUNK_LOADED_METADATA, Setting.KEEP_CHUNKS_LOADED.asBoolean())) {
ChunkCoord currentCoord = new ChunkCoord(getStoredLocation()); ChunkCoord currentCoord = new ChunkCoord(getStoredLocation());
if (!currentCoord.equals(cachedCoord)) { if (!currentCoord.equals(cachedCoord)) {
resetCachedCoord(); resetCachedCoord();
@ -478,7 +495,6 @@ public class CitizensNPC extends AbstractNPC {
updateScoreboard(); updateScoreboard();
} }
updateCounter = 0; updateCounter = 0;
data().remove(NPC.Metadata.FORCE_PACKET_UPDATE);
} }
updateCustomNameVisibility(); updateCustomNameVisibility();
@ -502,13 +518,15 @@ public class CitizensNPC extends AbstractNPC {
} }
} }
if (SUPPORT_SILENT && data().has(NPC.SILENT_METADATA)) { if (SUPPORT_SILENT && data().has(NPC.Metadata.SILENT)) {
try { try {
getEntity().setSilent(Boolean.parseBoolean(data().get(NPC.Metadata.SILENT).toString())); getEntity().setSilent(Boolean.parseBoolean(data().get(NPC.Metadata.SILENT).toString()));
} catch (NoSuchMethodError e) { } catch (NoSuchMethodError e) {
SUPPORT_SILENT = false; SUPPORT_SILENT = false;
} }
} }
updateCounter++;
} catch (Exception ex) { } catch (Exception ex) {
Throwable error = Throwables.getRootCause(ex); Throwable error = Throwables.getRootCause(ex);
Messaging.logTr(Messages.EXCEPTION_UPDATING_NPC, getId(), error.getMessage()); Messaging.logTr(Messages.EXCEPTION_UPDATING_NPC, getId(), error.getMessage());
@ -542,8 +560,8 @@ public class CitizensNPC extends AbstractNPC {
return; return;
if (!Util.isAlwaysFlyable(type)) if (!Util.isAlwaysFlyable(type))
return; return;
if (!data().has(NPC.FLYABLE_METADATA)) { if (!data().has(NPC.Metadata.FLYABLE)) {
data().setPersistent(NPC.FLYABLE_METADATA, true); data().setPersistent(NPC.Metadata.FLYABLE, true);
} }
if (!hasTrait(Gravity.class)) { if (!hasTrait(Gravity.class)) {
getOrAddTrait(Gravity.class).setEnabled(true); getOrAddTrait(Gravity.class).setEnabled(true);
@ -580,6 +598,8 @@ public class CitizensNPC extends AbstractNPC {
private static boolean SUPPORT_GLOWING = true; private static boolean SUPPORT_GLOWING = true;
private static boolean SUPPORT_NODAMAGE_TICKS = true; private static boolean SUPPORT_NODAMAGE_TICKS = true;
private static boolean SUPPORT_PICKUP_ITEMS = true; private static boolean SUPPORT_PICKUP_ITEMS = true;
private static boolean SUPPORT_SILENT = true; private static boolean SUPPORT_SILENT = true;
private static boolean SUPPORT_USE_ITEM = true; private static boolean SUPPORT_USE_ITEM = true;
} }

View File

@ -17,6 +17,7 @@ import net.citizensnpcs.api.ai.NavigatorParameters;
import net.citizensnpcs.api.ai.TargetType; import net.citizensnpcs.api.ai.TargetType;
import net.citizensnpcs.api.ai.event.CancelReason; import net.citizensnpcs.api.ai.event.CancelReason;
import net.citizensnpcs.api.astar.AStarMachine; import net.citizensnpcs.api.astar.AStarMachine;
import net.citizensnpcs.api.astar.AStarMachine.AStarState;
import net.citizensnpcs.api.astar.pathfinder.BlockExaminer; import net.citizensnpcs.api.astar.pathfinder.BlockExaminer;
import net.citizensnpcs.api.astar.pathfinder.BlockSource; import net.citizensnpcs.api.astar.pathfinder.BlockSource;
import net.citizensnpcs.api.astar.pathfinder.MinecraftBlockExaminer; import net.citizensnpcs.api.astar.pathfinder.MinecraftBlockExaminer;
@ -30,12 +31,10 @@ import net.citizensnpcs.util.Util;
public class AStarNavigationStrategy extends AbstractPathStrategy { public class AStarNavigationStrategy extends AbstractPathStrategy {
private final Location destination; private final Location destination;
private int iterations;
private final NPC npc; private final NPC npc;
private final NavigatorParameters params; private final NavigatorParameters params;
private Path plan; private Path plan;
private boolean planned = false; private AStarPlanner planner;
private AStarMachine<VectorNode, Path>.AStarState state;
private Vector vector; private Vector vector;
public AStarNavigationStrategy(NPC npc, Iterable<Vector> path, NavigatorParameters params) { public AStarNavigationStrategy(NPC npc, Iterable<Vector> path, NavigatorParameters params) {
@ -44,7 +43,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
this.params = params; this.params = params;
this.destination = list.get(list.size() - 1).toLocation(npc.getStoredLocation().getWorld()); this.destination = list.get(list.size() - 1).toLocation(npc.getStoredLocation().getWorld());
this.npc = npc; this.npc = npc;
setPlan(new Path(list)); this.plan = new Path(list);
} }
public AStarNavigationStrategy(NPC npc, Location dest, NavigatorParameters params) { public AStarNavigationStrategy(NPC npc, Location dest, NavigatorParameters params) {
@ -69,71 +68,28 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
return destination; return destination;
} }
public void initialisePathfinder() {
params.examiner(new BlockExaminer() {
@Override
public float getCost(BlockSource source, PathPoint point) {
Vector pos = point.getVector();
Material above = source.getMaterialAt(pos.setY(pos.getY() + 1));
return params.avoidWater() && (MinecraftBlockExaminer.isLiquid(above)
|| MinecraftBlockExaminer.isLiquidOrInLiquid(pos.toLocation(source.getWorld()).getBlock())) ? 1F
: 0F;
}
@Override
public PassableState isPassable(BlockSource source, PathPoint point) {
return PassableState.IGNORE;
}
});
Location location = npc.getEntity().getLocation();
VectorGoal goal = new VectorGoal(destination, (float) params.pathDistanceMargin());
state = ASTAR.getStateFor(goal,
new VectorNode(goal, location, new NMSChunkBlockSource(location, params.range()), params.examiners()));
}
public void setPlan(Path path) {
this.plan = path;
this.planned = true;
if (plan == null || plan.isComplete()) {
setCancelReason(CancelReason.STUCK);
} else {
vector = plan.getCurrentVector();
if (params.debug()) {
plan.debug();
}
}
}
@Override @Override
public void stop() { public void stop() {
if (plan != null && params.debug()) { if (plan != null && params.debug()) {
plan.debugEnd(); plan.debugEnd();
} }
state = null;
plan = null; plan = null;
} }
@Override @Override
public boolean update() { public boolean update() {
if (!planned) { if (plan == null) {
if (state == null) { if (planner == null) {
initialisePathfinder(); planner = new AStarPlanner(params, npc.getStoredLocation(), destination);
} }
int maxIterations = Setting.MAXIMUM_ASTAR_ITERATIONS.asInt(); CancelReason reason = planner.tick(Setting.ASTAR_ITERATIONS_PER_TICK.asInt(),
int iterationsPerTick = Setting.ASTAR_ITERATIONS_PER_TICK.asInt(); Setting.MAXIMUM_ASTAR_ITERATIONS.asInt());
Path plan = ASTAR.run(state, iterationsPerTick); if (reason != null) {
if (plan == null) { setCancelReason(reason);
if (state.isEmpty()) { }
setCancelReason(CancelReason.STUCK); plan = planner.plan;
} if (plan != null) {
if (iterationsPerTick > 0 && maxIterations > 0) { planner = null;
iterations += iterationsPerTick;
if (iterations > maxIterations) {
setCancelReason(CancelReason.STUCK);
}
}
} else {
setPlan(plan);
} }
} }
if (getCancelReason() != null || plan == null || plan.isComplete()) { if (getCancelReason() != null || plan == null || plan.isComplete()) {
@ -141,7 +97,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
} }
Location loc = npc.getEntity().getLocation(NPC_LOCATION); Location loc = npc.getEntity().getLocation(NPC_LOCATION);
/* Proper door movement - gets stuck on corners at times /* Proper door movement - gets stuck on corners at times
Block block = currLoc.getWorld().getBlockAt(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); Block block = currLoc.getWorld().getBlockAt(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
if (MinecraftBlockExaminer.isDoor(block.getType())) { if (MinecraftBlockExaminer.isDoor(block.getType())) {
Door door = (Door) block.getState().getData(); Door door = (Door) block.getState().getData();
@ -184,6 +140,65 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
return false; return false;
} }
public static class AStarPlanner {
Location from;
int iterations;
NavigatorParameters params;
Path plan;
AStarState state;
Location to;
public AStarPlanner(NavigatorParameters params, Location from, Location to) {
this.params = params;
this.from = from;
this.to = to;
params.examiner(new BlockExaminer() {
@Override
public float getCost(BlockSource source, PathPoint point) {
Vector pos = point.getVector();
Material above = source.getMaterialAt(pos.setY(pos.getY() + 1));
return params.avoidWater() && (MinecraftBlockExaminer.isLiquid(above)
|| MinecraftBlockExaminer.isLiquidOrInLiquid(pos.toLocation(source.getWorld()).getBlock()))
? 1F
: 0F;
}
@Override
public PassableState isPassable(BlockSource source, PathPoint point) {
return PassableState.IGNORE;
}
});
}
public CancelReason tick(int iterationsPerTick, int maxIterations) {
if (plan != null)
return null;
if (state == null) {
VectorGoal goal = new VectorGoal(to, (float) params.pathDistanceMargin());
state = ASTAR.getStateFor(goal,
new VectorNode(goal, from, new NMSChunkBlockSource(from, params.range()), params.examiners()));
}
Path plan = ASTAR.run(state, iterationsPerTick);
if (plan == null) {
if (state.isEmpty()) {
return CancelReason.STUCK;
}
if (iterationsPerTick > 0 && maxIterations > 0) {
iterations += iterationsPerTick;
if (iterations > maxIterations) {
return CancelReason.STUCK;
}
}
} else {
this.plan = plan;
if (params.debug()) {
plan.debug();
}
}
return null;
}
}
private static final AStarMachine<VectorNode, Path> ASTAR = AStarMachine.createWithDefaultStorage(); private static final AStarMachine<VectorNode, Path> ASTAR = AStarMachine.createWithDefaultStorage();
private static final Location NPC_LOCATION = new Location(null, 0, 0, 0); private static final Location NPC_LOCATION = new Location(null, 0, 0, 0);
} }

View File

@ -36,6 +36,8 @@ import net.citizensnpcs.api.astar.pathfinder.MinecraftBlockExaminer;
import net.citizensnpcs.api.astar.pathfinder.SwimmingExaminer; import net.citizensnpcs.api.astar.pathfinder.SwimmingExaminer;
import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.DataKey; import net.citizensnpcs.api.util.DataKey;
import net.citizensnpcs.npc.ai.AStarNavigationStrategy.AStarPlanner;
import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
import net.citizensnpcs.trait.RotationTrait; import net.citizensnpcs.trait.RotationTrait;
import net.citizensnpcs.trait.RotationTrait.PacketRotationSession; import net.citizensnpcs.trait.RotationTrait.PacketRotationSession;
import net.citizensnpcs.trait.RotationTrait.RotationParams; import net.citizensnpcs.trait.RotationTrait.RotationParams;
@ -65,7 +67,7 @@ public class CitizensNavigator implements Navigator, Runnable {
public CitizensNavigator(NPC npc) { public CitizensNavigator(NPC npc) {
this.npc = npc; this.npc = npc;
if (npc.data().get(NPC.DISABLE_DEFAULT_STUCK_ACTION_METADATA, false)) { if (npc.data().get(NPC.Metadata.DISABLE_DEFAULT_STUCK_ACTION, false)) {
defaultParams.stuckAction(null); defaultParams.stuckAction(null);
} }
defaultParams.examiner(new SwimmingExaminer(npc)); defaultParams.examiner(new SwimmingExaminer(npc));
@ -81,6 +83,23 @@ public class CitizensNavigator implements Navigator, Runnable {
stopNavigating(reason); stopNavigating(reason);
} }
@Override
public boolean canNavigateTo(Location dest) {
return canNavigateTo(dest, defaultParams.clone());
}
@Override
public boolean canNavigateTo(Location dest, NavigatorParameters params) {
if (defaultParams.useNewPathfinder()) {
AStarPlanner planner = new AStarPlanner(params, npc.getStoredLocation(), dest);
planner.tick(Setting.MAXIMUM_ASTAR_ITERATIONS.asInt(), Setting.MAXIMUM_ASTAR_ITERATIONS.asInt());
return planner.plan != null;
} else {
MCNavigator nav = NMS.getTargetNavigator(npc.getEntity(), dest, params);
return nav.getCancelReason() == null;
}
}
@Override @Override
public NavigatorParameters getDefaultParameters() { public NavigatorParameters getDefaultParameters() {
return defaultParams; return defaultParams;
@ -419,8 +438,7 @@ public class CitizensNavigator implements Navigator, Runnable {
private void switchParams() { private void switchParams() {
localParams = defaultParams.clone(); localParams = defaultParams.clone();
if (!npc.data().has(NPC.PATHFINDER_OPEN_DOORS_METADATA) ? Setting.NEW_PATHFINDER_OPENS_DOORS.asBoolean() if (npc.data().get(NPC.Metadata.PATHFINDER_OPEN_DOORS, Setting.NEW_PATHFINDER_OPENS_DOORS.asBoolean())) {
: npc.data().<Boolean> get(NPC.PATHFINDER_OPEN_DOORS_METADATA)) {
localParams.examiner(new DoorExaminer()); localParams.examiner(new DoorExaminer());
} }
if (Setting.NEW_PATHFINDER_CHECK_BOUNDING_BOXES.asBoolean()) { if (Setting.NEW_PATHFINDER_CHECK_BOUNDING_BOXES.asBoolean()) {

View File

@ -142,12 +142,12 @@ public class ArmorStandTrait extends Trait {
setMarker(true); setMarker(true);
setVisible(false); setVisible(false);
npc.setProtected(true); npc.setProtected(true);
npc.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false); npc.data().set(NPC.Metadata.NAMEPLATE_VISIBLE, false);
} }
public void setAsPointEntityWithName() { public void setAsPointEntityWithName() {
setAsPointEntity(); setAsPointEntity();
npc.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, true); npc.data().set(NPC.Metadata.NAMEPLATE_VISIBLE, true);
} }
/** /**

View File

@ -54,7 +54,7 @@ public class ScoreboardTrait extends Trait {
public void createTeam(String entityName) { public void createTeam(String entityName) {
String teamName = Util.getTeamName(npc.getUniqueId()); String teamName = Util.getTeamName(npc.getUniqueId());
npc.data().set(NPC.SCOREBOARD_FAKE_TEAM_NAME_METADATA, teamName); npc.data().set(NPC.Metadata.SCOREBOARD_FAKE_TEAM_NAME, teamName);
Scoreboard scoreboard = Util.getDummyScoreboard(); Scoreboard scoreboard = Util.getDummyScoreboard();
Team team = scoreboard.getTeam(teamName); Team team = scoreboard.getTeam(teamName);
if (team == null) { if (team == null) {
@ -84,11 +84,11 @@ public class ScoreboardTrait extends Trait {
if (npc.getEntity() == null) if (npc.getEntity() == null)
return; return;
String name = npc.getEntity() instanceof Player ? npc.getEntity().getName() : npc.getUniqueId().toString(); String name = npc.getEntity() instanceof Player ? npc.getEntity().getName() : npc.getUniqueId().toString();
String teamName = npc.data().get(NPC.SCOREBOARD_FAKE_TEAM_NAME_METADATA, ""); String teamName = npc.data().get(NPC.Metadata.SCOREBOARD_FAKE_TEAM_NAME, "");
if (teamName.isEmpty()) if (teamName.isEmpty())
return; return;
Team team = Util.getDummyScoreboard().getTeam(teamName); Team team = Util.getDummyScoreboard().getTeam(teamName);
npc.data().remove(NPC.SCOREBOARD_FAKE_TEAM_NAME_METADATA); npc.data().remove(NPC.Metadata.SCOREBOARD_FAKE_TEAM_NAME);
if (team == null) if (team == null)
return; return;
if (team.hasEntry(name)) { if (team.hasEntry(name)) {
@ -132,7 +132,7 @@ public class ScoreboardTrait extends Trait {
if (!Setting.USE_SCOREBOARD_TEAMS.asBoolean()) { if (!Setting.USE_SCOREBOARD_TEAMS.asBoolean()) {
team.unregister(); team.unregister();
npc.data().remove(NPC.SCOREBOARD_FAKE_TEAM_NAME_METADATA); npc.data().remove(NPC.Metadata.SCOREBOARD_FAKE_TEAM_NAME);
return; return;
} }
@ -173,7 +173,7 @@ public class ScoreboardTrait extends Trait {
if (SUPPORT_COLLIDABLE_SETOPTION) { if (SUPPORT_COLLIDABLE_SETOPTION) {
try { try {
OptionStatus collide = npc.data().<Boolean> get(NPC.COLLIDABLE_METADATA, !npc.isProtected()) OptionStatus collide = npc.data().<Boolean> get(NPC.Metadata.COLLIDABLE, !npc.isProtected())
? OptionStatus.ALWAYS ? OptionStatus.ALWAYS
: OptionStatus.NEVER; : OptionStatus.NEVER;
if (collide != team.getOption(Option.COLLISION_RULE)) { if (collide != team.getOption(Option.COLLISION_RULE)) {

View File

@ -34,9 +34,11 @@ import net.citizensnpcs.api.gui.Menu;
import net.citizensnpcs.api.gui.MenuContext; import net.citizensnpcs.api.gui.MenuContext;
import net.citizensnpcs.api.gui.MenuPattern; import net.citizensnpcs.api.gui.MenuPattern;
import net.citizensnpcs.api.gui.MenuSlot; import net.citizensnpcs.api.gui.MenuSlot;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.persistence.Persist; import net.citizensnpcs.api.persistence.Persist;
import net.citizensnpcs.api.trait.Trait; import net.citizensnpcs.api.trait.Trait;
import net.citizensnpcs.api.trait.TraitName; import net.citizensnpcs.api.trait.TraitName;
import net.citizensnpcs.api.trait.trait.Owner;
import net.citizensnpcs.api.util.Messaging; import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.api.util.Placeholders; import net.citizensnpcs.api.util.Placeholders;
import net.citizensnpcs.trait.shop.CommandAction; import net.citizensnpcs.trait.shop.CommandAction;
@ -109,11 +111,17 @@ public class ShopTrait extends Trait {
this.name = name; this.name = name;
} }
public boolean canEdit(NPC npc, Player sender) {
return sender.hasPermission("citizens.admin") || sender.hasPermission("citizens.npc.shop.edit")
|| sender.hasPermission("citizens.npc.shop.edit." + getName())
|| npc.getOrAddTrait(Owner.class).isOwnedBy(sender);
}
public void display(Player sender) { public void display(Player sender) {
if (viewPermission != null && !sender.hasPermission(viewPermission)) if (viewPermission != null && !sender.hasPermission(viewPermission))
return; return;
if (pages.size() == 0) { if (pages.size() == 0) {
Messaging.send(sender, "<red>Empty shop"); Messaging.sendError(sender, "Empty shop");
return; return;
} }
InventoryMenu.createSelfRegistered(new NPCShopViewer(this, sender)).present(sender); InventoryMenu.createSelfRegistered(new NPCShopViewer(this, sender)).present(sender);

View File

@ -28,9 +28,9 @@ public class SneakTrait extends Trait {
@Override @Override
public void run() { public void run() {
if (npc.data().has(NPC.SNEAKING_METADATA)) { if (npc.data().has(NPC.Metadata.SNEAKING)) {
setSneaking(npc.data().get(NPC.SNEAKING_METADATA)); setSneaking(npc.data().get(NPC.Metadata.SNEAKING));
npc.data().remove(NPC.SNEAKING_METADATA); npc.data().remove(NPC.Metadata.SNEAKING);
} }
} }

View File

@ -5,7 +5,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -152,12 +151,11 @@ public class Text extends Trait implements Runnable, Listener {
@EventHandler @EventHandler
private void onRightClick(NPCRightClickEvent event) { private void onRightClick(NPCRightClickEvent event) {
if (!event.getNPC().equals(npc)) if (!event.getNPC().equals(npc) || text.size() == 0)
return; return;
String localPattern = itemInHandPattern.equals("default") ? Setting.TALK_ITEM.asString() : itemInHandPattern; String localPattern = itemInHandPattern.equals("default") ? Setting.TALK_ITEM.asString() : itemInHandPattern;
if (Util.matchesItemInHand(event.getClicker(), localPattern) && !shouldTalkClose()) { if (Util.matchesItemInHand(event.getClicker(), localPattern) && !shouldTalkClose()) {
sendCooldownMessage(event.getClicker()); talk(event.getClicker());
event.setCancelled(true);
} }
} }
@ -174,16 +172,13 @@ public class Text extends Trait implements Runnable, Listener {
@Override @Override
public void run() { public void run() {
if (!npc.isSpawned()) if (!npc.isSpawned() || !talkClose || text.size() == 0)
return;
if (!talkClose)
return; return;
for (Player player : CitizensAPI.getLocationLookup().getNearbyPlayers(npc.getEntity().getLocation(), range)) { for (Player player : CitizensAPI.getLocationLookup().getNearbyPlayers(npc.getEntity().getLocation(), range)) {
if (player.getGameMode() == GameMode.SPECTATOR) if (player.getGameMode() == GameMode.SPECTATOR)
continue; continue;
sendCooldownMessage(player); talk(player);
} }
} }
@ -202,26 +197,6 @@ public class Text extends Trait implements Runnable, Listener {
} }
} }
private void sendCooldownMessage(Player player) {
Long cooldown = cooldowns.get(player.getUniqueId());
if (cooldown != null) {
if (System.currentTimeMillis() < cooldown)
return;
cooldowns.remove(player.getUniqueId());
}
sendText(player);
int secondsDelta = delay != -1 ? delay
: RANDOM.nextInt(Setting.TALK_CLOSE_MAXIMUM_COOLDOWN.asInt())
+ Setting.TALK_CLOSE_MINIMUM_COOLDOWN.asInt();
if (secondsDelta <= 0)
return;
long millisecondsDelta = TimeUnit.MILLISECONDS.convert(secondsDelta, TimeUnit.SECONDS);
cooldowns.put(player.getUniqueId(), System.currentTimeMillis() + millisecondsDelta);
}
boolean sendPage(CommandSender player, int page) { boolean sendPage(CommandSender player, int page) {
Paginator paginator = new Paginator().header("Current Texts").enablePageSwitcher("/npc text page $page"); Paginator paginator = new Paginator().header("Current Texts").enablePageSwitcher("/npc text page $page");
for (int i = 0; i < text.size(); i++) { for (int i = 0; i < text.size(); i++) {
@ -292,9 +267,20 @@ public class Text extends Trait implements Runnable, Listener {
return talkClose; return talkClose;
} }
@Deprecated private void talk(Player player) {
public boolean toggle() { Long cooldown = cooldowns.get(player.getUniqueId());
return toggleTalkClose(); if (cooldown != null) {
if (System.currentTimeMillis() < cooldown)
return;
cooldowns.remove(player.getUniqueId());
}
sendText(player);
if (delay <= 0)
return;
cooldowns.put(player.getUniqueId(), System.currentTimeMillis() + (delay * 50));
} }
/** /**

View File

@ -486,8 +486,8 @@ public class NMS {
BRIDGE.playAnimation(animation, player, radius); BRIDGE.playAnimation(animation, player, radius);
} }
public static void playerTick(Player entity) { public static Runnable playerTicker(Player entity) {
BRIDGE.playerTick(entity); return BRIDGE.playerTicker(entity);
} }
public static void registerEntityClass(Class<?> clazz) { public static void registerEntityClass(Class<?> clazz) {
@ -689,6 +689,7 @@ public class NMS {
private static Object UNSAFE; private static Object UNSAFE;
private static MethodHandle UNSAFE_FIELD_OFFSET; private static MethodHandle UNSAFE_FIELD_OFFSET;
private static MethodHandle UNSAFE_PUT_OBJECT; private static MethodHandle UNSAFE_PUT_OBJECT;
private static MethodHandle UNSAFE_STATIC_FIELD_OFFSET; private static MethodHandle UNSAFE_STATIC_FIELD_OFFSET;
static { static {

View File

@ -130,7 +130,7 @@ public interface NMSBridge {
public void playAnimation(PlayerAnimation animation, Player player, int radius); public void playAnimation(PlayerAnimation animation, Player player, int radius);
public void playerTick(Player entity); public Runnable playerTicker(Player entity);
public void registerEntityClass(Class<?> clazz); public void registerEntityClass(Class<?> clazz);
@ -146,9 +146,9 @@ public interface NMSBridge {
public void sendPositionUpdate(Player excluding, Entity from, Location location); public void sendPositionUpdate(Player excluding, Entity from, Location location);
public void sendRotationNearby(Entity from, float bodyYaw, float headYaw, float pitch); public void sendRotationNearby(Entity from, float bodyYaw, float headYaw, float pitch);;
public boolean sendTabListAdd(Player recipient, Player listPlayer);; public boolean sendTabListAdd(Player recipient, Player listPlayer);
public void sendTabListRemove(Player recipient, Collection<? extends SkinnableEntity> skinnableNPCs); public void sendTabListRemove(Player recipient, Collection<? extends SkinnableEntity> skinnableNPCs);
@ -166,13 +166,13 @@ public interface NMSBridge {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public void setCustomName(Entity entity, Object component, String string); public void setCustomName(Entity entity, Object component, String string);;
public void setDestination(Entity entity, double x, double y, double z, float speed);; public void setDestination(Entity entity, double x, double y, double z, float speed);
public void setEndermanAngry(Enderman enderman, boolean angry); public void setEndermanAngry(Enderman enderman, boolean angry);
public void setHeadYaw(Entity entity, float yaw); public void setHeadYaw(Entity entity, float yaw);;
public void setKnockbackResistance(LivingEntity entity, double d);; public void setKnockbackResistance(LivingEntity entity, double d);;
@ -180,13 +180,13 @@ public interface NMSBridge {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
}; };
public void setNavigationTarget(Entity handle, Entity target, float speed);; public void setNavigationTarget(Entity handle, Entity target, float speed);
public void setNoGravity(Entity entity, boolean nogravity); public void setNoGravity(Entity entity, boolean nogravity);;
public default void setPandaSitting(Entity entity, boolean sitting) { public default void setPandaSitting(Entity entity, boolean sitting) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
}; }
public default void setPeekShulker(Entity entity, int peek) { public default void setPeekShulker(Entity entity, int peek) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();

View File

@ -11,6 +11,10 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.npc.ai.NPCHolder;
public class PlayerUpdateTask extends BukkitRunnable { public class PlayerUpdateTask extends BukkitRunnable {
@Override @Override
public void cancel() { public void cancel() {
@ -43,14 +47,35 @@ public class PlayerUpdateTask extends BukkitRunnable {
PLAYERS.remove(entity.getUniqueId()); PLAYERS.remove(entity.getUniqueId());
} }
for (Entity entity : PLAYERS_PENDING_ADD) { for (Entity entity : PLAYERS_PENDING_ADD) {
PLAYERS.put(entity.getUniqueId(), (Player) entity); PlayerTick rm = PLAYERS.remove(entity.getUniqueId());
if (rm != null) {
NPC old = ((NPCHolder) rm).getNPC();
NPC next = ((NPCHolder) entity).getNPC();
Messaging.severe(old == next ? "Player registered twice"
: "Player registered twice with different NPC instances", rm.entity.getUniqueId());
rm.entity.remove();
}
PLAYERS.put(entity.getUniqueId(), new PlayerTick((Player) entity));
} }
PLAYERS_PENDING_ADD.clear(); PLAYERS_PENDING_ADD.clear();
PLAYERS_PENDING_REMOVE.clear(); PLAYERS_PENDING_REMOVE.clear();
for (Player entity : PLAYERS.values()) { PLAYERS.values().forEach(Runnable::run);
}
private static class PlayerTick implements Runnable {
Player entity;
Runnable tick;
public PlayerTick(Player player) {
entity = player;
tick = NMS.playerTicker(player);
}
@Override
public void run() {
if (entity.isValid()) { if (entity.isValid()) {
NMS.playerTick(entity); tick.run();
} }
} }
} }
@ -76,10 +101,10 @@ public class PlayerUpdateTask extends BukkitRunnable {
PLAYERS_PENDING_ADD.add(entity); PLAYERS_PENDING_ADD.add(entity);
} }
private static Map<UUID, org.bukkit.entity.Player> PLAYERS = new HashMap<UUID, org.bukkit.entity.Player>(); private static Map<UUID, PlayerTick> PLAYERS = new HashMap<>();
private static List<org.bukkit.entity.Entity> PLAYERS_PENDING_ADD = new ArrayList<org.bukkit.entity.Entity>(); private static List<Entity> PLAYERS_PENDING_ADD = new ArrayList<>();
private static List<org.bukkit.entity.Entity> PLAYERS_PENDING_REMOVE = new ArrayList<org.bukkit.entity.Entity>(); private static List<Entity> PLAYERS_PENDING_REMOVE = new ArrayList<>();
private static Map<UUID, org.bukkit.entity.Entity> TICKERS = new HashMap<UUID, org.bukkit.entity.Entity>(); private static Map<UUID, Entity> TICKERS = new HashMap<>();
private static List<org.bukkit.entity.Entity> TICKERS_PENDING_ADD = new ArrayList<org.bukkit.entity.Entity>(); private static List<Entity> TICKERS_PENDING_ADD = new ArrayList<>();
private static List<org.bukkit.entity.Entity> TICKERS_PENDING_REMOVE = new ArrayList<org.bukkit.entity.Entity>(); private static List<Entity> TICKERS_PENDING_REMOVE = new ArrayList<>();
} }

View File

@ -56,7 +56,7 @@ public class Util {
return new Vector(x, y, z); return new Vector(x, y, z);
} }
boolean allowed = !npc.isProtected() boolean allowed = !npc.isProtected()
|| (npc.data().has(NPC.COLLIDABLE_METADATA) && npc.data().<Boolean> get(NPC.COLLIDABLE_METADATA)); || (npc.data().has(NPC.Metadata.COLLIDABLE) && npc.data().<Boolean> get(NPC.Metadata.COLLIDABLE));
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) {
return allowed ? new Vector(x, y, z) : null; return allowed ? new Vector(x, y, z) : null;
} }

View File

@ -350,7 +350,7 @@ citizens.editors.text.invalid-range=Invalid range.
citizens.editors.text.invalid-delay=Invalid delay. citizens.editors.text.invalid-delay=Invalid delay.
citizens.editors.text.random-talker-set=[[Random talking]] set to [[{0}]]. citizens.editors.text.random-talker-set=[[Random talking]] set to [[{0}]].
citizens.editors.text.range-set=[[Range]] set to [[{0}]]. citizens.editors.text.range-set=[[Range]] set to [[{0}]].
citizens.editors.text.delay-set=[[Delay]] set to [[{0}]] seconds. citizens.editors.text.delay-set=[[Delay]] set to [[{0}]] ticks.
citizens.editors.text.realistic-looking-set=[[Realistic looking]] set to [[{0}]]. citizens.editors.text.realistic-looking-set=[[Realistic looking]] set to [[{0}]].
citizens.editors.text.speech-bubbles-set=[[Speech bubbles]] set to [[{0}]]. citizens.editors.text.speech-bubbles-set=[[Speech bubbles]] set to [[{0}]].
citizens.editors.text.start-prompt=<click:suggest_command:add ><yellow>Add text</click> | <click:suggest_command:item ><hover:show_text:"Set the talk item in hand pattern (set to <yellow>default</yellow> to clear)"><yellow>item</hover></click> | <click:suggest_command:range ><hover:show_text:Set the talking range in blocks><yellow>range</hover></click> | <click:suggest_command:delay ><hover:show_text:Set the talking delay in seconds><yellow>delay</yellow></hover></click><br><click:run_command:/npc text close><hover:show_text:Toggle sending messages when players get close>{0}talk close</hover></click> | <click:run_command:/npc text random><hover:show_text:Toggle random talking>{1}random</hover></click> | <click:run_command:/npc text speech bubbles><hover:show_text:Toggle showing text as holograms instead of chat messages>{2}speech bubbles</hover></click> | <click:run_command:/npc text realistic looking><hover:show_text:Toggle requiring line of sight before speaking>{3}realistic</hover></click> citizens.editors.text.start-prompt=<click:suggest_command:add ><yellow>Add text</click> | <click:suggest_command:item ><hover:show_text:"Set the talk item in hand pattern (set to <yellow>default</yellow> to clear)"><yellow>item</hover></click> | <click:suggest_command:range ><hover:show_text:Set the talking range in blocks><yellow>range</hover></click> | <click:suggest_command:delay ><hover:show_text:Set the talking delay in seconds><yellow>delay</yellow></hover></click><br><click:run_command:/npc text close><hover:show_text:Toggle sending messages when players get close>{0}talk close</hover></click> | <click:run_command:/npc text random><hover:show_text:Toggle random talking>{1}random</hover></click> | <click:run_command:/npc text speech bubbles><hover:show_text:Toggle showing text as holograms instead of chat messages>{2}speech bubbles</hover></click> | <click:run_command:/npc text realistic looking><hover:show_text:Toggle requiring line of sight before speaking>{3}realistic</hover></click>

View File

@ -71,12 +71,12 @@ public class BatController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -115,7 +115,7 @@ public class BatController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -136,7 +136,7 @@ public class BatController extends MobEntityController {
return super.isLeashed(); return super.isLeashed();
} }
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -68,12 +68,12 @@ public class BlazeController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -112,7 +112,7 @@ public class BlazeController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -132,7 +132,7 @@ public class BlazeController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -77,12 +77,12 @@ public class CaveSpiderController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -137,7 +137,7 @@ public class CaveSpiderController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -158,7 +158,7 @@ public class CaveSpiderController extends MobEntityController {
return super.isLeashed(); return super.isLeashed();
} }
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) { if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault)) {
return super.isLeashed(); return super.isLeashed();
} }
if (super.isLeashed()) { if (super.isLeashed()) {

View File

@ -88,12 +88,12 @@ public class ChickenController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -148,7 +148,7 @@ public class ChickenController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -168,7 +168,7 @@ public class ChickenController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -103,12 +103,12 @@ public class CowController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -163,7 +163,7 @@ public class CowController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -183,7 +183,7 @@ public class CowController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -88,12 +88,12 @@ public class CreeperController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -147,7 +147,7 @@ public class CreeperController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -167,7 +167,7 @@ public class CreeperController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -68,12 +68,12 @@ public class EnderDragonController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -111,7 +111,7 @@ public class EnderDragonController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -131,7 +131,7 @@ public class EnderDragonController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -77,12 +77,12 @@ public class EndermanController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -136,7 +136,7 @@ public class EndermanController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -156,7 +156,7 @@ public class EndermanController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -77,12 +77,12 @@ public class EndermiteController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -136,7 +136,7 @@ public class EndermiteController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -156,7 +156,7 @@ public class EndermiteController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -22,6 +22,7 @@ import net.citizensnpcs.Settings.Setting;
import net.citizensnpcs.api.CitizensAPI; import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.event.NPCEnderTeleportEvent; import net.citizensnpcs.api.event.NPCEnderTeleportEvent;
import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.npc.NPC.NPCUpdate;
import net.citizensnpcs.api.trait.trait.Inventory; import net.citizensnpcs.api.trait.trait.Inventory;
import net.citizensnpcs.api.util.SpigotUtil; import net.citizensnpcs.api.util.SpigotUtil;
import net.citizensnpcs.nms.v1_10_R1.network.EmptyNetHandler; import net.citizensnpcs.nms.v1_10_R1.network.EmptyNetHandler;
@ -73,7 +74,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
private final CitizensNPC npc; private final CitizensNPC npc;
private final Location packetLocationCache = new Location(null, 0, 0, 0); private final Location packetLocationCache = new Location(null, 0, 0, 0);
private final SkinPacketTracker skinTracker; private final SkinPacketTracker skinTracker;
private int updateCounter = 0;
public EntityHumanNPC(MinecraftServer minecraftServer, WorldServer world, GameProfile gameProfile, public EntityHumanNPC(MinecraftServer minecraftServer, WorldServer world, GameProfile gameProfile,
PlayerInteractManager playerInteractManager, NPC npc) { PlayerInteractManager playerInteractManager, NPC npc) {
@ -114,12 +114,12 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -278,7 +278,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
@Override @Override
public boolean isCollidable() { public boolean isCollidable() {
return npc == null ? super.isCollidable() return npc == null ? super.isCollidable()
: npc.data().has(NPC.COLLIDABLE_METADATA) ? npc.data().<Boolean> get(NPC.COLLIDABLE_METADATA) : npc.data().has(NPC.Metadata.COLLIDABLE) ? npc.data().<Boolean> get(NPC.Metadata.COLLIDABLE)
: !npc.isProtected(); : !npc.isProtected();
} }
@ -336,18 +336,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
super.m(); super.m();
if (npc == null) if (npc == null)
return; return;
if (updateCounter + 1 > Setting.PACKET_UPDATE_DELAY.asInt()) {
updateEffects = true;
}
this.noclip = isSpectator(); this.noclip = isSpectator();
Bukkit.getServer().getPluginManager().unsubscribeFromPermission("bukkit.broadcast.user", bukkitEntity); Bukkit.getServer().getPluginManager().unsubscribeFromPermission("bukkit.broadcast.user", bukkitEntity);
boolean navigating = npc.getNavigator().isNavigating(); updatePackets(npc.getNavigator().isNavigating());
updatePackets(navigating);
if (noDamageTicks > 0) {
--noDamageTicks;
}
npc.update(); npc.update();
} }
@ -428,10 +420,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
} }
private void updatePackets(boolean navigating) { private void updatePackets(boolean navigating) {
if (updateCounter++ <= npc.data().<Integer> get(NPC.Metadata.PACKET_UPDATE_DELAY, if (!npc.isUpdating(NPCUpdate.PACKET))
Setting.PACKET_UPDATE_DELAY.asInt()))
return; return;
updateCounter = 0; updateEffects = true;
boolean itemChanged = false; boolean itemChanged = false;
for (EnumItemSlot slot : EnumItemSlot.values()) { for (EnumItemSlot slot : EnumItemSlot.values()) {
ItemStack equipment = getEquipment(slot); ItemStack equipment = getEquipment(slot);

View File

@ -54,12 +54,12 @@ public class GhastController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -103,7 +103,7 @@ public class GhastController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -123,7 +123,7 @@ public class GhastController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class GiantController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class GiantController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class GiantController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class GuardianController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -123,7 +123,7 @@ public class GuardianController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -143,7 +143,7 @@ public class GuardianController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -86,12 +86,12 @@ public class HorseController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -154,7 +154,7 @@ public class HorseController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -174,7 +174,7 @@ public class HorseController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class IronGolemController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class IronGolemController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class IronGolemController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -69,12 +69,12 @@ public class MagmaCubeController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -135,7 +135,7 @@ public class MagmaCubeController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -155,7 +155,7 @@ public class MagmaCubeController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -85,12 +85,12 @@ public class MushroomCowController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -144,7 +144,7 @@ public class MushroomCowController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -164,7 +164,7 @@ public class MushroomCowController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -74,12 +74,12 @@ public class OcelotController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -140,7 +140,7 @@ public class OcelotController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -160,7 +160,7 @@ public class OcelotController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -75,12 +75,12 @@ public class PigController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -143,7 +143,7 @@ public class PigController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -163,7 +163,7 @@ public class PigController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -64,12 +64,12 @@ public class PigZombieController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -123,7 +123,7 @@ public class PigZombieController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -143,7 +143,7 @@ public class PigZombieController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -65,12 +65,12 @@ public class PolarBearController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -109,7 +109,7 @@ public class PolarBearController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -130,7 +130,7 @@ public class PolarBearController extends MobEntityController {
return super.isLeashed(); return super.isLeashed();
} }
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -75,12 +75,12 @@ public class RabbitController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -135,7 +135,7 @@ public class RabbitController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -160,7 +160,7 @@ public class RabbitController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -74,12 +74,12 @@ public class SheepController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -133,7 +133,7 @@ public class SheepController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -153,7 +153,7 @@ public class SheepController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -64,12 +64,12 @@ public class ShulkerController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -123,7 +123,7 @@ public class ShulkerController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -143,7 +143,7 @@ public class ShulkerController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class SilverfishController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class SilverfishController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class SilverfishController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class SkeletonController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class SkeletonController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class SkeletonController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -69,12 +69,12 @@ public class SlimeController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -136,7 +136,7 @@ public class SlimeController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -156,7 +156,7 @@ public class SlimeController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class SnowmanController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class SnowmanController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class SnowmanController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class SpiderController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class SpiderController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class SpiderController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class SquidController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class SquidController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class SquidController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -80,7 +80,7 @@ public class VillagerController extends MobEntityController {
@Override @Override
public boolean a(EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack) { public boolean a(EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack) {
if (npc != null && npc.data().get(NPC.VILLAGER_BLOCK_TRADES, true)) { if (npc != null && npc.data().get(NPC.Metadata.VILLAGER_BLOCK_TRADES, true)) {
blockingATrade = true; blockingATrade = true;
} }
return super.a(entityhuman, enumhand, itemstack); return super.a(entityhuman, enumhand, itemstack);
@ -88,12 +88,12 @@ public class VillagerController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -157,7 +157,7 @@ public class VillagerController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -177,7 +177,7 @@ public class VillagerController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class WitchController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class WitchController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class WitchController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -54,12 +54,12 @@ public class WitherController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -103,7 +103,7 @@ public class WitherController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -123,7 +123,7 @@ public class WitherController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -76,12 +76,12 @@ public class WolfController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -136,7 +136,7 @@ public class WolfController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -156,7 +156,7 @@ public class WolfController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class ZombieController extends MobEntityController {
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class ZombieController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class ZombieController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -891,8 +891,8 @@ public class NMSImpl implements NMSBridge {
} }
@Override @Override
public void playerTick(Player entity) { public Runnable playerTicker(Player entity) {
((EntityPlayer) getHandle(entity)).k_(); return ((EntityPlayer) getHandle(entity))::k_;
} }
@Override @Override
@ -1719,7 +1719,7 @@ public class NMSImpl implements NMSBridge {
return null; return null;
} }
public static SoundEffect getSoundEffect(NPC npc, SoundEffect snd, String meta) { public static SoundEffect getSoundEffect(NPC npc, SoundEffect snd, NPC.Metadata meta) {
return npc == null || !npc.data().has(meta) ? snd return npc == null || !npc.data().has(meta) ? snd
: SoundEffect.a.get(new MinecraftKey(npc.data().get(meta, snd == null ? "" : snd.toString()))); : SoundEffect.a.get(new MinecraftKey(npc.data().get(meta, snd == null ? "" : snd.toString())));
} }
@ -1748,9 +1748,9 @@ public class NMSImpl implements NMSBridge {
NPC npc = ((NPCHolder) minecart).getNPC(); NPC npc = ((NPCHolder) minecart).getNPC();
if (npc == null) if (npc == null)
return; return;
Material mat = Material.getMaterial(npc.data().get(NPC.MINECART_ITEM_METADATA, "")); Material mat = Material.getMaterial(npc.data().get(NPC.Metadata.MINECART_ITEM, ""));
int data = npc.data().get(NPC.MINECART_ITEM_DATA_METADATA, 0); int data = npc.data().get(NPC.Metadata.MINECART_ITEM_DATA, 0);
int offset = npc.data().get(NPC.MINECART_OFFSET_METADATA, 0); int offset = npc.data().get(NPC.Metadata.MINECART_OFFSET, 0);
minecart.a(mat != null); minecart.a(mat != null);
if (mat != null) { if (mat != null) {
minecart.setDisplayBlock(Block.getById(mat.getId()).fromLegacyData(data)); minecart.setDisplayBlock(Block.getById(mat.getId()).fromLegacyData(data));

View File

@ -71,12 +71,12 @@ public class BatController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -115,7 +115,7 @@ public class BatController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -137,7 +137,7 @@ public class BatController extends MobEntityController {
return super.isLeashed(); return super.isLeashed();
} }
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -68,12 +68,12 @@ public class BlazeController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -112,7 +112,7 @@ public class BlazeController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -133,7 +133,7 @@ public class BlazeController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -77,12 +77,12 @@ public class CaveSpiderController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -137,7 +137,7 @@ public class CaveSpiderController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -159,7 +159,7 @@ public class CaveSpiderController extends MobEntityController {
return super.isLeashed(); return super.isLeashed();
} }
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) { if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault)) {
return super.isLeashed(); return super.isLeashed();
} }
if (super.isLeashed()) { if (super.isLeashed()) {

View File

@ -88,12 +88,12 @@ public class ChickenController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -148,7 +148,7 @@ public class ChickenController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -169,7 +169,7 @@ public class ChickenController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -103,12 +103,12 @@ public class CowController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -163,7 +163,7 @@ public class CowController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -184,7 +184,7 @@ public class CowController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -80,12 +80,12 @@ public class CreeperController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -139,7 +139,7 @@ public class CreeperController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -160,7 +160,7 @@ public class CreeperController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -68,12 +68,12 @@ public class EnderDragonController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -111,7 +111,7 @@ public class EnderDragonController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -132,7 +132,7 @@ public class EnderDragonController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -77,12 +77,12 @@ public class EndermanController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -136,7 +136,7 @@ public class EndermanController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -157,7 +157,7 @@ public class EndermanController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -77,12 +77,12 @@ public class EndermiteController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -136,7 +136,7 @@ public class EndermiteController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -157,7 +157,7 @@ public class EndermiteController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -22,6 +22,7 @@ import net.citizensnpcs.Settings.Setting;
import net.citizensnpcs.api.CitizensAPI; import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.event.NPCEnderTeleportEvent; import net.citizensnpcs.api.event.NPCEnderTeleportEvent;
import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.npc.NPC.NPCUpdate;
import net.citizensnpcs.api.trait.trait.Inventory; import net.citizensnpcs.api.trait.trait.Inventory;
import net.citizensnpcs.api.util.SpigotUtil; import net.citizensnpcs.api.util.SpigotUtil;
import net.citizensnpcs.nms.v1_11_R1.network.EmptyNetHandler; import net.citizensnpcs.nms.v1_11_R1.network.EmptyNetHandler;
@ -75,7 +76,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
private final CitizensNPC npc; private final CitizensNPC npc;
private final Location packetLocationCache = new Location(null, 0, 0, 0); private final Location packetLocationCache = new Location(null, 0, 0, 0);
private final SkinPacketTracker skinTracker; private final SkinPacketTracker skinTracker;
private int updateCounter = 0;
public EntityHumanNPC(MinecraftServer minecraftServer, WorldServer world, GameProfile gameProfile, public EntityHumanNPC(MinecraftServer minecraftServer, WorldServer world, GameProfile gameProfile,
PlayerInteractManager playerInteractManager, NPC npc) { PlayerInteractManager playerInteractManager, NPC npc) {
@ -120,9 +120,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
if (npc == null) if (npc == null)
return; return;
this.noclip = isSpectator(); this.noclip = isSpectator();
if (updateCounter + 1 > Setting.PACKET_UPDATE_DELAY.asInt()) {
updateEffects = true;
}
Bukkit.getServer().getPluginManager().unsubscribeFromPermission("bukkit.broadcast.user", bukkitEntity); Bukkit.getServer().getPluginManager().unsubscribeFromPermission("bukkit.broadcast.user", bukkitEntity);
boolean navigating = npc.getNavigator().isNavigating() || controllerMove.a(); boolean navigating = npc.getNavigator().isNavigating() || controllerMove.a();
@ -133,12 +130,12 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -247,7 +244,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
@Override @Override
public IChatBaseComponent getPlayerListName() { public IChatBaseComponent getPlayerListName() {
if (npc.data().get(NPC.REMOVE_FROM_PLAYERLIST_METADATA, Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean())) { if (Setting.DISABLE_TABLIST.asBoolean()) {
return new ChatComponentText(""); return new ChatComponentText("");
} }
return super.getPlayerListName(); return super.getPlayerListName();
@ -305,7 +302,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
@Override @Override
public boolean isCollidable() { public boolean isCollidable() {
return npc == null ? super.isCollidable() return npc == null ? super.isCollidable()
: npc.data().has(NPC.COLLIDABLE_METADATA) ? npc.data().<Boolean> get(NPC.COLLIDABLE_METADATA) : npc.data().has(NPC.Metadata.COLLIDABLE) ? npc.data().<Boolean> get(NPC.Metadata.COLLIDABLE)
: !npc.isProtected(); : !npc.isProtected();
} }
@ -434,10 +431,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
} }
private void updatePackets(boolean navigating) { private void updatePackets(boolean navigating) {
if (updateCounter++ <= npc.data().<Integer> get(NPC.Metadata.PACKET_UPDATE_DELAY, if (!npc.isUpdating(NPCUpdate.PACKET))
Setting.PACKET_UPDATE_DELAY.asInt()))
return; return;
updateCounter = 0; updateEffects = true;
boolean itemChanged = false; boolean itemChanged = false;
for (EnumItemSlot slot : EnumItemSlot.values()) { for (EnumItemSlot slot : EnumItemSlot.values()) {
ItemStack equipment = getEquipment(slot); ItemStack equipment = getEquipment(slot);

View File

@ -63,12 +63,12 @@ public class EvokerController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -123,7 +123,7 @@ public class EvokerController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -144,7 +144,7 @@ public class EvokerController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -54,12 +54,12 @@ public class GhastController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -103,7 +103,7 @@ public class GhastController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -124,7 +124,7 @@ public class GhastController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class GiantController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class GiantController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -143,7 +143,7 @@ public class GiantController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class GuardianController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -123,7 +123,7 @@ public class GuardianController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -144,7 +144,7 @@ public class GuardianController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class GuardianElderController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -123,7 +123,7 @@ public class GuardianElderController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -144,7 +144,7 @@ public class GuardianElderController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -86,12 +86,12 @@ public class HorseController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -146,7 +146,7 @@ public class HorseController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -167,7 +167,7 @@ public class HorseController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -86,12 +86,12 @@ public class HorseDonkeyController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -146,7 +146,7 @@ public class HorseDonkeyController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -167,7 +167,7 @@ public class HorseDonkeyController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -86,12 +86,12 @@ public class HorseMuleController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -146,7 +146,7 @@ public class HorseMuleController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -167,7 +167,7 @@ public class HorseMuleController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -87,12 +87,12 @@ public class HorseSkeletonController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -147,7 +147,7 @@ public class HorseSkeletonController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -168,7 +168,7 @@ public class HorseSkeletonController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -87,12 +87,12 @@ public class HorseZombieController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -147,7 +147,7 @@ public class HorseZombieController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -168,7 +168,7 @@ public class HorseZombieController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class IronGolemController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class IronGolemController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -143,7 +143,7 @@ public class IronGolemController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -86,12 +86,12 @@ public class LlamaController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -146,7 +146,7 @@ public class LlamaController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -167,7 +167,7 @@ public class LlamaController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -77,12 +77,12 @@ public class MagmaCubeController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -143,7 +143,7 @@ public class MagmaCubeController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -164,7 +164,7 @@ public class MagmaCubeController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -84,12 +84,12 @@ public class MushroomCowController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -143,7 +143,7 @@ public class MushroomCowController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -164,7 +164,7 @@ public class MushroomCowController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -74,12 +74,12 @@ public class OcelotController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -140,7 +140,7 @@ public class OcelotController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -161,7 +161,7 @@ public class OcelotController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -75,12 +75,12 @@ public class PigController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -141,7 +141,7 @@ public class PigController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -162,7 +162,7 @@ public class PigController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -64,12 +64,12 @@ public class PigZombieController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -123,7 +123,7 @@ public class PigZombieController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -144,7 +144,7 @@ public class PigZombieController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -65,12 +65,12 @@ public class PolarBearController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -109,7 +109,7 @@ public class PolarBearController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -131,7 +131,7 @@ public class PolarBearController extends MobEntityController {
return super.isLeashed(); return super.isLeashed();
} }
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -75,12 +75,12 @@ public class RabbitController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -135,7 +135,7 @@ public class RabbitController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -161,7 +161,7 @@ public class RabbitController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -74,12 +74,12 @@ public class SheepController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -133,7 +133,7 @@ public class SheepController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -154,7 +154,7 @@ public class SheepController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -74,12 +74,12 @@ public class ShulkerController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -133,7 +133,7 @@ public class ShulkerController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -153,7 +153,7 @@ public class ShulkerController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class SilverfishController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class SilverfishController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class SilverfishController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class SkeletonController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class SkeletonController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class SkeletonController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class SkeletonStrayController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class SkeletonStrayController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class SkeletonStrayController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class SkeletonWitherController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class SkeletonWitherController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class SkeletonWitherController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -77,12 +77,12 @@ public class SlimeController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -144,7 +144,7 @@ public class SlimeController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -164,7 +164,7 @@ public class SlimeController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class SnowmanController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class SnowmanController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class SnowmanController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class SpiderController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class SpiderController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class SpiderController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class SquidController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class SquidController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class SquidController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -57,12 +57,12 @@ public class VexController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -101,7 +101,7 @@ public class VexController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class VexController extends MobEntityController {
return super.isLeashed(); return super.isLeashed();
} }
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -82,7 +82,7 @@ public class VillagerController extends MobEntityController {
@Override @Override
public boolean a(EntityHuman entityhuman, EnumHand enumhand) { public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
if (npc != null && npc.data().get(NPC.VILLAGER_BLOCK_TRADES, true)) { if (npc != null && npc.data().get(NPC.Metadata.VILLAGER_BLOCK_TRADES, true)) {
blockingATrade = true; blockingATrade = true;
List<MerchantRecipe> list = getOffers(entityhuman); List<MerchantRecipe> list = getOffers(entityhuman);
if (list != null) { if (list != null) {
@ -94,12 +94,12 @@ public class VillagerController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -163,7 +163,7 @@ public class VillagerController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -183,7 +183,7 @@ public class VillagerController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -74,12 +74,12 @@ public class VindicatorController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -134,7 +134,7 @@ public class VindicatorController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -154,7 +154,7 @@ public class VindicatorController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class WitchController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class WitchController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class WitchController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -54,12 +54,12 @@ public class WitherController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -103,7 +103,7 @@ public class WitherController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -123,7 +123,7 @@ public class WitherController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -76,12 +76,12 @@ public class WolfController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -136,7 +136,7 @@ public class WolfController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -156,7 +156,7 @@ public class WolfController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

View File

@ -63,12 +63,12 @@ public class ZombieController extends MobEntityController {
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);
} }
@Override @Override
protected SoundEffect bX() { protected SoundEffect bX() {
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.bX(), NPC.Metadata.HURT_SOUND);
} }
@Override @Override
@ -122,7 +122,7 @@ public class ZombieController extends MobEntityController {
@Override @Override
protected SoundEffect G() { protected SoundEffect G() {
return NMSImpl.getSoundEffect(npc, super.G(), NPC.AMBIENT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.G(), NPC.Metadata.AMBIENT_SOUND);
} }
@Override @Override
@ -142,7 +142,7 @@ public class ZombieController extends MobEntityController {
if (npc == null) if (npc == null)
return super.isLeashed(); return super.isLeashed();
boolean protectedDefault = npc.isProtected(); boolean protectedDefault = npc.isProtected();
if (!protectedDefault || !npc.data().get(NPC.LEASH_PROTECTED_METADATA, protectedDefault)) if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
return super.isLeashed(); return super.isLeashed();
if (super.isLeashed()) { if (super.isLeashed()) {
unleash(true, false); // clearLeash with client update unleash(true, false); // clearLeash with client update

Some files were not shown because too many files have changed in this diff Show More