Add durations to settings, allow falling distance to be set for all mobs

This commit is contained in:
fullwall 2023-03-12 22:29:41 +08:00
parent a29e7cb8e7
commit 74a861142b
735 changed files with 3839 additions and 366 deletions

View File

@ -622,7 +622,7 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
Messaging.logTr(Messages.NUM_LOADED_NOTIFICATION, Iterables.size(npcRegistry), "?"); Messaging.logTr(Messages.NUM_LOADED_NOTIFICATION, Iterables.size(npcRegistry), "?");
startMetrics(); startMetrics();
scheduleSaveTask(Setting.SAVE_TASK_DELAY.asInt()); scheduleSaveTask(Setting.SAVE_TASK_DELAY.asTicks());
Bukkit.getPluginManager().callEvent(new CitizensEnableEvent()); Bukkit.getPluginManager().callEvent(new CitizensEnableEvent());
new PlayerUpdateTask().runTaskTimer(Citizens.this, 0, 1); new PlayerUpdateTask().runTaskTimer(Citizens.this, 0, 1);
enabled = true; enabled = true;

View File

@ -462,7 +462,7 @@ public class EventListen implements Listener {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
skinUpdateTracker.updatePlayer(event.getPlayer(), Setting.INITIAL_PLAYER_JOIN_SKIN_PACKET_DELAY_TICKS.asInt(), skinUpdateTracker.updatePlayer(event.getPlayer(), Setting.INITIAL_PLAYER_JOIN_SKIN_PACKET_DELAY.asTicks(),
true); true);
CitizensAPI.getLocationLookup().onJoin(event); CitizensAPI.getLocationLookup().onJoin(event);
} }
@ -508,7 +508,7 @@ public class EventListen implements Listener {
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 && !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.asTicks() > 0) {
event.setCancelled(true); event.setCancelled(true);
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
@Override @Override
@ -518,7 +518,7 @@ public class EventListen implements Listener {
event.getPlayer().teleport(event.getTo()); event.getPlayer().teleport(event.getTo());
event.getPlayer().removeMetadata("citizens-force-teleporting", CitizensAPI.getPlugin()); event.getPlayer().removeMetadata("citizens-force-teleporting", CitizensAPI.getPlugin());
} }
}, Setting.PLAYER_TELEPORT_DELAY.asInt()); }, Setting.PLAYER_TELEPORT_DELAY.asTicks());
} }
skinUpdateTracker.updatePlayer(event.getPlayer(), 15, true); skinUpdateTracker.updatePlayer(event.getPlayer(), 15, true);
} }

View File

