mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-03-14 15:49:24 +01:00
Add config comments, remove subplugins, remove NPCEnderTeleportEvent
This commit is contained in:
parent
6a19f19aa9
commit
e6f8a47f36
@ -203,33 +203,6 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
private void enableSubPlugins() {
|
||||
File root = new File(getDataFolder(), Setting.SUBPLUGIN_FOLDER.asString());
|
||||
if (!root.exists() || !root.isDirectory())
|
||||
return;
|
||||
File[] files = root.listFiles();
|
||||
for (File file : files) {
|
||||
Plugin plugin;
|
||||
try {
|
||||
plugin = Bukkit.getPluginManager().loadPlugin(file);
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
if (plugin == null)
|
||||
continue;
|
||||
// code beneath modified from CraftServer
|
||||
try {
|
||||
Messaging.logTr(Messages.LOADING_SUB_PLUGIN, plugin.getDescription().getFullName());
|
||||
plugin.onLoad();
|
||||
} catch (Throwable ex) {
|
||||
Messaging.severeTr(Messages.ERROR_INITALISING_SUB_PLUGIN, ex.getMessage(),
|
||||
plugin.getDescription().getFullName());
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
NMS.loadPlugins();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandManager getCommandManager() {
|
||||
return commands;
|
||||
@ -457,7 +430,6 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
||||
setupEconomy();
|
||||
|
||||
registerCommands();
|
||||
enableSubPlugins();
|
||||
NMS.load(commands);
|
||||
Template.migrate();
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||
@ -622,8 +594,6 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
||||
|
||||
Messaging.logTr(Messages.NUM_LOADED_NOTIFICATION, Iterables.size(npcRegistry), "?");
|
||||
startMetrics();
|
||||
System.out.println(Setting.SAVE_TASK_DELAY.asTicks());
|
||||
System.out.println(Setting.SAVE_TASK_DELAY.asTicks() / 20);
|
||||
scheduleSaveTask(Setting.SAVE_TASK_DELAY.asTicks());
|
||||
Bukkit.getPluginManager().callEvent(new CitizensEnableEvent());
|
||||
new PlayerUpdateTask().runTaskTimer(Citizens.this, 0, 1);
|
||||
|
@ -3,6 +3,7 @@ package net.citizensnpcs;
|
||||
import java.io.File;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -14,6 +15,7 @@ import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.SpigotUtil;
|
||||
import net.citizensnpcs.api.util.Storage;
|
||||
import net.citizensnpcs.api.util.YamlStorage;
|
||||
import net.citizensnpcs.api.util.YamlStorage.YamlKey;
|
||||
import net.citizensnpcs.util.Util;
|
||||
|
||||
public class Settings {
|
||||
@ -61,49 +63,84 @@ public class Settings {
|
||||
}
|
||||
|
||||
public enum Setting {
|
||||
ALWAYS_USE_NAME_HOLOGRAM("npc.always-use-name-holograms", false),
|
||||
ASTAR_ITERATIONS_PER_TICK("npc.pathfinding.new-finder.iterations-per-tick",
|
||||
"npc.pathfinding.new-finder.iterations-per-tick", 2500),
|
||||
AUTH_SERVER_URL("general.authlib.profile-url", "https://sessionserver.mojang.com/session/minecraft/profile/"),
|
||||
BOSSBAR_RANGE("npc.default.bossbar-view-range", 64),
|
||||
CHAT_BYSTANDERS_HEAR_TARGETED_CHAT("npc.chat.options.bystanders-hear-targeted-chat", false),
|
||||
CHAT_FORMAT("npc.chat.format.no-targets", "[<npc>]: <text>"),
|
||||
CHAT_FORMAT_TO_BYSTANDERS("npc.chat.format.with-target-to-bystanders", "[<npc>] -> [<target>]: <text>"),
|
||||
CHAT_FORMAT_TO_TARGET("npc.chat.format.to-target", "<npc>: <text>"),
|
||||
CHAT_FORMAT_WITH_TARGETS_TO_BYSTANDERS("npc.chat.format.with-targets-to-bystanders",
|
||||
"[<npc>] -> [<targets>]: <text>"),
|
||||
CHAT_MAX_NUMBER_OF_TARGETS("npc.chat.options.max-number-of-targets-to-show", 2),
|
||||
ALWAYS_USE_NAME_HOLOGRAM("Always use holograms for names instead of only for hex colors / placeholders",
|
||||
"npc.always-use-name-holograms", false),
|
||||
ASTAR_ITERATIONS_PER_TICK("Number of blocks to search per tick (Citizens pathfinder)",
|
||||
"npc.pathfinding.new-finder.iterations-per-tick", "npc.pathfinding.new-finder.iterations-per-tick",
|
||||
250),
|
||||
AUTH_SERVER_URL("Search for gameprofiles using this URL", "general.authlib.profile-url",
|
||||
"https://sessionserver.mojang.com/session/minecraft/profile/"),
|
||||
BOSSBAR_RANGE("The default bossbar range, in blocks", "npc.default.bossbar-view-range", 64),
|
||||
CHAT_BYSTANDERS_HEAR_TARGETED_CHAT(
|
||||
"Whether nearby players also hear text, even if targeted at a specific player",
|
||||
"npc.chat.options.bystanders-hear-targeted-chat", false),
|
||||
CHAT_FORMAT("The default text format (placeholder enabled)", "npc.chat.format.no-targets", "[<npc>]: <text>"),
|
||||
CHAT_FORMAT_TO_BYSTANDERS("The default text format for nearby players (placeholder enabled)",
|
||||
"npc.chat.format.with-target-to-bystanders", "[<npc>] -> [<target>]: <text>"),
|
||||
CHAT_FORMAT_TO_TARGET("The default text format for targeted text (placeholder enabled)",
|
||||
"npc.chat.format.to-target", "<npc>: <text>"),
|
||||
CHAT_FORMAT_WITH_TARGETS_TO_BYSTANDERS("The default text format for nearby players (placeholder enabled)",
|
||||
"npc.chat.format.with-targets-to-bystanders", "[<npc>] -> [<targets>]: <text>"),
|
||||
CHAT_MAX_NUMBER_OF_TARGETS("Number of target names to show to bystanders",
|
||||
"npc.chat.options.max-number-of-targets-to-show", 2),
|
||||
CHAT_MULTIPLE_TARGETS_FORMAT("npc.chat.options.multiple-targets-format",
|
||||
"<target>|, <target>| & <target>| & others"),
|
||||
CHAT_RANGE("npc.chat.options.range", 5),
|
||||
CHECK_MINECRAFT_VERSION("advanced.check-minecraft-version", true),
|
||||
CONTROLLABLE_GROUND_DIRECTION_MODIFIER("npc.controllable.ground-direction-modifier", 1.0D),
|
||||
DEBUG_CHUNK_LOADS("general.debug-chunk-loads", false),
|
||||
DEBUG_FILE("general.debug-file", ""),
|
||||
DEBUG_MODE("general.debug-mode", false),
|
||||
DEBUG_PATHFINDING("general.debug-pathfinding", false),
|
||||
DEFAULT_BLOCK_BREAKER_RADIUS("npc.defaults.block-breaker-radius", "npc.default.block-breaker-radius", -1),
|
||||
DEFAULT_CACHE_WAYPOINT_PATHS("npc.default.waypoints.cache-paths", false),
|
||||
DEFAULT_DESTINATION_TELEPORT_MARGIN("npc.pathfinding.defaults.destination-teleport-margin",
|
||||
CHAT_RANGE("Nearby player range in blocks", "npc.chat.options.range", 5),
|
||||
CHECK_MINECRAFT_VERSION("Whether to check the minecraft version for compatibility (do not change)",
|
||||
"advanced.check-minecraft-version", true),
|
||||
CONTROLLABLE_GROUND_DIRECTION_MODIFIER("The percentage to increase speed when controlling NPCs on the ground",
|
||||
"npc.controllable.ground-direction-modifier", 1.0D),
|
||||
DEBUG_CHUNK_LOADS("Debug chunk load stack traces, not as useful in recent Minecraft versions",
|
||||
"general.debug-chunk-loads", false),
|
||||
DEBUG_FILE("Send Citizens debug output to a specific file", "general.debug-file", ""),
|
||||
DEBUG_MODE("Enable Citizens debugging", "general.debug-mode", false),
|
||||
DEBUG_PATHFINDING("Debug pathfinding by showing fake target blocks", "general.debug-pathfinding", false),
|
||||
DEFAULT_BLOCK_BREAKER_RADIUS(
|
||||
"The default distance radius for block breaking, in blocks<br>The NPC will pathfind to be this far away from the target block if greater than 0",
|
||||
"npc.defaults.block-breaker-radius", "npc.default.block-breaker-radius", -1),
|
||||
DEFAULT_CACHE_WAYPOINT_PATHS(
|
||||
"Whether to cache /npc path by default<br>Can eliminate pathfinding for repetitive static paths",
|
||||
"npc.default.waypoints.cache-paths", false),
|
||||
DEFAULT_DESTINATION_TELEPORT_MARGIN(
|
||||
"The default distance in blocks where the NPC will just teleport to the destination<br>Useful when trying to get exactly to the destination",
|
||||
"npc.pathfinding.defaults.destination-teleport-margin",
|
||||
"npc.pathfinding.default-destination-teleport-margin", -1),
|
||||
DEFAULT_DISTANCE_MARGIN("npc.pathfinding.default-distance-margin", 2),
|
||||
DEFAULT_LOOK_CLOSE("npc.default.look-close.enabled", false),
|
||||
DEFAULT_LOOK_CLOSE_RANGE("npc.default.look-close.range", 5),
|
||||
DEFAULT_NPC_HOLOGRAM_LINE_HEIGHT("npc.hologram.default-line-height", 0.4D),
|
||||
DEFAULT_NPC_LIMIT("npc.limits.default-limit", 10),
|
||||
DEFAULT_PATH_DISTANCE_MARGIN("npc.pathfinding.default-path-distance-margin", 1),
|
||||
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_RANDOM_LOOK_CLOSE("npc.default.look-close.random-look-enabled", false),
|
||||
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_REALISTIC_LOOKING("npc.default.realistic-looking", "npc.default.look-close.realistic-looking", false),
|
||||
DEFAULT_SPAWN_NODAMAGE_DURATION("npc.default.spawn-nodamage-ticks", "npc.default.spawn-nodamage-duration",
|
||||
"1s"),
|
||||
DEFAULT_STATIONARY_DURATION("npc.default.stationary-ticks", "npc.default.stationary-duration", -1),
|
||||
DEFAULT_STRAIGHT_LINE_TARGETING_DISTANCE("npc.pathfinding.straight-line-targeting-distance", 5),
|
||||
DEFAULT_DISTANCE_MARGIN(
|
||||
"The default MOVEMENT distance in blocks where the NPC will move to before considering a path finished<br>Note: this is different from the PATHFINDING distance which is specified by path-distance-margin",
|
||||
"npc.pathfinding.default-distance-margin", 1),
|
||||
DEFAULT_LOOK_CLOSE("Enable look close by default", "npc.default.look-close.enabled", false),
|
||||
DEFAULT_LOOK_CLOSE_RANGE("Default look close range in blocks", "npc.default.look-close.range", 5),
|
||||
DEFAULT_NPC_HOLOGRAM_LINE_HEIGHT("Default distance between hologram lines", "npc.hologram.default-line-height",
|
||||
0.4D),
|
||||
DEFAULT_NPC_LIMIT(
|
||||
"Default maximum number of NPCs owned by a single player (give the citizens ignore-limits permission to skip this check)",
|
||||
"npc.limits.default-limit", 10),
|
||||
DEFAULT_PATH_DISTANCE_MARGIN(
|
||||
"Default PATHFINDING distance in blocks where the NPC will consider pathfinding complete<br>Note: this is different from the MOVEMENT distance, which is specified by the distance-margin<br>Set to 0 if you want to try pathfind exactly to the target destination",
|
||||
"npc.pathfinding.default-path-distance-margin", 1),
|
||||
DEFAULT_PATHFINDER_UPDATE_PATH_RATE("How often to repathfind when targeting a dynamic target such as an entity",
|
||||
"npc.pathfinding.update-path-rate", "1s"),
|
||||
DEFAULT_PATHFINDING_RANGE(
|
||||
"The default pathfinding range in blocks<br>Shouldn't be set too high to avoid lag - try pathfinding in sections instead",
|
||||
"npc.default.pathfinding.range", "npc.pathfinding.default-range-blocks", 75F),
|
||||
DEFAULT_RANDOM_LOOK_CLOSE("Default random look close enabled", "npc.default.look-close.random-look-enabled",
|
||||
false),
|
||||
DEFAULT_RANDOM_LOOK_DELAY("Default random look delay", "npc.default.look-close.random-look-delay", "3s"),
|
||||
DEFAULT_RANDOM_TALKER("Default talk to nearby players", "npc.default.random-talker",
|
||||
"npc.default.talk-close.random-talker", false),
|
||||
DEFAULT_REALISTIC_LOOKING("Default to checking for line of sight when looking at players",
|
||||
"npc.default.realistic-looking", "npc.default.look-close.realistic-looking", false),
|
||||
DEFAULT_SPAWN_NODAMAGE_DURATION(
|
||||
"Default duration of no-damage-ticks on entity spawn, Minecraft default is 20 ticks",
|
||||
"npc.default.spawn-nodamage-ticks", "npc.default.spawn-nodamage-duration", "1s"),
|
||||
DEFAULT_STATIONARY_DURATION(
|
||||
"Default duration in the same location before the NPC considers itself stuck and failed pathfinding",
|
||||
"npc.default.stationary-ticks", "npc.default.stationary-duration", -1),
|
||||
DEFAULT_STRAIGHT_LINE_TARGETING_DISTANCE(
|
||||
"The distance in blocks where the NPC will switch to walking straight towards the target instead of pathfinding<br>Currently only for dynamic targets like entities",
|
||||
"npc.pathfinding.straight-line-targeting-distance", 5),
|
||||
DEFAULT_TALK_CLOSE("npc.default.talk-close.enabled", false),
|
||||
DEFAULT_TALK_CLOSE_RANGE("npc.default.talk-close.range", 5),
|
||||
DEFAULT_TALK_CLOSE_RANGE("Default talk close range in blocks", "npc.default.talk-close.range", 5),
|
||||
DEFAULT_TEXT("npc.default.talk-close.text.0", "Hi, I'm <npc>!") {
|
||||
@Override
|
||||
public void loadFromKey(DataKey root) {
|
||||
@ -114,35 +151,57 @@ public class Settings {
|
||||
value = list;
|
||||
}
|
||||
},
|
||||
DEFAULT_TEXT_DELAY_MAX("npc.text.default-random-text-delay-max", "10s"),
|
||||
DEFAULT_TEXT_DELAY_MIN("npc.text.default-random-text-delay-min", "5s"),
|
||||
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_MC_NAVIGATION_FALLBACK("npc.pathfinding.disable-mc-fallback-navigation", true),
|
||||
DISABLE_TABLIST("npc.tablist.disable", true),
|
||||
ENTITY_SPAWN_WAIT_DURATION("general.entity-spawn-wait-ticks", "general.wait-for-entity-spawn", "1s"),
|
||||
DEFAULT_TEXT_DELAY_MAX("Default maximum delay when talking to players",
|
||||
"npc.text.default-random-text-delay-max", "10s"),
|
||||
DEFAULT_TEXT_DELAY_MIN("Default minimum delay when talking to players",
|
||||
"npc.text.default-random-text-delay-min", "5s"),
|
||||
DEFAULT_TEXT_SPEECH_BUBBLE_DURATION("Default duration that speech bubbles show up for",
|
||||
"npc.text.speech-bubble-ticks", "npc.text.speech-bubble-duration", "50t"),
|
||||
DISABLE_LOOKCLOSE_WHILE_NAVIGATING("Whether to disable look close while pathfinding",
|
||||
"npc.default.look-close.disable-while-navigating", true),
|
||||
DISABLE_MC_NAVIGATION_FALLBACK(
|
||||
"Minecraft will pick a 'close-enough' location when pathfinding to a block if it can't find a direct path<br>Disabled by default",
|
||||
"npc.pathfinding.disable-mc-fallback-navigation", true),
|
||||
DISABLE_TABLIST("Whether to remove NPCs from the tablist", "npc.tablist.disable", true),
|
||||
ENTITY_SPAWN_WAIT_DURATION(
|
||||
"Entities are no longer spawned until the chunks are loaded from disk<br>Wait for chunk loading for one second by default, increase if your disk is slow",
|
||||
"general.entity-spawn-wait-ticks", "general.wait-for-entity-spawn", "1s"),
|
||||
ERROR_COLOUR("general.color-scheme.message-error", "<red>"),
|
||||
FOLLOW_ACROSS_WORLDS("npc.follow.teleport-across-worlds", true),
|
||||
FOLLOW_ACROSS_WORLDS("Whether /npc follow will teleport across worlds to follow its target",
|
||||
"npc.follow.teleport-across-worlds", true),
|
||||
HIGHLIGHT_COLOUR("general.color-scheme.message-highlight", "yellow"),
|
||||
HOLOGRAM_UPDATE_RATE("npc.hologram.update-rate-ticks", "npc.hologram.update-rate", "1s"),
|
||||
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),
|
||||
LOCALE("general.translation.locale", ""),
|
||||
MAX_CONTROLLABLE_GROUND_SPEED("npc.controllable.max-ground-speed", 0.5),
|
||||
MAX_NPC_LIMIT_CHECKS("npc.limits.max-permission-checks", 100),
|
||||
MAX_NPC_SKIN_RETRIES("npc.skins.max-retries", -1),
|
||||
HOLOGRAM_UPDATE_RATE("How often to update hologram names (including placeholders)",
|
||||
"npc.hologram.update-rate-ticks", "npc.hologram.update-rate", "1s"),
|
||||
INITIAL_PLAYER_JOIN_SKIN_PACKET_DELAY("How long to wait before sending skins to joined players",
|
||||
"npc.skins.player-join-update-delay-ticks", "npc.skins.player-join-update-delay", "3s"),
|
||||
KEEP_CHUNKS_LOADED("Whether to keep NPC chunks loaded", "npc.chunks.always-keep-loaded", false),
|
||||
LOCALE("Controls translation files - defaults to your system language, set to en if English required",
|
||||
"general.translation.locale", ""),
|
||||
MAX_CONTROLLABLE_GROUND_SPEED("The maximum speed that controllable NPCs can reach, in Minecraft velocity units",
|
||||
"npc.controllable.max-ground-speed", 0.5),
|
||||
MAX_NPC_LIMIT_CHECKS(
|
||||
"How many permissions to check when creating NPCs<br>Only change if you have a permission limit greater than this",
|
||||
"npc.limits.max-permission-checks", 100),
|
||||
MAX_NPC_SKIN_RETRIES(
|
||||
"How many times to try load NPC skins (due to Minecraft rate-limiting skin requests, should rarely be less than 5",
|
||||
"npc.skins.max-retries", -1),
|
||||
MAX_PACKET_ENTRIES("npc.limits.max-packet-entries", 15),
|
||||
MAX_SPEED("npc.limits.max-speed", 100),
|
||||
MAX_TEXT_RANGE("npc.chat.options.max-text-range", 500),
|
||||
MAXIMUM_ASTAR_ITERATIONS("npc.pathfinding.maximum-new-pathfinder-iterations",
|
||||
"npc.pathfinding.new-finder.maximum-iterations", 5000),
|
||||
MAXIMUM_VISITED_NODES("npc.pathfinding.maximum-visited-nodes", "npc.pathfinding.maximum-visited-blocks", 768),
|
||||
MAX_TEXT_RANGE("The maximum range in blocks for chatting", "npc.chat.options.max-text-range", 500),
|
||||
MAXIMUM_ASTAR_ITERATIONS("The maximum number of blocks to check when pathfinding",
|
||||
"npc.pathfinding.maximum-new-pathfinder-iterations", "npc.pathfinding.new-finder.maximum-iterations",
|
||||
768),
|
||||
MAXIMUM_VISITED_NODES("The maximum number of blocks to check when MINECRAFT pathfinding",
|
||||
"npc.pathfinding.maximum-visited-nodes", "npc.pathfinding.maximum-visited-blocks", 768),
|
||||
MESSAGE_COLOUR("general.color-scheme.message", "<green>"),
|
||||
NEW_PATHFINDER_CHECK_BOUNDING_BOXES("npc.pathfinding.new-finder.check-bounding-boxes", false),
|
||||
NEW_PATHFINDER_OPENS_DOORS("npc.pathfinding.new-finder.open-doors", false),
|
||||
NPC_ATTACK_DISTANCE("npc.pathfinding.attack-range", 1.75),
|
||||
NPC_COMMAND_GLOBAL_COMMAND_COOLDOWN("npc.commands.global-delay-seconds", "npc.commands.global-cooldown", "1s"),
|
||||
NEW_PATHFINDER_CHECK_BOUNDING_BOXES(
|
||||
"Whether to check bounding boxes when pathfinding such as between fences, inside doors, or other half-blocks",
|
||||
"npc.pathfinding.new-finder.check-bounding-boxes", false),
|
||||
NEW_PATHFINDER_OPENS_DOORS("Whether to open doors while pathfinding (should close them as well)",
|
||||
"npc.pathfinding.new-finder.open-doors", false),
|
||||
NPC_ATTACK_DISTANCE("The range in blocks before attacking the target", "npc.pathfinding.attack-range", 1.75),
|
||||
NPC_COMMAND_GLOBAL_COMMAND_COOLDOWN(
|
||||
"The global cooldown before a command can be used again, must be in seconds",
|
||||
"npc.commands.global-delay-seconds", "npc.commands.global-cooldown", "1s"),
|
||||
NPC_COMMAND_MAXIMUM_TIMES_USED_MESSAGE("npc.commands.error-messages.maximum-times-used",
|
||||
"You have reached the maximum number of uses ({0})."),
|
||||
NPC_COMMAND_MISSING_ITEM_MESSAGE("npc.commands.error-messages.missing-item", "Missing {1} {0}"),
|
||||
@ -155,34 +214,47 @@ public class Settings {
|
||||
"Please wait for {minutes} minutes and {seconds_over} seconds."),
|
||||
NPC_COMMAND_ON_GLOBAL_COOLDOWN_MESSAGE("npc.commands.error-messages.on-global-cooldown",
|
||||
"Please wait for {minutes} minutes and {seconds_over} seconds."),
|
||||
NPC_COST("economy.npc.cost", 100D),
|
||||
NPC_SKIN_RETRY_DELAY("npc.skins.retry-delay", "5s"),
|
||||
NPC_COST("The default cost to create an NPC", "economy.npc.cost", 100D),
|
||||
NPC_SKIN_RETRY_DELAY("How long before retrying skin requests (typically due to Mojang rate limiting)",
|
||||
"npc.skins.retry-delay", "5s"),
|
||||
NPC_SKIN_ROTATION_UPDATE_DEGREES("npc.skins.rotation-update-degrees", 90f),
|
||||
NPC_SKIN_USE_LATEST("npc.skins.use-latest-by-default", false),
|
||||
NPC_SKIN_VIEW_DISTANCE("npc.skins.view-distance", 100D),
|
||||
NPC_WATER_SPEED_MODIFIER("npc.movement.water-speed-modifier", 1.15F),
|
||||
NPC_WATER_SPEED_MODIFIER("Movement speed percentage increase while in water",
|
||||
"npc.movement.water-speed-modifier", 1.15F),
|
||||
PACKET_HOLOGRAMS("Use packet NPCs for name holograms (experimental)", "npc.use-packet-holograms", false),
|
||||
PACKET_UPDATE_DELAY("npc.packets.update-delay", 30),
|
||||
PATHFINDER_FALL_DISTANCE("npc.pathfinding.allowed-fall-distance", -1),
|
||||
PLACEHOLDER_SKIN_UPDATE_FREQUENCY("npc.skins.placeholder-update-frequency-ticks",
|
||||
"npc.skins.placeholder-update-frequency", "5m"),
|
||||
PATHFINDER_FALL_DISTANCE(
|
||||
"The default allowed maximum fall distance when pathfinding, set to -1 to use the Minecraft value",
|
||||
"npc.pathfinding.allowed-fall-distance", -1),
|
||||
PLACEHOLDER_SKIN_UPDATE_FREQUENCY("How often to update placeholders",
|
||||
"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),
|
||||
RESOURCE_PACK_PATH("general.resource-pack-path", "plugins/Citizens/resourcepack"),
|
||||
SAVE_TASK_DELAY("storage.save-task.delay", "1hr"),
|
||||
SELECTION_ITEM("npc.selection.item", "stick"),
|
||||
REMOVE_PLAYERS_FROM_PLAYER_LIST("Whether to remove NPCs from the Java list of players",
|
||||
"npc.player.remove-from-list", true),
|
||||
RESOURCE_PACK_PATH("The resource pack path to save resource packs to", "general.resource-pack-path",
|
||||
"plugins/Citizens/resourcepack"),
|
||||
SAVE_TASK_DELAY("How often to save NPCs to disk", "storage.save-task.delay", "1hr"),
|
||||
SELECTION_ITEM("The default item in hand to select an NPC", "npc.selection.item", "stick"),
|
||||
SELECTION_MESSAGE("npc.selection.message", "Selected [[<npc>]] (ID [[<id>]])."),
|
||||
SERVER_OWNS_NPCS("npc.server-ownership", false),
|
||||
SERVER_OWNS_NPCS("Whether the server owns NPCs rather than individual players", "npc.server-ownership", false),
|
||||
STORAGE_FILE("storage.file", "saves.yml"),
|
||||
STORAGE_TYPE("storage.type", "yaml"),
|
||||
SUBPLUGIN_FOLDER("subplugins.folder", "plugins"),
|
||||
TABLIST_REMOVE_PACKET_DELAY("npc.tablist.remove-packet-delay", "1t"),
|
||||
TALK_CLOSE_TO_NPCS("npc.chat.options.talk-to-npcs", true),
|
||||
TALK_ITEM("npc.text.talk-item", "*"),
|
||||
USE_BOAT_CONTROLS("npc.controllable.use-boat-controls", true),
|
||||
USE_NEW_PATHFINDER("npc.pathfinding.use-new-finder", false),
|
||||
STORAGE_TYPE("Although technically Citizens can use NBT storage, it is not well tested and YAML is recommended",
|
||||
"storage.type", "yaml"),
|
||||
TABLIST_REMOVE_PACKET_DELAY("How long to wait before sending the tablist remove packet",
|
||||
"npc.tablist.remove-packet-delay", "1t"),
|
||||
TALK_CLOSE_TO_NPCS("Whether to talk to NPCs (and therefore bystanders) as well as players",
|
||||
"npc.chat.options.talk-to-npcs", true),
|
||||
TALK_ITEM("The item filter to talk with", "npc.text.talk-item", "*"),
|
||||
USE_BOAT_CONTROLS("Whether to change vehicle direction with movement instead of strafe controls",
|
||||
"npc.controllable.use-boat-controls", true),
|
||||
USE_NEW_PATHFINDER(
|
||||
"Whether to use the Citizens pathfinder instead of the Minecraft pathfinder<br>Much more flexible, but may have different performance characteristics",
|
||||
"npc.pathfinding.use-new-finder", false),
|
||||
USE_SCOREBOARD_TEAMS("npc.scoreboard-teams.enable", true),
|
||||
WARN_ON_RELOAD("general.reload-warning-enabled", true);
|
||||
|
||||
protected String comments;
|
||||
private Duration duration;
|
||||
protected String migrate;
|
||||
protected String path;
|
||||
@ -194,7 +266,18 @@ public class Settings {
|
||||
}
|
||||
|
||||
Setting(String migrate, String path, Object value) {
|
||||
if (migrate.contains(".")) {
|
||||
this.migrate = migrate;
|
||||
} else {
|
||||
this.comments = migrate;
|
||||
}
|
||||
this.path = path;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
Setting(String comments, String migrate, String path, Object value) {
|
||||
this.migrate = migrate;
|
||||
this.comments = comments;
|
||||
this.path = path;
|
||||
this.value = value;
|
||||
}
|
||||
@ -245,8 +328,13 @@ public class Settings {
|
||||
}
|
||||
|
||||
protected void loadFromKey(DataKey root) {
|
||||
if (root.keyExists(path)) {
|
||||
((YamlKey) root).getSection("").setComments(path,
|
||||
comments == null ? null : Arrays.asList(comments.split("<br>")));
|
||||
}
|
||||
if (migrate != null && root.keyExists(migrate) && !root.keyExists(path)) {
|
||||
value = root.getRaw(migrate);
|
||||
root.removeKey(migrate);
|
||||
} else {
|
||||
value = root.getRaw(path);
|
||||
}
|
||||
|
@ -2935,8 +2935,6 @@ public class NPCCommands {
|
||||
permission = "citizens.npc.speed")
|
||||
public void speed(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
|
||||
float newSpeed = (float) Math.abs(args.getDouble(1));
|
||||
if (newSpeed >= Setting.MAX_SPEED.asDouble())
|
||||
throw new CommandException(Messages.SPEED_MODIFIER_ABOVE_LIMIT);
|
||||
npc.getNavigator().getDefaultParameters().speedModifier(newSpeed);
|
||||
|
||||
Messaging.sendTr(sender, Messages.SPEED_MODIFIER_SET, newSpeed);
|
||||
|
@ -11,6 +11,7 @@ import net.citizensnpcs.api.trait.Trait;
|
||||
import net.citizensnpcs.api.trait.TraitName;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
|
||||
@TraitName("boundingbox")
|
||||
public class BoundingBoxTrait extends Trait implements Supplier<BoundingBox> {
|
||||
@ -31,15 +32,18 @@ public class BoundingBoxTrait extends Trait implements Supplier<BoundingBox> {
|
||||
public BoundingBox get() {
|
||||
Location location = npc.getEntity().getLocation();
|
||||
if (function != null) {
|
||||
return function.apply(getAdjustedBoundingBox()).add(location);
|
||||
BoundingBox bb = function.apply(getAdjustedBoundingBox());
|
||||
NMS.setDimensions(npc.getEntity(), bb.toDimensions());
|
||||
return bb.add(location);
|
||||
}
|
||||
EntityDim dim = getAdjustedBoundingBox();
|
||||
NMS.setDimensions(npc.getEntity(), dim);
|
||||
return new BoundingBox(location.getX() - dim.width / 2, location.getY(), location.getZ() - dim.width / 2,
|
||||
location.getX() + dim.width / 2, location.getY() + dim.height, location.getZ() + dim.width / 2);
|
||||
}
|
||||
|
||||
public EntityDim getAdjustedBoundingBox() {
|
||||
EntityDim desired = base.clone();
|
||||
EntityDim desired = base;
|
||||
if (scale != -1) {
|
||||
desired = desired.mul(scale);
|
||||
}
|
||||
@ -70,8 +74,8 @@ public class BoundingBoxTrait extends Trait implements Supplier<BoundingBox> {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public void setScale(float s) {
|
||||
this.scale = s;
|
||||
public void setScale(float scale) {
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
public void setWidth(float width) {
|
||||
|
@ -89,6 +89,9 @@ public class HologramTrait extends Trait {
|
||||
private NPC createHologram(String line, double heightOffset) {
|
||||
NPC hologramNPC = registry.createNPC(EntityType.ARMOR_STAND, line);
|
||||
hologramNPC.getOrAddTrait(ArmorStandTrait.class).setAsHelperEntityWithName(npc);
|
||||
if (Setting.PACKET_HOLOGRAMS.asBoolean()) {
|
||||
hologramNPC.addTrait(PacketNPC.class);
|
||||
}
|
||||
hologramNPC.spawn(currentLoc.clone().add(0,
|
||||
getEntityHeight()
|
||||
+ (direction == HologramDirection.BOTTOM_UP ? heightOffset : getMaxHeight() - heightOffset),
|
||||
@ -269,8 +272,7 @@ public class HologramTrait extends Trait {
|
||||
|| currentLoc.distance(npc.getStoredLocation()) >= 0.001 || lastNameplateVisible != nameplateVisible
|
||||
|| Math.abs(lastEntityHeight - getEntityHeight()) >= 0.05;
|
||||
boolean updateName = false;
|
||||
if (t++ >= Setting.HOLOGRAM_UPDATE_RATE.asTicks()
|
||||
+ Util.getFastRandom().nextInt(3) /* add some jitter */) {
|
||||
if (t++ >= Setting.HOLOGRAM_UPDATE_RATE.asTicks() + Util.getFastRandom().nextInt(3) /* add some jitter */) {
|
||||
t = 0;
|
||||
updateName = true;
|
||||
}
|
||||
|
@ -106,7 +106,6 @@ public class Messages {
|
||||
public static final String ERROR_GETTING_FIELD = "citizens.nms-errors.getting-field";
|
||||
public static final String ERROR_GETTING_ID_MAPPING = "citizens.nms-errors.getting-id-mapping";
|
||||
public static final String ERROR_GETTING_METHOD = "citizens.nms-errors.getting-method";
|
||||
public static final String ERROR_INITALISING_SUB_PLUGIN = "citizens.sub-plugins.error-on-load";
|
||||
public static final String ERROR_RESTORING_GOALS = "citizens.nms-errors.restoring-goals";
|
||||
public static final String ERROR_SETTING_LOOKCLOSE_RANGE = "citizens.commands.npc.lookclose.error-random-range";
|
||||
public static final String ERROR_SETTING_SKIN_URL = "citizens.commands.npc.skin.error-setting-url";
|
||||
@ -216,7 +215,6 @@ public class Messages {
|
||||
public static final String LOAD_TASK_NOT_SCHEDULED = "citizens.load-task-error";
|
||||
public static final String LOAD_UNKNOWN_NPC_TYPE = "citizens.notifications.unknown-npc-type";
|
||||
public static final String LOADED_ECONOMY = "citizens.economy.loaded";
|
||||
public static final String LOADING_SUB_PLUGIN = "citizens.sub-plugins.load";
|
||||
public static final String LOCALE_NOTIFICATION = "citizens.notifications.locale";
|
||||
public static final String LOOKCLOSE_DISABLE_WHEN_NAVIGATING = "citizens.commands.npc.lookclose.disable-when-navigating";
|
||||
public static final String LOOKCLOSE_ENABLE_WHEN_NAVIGATING = "citizens.commands.npc.lookclose.enable-when-navigating";
|
||||
|
@ -39,7 +39,6 @@ import net.citizensnpcs.api.ai.NavigatorParameters;
|
||||
import net.citizensnpcs.api.astar.pathfinder.SwimmingExaminer;
|
||||
import net.citizensnpcs.api.command.CommandManager;
|
||||
import net.citizensnpcs.api.command.exception.CommandException;
|
||||
import net.citizensnpcs.api.event.NPCEnderTeleportEvent;
|
||||
import net.citizensnpcs.api.event.NPCKnockbackEvent;
|
||||
import net.citizensnpcs.api.jnbt.CompoundTag;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
@ -95,18 +94,6 @@ public class NMS {
|
||||
return BRIDGE.createPacketTracker(entity);
|
||||
}
|
||||
|
||||
public static void enderTeleportTo(NPC npc, Runnable cb) {
|
||||
if (npc == null) {
|
||||
cb.run();
|
||||
return;
|
||||
}
|
||||
NPCEnderTeleportEvent event = new NPCEnderTeleportEvent(npc);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
cb.run();
|
||||
}
|
||||
}
|
||||
|
||||
public static GameProfile fillProfileProperties(GameProfile profile, boolean requireSecure) throws Throwable {
|
||||
return BRIDGE.fillProfileProperties(profile, requireSecure);
|
||||
}
|
||||
@ -518,10 +505,6 @@ public class NMS {
|
||||
.newInstance();
|
||||
}
|
||||
|
||||
public static void loadPlugins() {
|
||||
BRIDGE.loadPlugins();
|
||||
}
|
||||
|
||||
public static void look(Entity entity, float yaw, float pitch) {
|
||||
BRIDGE.look(entity, yaw, pitch);
|
||||
}
|
||||
|
@ -119,8 +119,6 @@ public interface NMSBridge {
|
||||
|
||||
public void load(CommandManager commands);
|
||||
|
||||
public void loadPlugins();
|
||||
|
||||
public void look(Entity from, Entity to);
|
||||
|
||||
public void look(Entity entity, float yaw, float pitch);
|
||||
|
@ -80,6 +80,10 @@ public class Quaternion {
|
||||
c1c2 * c3 - s1s2 * s3);
|
||||
}
|
||||
|
||||
public static Quaternion fromEuler(EulerAngle angle) {
|
||||
return fromEuler(angle.getX(), angle.getY(), angle.getZ());
|
||||
}
|
||||
|
||||
public static Quaternion nlerp(Quaternion a, Quaternion b, double t) {
|
||||
if (a.dot(b) < 0) {
|
||||
b = b.mul(-1);
|
||||
|
@ -1,134 +1,136 @@
|
||||
package net.citizensnpcs.nms.v1_10_R1.entity.nonliving;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftArmorStand;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController;
|
||||
import net.citizensnpcs.nms.v1_10_R1.util.NMSBoundingBox;
|
||||
import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_10_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_10_R1.EntityArmorStand;
|
||||
import net.minecraft.server.v1_10_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_10_R1.EnumHand;
|
||||
import net.minecraft.server.v1_10_R1.EnumInteractionResult;
|
||||
import net.minecraft.server.v1_10_R1.ItemStack;
|
||||
import net.minecraft.server.v1_10_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_10_R1.Vec3D;
|
||||
import net.minecraft.server.v1_10_R1.World;
|
||||
|
||||
public class ArmorStandController extends MobEntityController {
|
||||
public ArmorStandController() {
|
||||
super(EntityArmorStandNPC.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArmorStand getBukkitEntity() {
|
||||
return (ArmorStand) super.getBukkitEntity();
|
||||
}
|
||||
|
||||
public static class ArmorStandNPC extends CraftArmorStand implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public ArmorStandNPC(EntityArmorStandNPC entity) {
|
||||
super((CraftServer) Bukkit.getServer(), entity);
|
||||
this.npc = entity.npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EntityArmorStandNPC extends EntityArmorStand implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public EntityArmorStandNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
|
||||
public EntityArmorStandNPC(World world, NPC npc) {
|
||||
super(world);
|
||||
this.npc = (CitizensNPC) npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB bb) {
|
||||
super.a(NMSBoundingBox.makeBB(npc, bb));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman entityhuman, Vec3D vec3d, ItemStack itemstack, EnumHand enumhand) {
|
||||
if (npc == null) {
|
||||
return super.a(entityhuman, vec3d, itemstack, enumhand);
|
||||
}
|
||||
PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) entityhuman.getBukkitEntity(),
|
||||
getBukkitEntity());
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
return event.isCancelled() ? EnumInteractionResult.FAIL : EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_10_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound save) {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
Vector vector = Util.callPushEvent(npc, x, y, z);
|
||||
if (vector != null) {
|
||||
super.g(vector.getX(), vector.getY(), vector.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new ArmorStandNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void m() {
|
||||
super.m();
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSize(float f, float f1) {
|
||||
if (npc == null) {
|
||||
super.setSize(f, f1);
|
||||
} else {
|
||||
NMSImpl.setSize(this, f, f1, justCreated);
|
||||
}
|
||||
}
|
||||
}
|
||||
package net.citizensnpcs.nms.v1_10_R1.entity;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftArmorStand;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_10_R1.util.NMSBoundingBox;
|
||||
import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_10_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_10_R1.EntityArmorStand;
|
||||
import net.minecraft.server.v1_10_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_10_R1.EnumHand;
|
||||
import net.minecraft.server.v1_10_R1.EnumInteractionResult;
|
||||
import net.minecraft.server.v1_10_R1.ItemStack;
|
||||
import net.minecraft.server.v1_10_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_10_R1.Vec3D;
|
||||
import net.minecraft.server.v1_10_R1.World;
|
||||
|
||||
public class ArmorStandController extends MobEntityController {
|
||||
public ArmorStandController() {
|
||||
super(EntityArmorStandNPC.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArmorStand getBukkitEntity() {
|
||||
return (ArmorStand) super.getBukkitEntity();
|
||||
}
|
||||
|
||||
public static class ArmorStandNPC extends CraftArmorStand implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public ArmorStandNPC(EntityArmorStandNPC entity) {
|
||||
super((CraftServer) Bukkit.getServer(), entity);
|
||||
this.npc = entity.npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EntityArmorStandNPC extends EntityArmorStand implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public EntityArmorStandNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
|
||||
public EntityArmorStandNPC(World world, NPC npc) {
|
||||
super(world);
|
||||
this.npc = (CitizensNPC) npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB bb) {
|
||||
super.a(NMSBoundingBox.makeBB(npc, bb));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman entityhuman, Vec3D vec3d, ItemStack itemstack, EnumHand enumhand) {
|
||||
if (npc == null) {
|
||||
return super.a(entityhuman, vec3d, itemstack, enumhand);
|
||||
}
|
||||
PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) entityhuman.getBukkitEntity(),
|
||||
getBukkitEntity());
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
return event.isCancelled() ? EnumInteractionResult.FAIL : EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_10_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound save) {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
Vector vector = Util.callPushEvent(npc, x, y, z);
|
||||
if (vector != null) {
|
||||
super.g(vector.getX(), vector.getY(), vector.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new ArmorStandNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void m() {
|
||||
super.m();
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSize(float f, float f1) {
|
||||
if (npc == null) {
|
||||
super.setSize(f, f1);
|
||||
} else {
|
||||
NMSImpl.setSize(this, f, f1, justCreated);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -101,10 +101,7 @@ public class BatController extends MobEntityController {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -98,10 +98,7 @@ public class BlazeController extends MobEntityController {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -114,10 +114,7 @@ public class CaveSpiderController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -123,10 +123,7 @@ public class ChickenController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -138,10 +138,7 @@ public class CowController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -131,10 +131,7 @@ public class CreeperController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -97,10 +97,7 @@ public class EnderDragonController extends MobEntityController {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -113,10 +113,7 @@ public class EndermanController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -113,10 +113,7 @@ public class EndermiteController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -20,7 +20,7 @@ import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.citizensnpcs.Settings.Setting;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.event.NPCEnderTeleportEvent;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.npc.NPC.NPCUpdate;
|
||||
import net.citizensnpcs.api.trait.trait.Inventory;
|
||||
@ -172,16 +172,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
if (npc == null)
|
||||
super.enderTeleportTo(d0, d1, d2);
|
||||
NPCEnderTeleportEvent event = new NPCEnderTeleportEvent(npc);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
super.enderTeleportTo(d0, d1, d2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -89,10 +89,7 @@ public class GhastController extends MobEntityController {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class GiantController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -100,10 +100,7 @@ public class GuardianController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -128,10 +128,7 @@ public class HorseController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class IronGolemController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -112,10 +112,7 @@ public class MagmaCubeController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -118,10 +118,7 @@ public class MushroomCowController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -115,10 +115,7 @@ public class OcelotController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -118,10 +118,7 @@ public class PigController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class PigZombieController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -93,10 +93,7 @@ public class PolarBearController extends MobEntityController {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -110,10 +110,7 @@ public class RabbitController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -108,10 +108,7 @@ public class SheepController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -100,10 +100,7 @@ public class ShulkerController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class SilverfishController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class SkeletonController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -113,10 +113,7 @@ public class SlimeController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class SnowmanController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class SpiderController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class SquidController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -132,10 +132,7 @@ public class VillagerController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class WitchController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -89,10 +89,7 @@ public class WitherController extends MobEntityController {
|
||||
: npc.data().get("wither-arrow-shield");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -111,10 +111,7 @@ public class WolfController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class ZombieController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
|
@ -52,7 +52,6 @@ import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.plugin.PluginLoadOrder;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -101,6 +100,7 @@ import net.citizensnpcs.api.trait.TraitInfo;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.ArmorStandController;
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.BatController;
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.BlazeController;
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.CaveSpiderController;
|
||||
@ -138,7 +138,6 @@ import net.citizensnpcs.nms.v1_10_R1.entity.WitherController;
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.WolfController;
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.ZombieController;
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.nonliving.AreaEffectCloudController;
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.nonliving.ArmorStandController;
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.nonliving.BoatController;
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.nonliving.DragonFireballController;
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.nonliving.EggController;
|
||||
@ -777,11 +776,6 @@ public class NMSImpl implements NMSBridge {
|
||||
EntityControllers.setEntityControllerForType(EntityType.ZOMBIE, ZombieController.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadPlugins() {
|
||||
((CraftServer) Bukkit.getServer()).enablePlugins(PluginLoadOrder.POSTWORLD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void look(org.bukkit.entity.Entity entity, float yaw, float pitch) {
|
||||
Entity handle = NMSImpl.getHandle(entity);
|
||||
|
@ -1,123 +1,125 @@
|
||||
package net.citizensnpcs.nms.v1_11_R1.entity.nonliving;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftArmorStand;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController;
|
||||
import net.citizensnpcs.nms.v1_11_R1.util.NMSBoundingBox;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_11_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_11_R1.EntityArmorStand;
|
||||
import net.minecraft.server.v1_11_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_11_R1.EnumHand;
|
||||
import net.minecraft.server.v1_11_R1.EnumInteractionResult;
|
||||
import net.minecraft.server.v1_11_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_11_R1.Vec3D;
|
||||
import net.minecraft.server.v1_11_R1.World;
|
||||
|
||||
public class ArmorStandController extends MobEntityController {
|
||||
public ArmorStandController() {
|
||||
super(EntityArmorStandNPC.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArmorStand getBukkitEntity() {
|
||||
return (ArmorStand) super.getBukkitEntity();
|
||||
}
|
||||
|
||||
public static class ArmorStandNPC extends CraftArmorStand implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public ArmorStandNPC(EntityArmorStandNPC entity) {
|
||||
super((CraftServer) Bukkit.getServer(), entity);
|
||||
this.npc = entity.npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EntityArmorStandNPC extends EntityArmorStand implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public EntityArmorStandNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
|
||||
public EntityArmorStandNPC(World world, NPC npc) {
|
||||
super(world);
|
||||
this.npc = (CitizensNPC) npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB bb) {
|
||||
super.a(NMSBoundingBox.makeBB(npc, bb));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman entityhuman, Vec3D vec3d, EnumHand enumhand) {
|
||||
if (npc == null) {
|
||||
return super.a(entityhuman, vec3d, enumhand);
|
||||
}
|
||||
PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) entityhuman.getBukkitEntity(),
|
||||
getBukkitEntity());
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
return event.isCancelled() ? EnumInteractionResult.FAIL : EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void A_() {
|
||||
super.A_();
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_11_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound save) {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
Vector vector = Util.callPushEvent(npc, x, y, z);
|
||||
if (vector != null) {
|
||||
super.f(vector.getX(), vector.getY(), vector.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new ArmorStandNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
package net.citizensnpcs.nms.v1_11_R1.entity;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftArmorStand;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_11_R1.util.NMSBoundingBox;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_11_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_11_R1.EntityArmorStand;
|
||||
import net.minecraft.server.v1_11_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_11_R1.EnumHand;
|
||||
import net.minecraft.server.v1_11_R1.EnumInteractionResult;
|
||||
import net.minecraft.server.v1_11_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_11_R1.Vec3D;
|
||||
import net.minecraft.server.v1_11_R1.World;
|
||||
|
||||
public class ArmorStandController extends MobEntityController {
|
||||
public ArmorStandController() {
|
||||
super(EntityArmorStandNPC.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArmorStand getBukkitEntity() {
|
||||
return (ArmorStand) super.getBukkitEntity();
|
||||
}
|
||||
|
||||
public static class ArmorStandNPC extends CraftArmorStand implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public ArmorStandNPC(EntityArmorStandNPC entity) {
|
||||
super((CraftServer) Bukkit.getServer(), entity);
|
||||
this.npc = entity.npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EntityArmorStandNPC extends EntityArmorStand implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public EntityArmorStandNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
|
||||
public EntityArmorStandNPC(World world, NPC npc) {
|
||||
super(world);
|
||||
this.npc = (CitizensNPC) npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB bb) {
|
||||
super.a(NMSBoundingBox.makeBB(npc, bb));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman entityhuman, Vec3D vec3d, EnumHand enumhand) {
|
||||
if (npc == null) {
|
||||
return super.a(entityhuman, vec3d, enumhand);
|
||||
}
|
||||
PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) entityhuman.getBukkitEntity(),
|
||||
getBukkitEntity());
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
return event.isCancelled() ? EnumInteractionResult.FAIL : EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void A_() {
|
||||
super.A_();
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_11_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound save) {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
Vector vector = Util.callPushEvent(npc, x, y, z);
|
||||
if (vector != null) {
|
||||
super.f(vector.getX(), vector.getY(), vector.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new ArmorStandNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
}
|
@ -101,10 +101,7 @@ public class BatController extends MobEntityController {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -98,10 +98,7 @@ public class BlazeController extends MobEntityController {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -114,10 +114,7 @@ public class CaveSpiderController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -123,10 +123,7 @@ public class ChickenController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -138,10 +138,7 @@ public class CowController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -123,10 +123,7 @@ public class CreeperController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -97,10 +97,7 @@ public class EnderDragonController extends MobEntityController {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -113,10 +113,7 @@ public class EndermanController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -113,10 +113,7 @@ public class EndermiteController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -20,7 +20,7 @@ import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.citizensnpcs.Settings.Setting;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.event.NPCEnderTeleportEvent;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.npc.NPC.NPCUpdate;
|
||||
import net.citizensnpcs.api.trait.trait.Inventory;
|
||||
@ -186,16 +186,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
if (npc == null)
|
||||
super.enderTeleportTo(d0, d1, d2);
|
||||
NPCEnderTeleportEvent event = new NPCEnderTeleportEvent(npc);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
super.enderTeleportTo(d0, d1, d2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -100,10 +100,7 @@ public class EvokerController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -89,10 +89,7 @@ public class GhastController extends MobEntityController {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class GiantController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -100,10 +100,7 @@ public class GuardianController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -100,10 +100,7 @@ public class GuardianElderController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -120,10 +120,7 @@ public class HorseController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -120,10 +120,7 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -120,10 +120,7 @@ public class HorseMuleController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -121,10 +121,7 @@ public class HorseSkeletonController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -121,10 +121,7 @@ public class HorseZombieController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class IronGolemController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -120,10 +120,7 @@ public class LlamaController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -120,10 +120,7 @@ public class MagmaCubeController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -117,10 +117,7 @@ public class MushroomCowController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -115,10 +115,7 @@ public class OcelotController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -116,10 +116,7 @@ public class PigController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class PigZombieController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -93,10 +93,7 @@ public class PolarBearController extends MobEntityController {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -110,10 +110,7 @@ public class RabbitController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -108,10 +108,7 @@ public class SheepController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -110,10 +110,7 @@ public class ShulkerController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class SilverfishController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class SkeletonController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class SkeletonStrayController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class SkeletonWitherController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -121,10 +121,7 @@ public class SlimeController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class SnowmanController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class SpiderController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class SquidController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -87,10 +87,7 @@ public class VexController extends MobEntityController {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -138,10 +138,7 @@ public class VillagerController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -109,10 +109,7 @@ public class VindicatorController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class WitchController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -89,10 +89,7 @@ public class WitherController extends MobEntityController {
|
||||
: npc.data().get("wither-arrow-shield");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -111,10 +111,7 @@ public class WolfController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class ZombieController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class ZombieHuskController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class ZombieVillagerController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -52,7 +52,6 @@ import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.plugin.PluginLoadOrder;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -101,6 +100,7 @@ import net.citizensnpcs.api.trait.TraitInfo;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.ArmorStandController;
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.BatController;
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.BlazeController;
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.CaveSpiderController;
|
||||
@ -151,7 +151,6 @@ import net.citizensnpcs.nms.v1_11_R1.entity.ZombieController;
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.ZombieHuskController;
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.ZombieVillagerController;
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.nonliving.AreaEffectCloudController;
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.nonliving.ArmorStandController;
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.nonliving.BoatController;
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.nonliving.DragonFireballController;
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.nonliving.EggController;
|
||||
@ -831,11 +830,6 @@ public class NMSImpl implements NMSBridge {
|
||||
EntityControllers.setEntityControllerForType(EntityType.ZOMBIE_VILLAGER, ZombieVillagerController.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadPlugins() {
|
||||
((CraftServer) Bukkit.getServer()).enablePlugins(PluginLoadOrder.POSTWORLD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void look(org.bukkit.entity.Entity entity, float yaw, float pitch) {
|
||||
Entity handle = NMSImpl.getHandle(entity);
|
||||
|
@ -1,123 +1,122 @@
|
||||
package net.citizensnpcs.nms.v1_12_R1.entity.nonliving;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftArmorStand;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController;
|
||||
import net.citizensnpcs.nms.v1_12_R1.util.NMSBoundingBox;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_12_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_12_R1.EntityArmorStand;
|
||||
import net.minecraft.server.v1_12_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_12_R1.EnumHand;
|
||||
import net.minecraft.server.v1_12_R1.EnumInteractionResult;
|
||||
import net.minecraft.server.v1_12_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_12_R1.Vec3D;
|
||||
import net.minecraft.server.v1_12_R1.World;
|
||||
|
||||
public class ArmorStandController extends MobEntityController {
|
||||
public ArmorStandController() {
|
||||
super(EntityArmorStandNPC.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArmorStand getBukkitEntity() {
|
||||
return (ArmorStand) super.getBukkitEntity();
|
||||
}
|
||||
|
||||
public static class ArmorStandNPC extends CraftArmorStand implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public ArmorStandNPC(EntityArmorStandNPC entity) {
|
||||
super((CraftServer) Bukkit.getServer(), entity);
|
||||
this.npc = entity.npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EntityArmorStandNPC extends EntityArmorStand implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public EntityArmorStandNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
|
||||
public EntityArmorStandNPC(World world, NPC npc) {
|
||||
super(world);
|
||||
this.npc = (CitizensNPC) npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB bb) {
|
||||
super.a(NMSBoundingBox.makeBB(npc, bb));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman entityhuman, Vec3D vec3d, EnumHand enumhand) {
|
||||
if (npc == null) {
|
||||
return super.a(entityhuman, vec3d, enumhand);
|
||||
}
|
||||
PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) entityhuman.getBukkitEntity(),
|
||||
getBukkitEntity());
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
return event.isCancelled() ? EnumInteractionResult.FAIL : EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void B_() {
|
||||
super.B_();
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_12_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound save) {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
Vector vector = Util.callPushEvent(npc, x, y, z);
|
||||
if (vector != null) {
|
||||
super.f(vector.getX(), vector.getY(), vector.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new ArmorStandNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
package net.citizensnpcs.nms.v1_12_R1.entity;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftArmorStand;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_12_R1.util.NMSBoundingBox;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_12_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_12_R1.EntityArmorStand;
|
||||
import net.minecraft.server.v1_12_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_12_R1.EnumHand;
|
||||
import net.minecraft.server.v1_12_R1.EnumInteractionResult;
|
||||
import net.minecraft.server.v1_12_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_12_R1.Vec3D;
|
||||
import net.minecraft.server.v1_12_R1.World;
|
||||
|
||||
public class ArmorStandController extends MobEntityController {
|
||||
public ArmorStandController() {
|
||||
super(EntityArmorStandNPC.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArmorStand getBukkitEntity() {
|
||||
return (ArmorStand) super.getBukkitEntity();
|
||||
}
|
||||
|
||||
public static class ArmorStandNPC extends CraftArmorStand implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public ArmorStandNPC(EntityArmorStandNPC entity) {
|
||||
super((CraftServer) Bukkit.getServer(), entity);
|
||||
this.npc = entity.npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EntityArmorStandNPC extends EntityArmorStand implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public EntityArmorStandNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
|
||||
public EntityArmorStandNPC(World world, NPC npc) {
|
||||
super(world);
|
||||
this.npc = (CitizensNPC) npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB bb) {
|
||||
super.a(NMSBoundingBox.makeBB(npc, bb));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman entityhuman, Vec3D vec3d, EnumHand enumhand) {
|
||||
if (npc == null) {
|
||||
return super.a(entityhuman, vec3d, enumhand);
|
||||
}
|
||||
PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) entityhuman.getBukkitEntity(),
|
||||
getBukkitEntity());
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
return event.isCancelled() ? EnumInteractionResult.FAIL : EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void B_() {
|
||||
super.B_();
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_12_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound save) {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
Vector vector = Util.callPushEvent(npc, x, y, z);
|
||||
if (vector != null) {
|
||||
super.f(vector.getX(), vector.getY(), vector.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new ArmorStandNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
}
|
@ -102,10 +102,7 @@ public class BatController extends MobEntityController {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -99,10 +99,7 @@ public class BlazeController extends MobEntityController {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
@ -124,10 +124,7 @@ public class CaveSpiderController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
NMS.enderTeleportTo(npc, () -> super.enderTeleportTo(d0, d1, d2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void f(double x, double y, double z) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user