mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-14 04:02:01 +01:00
Minor fix for player tab list
This commit is contained in:
parent
9048d0738a
commit
651fbac979
@ -25,7 +25,6 @@ import net.citizensnpcs.api.npc.NPCRegistry;
|
||||
import net.citizensnpcs.api.trait.trait.Owner;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.editor.Editor;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.trait.Controllable;
|
||||
import net.citizensnpcs.trait.CurrentLocation;
|
||||
import net.citizensnpcs.util.Messages;
|
||||
@ -129,7 +128,7 @@ public class EventListen implements Listener {
|
||||
toRespawn.put(coord, npc);
|
||||
if (Messaging.isDebugging()) {
|
||||
Messaging
|
||||
.debug("Despawned id", npc.getId(), "due to chunk unload at [" + coord.x + "," + coord.z + "]");
|
||||
.debug("Despawned id", npc.getId(), "due to chunk unload at [" + coord.x + "," + coord.z + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -249,7 +248,7 @@ public class EventListen implements Listener {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
|
||||
if (!(event.getPlayer() instanceof NPCHolder))
|
||||
if (npcRegistry.getNPC(event.getPlayer()) == null)
|
||||
return;
|
||||
NMS.removeFromServerPlayerList(event.getPlayer());
|
||||
// on teleport, player NPCs are added to the server player list. this is
|
||||
|
@ -89,9 +89,9 @@ public class BlockBreaker extends BehaviorGoalAdapter {
|
||||
startDigTick = currentTick;
|
||||
if (entity instanceof NPCHolder) {
|
||||
NPC npc = ((NPCHolder) entity).getNPC();
|
||||
if (!npc.getNavigator().isNavigating()) {
|
||||
if (npc != null && !npc.getNavigator().isNavigating()) {
|
||||
npc.getNavigator()
|
||||
.setTarget(entity.world.getWorld().getBlockAt(x, y, z).getLocation().add(0, 1, 0));
|
||||
.setTarget(entity.world.getWorld().getBlockAt(x, y, z).getLocation().add(0, 1, 0));
|
||||
}
|
||||
}
|
||||
return BehaviorStatus.RUNNING;
|
||||
@ -108,7 +108,7 @@ public class BlockBreaker extends BehaviorGoalAdapter {
|
||||
float damage = getStrength(block) * (tickDifference + 1) * configuration.blockStrengthModifier();
|
||||
if (damage >= 1F) {
|
||||
entity.world.getWorld().getBlockAt(x, y, z)
|
||||
.breakNaturally(CraftItemStack.asCraftMirror(getCurrentItem()));
|
||||
.breakNaturally(CraftItemStack.asCraftMirror(getCurrentItem()));
|
||||
return BehaviorStatus.SUCCESS;
|
||||
}
|
||||
int modifiedDamage = (int) (damage * 10.0F);
|
||||
|
@ -230,7 +230,7 @@ public class CitizensNavigator implements Navigator, Runnable {
|
||||
NavigationStuckEvent event = new NavigationStuckEvent(this, action);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
action = event.getAction();
|
||||
boolean shouldContinue = action != null ? action.run(npc, this): false;
|
||||
boolean shouldContinue = action != null ? action.run(npc, this) : false;
|
||||
if (shouldContinue) {
|
||||
stationaryTicks = 0;
|
||||
executing.clearCancelReason();
|
||||
|
@ -42,6 +42,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -293,7 +294,16 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
if (useListName != this.useListName || this.useListName == -1) {
|
||||
this.useListName = useListName;
|
||||
}
|
||||
NMS.sendToOnline(getListPacket(removeFromPlayerList));
|
||||
boolean sendListPacket = true;
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (player.getName().equalsIgnoreCase(getName())) {
|
||||
sendListPacket = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sendListPacket) {
|
||||
NMS.sendToOnline(getListPacket(removeFromPlayerList));
|
||||
}
|
||||
NMS.sendPacketsNearby(getBukkitEntity(), current, packets);
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ public class NMS {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static Constructor<?> getCustomEntityConstructor(Class<?> clazz, EntityType type) throws SecurityException,
|
||||
NoSuchMethodException {
|
||||
NoSuchMethodException {
|
||||
Constructor<?> constructor = ENTITY_CONSTRUCTOR_CACHE.get(clazz);
|
||||
if (constructor == null) {
|
||||
constructor = clazz.getConstructor(World.class);
|
||||
@ -295,6 +295,8 @@ public class NMS {
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void minecartItemLogic(EntityMinecartAbstract minecart) {
|
||||
NPC npc = ((NPCHolder) minecart).getNPC();
|
||||
if (npc == null)
|
||||
return;
|
||||
Material mat = Material.getMaterial(npc.data().get(NPC.MINECART_ITEM_METADATA, ""));
|
||||
int data = npc.data().get(NPC.MINECART_ITEM_DATA_METADATA, 0);
|
||||
int offset = npc.data().get(NPC.MINECART_OFFSET_METADATA, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user