@ -1,16 +1,20 @@
package net.citizensnpcs; package net.citizensnpcs;
import java.io.File; import java.io.File;
import java.time.Duration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.citizensnpcs.api.CitizensAPI; import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.util.DataKey; import net.citizensnpcs.api.util.DataKey;
import net.citizensnpcs.api.util.Messaging; import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.api.util.SpigotUtil;
import net.citizensnpcs.api.util.Storage; import net.citizensnpcs.api.util.Storage;
import net.citizensnpcs.api.util.YamlStorage; import net.citizensnpcs.api.util.YamlStorage;
import net.citizensnpcs.util.Util;
public class Settings { public class Settings {
private final Storage config; private final Storage config;
@ -88,13 +92,14 @@ public class Settings {
DEFAULT_NPC_HOLOGRAM_LINE_HEIGHT("npc.hologram.default-line-height", 0.4D), DEFAULT_NPC_HOLOGRAM_LINE_HEIGHT("npc.hologram.default-line-height", 0.4D),
DEFAULT_NPC_LIMIT("npc.limits.default-limit", 10), DEFAULT_NPC_LIMIT("npc.limits.default-limit", 10),
DEFAULT_PATH_DISTANCE_MARGIN("npc.pathfinding.default-path-distance-margin", 1), DEFAULT_PATH_DISTANCE_MARGIN("npc.pathfinding.default-path-distance-margin", 1),
DEFAULT_PATHFINDER_UPDATE_PATH_RATE("npc.pathfinding.update-path-rate", 20), DEFAULT_PATHFINDER_UPDATE_PATH_RATE("npc.pathfinding.update-path-rate", "1s"),
DEFAULT_PATHFINDING_RANGE("npc.default.pathfinding.range", "npc.pathfinding.default-range-blocks", 75F), DEFAULT_PATHFINDING_RANGE("npc.default.pathfinding.range", "npc.pathfinding.default-range-blocks", 75F),
DEFAULT_RANDOM_LOOK_CLOSE("npc.default.look-close.random-look-enabled", false), DEFAULT_RANDOM_LOOK_CLOSE("npc.default.look-close.random-look-enabled", false),
DEFAULT_RANDOM_LOOK_DELAY("npc.default.look-close.random-look-delay", 60), DEFAULT_RANDOM_LOOK_DELAY("npc.default.look-close.random-look-delay", "3s"),
DEFAULT_RANDOM_TALKER("npc.default.random-talker", "npc.default.talk-close.random-talker", false), DEFAULT_RANDOM_TALKER("npc.default.random-talker", "npc.default.talk-close.random-talker", false),
DEFAULT_REALISTIC_LOOKING("npc.default.realistic-looking", "npc.default.look-close.realistic-looking", false), DEFAULT_REALISTIC_LOOKING("npc.default.realistic-looking", "npc.default.look-close.realistic-looking", false),
DEFAULT_SPAWN_NODAMAGE_TICKS("npc.default.spawn-nodamage-ticks", 20), DEFAULT_SPAWN_NODAMAGE_DURATION("npc.default.spawn-nodamage-ticks", "npc.default.spawn-nodamage-duration",
"1s"),
DEFAULT_STATIONARY_TICKS("npc.default.stationary-ticks", -1), DEFAULT_STATIONARY_TICKS("npc.default.stationary-ticks", -1),
DEFAULT_STRAIGHT_LINE_TARGETING_DISTANCE("npc.pathfinding.straight-line-targeting-distance", 5), DEFAULT_STRAIGHT_LINE_TARGETING_DISTANCE("npc.pathfinding.straight-line-targeting-distance", 5),
DEFAULT_TALK_CLOSE("npc.default.talk-close.enabled", false), DEFAULT_TALK_CLOSE("npc.default.talk-close.enabled", false),
@ -109,18 +114,19 @@ public class Settings {
value = list; value = list;
} }
}, },
DEFAULT_TEXT_DELAY_MAX("npc.text.default-random-text-delay-max", 200), DEFAULT_TEXT_DELAY_MAX("npc.text.default-random-text-delay-max", "10s"),
DEFAULT_TEXT_DELAY_MIN("npc.text.default-random-text-delay-min", 100), DEFAULT_TEXT_DELAY_MIN("npc.text.default-random-text-delay-min", "5s"),
DEFAULT_TEXT_SPEECH_BUBBLE_TICKS("npc.text.speech-bubble-ticks", 50), DEFAULT_TEXT_SPEECH_BUBBLE_DURATION("npc.text.speech-bubble-ticks", "npc.text.speech-bubble-duration", "50t"),
DISABLE_LOOKCLOSE_WHILE_NAVIGATING("npc.default.look-close.disable-while-navigating", true), DISABLE_LOOKCLOSE_WHILE_NAVIGATING("npc.default.look-close.disable-while-navigating", true),
DISABLE_MC_NAVIGATION_FALLBACK("npc.pathfinding.disable-mc-fallback-navigation", true), DISABLE_MC_NAVIGATION_FALLBACK("npc.pathfinding.disable-mc-fallback-navigation", true),
DISABLE_TABLIST("npc.tablist.disable", true), DISABLE_TABLIST("npc.tablist.disable", true),
ENTITY_SPAWN_WAIT_TICKS("general.entity-spawn-wait-ticks", 20), ENTITY_SPAWN_WAIT_DURATION("general.entity-spawn-wait-ticks", "general.wait-for-entity-spawn", "1s"),
ERROR_COLOUR("general.color-scheme.message-error", "<red>"), ERROR_COLOUR("general.color-scheme.message-error", "<red>"),
FOLLOW_ACROSS_WORLDS("npc.follow.teleport-across-worlds", true), FOLLOW_ACROSS_WORLDS("npc.follow.teleport-across-worlds", true),
HIGHLIGHT_COLOUR("general.color-scheme.message-highlight", "yellow"), HIGHLIGHT_COLOUR("general.color-scheme.message-highlight", "yellow"),
HOLOGRAM_UPDATE_RATE_TICKS("npc.hologram.update-rate-ticks", 20), HOLOGRAM_UPDATE_RATE("npc.hologram.update-rate-ticks", "npc.hologram.update-rate", "1s"),
INITIAL_PLAYER_JOIN_SKIN_PACKET_DELAY_TICKS("npc.skins.player-join-update-delay-ticks", 3 * 20), INITIAL_PLAYER_JOIN_SKIN_PACKET_DELAY("npc.skins.player-join-update-delay-ticks",
"npc.skins.player-join-update-delay", "3s"),
KEEP_CHUNKS_LOADED("npc.chunks.always-keep-loaded", false), KEEP_CHUNKS_LOADED("npc.chunks.always-keep-loaded", false),
LOCALE("general.translation.locale", ""), LOCALE("general.translation.locale", ""),
MAX_CONTROLLABLE_GROUND_SPEED("npc.controllable.max-ground-speed", 0.5), MAX_CONTROLLABLE_GROUND_SPEED("npc.controllable.max-ground-speed", 0.5),
@ -132,12 +138,11 @@ public class Settings {
MAXIMUM_ASTAR_ITERATIONS("npc.pathfinding.maximum-new-pathfinder-iterations", MAXIMUM_ASTAR_ITERATIONS("npc.pathfinding.maximum-new-pathfinder-iterations",
"npc.pathfinding.new-finder.maximum-iterations", 5000), "npc.pathfinding.new-finder.maximum-iterations", 5000),
MAXIMUM_VISITED_NODES("npc.pathfinding.maximum-visited-nodes", "npc.pathfinding.maximum-visited-blocks", 768), MAXIMUM_VISITED_NODES("npc.pathfinding.maximum-visited-nodes", "npc.pathfinding.maximum-visited-blocks", 768),
MC_NAVIGATION_MAX_FALL_DISTANCE("npc.pathfinding.minecraft.max-fall-distance", 3),
MESSAGE_COLOUR("general.color-scheme.message", "<green>"), MESSAGE_COLOUR("general.color-scheme.message", "<green>"),
NEW_PATHFINDER_CHECK_BOUNDING_BOXES("npc.pathfinding.new-finder.check-bounding-boxes", false), NEW_PATHFINDER_CHECK_BOUNDING_BOXES("npc.pathfinding.new-finder.check-bounding-boxes", false),
NEW_PATHFINDER_OPENS_DOORS("npc.pathfinding.new-finder.open-doors", false), NEW_PATHFINDER_OPENS_DOORS("npc.pathfinding.new-finder.open-doors", false),
NPC_ATTACK_DISTANCE("npc.pathfinding.attack-range", 1.75 * 1.75), NPC_ATTACK_DISTANCE("npc.pathfinding.attack-range", 1.75),
NPC_COMMAND_GLOBAL_COMMAND_DELAY("npc.commands.global-delay-seconds", 1), NPC_COMMAND_GLOBAL_COMMAND_COOLDOWN("npc.commands.global-delay-seconds", "npc.commands.global-cooldown", "1s"),
NPC_COMMAND_MAXIMUM_TIMES_USED_MESSAGE("npc.commands.error-messages.maximum-times-used", NPC_COMMAND_MAXIMUM_TIMES_USED_MESSAGE("npc.commands.error-messages.maximum-times-used",
"You have reached the maximum number of uses ({0})."), "You have reached the maximum number of uses ({0})."),
NPC_COMMAND_MISSING_ITEM_MESSAGE("npc.commands.error-messages.missing-item", "Missing {1} {0}"), NPC_COMMAND_MISSING_ITEM_MESSAGE("npc.commands.error-messages.missing-item", "Missing {1} {0}"),
@ -151,25 +156,26 @@ public class Settings {
NPC_COMMAND_ON_GLOBAL_COOLDOWN_MESSAGE("npc.commands.error-messages.on-global-cooldown", NPC_COMMAND_ON_GLOBAL_COOLDOWN_MESSAGE("npc.commands.error-messages.on-global-cooldown",
"Please wait for {minutes} minutes and {seconds_over} seconds."), "Please wait for {minutes} minutes and {seconds_over} seconds."),
NPC_COST("economy.npc.cost", 100D), NPC_COST("economy.npc.cost", 100D),
NPC_SKIN_RETRY_DELAY("npc.skins.retry-delay", 120), NPC_SKIN_RETRY_DELAY("npc.skins.retry-delay", "5s"),
NPC_SKIN_ROTATION_UPDATE_DEGREES("npc.skins.rotation-update-degrees", 90f), NPC_SKIN_ROTATION_UPDATE_DEGREES("npc.skins.rotation-update-degrees", 90f),
NPC_SKIN_USE_LATEST("npc.skins.use-latest-by-default", false), NPC_SKIN_USE_LATEST("npc.skins.use-latest-by-default", false),
NPC_SKIN_VIEW_DISTANCE("npc.skins.view-distance", 100D), NPC_SKIN_VIEW_DISTANCE("npc.skins.view-distance", 100D),
NPC_WATER_SPEED_MODIFIER("npc.movement.water-speed-modifier", 1.15F), NPC_WATER_SPEED_MODIFIER("npc.movement.water-speed-modifier", 1.15F),
PACKET_UPDATE_DELAY("npc.packets.update-delay", 30), PACKET_UPDATE_DELAY("npc.packets.update-delay", 30),
PLACEHOLDER_SKIN_UPDATE_FREQUENCY("npc.skins.placeholder-update-frequency-ticks", 5 * 60 * 20), PATHFINDER_FALL_DISTANCE("npc.pathfinding.allowed-fall-distance", -1),
PLAYER_TELEPORT_DELAY("npc.teleport-delay", "npc.delay-player-teleport-ticks", -1), PLACEHOLDER_SKIN_UPDATE_FREQUENCY("npc.skins.placeholder-update-frequency-ticks",
"npc.skins.placeholder-update-frequency", "5m"),
PLAYER_TELEPORT_DELAY("npc.delay-player-teleport-ticks", "npc.delay-player-teleport", -1),
REMOVE_PLAYERS_FROM_PLAYER_LIST("npc.player.remove-from-list", true), REMOVE_PLAYERS_FROM_PLAYER_LIST("npc.player.remove-from-list", true),
RESOURCE_PACK_PATH("general.resource-pack-path", "plugins/Citizens/resourcepack"), RESOURCE_PACK_PATH("general.resource-pack-path", "plugins/Citizens/resourcepack"),
SAVE_TASK_DELAY("storage.save-task.delay", 20 * 60 * 60), SAVE_TASK_DELAY("storage.save-task.delay", "1hr"),
SCOREBOARD_SEND_TICKS("npc.scoreboard-teams.packet-send-ticks", 1),
SELECTION_ITEM("npc.selection.item", "stick"), SELECTION_ITEM("npc.selection.item", "stick"),
SELECTION_MESSAGE("npc.selection.message", "Selected [[<npc>]] (ID [[<id>]])."), SELECTION_MESSAGE("npc.selection.message", "Selected [[<npc>]] (ID [[<id>]])."),
SERVER_OWNS_NPCS("npc.server-ownership", false), SERVER_OWNS_NPCS("npc.server-ownership", false),
STORAGE_FILE("storage.file", "saves.yml"), STORAGE_FILE("storage.file", "saves.yml"),
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", "1t"),
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),
@ -177,6 +183,7 @@ public class Settings {
USE_SCOREBOARD_TEAMS("npc.scoreboard-teams.enable", true), USE_SCOREBOARD_TEAMS("npc.scoreboard-teams.enable", true),
WARN_ON_RELOAD("general.reload-warning-enabled", true); WARN_ON_RELOAD("general.reload-warning-enabled", true);
private Duration duration;
protected String migrate; protected String migrate;
protected String path; protected String path;
protected Object value; protected Object value;
@ -223,10 +230,24 @@ public class Settings {
return ((Number) value).longValue(); return ((Number) value).longValue();
} }
public int asSeconds() {
if (duration == null) {
duration = SpigotUtil.parseDuration(asString());
}
return (int) TimeUnit.SECONDS.convert(duration);
}
public String asString() { public String asString() {
return value.toString(); return value.toString();
} }
public int asTicks() {
if (duration == null) {
duration = SpigotUtil.parseDuration(asString());
}
return Util.toTicks(duration);
}
protected void loadFromKey(DataKey root) { protected void loadFromKey(DataKey root) {
if (migrate != null && root.keyExists(migrate) && !root.keyExists(path)) { if (migrate != null && root.keyExists(migrate) && !root.keyExists(path)) {
value = root.getRaw(migrate); value = root.getRaw(migrate);

View File

@ -7,6 +7,7 @@ import java.io.InputStreamReader;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.Duration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -99,7 +100,6 @@ import net.citizensnpcs.commands.history.RemoveNPCHistoryItem;
import net.citizensnpcs.npc.EntityControllers; import net.citizensnpcs.npc.EntityControllers;
import net.citizensnpcs.npc.NPCSelector; import net.citizensnpcs.npc.NPCSelector;
import net.citizensnpcs.npc.Template; import net.citizensnpcs.npc.Template;
import net.citizensnpcs.npc.ai.FallingExaminer;
import net.citizensnpcs.trait.Age; import net.citizensnpcs.trait.Age;
import net.citizensnpcs.trait.Anchors; import net.citizensnpcs.trait.Anchors;
import net.citizensnpcs.trait.ArmorStandTrait; import net.citizensnpcs.trait.ArmorStandTrait;
@ -452,9 +452,9 @@ public class NPCCommands {
permission = "citizens.npc.command") permission = "citizens.npc.command")
public void command(CommandContext args, CommandSender sender, NPC npc, public void command(CommandContext args, CommandSender sender, NPC npc,
@Flag(value = { "permissions", "permission" }) String permissions, @Flag(value = { "permissions", "permission" }) String permissions,
@Flag(value = "cooldown", defValue = "0") int cooldown, @Flag(value = "cooldown", defValue = "0") Duration cooldown,
@Flag(value = "gcooldown", defValue = "0") int gcooldown, @Flag(value = "n", defValue = "-1") int n, @Flag(value = "gcooldown", defValue = "0") Duration gcooldown, @Flag(value = "n", defValue = "-1") int n,
@Flag(value = "delay", defValue = "0") int delay, @Flag(value = "delay", defValue = "0") Duration delay,
@Arg( @Arg(
value = 1, value = 1,
completions = { "add", "remove", "permissions", "persistsequence", "sequential", "random", completions = { "add", "remove", "permissions", "persistsequence", "sequential", "random",
@ -484,7 +484,7 @@ public class NPCCommands {
try { try {
int id = commands.addCommand(new NPCCommandBuilder(command, hand).addPerms(perms) int id = commands.addCommand(new NPCCommandBuilder(command, hand).addPerms(perms)
.player(args.hasFlag('p') || args.hasFlag('o')).op(args.hasFlag('o')).cooldown(cooldown) .player(args.hasFlag('p') || args.hasFlag('o')).op(args.hasFlag('o')).cooldown(cooldown)
.globalCooldown(gcooldown).n(n).delay(delay)); .globalCooldown(gcooldown).n(n).delay(Util.toTicks(delay)));
Messaging.sendTr(sender, Messages.COMMAND_ADDED, command, id); Messaging.sendTr(sender, Messages.COMMAND_ADDED, command, id);
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
throw new CommandException(CommandMessages.INVALID_NUMBER); throw new CommandException(CommandMessages.INVALID_NUMBER);
@ -653,7 +653,7 @@ public class NPCCommands {
public void create(CommandContext args, CommandSender sender, NPC npc, @Flag("at") Location at, public void create(CommandContext args, CommandSender sender, NPC npc, @Flag("at") Location at,
@Flag(value = "type", defValue = "PLAYER") EntityType type, @Flag("trait") String traits, @Flag(value = "type", defValue = "PLAYER") EntityType type, @Flag("trait") String traits,
@Flag(value = "nameplate", completions = { "true", "false", "hover" }) String nameplate, @Flag(value = "nameplate", completions = { "true", "false", "hover" }) String nameplate,
@Flag("temporaryticks") Integer temporaryTicks, @Flag("item") String item, @Flag("model") String model, @Flag("temporaryticks") Integer temporaryTicks, @Flag("item") String item,
@Flag("template") String templateName, @Flag("registry") String registryName) throws CommandException { @Flag("template") String templateName, @Flag("registry") String registryName) throws CommandException {
String name = args.getJoinedStrings(1).trim(); String name = args.getJoinedStrings(1).trim();
if (args.hasValueFlag("type")) { if (args.hasValueFlag("type")) {
@ -690,10 +690,6 @@ public class NPCCommands {
registry = temporaryRegistry; registry = temporaryRegistry;
} }
if (model != null) {
type = EntityType.ARMOR_STAND;
}
if (item != null) { if (item != null) {
ItemStack stack = new ItemStack(Material.STONE, 1); ItemStack stack = new ItemStack(Material.STONE, 1);
try { try {
@ -1182,7 +1178,7 @@ public class NPCCommands {
permission = "citizens.npc.home") permission = "citizens.npc.home")
@Requirements(ownership = true, selected = true) @Requirements(ownership = true, selected = true)
public void home(CommandContext args, CommandSender sender, NPC npc, @Flag("location") Location loc, public void home(CommandContext args, CommandSender sender, NPC npc, @Flag("location") Location loc,
@Flag("delay") Integer delay, @Flag("distance") Double distance) throws CommandException { @Flag("delay") Duration delay, @Flag("distance") Double distance) throws CommandException {
HomeTrait trait = npc.getOrAddTrait(HomeTrait.class); HomeTrait trait = npc.getOrAddTrait(HomeTrait.class);
String output = ""; String output = "";
if (args.hasFlag('h')) { if (args.hasFlag('h')) {
@ -1209,7 +1205,7 @@ public class NPCCommands {
output += " " + Messaging.tr(Messages.HOME_TRAIT_TELEPORT_SET, npc.getName()); output += " " + Messaging.tr(Messages.HOME_TRAIT_TELEPORT_SET, npc.getName());
} }
if (delay != null) { if (delay != null) {
trait.setDelayTicks(delay); trait.setDelayTicks(Util.toTicks(delay));
output += " " + Messaging.tr(Messages.HOME_TRAIT_DELAY_SET, delay); output += " " + Messaging.tr(Messages.HOME_TRAIT_DELAY_SET, delay);
} }
if (!output.isEmpty()) { if (!output.isEmpty()) {
@ -1457,7 +1453,7 @@ public class NPCCommands {
permission = "citizens.npc.lookclose") permission = "citizens.npc.lookclose")
public void lookClose(CommandContext args, CommandSender sender, NPC npc, public void lookClose(CommandContext args, CommandSender sender, NPC npc,
@Flag({ "randomlook", "rlook" }) Boolean randomlook, @Flag("range") Double range, @Flag({ "randomlook", "rlook" }) Boolean randomlook, @Flag("range") Double range,
@Flag("randomlookdelay") Integer randomLookDelay, @Flag("randomyawrange") String randomYaw, @Flag("randomlookdelay") Duration randomLookDelay, @Flag("randomyawrange") String randomYaw,
@Flag("randompitchrange") String randomPitch, @Flag("randomswitchtargets") Boolean randomSwitchTargets, @Flag("randompitchrange") String randomPitch, @Flag("randomswitchtargets") Boolean randomSwitchTargets,
@Flag("headonly") Boolean headonly, @Flag("disablewhennavigating") Boolean disableWhenNavigating, @Flag("headonly") Boolean headonly, @Flag("disablewhennavigating") Boolean disableWhenNavigating,
@Flag("perplayer") Boolean perPlayer, @Flag("targetnpcs") Boolean targetNPCs) throws CommandException { @Flag("perplayer") Boolean perPlayer, @Flag("targetnpcs") Boolean targetNPCs) throws CommandException {
@ -1511,7 +1507,7 @@ public class NPCCommands {
toggle = false; toggle = false;
} }
if (randomLookDelay != null) { if (randomLookDelay != null) {
trait.setRandomLookDelay(Math.max(1, randomLookDelay)); trait.setRandomLookDelay(Math.max(1, Util.toTicks(randomLookDelay)));
Messaging.sendTr(sender, Messages.LOOKCLOSE_RANDOM_DELAY_SET, npc.getName(), randomLookDelay); Messaging.sendTr(sender, Messages.LOOKCLOSE_RANDOM_DELAY_SET, npc.getName(), randomLookDelay);
toggle = false; toggle = false;
} }
@ -1915,54 +1911,63 @@ public class NPCCommands {
max = 1, max = 1,
permission = "citizens.npc.pathfindingoptions") permission = "citizens.npc.pathfindingoptions")
public void pathfindingOptions(CommandContext args, CommandSender sender, NPC npc, public void pathfindingOptions(CommandContext args, CommandSender sender, NPC npc,
@Flag({ "avoid-water" }) Boolean avoidwater, @Flag("stationary-ticks") Integer stationaryTicks, @Flag("avoid-water") Boolean avoidwater, @Flag("open-doors") Boolean opendoors,
@Flag("distance-margin") Double distanceMargin, @Flag("path-distance-margin") Double pathDistanceMargin, @Flag("stationary-ticks") Integer stationaryTicks, @Flag("distance-margin") Double distanceMargin,
@Flag("attack-range") Double attackRange, @Flag("use-new-finder") Boolean useNewFinder, @Flag("path-distance-margin") Double pathDistanceMargin, @Flag("attack-range") Double attackRange,
@Flag("falling-distance") Integer fallingDistance) throws CommandException { @Flag("use-new-finder") Boolean useNewFinder, @Flag("falling-distance") Integer fallingDistance)
throws CommandException {
String output = ""; String output = "";
if (avoidwater != null) { if (avoidwater != null) {
npc.getNavigator().getDefaultParameters().avoidWater(avoidwater); npc.getNavigator().getDefaultParameters().avoidWater(avoidwater);
output += Messaging.tr(avoidwater ? Messages.PATHFINDING_OPTIONS_AVOID_WATER_SET output += Messaging.tr(avoidwater ? Messages.PATHFINDING_OPTIONS_AVOID_WATER_SET
: Messages.PATHFINDING_OPTIONS_AVOID_WATER_UNSET, npc.getName()); : Messages.PATHFINDING_OPTIONS_AVOID_WATER_UNSET, npc.getName());
} }
if (opendoors != null) {
npc.data().setPersistent(NPC.Metadata.PATHFINDER_OPEN_DOORS, opendoors);
output += Messaging.tr(opendoors ? Messages.PATHFINDING_OPTIONS_OPEN_DOORS_SET
: Messages.PATHFINDING_OPTIONS_OPEN_DOORS_UNSET, npc.getName());
}
if (stationaryTicks != null) { if (stationaryTicks != null) {
if (stationaryTicks < 0) if (stationaryTicks < 0)
throw new CommandUsageException(); throw new CommandUsageException();
npc.getNavigator().getDefaultParameters().stationaryTicks(stationaryTicks); npc.getNavigator().getDefaultParameters().stationaryTicks(stationaryTicks);
output += Messaging.tr(Messages.PATHFINDING_OPTIONS_STATIONARY_TICKS_SET, npc.getName(), stationaryTicks); output += " "
+ Messaging.tr(Messages.PATHFINDING_OPTIONS_STATIONARY_TICKS_SET, npc.getName(), stationaryTicks);
} }
if (distanceMargin != null) { if (distanceMargin != null) {
if (distanceMargin < 0) if (distanceMargin < 0)
throw new CommandUsageException(); throw new CommandUsageException();
npc.getNavigator().getDefaultParameters().distanceMargin(distanceMargin); npc.getNavigator().getDefaultParameters().distanceMargin(distanceMargin);
output += Messaging.tr(Messages.PATHFINDING_OPTIONS_DISTANCE_MARGIN_SET, npc.getName(), distanceMargin); output += " "
+ Messaging.tr(Messages.PATHFINDING_OPTIONS_DISTANCE_MARGIN_SET, npc.getName(), distanceMargin);
} }
if (pathDistanceMargin != null) { if (pathDistanceMargin != null) {
if (pathDistanceMargin < 0) if (pathDistanceMargin < 0)
throw new CommandUsageException(); throw new CommandUsageException();
npc.getNavigator().getDefaultParameters().pathDistanceMargin(pathDistanceMargin); npc.getNavigator().getDefaultParameters().pathDistanceMargin(pathDistanceMargin);
output += Messaging.tr(Messages.PATHFINDING_OPTIONS_PATH_DISTANCE_MARGIN_SET, npc.getName(), output += " " + Messaging.tr(Messages.PATHFINDING_OPTIONS_PATH_DISTANCE_MARGIN_SET, npc.getName(),
pathDistanceMargin); pathDistanceMargin);
} }
if (attackRange != null) { if (attackRange != null) {
if (attackRange < 0) if (attackRange < 0)
throw new CommandUsageException(); throw new CommandUsageException();
npc.getNavigator().getDefaultParameters().attackRange(attackRange); npc.getNavigator().getDefaultParameters().attackRange(attackRange);
output += Messaging.tr(Messages.PATHFINDING_OPTIONS_ATTACK_RANGE_SET, npc.getName(), attackRange); output += " " + Messaging.tr(Messages.PATHFINDING_OPTIONS_ATTACK_RANGE_SET, npc.getName(), attackRange);
} }
if (useNewFinder != null) { if (useNewFinder != null) {
npc.getNavigator().getDefaultParameters().useNewPathfinder(useNewFinder); npc.getNavigator().getDefaultParameters().useNewPathfinder(useNewFinder);
output += Messaging.tr(Messages.PATHFINDING_OPTIONS_USE_NEW_FINDER, npc.getName(), useNewFinder); output += " " + Messaging.tr(Messages.PATHFINDING_OPTIONS_USE_NEW_FINDER, npc.getName(), useNewFinder);
} }
if (fallingDistance != null) { if (fallingDistance != null) {
npc.getNavigator().getDefaultParameters().examiner(new FallingExaminer(fallingDistance)); npc.data().set(NPC.Metadata.PATHFINDER_FALL_DISTANCE, fallingDistance);
output += Messaging.tr(Messages.PATHFINDING_OPTIONS_FALLING_DISTANCE_SET, npc.getName(), fallingDistance); output += " "
+ Messaging.tr(Messages.PATHFINDING_OPTIONS_FALLING_DISTANCE_SET, npc.getName(), fallingDistance);
} }
if (output.isEmpty()) { if (output.isEmpty()) {
throw new CommandUsageException(); throw new CommandUsageException();
} else { } else {
Messaging.send(sender, output); Messaging.send(sender, output.trim());
} }
} }
@ -2073,14 +2078,16 @@ public class NPCCommands {
@Command( @Command(
aliases = { "npc" }, aliases = { "npc" },
usage = "playerfilter --hide [uuid] --unhide [uuid] --only [uuid]", usage = "playerfilter --hide [uuid] --unhide [uuid] --only [uuid] --hidegroup [group] --unhidegroup [group] --onlygroup [group] -c(lear)",
desc = "Sets the NPC filter", desc = "Sets the NPC filter",
modifiers = { "playerfilter" }, modifiers = { "playerfilter" },
min = 1, min = 1,
max = 1, max = 1,
flags = "c",
permission = "citizens.npc.playerfilter") permission = "citizens.npc.playerfilter")
public void playerfilter(CommandContext args, CommandSender sender, NPC npc, @Flag("hide") UUID hide, public void playerfilter(CommandContext args, CommandSender sender, NPC npc, @Flag("hide") UUID hide,
@Flag("unhide") UUID unhide, @Flag("only") UUID only) { @Flag("unhide") UUID unhide, @Flag("only") UUID only, @Flag("hidegroup") String hidegroup,
@Flag("unhidegroup") String unhidegroup, @Flag("onlygroup") String onlygroup) {
PlayerFilter trait = npc.getOrAddTrait(PlayerFilter.class); PlayerFilter trait = npc.getOrAddTrait(PlayerFilter.class);
if (hide != null) { if (hide != null) {
trait.hide(hide); trait.hide(hide);
@ -2094,6 +2101,22 @@ public class NPCCommands {
trait.only(only); trait.only(only);
Messaging.sendTr(sender, Messages.PLAYERFILTER_PLAYER_ONLY_ADDED, only, npc.getName()); Messaging.sendTr(sender, Messages.PLAYERFILTER_PLAYER_ONLY_ADDED, only, npc.getName());
} }
if (hidegroup != null) {
trait.hideGroup(hidegroup);
Messaging.sendTr(sender, Messages.PLAYERFILTER_GROUP_HIDDEN, hidegroup, npc.getName());
}
if (unhidegroup != null) {
trait.unhideGroup(unhidegroup);
Messaging.sendTr(sender, Messages.PLAYERFILTER_GROUP_UNHIDDEN, unhidegroup, npc.getName());
}
if (onlygroup != null) {
trait.onlyGroup(onlygroup);
Messaging.sendTr(sender, Messages.PLAYERFILTER_GROUP_ONLY_ADDED, onlygroup, npc.getName());
}
if (args.hasFlag('c')) {
trait.clear();
Messaging.sendTr(sender, Messages.PLAYERFILTER_PLAYER_CLEARED, npc.getName());
}
} }
@Command( @Command(
@ -2374,10 +2397,9 @@ public class NPCCommands {
min = 1, min = 1,
max = 2, max = 2,
permission = "citizens.npc.respawn") permission = "citizens.npc.respawn")
public void respawn(CommandContext args, CommandSender sender, NPC npc) { public void respawn(CommandContext args, CommandSender sender, NPC npc, @Arg(1) Duration delay) {
if (args.argsLength() > 1) { if (delay != null) {
int delay = args.getTicks(1); npc.data().setPersistent(NPC.Metadata.RESPAWN_DELAY, Util.toTicks(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.Metadata.RESPAWN_DELAY, -1)); Messaging.sendTr(sender, Messages.RESPAWN_DELAY_DESCRIBE, npc.data().get(NPC.Metadata.RESPAWN_DELAY, -1));
@ -3025,9 +3047,9 @@ public class NPCCommands {
@Command( @Command(
aliases = { "npc" }, aliases = { "npc" },
usage = "tphere (cursor) (-c(enter))", usage = "tphere (cursor) -c(enter) -f(ront)",
desc = "Teleport a NPC to your location", desc = "Teleport a NPC to your location",
flags = "c", flags = "cf",
modifiers = { "tphere", "tph", "move" }, modifiers = { "tphere", "tph", "move" },
min = 1, min = 1,
max = 2, max = 2,
@ -3053,6 +3075,10 @@ public class NPCCommands {
to.setX(to.getX() + 0.5); to.setX(to.getX() + 0.5);
to.setZ(to.getZ() + 0.5); to.setZ(to.getZ() + 0.5);
} }
if (args.hasFlag('f')) {
to = to.clone().add(to.getDirection().setY(0));
to.setDirection(to.getDirection().multiply(-1)).setPitch(0);
}
if (!npc.isSpawned()) { if (!npc.isSpawned()) {
NPCTeleportEvent event = new NPCTeleportEvent(npc, to); NPCTeleportEvent event = new NPCTeleportEvent(npc, to);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);

View File

@ -9,7 +9,6 @@ import org.bukkit.World;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.citizensnpcs.Citizens;
import net.citizensnpcs.api.ai.TeleportStuckAction; import net.citizensnpcs.api.ai.TeleportStuckAction;
import net.citizensnpcs.api.astar.pathfinder.ChunkBlockSource; import net.citizensnpcs.api.astar.pathfinder.ChunkBlockSource;
import net.citizensnpcs.api.command.Command; import net.citizensnpcs.api.command.Command;
@ -31,9 +30,6 @@ import net.citizensnpcs.util.Util;
@Requirements(ownership = true, selected = true) @Requirements(ownership = true, selected = true)
public class WaypointCommands { public class WaypointCommands {
public WaypointCommands(Citizens plugin) {
}
@Command( @Command(
aliases = { "waypoints", "waypoint", "wp" }, aliases = { "waypoints", "waypoint", "wp" },
usage = "add [x] [y] [z] (world) (--index idx)", usage = "add [x] [y] [z] (world) (--index idx)",

View File

@ -217,7 +217,7 @@ public class CitizensNPC extends AbstractNPC {
@Override @Override
public void scheduleUpdate(NPCUpdate update) { public void scheduleUpdate(NPCUpdate update) {
if (update == NPCUpdate.PACKET) { if (update == NPCUpdate.PACKET) {
updateCounter = data().get(NPC.Metadata.PACKET_UPDATE_DELAY, Setting.PACKET_UPDATE_DELAY.asInt()) + 1; updateCounter = data().get(NPC.Metadata.PACKET_UPDATE_DELAY, Setting.PACKET_UPDATE_DELAY.asTicks()) + 1;
} }
} }
@ -340,7 +340,7 @@ public class CitizensNPC extends AbstractNPC {
@Override @Override
public void accept(Runnable cancel) { public void accept(Runnable cancel) {
if (getEntity() == null || (!hasTrait(PacketNPC.class) && !getEntity().isValid())) { if (getEntity() == null || (!hasTrait(PacketNPC.class) && !getEntity().isValid())) {
if (timer++ > Setting.ENTITY_SPAWN_WAIT_TICKS.asInt()) { if (timer++ > Setting.ENTITY_SPAWN_WAIT_DURATION.asTicks()) {
Messaging.debug("Couldn't spawn ", CitizensNPC.this, "waited", timer, Messaging.debug("Couldn't spawn ", CitizensNPC.this, "waited", timer,
"ticks but entity not added to world"); "ticks but entity not added to world");
entityController.remove(); entityController.remove();
@ -394,11 +394,11 @@ public class CitizensNPC extends AbstractNPC {
NMS.setAggressive(entity, data().<Boolean> get(NPC.Metadata.AGGRESSIVE)); NMS.setAggressive(entity, data().<Boolean> get(NPC.Metadata.AGGRESSIVE));
} }
if (SUPPORT_NODAMAGE_TICKS && (Setting.DEFAULT_SPAWN_NODAMAGE_TICKS.asInt() != 20 if (SUPPORT_NODAMAGE_TICKS && (Setting.DEFAULT_SPAWN_NODAMAGE_DURATION.asTicks() != 20
|| data().has(NPC.Metadata.SPAWN_NODAMAGE_TICKS))) { || data().has(NPC.Metadata.SPAWN_NODAMAGE_TICKS))) {
try { try {
entity.setNoDamageTicks(data().get(NPC.Metadata.SPAWN_NODAMAGE_TICKS, entity.setNoDamageTicks(data().get(NPC.Metadata.SPAWN_NODAMAGE_TICKS,
Setting.DEFAULT_SPAWN_NODAMAGE_TICKS.asInt())); Setting.DEFAULT_SPAWN_NODAMAGE_DURATION.asTicks()));
} catch (NoSuchMethodError err) { } catch (NoSuchMethodError err) {
SUPPORT_NODAMAGE_TICKS = false; SUPPORT_NODAMAGE_TICKS = false;
} }
@ -480,10 +480,10 @@ public class CitizensNPC extends AbstractNPC {
} }
} }
boolean canSwim = data().get(NPC.Metadata.SWIMMING, SwimmingExaminer.isWaterMob(getEntity())); boolean shouldSwim = data().get(NPC.Metadata.SWIMMING, SwimmingExaminer.isWaterMob(getEntity()))
boolean inLiquid = MinecraftBlockExaminer.isLiquid(getEntity().getLocation().getBlock().getType()); && MinecraftBlockExaminer.isLiquid(getEntity().getLocation().getBlock().getType());
if (navigator.isNavigating()) { if (navigator.isNavigating()) {
if (canSwim && inLiquid) { if (shouldSwim) {
getEntity().setVelocity(getEntity().getVelocity().multiply( getEntity().setVelocity(getEntity().getVelocity().multiply(
data().get(NPC.Metadata.WATER_SPEED_MODIFIER, Setting.NPC_WATER_SPEED_MODIFIER.asFloat()))); data().get(NPC.Metadata.WATER_SPEED_MODIFIER, Setting.NPC_WATER_SPEED_MODIFIER.asFloat())));
Location currentDest = navigator.getPathStrategy().getCurrentDestination(); Location currentDest = navigator.getPathStrategy().getCurrentDestination();
@ -491,7 +491,7 @@ public class CitizensNPC extends AbstractNPC {
NMS.trySwim(getEntity()); NMS.trySwim(getEntity());
} }
} }
} else if (canSwim && inLiquid) { } else if (shouldSwim) {
Gravity trait = getTraitNullable(Gravity.class); Gravity trait = getTraitNullable(Gravity.class);
if (trait == null || trait.hasGravity()) { if (trait == null || trait.hasGravity()) {
NMS.trySwim(getEntity()); NMS.trySwim(getEntity());

View File

@ -70,7 +70,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
@Override @Override
public void stop() { public void stop() {
if (plan != null && params.debug()) { if (plan != null && params.debug()) {
plan.debugEnd(); Util.sendBlockChanges(plan.getBlocks(npc.getEntity().getWorld()), null);
} }
plan = null; plan = null;
} }
@ -122,6 +122,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
vector = plan.getCurrentVector(); vector = plan.getCurrentVector();
return false; return false;
} }
if (params.debug()) { if (params.debug()) {
npc.getEntity().getWorld().playEffect(dest, Effect.ENDER_SIGNAL, 0); npc.getEntity().getWorld().playEffect(dest, Effect.ENDER_SIGNAL, 0);
} }
@ -191,7 +192,8 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
} else { } else {
this.plan = plan; this.plan = plan;
if (params.debug()) { if (params.debug()) {
plan.debug(); Util.sendBlockChanges(plan.getBlocks(to.getWorld()),
Util.getFallbackMaterial("DANDELION", "YELLOW_FLOWER"));
} }
} }
return null; return null;

View File

@ -236,7 +236,7 @@ public class CitizensNavigator implements Navigator, Runnable {
} else { } else {
root.removeKey("pathfindingrange"); root.removeKey("pathfindingrange");
} }
if (defaultParams.stationaryTicks() != Setting.DEFAULT_STATIONARY_TICKS.asInt()) { if (defaultParams.stationaryTicks() != Setting.DEFAULT_STATIONARY_TICKS.asTicks()) {
root.setInt("stationaryticks", defaultParams.stationaryTicks()); root.setInt("stationaryticks", defaultParams.stationaryTicks());
} else { } else {
root.removeKey("stationaryticks"); root.removeKey("stationaryticks");
@ -438,6 +438,11 @@ public class CitizensNavigator implements Navigator, Runnable {
private void switchParams() { private void switchParams() {
localParams = defaultParams.clone(); localParams = defaultParams.clone();
int fallDistance = npc.data().get(NPC.Metadata.PATHFINDER_FALL_DISTANCE,
Setting.PATHFINDER_FALL_DISTANCE.asInt());
if (fallDistance != -1) {
localParams.examiner(new FallingExaminer(fallDistance));
}
if (npc.data().get(NPC.Metadata.PATHFINDER_OPEN_DOORS, Setting.NEW_PATHFINDER_OPENS_DOORS.asBoolean())) { if (npc.data().get(NPC.Metadata.PATHFINDER_OPEN_DOORS, Setting.NEW_PATHFINDER_OPENS_DOORS.asBoolean())) {
localParams.examiner(new DoorExaminer()); localParams.examiner(new DoorExaminer());
} }

View File

@ -95,7 +95,8 @@ public class FlyingAStarNavigationStrategy extends AbstractPathStrategy {
} else { } else {
vector = plan.getCurrentVector(); vector = plan.getCurrentVector();
if (parameters.debug()) { if (parameters.debug()) {
plan.debug(); Util.sendBlockChanges(plan.getBlocks(npc.getEntity().getWorld()),
Util.getFallbackMaterial("DANDELION", "YELLOW_FLOWER"));
} }
} }
planned = true; planned = true;
@ -104,7 +105,7 @@ public class FlyingAStarNavigationStrategy extends AbstractPathStrategy {
@Override @Override
public void stop() { public void stop() {
if (plan != null && parameters.debug()) { if (plan != null && parameters.debug()) {
plan.debugEnd(); Util.sendBlockChanges(plan.getBlocks(npc.getEntity().getWorld()), null);
} }
plan = null; plan = null;
} }

View File

@ -184,7 +184,7 @@ public class Skin {
break; break;
} }
fetchRetries++; fetchRetries++;
long delay = Setting.NPC_SKIN_RETRY_DELAY.asLong(); long delay = Setting.NPC_SKIN_RETRY_DELAY.asTicks();
retryTask = Bukkit.getScheduler().runTaskLater(CitizensAPI.getPlugin(), new Runnable() { retryTask = Bukkit.getScheduler().runTaskLater(CitizensAPI.getPlugin(), new Runnable() {
@Override @Override
public void run() { public void run() {

View File

@ -1,5 +1,6 @@
package net.citizensnpcs.trait; package net.citizensnpcs.trait;
import java.time.Duration;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
@ -206,14 +207,18 @@ public class CommandTrait extends Trait {
} }
private String describe(NPCCommand command) { private String describe(NPCCommand command) {
String output = "<br> - " + command.command + " [" String output = Messaging.tr(Messages.COMMAND_DESCRIBE_TEMPLATE, command.command, StringHelper.wrap(
+ StringHelper.wrap( command.cooldown != 0 ? command.cooldown : Setting.NPC_COMMAND_GLOBAL_COMMAND_COOLDOWN.asSeconds()),
command.cooldown != 0 ? command.cooldown : Setting.NPC_COMMAND_GLOBAL_COMMAND_DELAY.asLong()) command.id);
+ "s] [<click:run_command:/npc cmd remove " + command.id
+ "><hover:show_text:Remove this command><red>-</hover></click>]";
if (command.globalCooldown > 0) { if (command.globalCooldown > 0) {
output += "[global " + StringHelper.wrap(command.globalCooldown) + "s]"; output += "[global " + StringHelper.wrap(command.globalCooldown) + "s]";
} }
if (command.delay > 0) {
output += "[delay " + StringHelper.wrap(command.delay) + "t]";
}
if (command.n > 0) {
output += "[" + StringHelper.wrap(command.n) + " uses]";
}
if (command.op) { if (command.op) {
output += " -o"; output += " -o";
} }
@ -568,6 +573,10 @@ public class CommandTrait extends Trait {
return this; return this;
} }
public NPCCommandBuilder cooldown(Duration cd) {
return cooldown((int) TimeUnit.SECONDS.convert(cd));
}
public NPCCommandBuilder cooldown(int cooldown) { public NPCCommandBuilder cooldown(int cooldown) {
this.cooldown = cooldown; this.cooldown = cooldown;
return this; return this;
@ -578,6 +587,10 @@ public class CommandTrait extends Trait {
return this; return this;
} }
public NPCCommandBuilder globalCooldown(Duration cd) {
return globalCooldown((int) TimeUnit.SECONDS.convert(cd));
}
public NPCCommandBuilder globalCooldown(int cooldown) { public NPCCommandBuilder globalCooldown(int cooldown) {
this.globalCooldown = cooldown; this.globalCooldown = cooldown;
return this; return this;
@ -651,7 +664,7 @@ public class CommandTrait extends Trait {
return false; return false;
} }
} }
long globalDelay = Setting.NPC_COMMAND_GLOBAL_COMMAND_DELAY.asLong(); long globalDelay = Setting.NPC_COMMAND_GLOBAL_COMMAND_COOLDOWN.asSeconds();
long currentTimeSec = System.currentTimeMillis() / 1000; long currentTimeSec = System.currentTimeMillis() / 1000;
String commandKey = command.getEncodedKey(); String commandKey = command.getEncodedKey();
if (lastUsed.containsKey(commandKey)) { if (lastUsed.containsKey(commandKey)) {
@ -701,7 +714,7 @@ public class CommandTrait extends Trait {
commandKeys.add(commandKey); commandKeys.add(commandKey);
Number number = lastUsed.get(commandKey); Number number = lastUsed.get(commandKey);
if (number != null && number.longValue() + (command.cooldown != 0 ? command.cooldown if (number != null && number.longValue() + (command.cooldown != 0 ? command.cooldown
: Setting.NPC_COMMAND_GLOBAL_COMMAND_DELAY.asLong()) <= currentTimeSec) { : Setting.NPC_COMMAND_GLOBAL_COMMAND_COOLDOWN.asSeconds()) <= currentTimeSec) {
lastUsed.remove(commandKey); lastUsed.remove(commandKey);
} }
if (globalCooldowns != null) { if (globalCooldowns != null) {
@ -731,7 +744,7 @@ public class CommandTrait extends Trait {
public static boolean requiresTracking(NPCCommand command) { public static boolean requiresTracking(NPCCommand command) {
return command.globalCooldown > 0 || command.cooldown > 0 || command.n > 0 return command.globalCooldown > 0 || command.cooldown > 0 || command.n > 0
|| (command.perms != null && command.perms.size() > 0) || (command.perms != null && command.perms.size() > 0)
|| Setting.NPC_COMMAND_GLOBAL_COMMAND_DELAY.asLong() > 0; || Setting.NPC_COMMAND_GLOBAL_COMMAND_COOLDOWN.asSeconds() > 0;
} }
} }

View File

@ -269,7 +269,8 @@ public class HologramTrait extends Trait {
|| currentLoc.distance(npc.getStoredLocation()) >= 0.001 || lastNameplateVisible != nameplateVisible || currentLoc.distance(npc.getStoredLocation()) >= 0.001 || lastNameplateVisible != nameplateVisible
|| Math.abs(lastEntityHeight - getEntityHeight()) >= 0.05; || Math.abs(lastEntityHeight - getEntityHeight()) >= 0.05;
boolean updateName = false; boolean updateName = false;
if (t++ >= Setting.HOLOGRAM_UPDATE_RATE_TICKS.asInt() + Util.getFastRandom().nextInt(3) /* add some jitter */) { if (t++ >= Setting.HOLOGRAM_UPDATE_RATE.asTicks()
+ Util.getFastRandom().nextInt(3) /* add some jitter */) {
t = 0; t = 0;
updateName = true; updateName = true;
} }

View File

@ -51,7 +51,7 @@ public class LookClose extends Trait implements Toggleable {
@Persist("perplayer") @Persist("perplayer")
private boolean perPlayer; private boolean perPlayer;
@Persist @Persist
private int randomLookDelay = Setting.DEFAULT_RANDOM_LOOK_DELAY.asInt(); private int randomLookDelay = Setting.DEFAULT_RANDOM_LOOK_DELAY.asTicks();
@Persist @Persist
private float[] randomPitchRange = { 0, 0 }; private float[] randomPitchRange = { 0, 0 };
@Persist @Persist

View File

@ -36,6 +36,7 @@ public class SkinTrait extends Trait {
if (skinName == null) if (skinName == null)
return; return;
String filled = ChatColor.stripColor(Placeholders.replace(skinName, null, npc).toLowerCase()); String filled = ChatColor.stripColor(Placeholders.replace(skinName, null, npc).toLowerCase());
System.out.println(skinName + " " + filled + " " + filledPlaceholder);
if (!filled.equalsIgnoreCase(skinName) && !filled.equalsIgnoreCase(filledPlaceholder)) { if (!filled.equalsIgnoreCase(skinName) && !filled.equalsIgnoreCase(filledPlaceholder)) {
filledPlaceholder = filled; filledPlaceholder = filled;
if (update) { if (update) {
@ -97,7 +98,7 @@ public class SkinTrait extends Trait {
public void run() { public void run() {
if (timer-- > 0) if (timer-- > 0)
return; return;
timer = Setting.PLACEHOLDER_SKIN_UPDATE_FREQUENCY.asInt(); timer = Setting.PLACEHOLDER_SKIN_UPDATE_FREQUENCY.asTicks();
checkPlaceholder(true); checkPlaceholder(true);
} }

View File

@ -225,7 +225,7 @@ public class Text extends Trait implements Runnable, Listener {
if (speechBubbles) { if (speechBubbles) {
HologramTrait trait = npc.getOrAddTrait(HologramTrait.class); HologramTrait trait = npc.getOrAddTrait(HologramTrait.class);
trait.addTemporaryLine(Placeholders.replace(text.get(index), player), trait.addTemporaryLine(Placeholders.replace(text.get(index), player),
Setting.DEFAULT_TEXT_SPEECH_BUBBLE_TICKS.asInt()); Setting.DEFAULT_TEXT_SPEECH_BUBBLE_DURATION.asTicks());
} else { } else {
npc.getDefaultSpeechController().speak(new SpeechContext(text.get(index), player)); npc.getDefaultSpeechController().speak(new SpeechContext(text.get(index), player));
} }
@ -281,7 +281,7 @@ public class Text extends Trait implements Runnable, Listener {
int delay = this.delay == -1 int delay = this.delay == -1
? Setting.DEFAULT_TEXT_DELAY_MIN.asInt() + Util.getFastRandom() ? Setting.DEFAULT_TEXT_DELAY_MIN.asInt() + Util.getFastRandom()
.nextInt(Setting.DEFAULT_TEXT_DELAY_MAX.asInt() - Setting.DEFAULT_TEXT_DELAY_MIN.asInt()) .nextInt(Setting.DEFAULT_TEXT_DELAY_MAX.asTicks() - Setting.DEFAULT_TEXT_DELAY_MIN.asTicks())
: this.delay; : this.delay;
if (delay <= 0) if (delay <= 0)
return; return;

View File

@ -86,29 +86,33 @@ public class FoxTrait extends Trait {
permission = "citizens.npc.fox") permission = "citizens.npc.fox")
@Requirements(selected = true, ownership = true, types = EntityType.FOX) @Requirements(selected = true, ownership = true, types = EntityType.FOX)
public static void fox(CommandContext args, CommandSender sender, NPC npc, @Flag("sleeping") Boolean sleeping, public static void fox(CommandContext args, CommandSender sender, NPC npc, @Flag("sleeping") Boolean sleeping,
@Flag("sitting") Boolean sitting, @Flag("crouching") Boolean crouching) throws CommandException { @Flag("sitting") Boolean sitting, @Flag("crouching") Boolean crouching,
@Flag(value = "type", completions = { "RED", "SNOW" }) String rawtype) throws CommandException {
FoxTrait trait = npc.getOrAddTrait(FoxTrait.class); FoxTrait trait = npc.getOrAddTrait(FoxTrait.class);
String output = ""; String output = "";
if (args.hasValueFlag("type")) { if (rawtype != null) {
Fox.Type type = Util.matchEnum(Fox.Type.values(), args.getFlag("type")); Fox.Type type = Util.matchEnum(Fox.Type.values(), args.getFlag("type"));
if (type == null) { if (type == null) {
throw new CommandUsageException( throw new CommandUsageException(
Messaging.tr(Messages.INVALID_FOX_TYPE, Util.listValuesPretty(Fox.Type.values())), null); Messaging.tr(Messages.INVALID_FOX_TYPE, Util.listValuesPretty(Fox.Type.values())), null);
} }
trait.setType(type); trait.setType(type);
output += ' ' + Messaging.tr(Messages.FOX_TYPE_SET, args.getFlag("type")); output += ' ' + Messaging.tr(Messages.FOX_TYPE_SET, args.getFlag("type"), npc.getName());
} }
if (sleeping != null) { if (sleeping != null) {
trait.setSleeping(sleeping); trait.setSleeping(sleeping);
output += ' ' + Messaging.tr(sleeping ? Messages.FOX_SLEEPING_SET : Messages.FOX_SLEEPING_UNSET); output += ' '
+ Messaging.tr(sleeping ? Messages.FOX_SLEEPING_SET : Messages.FOX_SLEEPING_UNSET, npc.getName());
} }
if (sitting != null) { if (sitting != null) {
trait.setSitting(sitting); trait.setSitting(sitting);
output += ' ' + Messaging.tr(sitting ? Messages.FOX_SITTING_SET : Messages.FOX_SITTING_UNSET); output += ' '
+ Messaging.tr(sitting ? Messages.FOX_SITTING_SET : Messages.FOX_SITTING_UNSET, npc.getName());
} }
if (crouching != null) { if (crouching != null) {
trait.setCrouching(crouching); trait.setCrouching(crouching);
output += ' ' + Messaging.tr(crouching ? Messages.FOX_CROUCHING_SET : Messages.FOX_CROUCHING_UNSET); output += ' ' + Messaging.tr(crouching ? Messages.FOX_CROUCHING_SET : Messages.FOX_CROUCHING_UNSET,
npc.getName());
} }
if (!output.isEmpty()) { if (!output.isEmpty()) {
Messaging.send(sender, output.trim()); Messaging.send(sender, output.trim());

View File

@ -62,6 +62,7 @@ public class Messages {
public static final String COMMAND_ADDED = "citizens.commands.npc.command.command-added"; public static final String COMMAND_ADDED = "citizens.commands.npc.command.command-added";
public static final String COMMAND_AGE_HELP = "citizens.commands.npc.age.help"; public static final String COMMAND_AGE_HELP = "citizens.commands.npc.age.help";
public static final String COMMAND_COST_SET = "citizens.commands.npc.command.cost-set"; public static final String COMMAND_COST_SET = "citizens.commands.npc.command.cost-set";
public static final String COMMAND_DESCRIBE_TEMPLATE = "citizens.commands.npc.command.describe-format";
public static final String COMMAND_EXPERIENCE_COST_SET = "citizens.commands.npc.command.experience-cost-set"; public static final String COMMAND_EXPERIENCE_COST_SET = "citizens.commands.npc.command.experience-cost-set";
public static final String COMMAND_HELP_HEADER = "citizens.commands.help.header"; public static final String COMMAND_HELP_HEADER = "citizens.commands.help.header";
public static final String COMMAND_HIDE_ERROR_MESSAGES_SET = "citizens.commands.npc.command.hide-error-messages-set"; public static final String COMMAND_HIDE_ERROR_MESSAGES_SET = "citizens.commands.npc.command.hide-error-messages-set";
@ -304,6 +305,8 @@ public class Messages {
public static final String PATHFINDING_OPTIONS_AVOID_WATER_UNSET = "citizens.commands.npc.pathopt.avoid-water-unset"; public static final String PATHFINDING_OPTIONS_AVOID_WATER_UNSET = "citizens.commands.npc.pathopt.avoid-water-unset";
public static final String PATHFINDING_OPTIONS_DISTANCE_MARGIN_SET = "citizens.commands.npc.pathopt.distance-margin-set"; public static final String PATHFINDING_OPTIONS_DISTANCE_MARGIN_SET = "citizens.commands.npc.pathopt.distance-margin-set";
public static final String PATHFINDING_OPTIONS_FALLING_DISTANCE_SET = "citizens.commands.npc.pathopt.falling-distance-set"; public static final String PATHFINDING_OPTIONS_FALLING_DISTANCE_SET = "citizens.commands.npc.pathopt.falling-distance-set";
public static final String PATHFINDING_OPTIONS_OPEN_DOORS_SET = "citizens.commands.npc.pathopt.open-doors-set";
public static final String PATHFINDING_OPTIONS_OPEN_DOORS_UNSET = "citizens.commands.npc.pathopt.avoid-water-set";
public static final String PATHFINDING_OPTIONS_PATH_DISTANCE_MARGIN_SET = "citizens.commands.npc.pathopt.path-distance-margin-set"; public static final String PATHFINDING_OPTIONS_PATH_DISTANCE_MARGIN_SET = "citizens.commands.npc.pathopt.path-distance-margin-set";
public static final String PATHFINDING_OPTIONS_STATIONARY_TICKS_SET = "citizens.commands.npc.pathopt.stationary-ticks-set"; public static final String PATHFINDING_OPTIONS_STATIONARY_TICKS_SET = "citizens.commands.npc.pathopt.stationary-ticks-set";
public static final String PATHFINDING_OPTIONS_USE_NEW_FINDER = "citizens.commands.npc.pathopt.use-new-finder"; public static final String PATHFINDING_OPTIONS_USE_NEW_FINDER = "citizens.commands.npc.pathopt.use-new-finder";
@ -318,6 +321,10 @@ public class Messages {
public static final String PIGLIN_DANCING_SET = "citizens.commands.npc.piglin.dancing-set"; public static final String PIGLIN_DANCING_SET = "citizens.commands.npc.piglin.dancing-set";
public static final String PIGLIN_DANCING_UNSET = "citizens.commands.npc.piglin.dancing-unset"; public static final String PIGLIN_DANCING_UNSET = "citizens.commands.npc.piglin.dancing-unset";
public static final String PLAYER_NOT_FOUND_FOR_SPAWN = "citizens.commands.npc.create.no-player-for-spawn"; public static final String PLAYER_NOT_FOUND_FOR_SPAWN = "citizens.commands.npc.create.no-player-for-spawn";
public static final String PLAYERFILTER_GROUP_HIDDEN = "citizens.commands.npc.playerfilter.hidden-group";
public static final String PLAYERFILTER_GROUP_ONLY_ADDED = "citizens.commands.npc.playerfilter.only-added-group";
public static final String PLAYERFILTER_GROUP_UNHIDDEN = "citizens.commands.npc.playerfilter.unhidden-group";
public static final String PLAYERFILTER_PLAYER_CLEARED = "citizens.commands.npc.playerfilter.cleared";
public static final String PLAYERFILTER_PLAYER_HIDDEN = "citizens.commands.npc.playerfilter.hidden"; public static final String PLAYERFILTER_PLAYER_HIDDEN = "citizens.commands.npc.playerfilter.hidden";
public static final String PLAYERFILTER_PLAYER_ONLY_ADDED = "citizens.commands.npc.playerfilter.only-added"; public static final String PLAYERFILTER_PLAYER_ONLY_ADDED = "citizens.commands.npc.playerfilter.only-added";
public static final String PLAYERFILTER_PLAYER_UNHIDDEN = "citizens.commands.npc.playerfilter.unhidden"; public static final String PLAYERFILTER_PLAYER_UNHIDDEN = "citizens.commands.npc.playerfilter.unhidden";

View File

@ -34,6 +34,7 @@ import org.bukkit.util.Vector;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.authlib.GameProfileRepository; import com.mojang.authlib.GameProfileRepository;
import net.citizensnpcs.Settings.Setting;
import net.citizensnpcs.api.ai.NavigatorParameters; import net.citizensnpcs.api.ai.NavigatorParameters;
import net.citizensnpcs.api.astar.pathfinder.SwimmingExaminer; import net.citizensnpcs.api.astar.pathfinder.SwimmingExaminer;
import net.citizensnpcs.api.command.CommandManager; import net.citizensnpcs.api.command.CommandManager;
@ -133,6 +134,13 @@ public class NMS {
return BRIDGE.getDestination(entity); return BRIDGE.getDestination(entity);
} }
public static int getFallDistance(NPC npc, int def) {
return npc == null ? def
: npc.data().get(NPC.Metadata.PATHFINDER_FALL_DISTANCE,
Setting.PATHFINDER_FALL_DISTANCE.asInt() != -1 ? Setting.PATHFINDER_FALL_DISTANCE.asInt()
: def);
}
public static Field getField(Class<?> clazz, String field) { public static Field getField(Class<?> clazz, String field) {
return getField(clazz, field, true); return getField(clazz, field, true);
} }
@ -766,7 +774,6 @@ 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

@ -1,12 +1,14 @@
package net.citizensnpcs.util; package net.citizensnpcs.util;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.time.Duration;
import java.util.Arrays; import java.util.Arrays;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.function.Function; import java.util.function.Function;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -336,6 +338,10 @@ public class Util {
TWO_DIGIT_DECIMAL.format(to.getYaw()), TWO_DIGIT_DECIMAL.format(to.getPitch())); TWO_DIGIT_DECIMAL.format(to.getYaw()), TWO_DIGIT_DECIMAL.format(to.getPitch()));
} }
public static String rawtype(Enum<?>[] values) {
return "<yellow>" + Joiner.on("<green>, <yellow>").join(values).toLowerCase();
}
public static void runCommand(NPC npc, Player clicker, String command, boolean op, boolean player) { public static void runCommand(NPC npc, Player clicker, String command, boolean op, boolean player) {
List<String> split = Splitter.on(' ').omitEmptyStrings().trimResults().limit(2).splitToList(command); List<String> split = Splitter.on(' ').omitEmptyStrings().trimResults().limit(2).splitToList(command);
String bungeeServer = split.size() == 2 && split.get(0).equalsIgnoreCase("server") ? split.get(1) : null; String bungeeServer = split.size() == 2 && split.get(0).equalsIgnoreCase("server") ? split.get(1) : null;
@ -380,6 +386,23 @@ public class Util {
} }
} }
public static void sendBlockChanges(List<Block> blocks, Material type) {
if (blocks.isEmpty())
return;
Location loc = new Location(null, 0, 0, 0);
for (Player player : blocks.get(0).getWorld().getPlayers()) {
for (Block block : blocks) {
if (type != null) {
player.sendBlockChange(loc, type, (byte) 0);
} else if (SpigotUtil.isUsing1_13API()) {
player.sendBlockChange(block.getLocation(loc), block.getBlockData());
} else {
player.sendBlockChange(block.getLocation(loc), block.getType(), block.getData());
}
}
}
}
/** /**
* Sets the entity's yaw and pitch directly including head yaw. * Sets the entity's yaw and pitch directly including head yaw.
*/ */
@ -387,10 +410,13 @@ public class Util {
NMS.look(entity, yaw, pitch); NMS.look(entity, yaw, pitch);
} }
public static int toTicks(Duration delay) {
return (int) TimeUnit.MILLISECONDS.convert(delay) / 50;
}
private static final Location AT_LOCATION = new Location(null, 0, 0, 0); private static final Location AT_LOCATION = new Location(null, 0, 0, 0);
private static final Scoreboard DUMMY_SCOREBOARD = Bukkit.getScoreboardManager().getNewScoreboard(); private static final Scoreboard DUMMY_SCOREBOARD = Bukkit.getScoreboardManager().getNewScoreboard();
private static String MINECRAFT_REVISION; private static String MINECRAFT_REVISION;
private static Boolean REQUIRES_CHANNEL_METADATA;
private static final DecimalFormat TWO_DIGIT_DECIMAL = new DecimalFormat(); private static final DecimalFormat TWO_DIGIT_DECIMAL = new DecimalFormat();
static { static {
TWO_DIGIT_DECIMAL.setMaximumFractionDigits(2); TWO_DIGIT_DECIMAL.setMaximumFractionDigits(2);

View File

@ -66,6 +66,7 @@ citizens.commands.npc.command.left-hand-header=Commands to run on [[left click]]
citizens.commands.npc.command.right-hand-header=Commands to run on [[right click]]: citizens.commands.npc.command.right-hand-header=Commands to run on [[right click]]:
citizens.commands.npc.command.command-removed=Command [[{0}]] removed. citizens.commands.npc.command.command-removed=Command [[{0}]] removed.
citizens.commands.npc.command.command-added=Command [[{0}]] added with id [[{1}]]. citizens.commands.npc.command.command-added=Command [[{0}]] added with id [[{1}]].
citizens.commands.npc.command.describe-format=<br> - {0} [{1}s] [<click:run_command:/npc cmd remove {3}><hover:show_text:Remove this command><red>-</hover></click>]
citizens.commands.npc.command.help=<br>Use the [[-l]] flag to make the command run on left click, [[-r]] on right click (default).<br>Set the per-player cooldown before the command can be used again using [[--cooldown]] (in [[seconds]]).<br>Set the server-wide cooldown in seconds using [[--gcooldown]].<br>[[--delay]] will wait the specified amount in [[ticks]] before executing the command.<br>[[--permissions]] will set the command to require specific permissions (separate multiple with commas).<br>[[--n]] will only let the player run the command that number of times.<br>Use [[-o]] to temporarily execute the command as an op and [[-p]] to run the command as the clicking player instead of the server.<br>To give the player temporary permissions instead of op, use [[/npc command permissions]].<br>Set the cost of each click with [[/npc command cost/expcost/itemcost]].<br>Commands can be executed one by one instead of all at once by using [[/npc command sequential]]. citizens.commands.npc.command.help=<br>Use the [[-l]] flag to make the command run on left click, [[-r]] on right click (default).<br>Set the per-player cooldown before the command can be used again using [[--cooldown]] (in [[seconds]]).<br>Set the server-wide cooldown in seconds using [[--gcooldown]].<br>[[--delay]] will wait the specified amount in [[ticks]] before executing the command.<br>[[--permissions]] will set the command to require specific permissions (separate multiple with commas).<br>[[--n]] will only let the player run the command that number of times.<br>Use [[-o]] to temporarily execute the command as an op and [[-p]] to run the command as the clicking player instead of the server.<br>To give the player temporary permissions instead of op, use [[/npc command permissions]].<br>Set the cost of each click with [[/npc command cost/expcost/itemcost]].<br>Commands can be executed one by one instead of all at once by using [[/npc command sequential]].
citizens.commands.npc.command.unknown-id=Unknown command id [[{0}]] for this NPC. citizens.commands.npc.command.unknown-id=Unknown command id [[{0}]] for this NPC.
citizens.commands.npc.command.temporary-permissions-set=Temporary permissions set to [[{0}]]. citizens.commands.npc.command.temporary-permissions-set=Temporary permissions set to [[{0}]].
@ -206,6 +207,8 @@ citizens.commands.npc.passive.unset=[[{0}]] will now damage entities.
citizens.commands.npc.pathfindingrange.set=Pathfinding range set to [[{0}]]. citizens.commands.npc.pathfindingrange.set=Pathfinding range set to [[{0}]].
citizens.commands.npc.parrot.invalid-variant=Invalid parrot variant. Valid variants are [[{0}]]. citizens.commands.npc.parrot.invalid-variant=Invalid parrot variant. Valid variants are [[{0}]].
citizens.commands.npc.parrot.variant-set=Variant set to [[{0}]]. citizens.commands.npc.parrot.variant-set=Variant set to [[{0}]].
citizens.commands.npc.pathopt.open-doors-set=[[{0}]] will now try to open doors.
citizens.commands.npc.pathopt.open-doors-unset=[[{0}]] will no longer try to open doors.
citizens.commands.npc.pathopt.avoid-water-set=[[{0}]] will now avoid water. citizens.commands.npc.pathopt.avoid-water-set=[[{0}]] will now avoid water.
citizens.commands.npc.pathopt.avoid-water-unset=[[{0}]] will no longer avoid water. citizens.commands.npc.pathopt.avoid-water-unset=[[{0}]] will no longer avoid water.
citizens.commands.npc.pathopt.stationary-ticks-set=[[{0}]]''s maximum stationary ticks set to [[{1}]]. citizens.commands.npc.pathopt.stationary-ticks-set=[[{0}]]''s maximum stationary ticks set to [[{1}]].
@ -220,9 +223,13 @@ citizens.commands.npc.pausepathfinding.rightclick-set=[[{0}]] will now pause pat
citizens.commands.npc.pausepathfinding.rightclick-unset=[[{0}]] will no longer pause pathfinding on right click. citizens.commands.npc.pausepathfinding.rightclick-unset=[[{0}]] will no longer pause pathfinding on right click.
citizens.commands.npc.playerlist.added=Added [[{0}]] to the player list. citizens.commands.npc.playerlist.added=Added [[{0}]] to the player list.
citizens.commands.npc.playerlist.removed=Removed [[{0}]] from the player list. citizens.commands.npc.playerlist.removed=Removed [[{0}]] from the player list.
citizens.commands.npc.playerfilter.cleared=[[{0}]]''s filter cleared.
citizens.commands.npc.playerfilter.only-added=[[{0}]] added to the list of players that will be allowed to see [[{1}]]. citizens.commands.npc.playerfilter.only-added=[[{0}]] added to the list of players that will be allowed to see [[{1}]].
citizens.commands.npc.playerfilter.hidden=[[{0}]] added to the list of players hidden from [[{1}]]. citizens.commands.npc.playerfilter.hidden=[[{0}]] added to the list of players hidden from [[{1}]].
citizens.commands.npc.playerfilter.unhidden=[[{0}]] will now be allowed to see [[{1}]]. citizens.commands.npc.playerfilter.unhidden=[[{0}]] will now be allowed to see [[{1}]].
citizens.commands.npc.playerfilter.only-added-group=[[{0}]] added to the list of groups that will be allowed to see [[{1}]].
citizens.commands.npc.playerfilter.hidden-group=[[{0}]] added to the list of groups hidden from [[{1}]].
citizens.commands.npc.playerfilter.unhidden-group=[[{0}]] will now be allowed to see [[{1}]].
citizens.commands.npc.polarbear.rearing-set=[[{0}]] is now rearing. citizens.commands.npc.polarbear.rearing-set=[[{0}]] is now rearing.
citizens.commands.npc.polarbear.rearing-unset=[[{0}]] is no longer rearing. citizens.commands.npc.polarbear.rearing-unset=[[{0}]] is no longer rearing.
citizens.commands.npc.pickupitems.set=[[{0}]] will now pickup items. citizens.commands.npc.pickupitems.set=[[{0}]] will now pickup items.

View File

@ -71,6 +71,11 @@ public class BatController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -68,6 +68,11 @@ public class BlazeController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -77,6 +77,11 @@ public class CaveSpiderController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -86,6 +86,11 @@ public class ChickenController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -101,6 +101,11 @@ public class CowController extends MobEntityController {
return super.a(entityhuman, enumhand, itemstack); return super.a(entityhuman, enumhand, itemstack);
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -53,6 +53,7 @@ public class CreeperController extends MobEntityController {
public static class EntityCreeperNPC extends EntityCreeper implements NPCHolder { public static class EntityCreeperNPC extends EntityCreeper implements NPCHolder {
private boolean allowPowered; private boolean allowPowered;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityCreeperNPC(World world) { public EntityCreeperNPC(World world) {
@ -87,6 +88,11 @@ public class CreeperController extends MobEntityController {
return npc == null || !npc.isProtected() ? super.a(entityhuman, enumhand, itemstack) : false; return npc == null || !npc.isProtected() ? super.a(entityhuman, enumhand, itemstack) : false;
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -68,6 +68,11 @@ public class EnderDragonController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -77,6 +77,11 @@ public class EndermanController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -77,6 +77,11 @@ public class EndermiteController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -54,6 +54,11 @@ public class GhastController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class GiantController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class GuardianController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -83,6 +83,11 @@ public class HorseController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class IronGolemController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -69,6 +69,11 @@ public class MagmaCubeController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -82,6 +82,11 @@ public class MushroomCowController extends MobEntityController {
return false; return false;
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -72,6 +72,11 @@ public class OcelotController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -73,6 +73,11 @@ public class PigController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class PigZombieController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class PolarBearController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -73,6 +73,11 @@ public class RabbitController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -72,6 +72,11 @@ public class SheepController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -64,6 +64,11 @@ public class ShulkerController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class SilverfishController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class SkeletonController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -69,6 +69,11 @@ public class SlimeController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class SnowmanController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class SpiderController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class SquidController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -39,6 +39,7 @@ public class VillagerController extends MobEntityController {
public static class EntityVillagerNPC extends EntityVillager implements NPCHolder { public static class EntityVillagerNPC extends EntityVillager implements NPCHolder {
private boolean blockingATrade; private boolean blockingATrade;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityVillagerNPC(World world) { public EntityVillagerNPC(World world) {
@ -85,6 +86,11 @@ public class VillagerController extends MobEntityController {
return super.a(entityhuman, enumhand, itemstack); return super.a(entityhuman, enumhand, itemstack);
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class WitchController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -54,6 +54,11 @@ public class WitherController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -74,6 +74,11 @@ public class WolfController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class ZombieController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bV() { protected SoundEffect bV() {
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bV(), NPC.Metadata.DEATH_SOUND);

View File

@ -75,6 +75,7 @@ import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.LocationLookup.PerPlayerMetadata; import net.citizensnpcs.api.LocationLookup.PerPlayerMetadata;
import net.citizensnpcs.api.ai.NavigatorParameters; import net.citizensnpcs.api.ai.NavigatorParameters;
import net.citizensnpcs.api.ai.event.CancelReason; import net.citizensnpcs.api.ai.event.CancelReason;
import net.citizensnpcs.api.astar.pathfinder.DoorExaminer;
import net.citizensnpcs.api.command.CommandManager; import net.citizensnpcs.api.command.CommandManager;
import net.citizensnpcs.api.command.exception.CommandException; import net.citizensnpcs.api.command.exception.CommandException;
import net.citizensnpcs.api.gui.ForwardingInventory; import net.citizensnpcs.api.gui.ForwardingInventory;
@ -332,6 +333,7 @@ public class NMSImpl implements NMSBridge {
handle.dead = false; handle.dead = false;
tracker.updatePlayer(p); tracker.updatePlayer(p);
tracker.trackedPlayers.add(p); tracker.trackedPlayers.add(p);
handle.dead = true;
} }
@Override @Override
@ -351,7 +353,9 @@ public class NMSImpl implements NMSBridge {
for (EntityPlayer link : Lists.newArrayList(tracker.trackedPlayers)) { for (EntityPlayer link : Lists.newArrayList(tracker.trackedPlayers)) {
Player entity = link.getBukkitEntity(); Player entity = link.getBukkitEntity();
unlink(entity); unlink(entity);
callback.accept(entity); if (callback != null) {
callback.accept(entity);
}
} }
} }
}; };
@ -594,6 +598,7 @@ public class NMSImpl implements NMSBridge {
((EntityInsentient) raw).a(PathType.WATER, oldWater + 1F); ((EntityInsentient) raw).a(PathType.WATER, oldWater + 1F);
} }
} }
navigation.q().b(params.hasExaminer(DoorExaminer.class));
return new MCNavigator() { return new MCNavigator() {
float lastSpeed; float lastSpeed;
CancelReason reason; CancelReason reason;
@ -623,8 +628,6 @@ public class NMSImpl implements NMSBridge {
@Override @Override
public boolean update() { public boolean update() {
if (params.speed() != lastSpeed && lastSpeed > 0) { if (params.speed() != lastSpeed && lastSpeed > 0) {
Messaging.idebug(
() -> "Repathfinding " + ((NPCHolder) entity).getNPC().getId() + " due to speed change");
Entity handle = getHandle(entity); Entity handle = getHandle(entity);
float oldWidth = handle.width; float oldWidth = handle.width;
if (handle instanceof EntityHorse) { if (handle instanceof EntityHorse) {

View File

@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_10_R1.util;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashSet; import java.util.HashSet;
import net.citizensnpcs.Settings.Setting;
import net.citizensnpcs.nms.v1_10_R1.entity.EntityHumanNPC; import net.citizensnpcs.nms.v1_10_R1.entity.EntityHumanNPC;
import net.minecraft.server.v1_10_R1.AxisAlignedBB; import net.minecraft.server.v1_10_R1.AxisAlignedBB;
import net.minecraft.server.v1_10_R1.Block; import net.minecraft.server.v1_10_R1.Block;
@ -242,7 +241,7 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
int i = 0; int i = 0;
while ((paramInt2 > 0) && (localPathType == PathType.OPEN)) { while ((paramInt2 > 0) && (localPathType == PathType.OPEN)) {
paramInt2--; paramInt2--;
if (i++ >= Setting.MC_NAVIGATION_MAX_FALL_DISTANCE.asInt()) { if (i++ >= b.aY()) {
return null; return null;
} }
localPathType = a(this.b, paramInt1, paramInt2, paramInt3); localPathType = a(this.b, paramInt1, paramInt2, paramInt3);

View File

@ -29,9 +29,9 @@ public class PlayerlistTrackerEntry extends EntityTrackerEntry {
if (entityplayer instanceof EntityHumanNPC) if (entityplayer instanceof EntityHumanNPC)
return; return;
Entity tracker = getTracker(this); Entity tracker = getTracker(this);
if (tracker instanceof NPCHolder && ((NPCHolder) tracker).getNPC().isHiddenFrom(entityplayer.getBukkitEntity())) if ((tracker instanceof NPCHolder
return; && ((NPCHolder) tracker).getNPC().isHiddenFrom(entityplayer.getBukkitEntity())) || tracker.dead
if (tracker.dead || tracker.getBukkitEntity().getType() != EntityType.PLAYER) || tracker.getBukkitEntity().getType() != EntityType.PLAYER)
return; return;
if (entityplayer != tracker && c(entityplayer)) { if (entityplayer != tracker && c(entityplayer)) {
if (!this.trackedPlayers.contains(entityplayer) if (!this.trackedPlayers.contains(entityplayer)

View File

@ -71,6 +71,11 @@ public class BatController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -68,6 +68,11 @@ public class BlazeController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -77,6 +77,11 @@ public class CaveSpiderController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -86,6 +86,11 @@ public class ChickenController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -101,6 +101,11 @@ public class CowController extends MobEntityController {
return super.a(entityhuman, enumhand); return super.a(entityhuman, enumhand);
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -50,6 +50,7 @@ public class CreeperController extends MobEntityController {
public static class EntityCreeperNPC extends EntityCreeper implements NPCHolder { public static class EntityCreeperNPC extends EntityCreeper implements NPCHolder {
private boolean allowPowered; private boolean allowPowered;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityCreeperNPC(World world) { public EntityCreeperNPC(World world) {
@ -79,6 +80,11 @@ public class CreeperController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -68,6 +68,11 @@ public class EnderDragonController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -77,6 +77,11 @@ public class EndermanController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -77,6 +77,11 @@ public class EndermiteController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class EvokerController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -54,6 +54,11 @@ public class GhastController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class GiantController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class GuardianController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class GuardianElderController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -83,6 +83,11 @@ public class HorseController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -83,6 +83,11 @@ public class HorseDonkeyController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -83,6 +83,11 @@ public class HorseMuleController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -84,6 +84,11 @@ public class HorseSkeletonController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -84,6 +84,11 @@ public class HorseZombieController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class IronGolemController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -83,6 +83,11 @@ public class LlamaController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -77,6 +77,11 @@ public class MagmaCubeController extends MobEntityController {
} }
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -81,6 +81,11 @@ public class MushroomCowController extends MobEntityController {
return false; return false;
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -72,6 +72,11 @@ public class OcelotController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -73,6 +73,11 @@ public class PigController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class PigZombieController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class PolarBearController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -73,6 +73,11 @@ public class RabbitController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -72,6 +72,11 @@ public class SheepController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -74,6 +74,11 @@ public class ShulkerController extends MobEntityController {
} }
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class SilverfishController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class SkeletonController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class SkeletonStrayController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class SkeletonWitherController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -77,6 +77,11 @@ public class SlimeController extends MobEntityController {
} }
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class SnowmanController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class SpiderController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class SquidController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -57,6 +57,11 @@ public class VexController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -41,6 +41,7 @@ public class VillagerController extends MobEntityController {
public static class EntityVillagerNPC extends EntityVillager implements NPCHolder { public static class EntityVillagerNPC extends EntityVillager implements NPCHolder {
private boolean blockingATrade; private boolean blockingATrade;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityVillagerNPC(World world) { public EntityVillagerNPC(World world) {
@ -91,6 +92,11 @@ public class VillagerController extends MobEntityController {
return super.a(entityhuman, enumhand); return super.a(entityhuman, enumhand);
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -72,6 +72,11 @@ public class VindicatorController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -63,6 +63,11 @@ public class WitchController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

View File

@ -54,6 +54,11 @@ public class WitherController extends MobEntityController {
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ())); evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
} }
@Override
public int aY() {
return NMS.getFallDistance(npc, super.aY());
}
@Override @Override
protected SoundEffect bW() { protected SoundEffect bW() {
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND); return NMSImpl.getSoundEffect(npc, super.bW(), NPC.Metadata.DEATH_SOUND);

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