Reorder tablist refresh

This commit is contained in:
fullwall 2014-12-28 14:55:15 +08:00
parent bc16fd739d
commit 273a2b358c
4 changed files with 24 additions and 28 deletions

View File

@ -408,8 +408,8 @@ public class EventListen implements Listener {
} }
private Location roundLocation(Location input) { private Location roundLocation(Location input) {
return new Location(input.getWorld(), Math.floor(input.getX()), return new Location(input.getWorld(), Math.floor(input.getX()), Math.floor(input.getY()), Math.floor(input
Math.floor(input.getY()), Math.floor(input.getZ())); .getZ()));
} }
private boolean spawn(NPC npc) { private boolean spawn(NPC npc) {

View File

@ -25,7 +25,6 @@ import net.minecraft.server.v1_8_R1.BlockPosition;
import net.minecraft.server.v1_8_R1.Entity; import net.minecraft.server.v1_8_R1.Entity;
import net.minecraft.server.v1_8_R1.EntityPlayer; import net.minecraft.server.v1_8_R1.EntityPlayer;
import net.minecraft.server.v1_8_R1.EnumGamemode; import net.minecraft.server.v1_8_R1.EnumGamemode;
import net.minecraft.server.v1_8_R1.EnumPlayerInfoAction;
import net.minecraft.server.v1_8_R1.EnumProtocolDirection; import net.minecraft.server.v1_8_R1.EnumProtocolDirection;
import net.minecraft.server.v1_8_R1.GenericAttributes; import net.minecraft.server.v1_8_R1.GenericAttributes;
import net.minecraft.server.v1_8_R1.MathHelper; import net.minecraft.server.v1_8_R1.MathHelper;
@ -232,8 +231,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
} }
moveOnCurrentHeading(); moveOnCurrentHeading();
} else if (motX != 0 || motZ != 0 || motY != 0) { } else if (motX != 0 || motZ != 0 || motY != 0) {
g(0, 0); // is this necessary? it does controllable but g(0, 0); // is this necessary? it does controllable but sometimes
// sometimes
// players sink into the ground // players sink into the ground
} }

View File

@ -87,8 +87,6 @@ public class HumanController extends AbstractEntityController {
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
@Override @Override
public void run() { public void run() {
// Double check that we're still spawned and haven't changed
// type.
if (npc.isSpawned() && npc.getEntity().getType() == EntityType.PLAYER) { if (npc.isSpawned() && npc.getEntity().getType() == EntityType.PLAYER) {
NMS.sendPlayerlistPacket(false, null, npc); NMS.sendPlayerlistPacket(false, null, npc);
} }

View File

@ -495,12 +495,12 @@ public class NMS {
public static void showNPCReset(final Player player, final NPC npc) { public static void showNPCReset(final Player player, final NPC npc) {
sendDestroyPacket(player, npc); sendDestroyPacket(player, npc);
sendPlayerlistPacket(true, player, npc);
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
@Override @Override
public void run() { public void run() {
if (player.isOnline() && player.isValid() && npc.isSpawned() if (player.isOnline() && player.isValid() && npc.isSpawned()
&& npc.getEntity().getType() == EntityType.PLAYER) { && npc.getEntity().getType() == EntityType.PLAYER) {
sendPlayerlistPacket(true, player, npc);
sendSpawnPacket(player, npc); sendSpawnPacket(player, npc);
} }
} }
@ -513,7 +513,7 @@ public class NMS {
sendPlayerlistPacket(false, player, npc); sendPlayerlistPacket(false, player, npc);
} }
} }
}, 2); }, 10);
} }
public static org.bukkit.entity.Entity spawnCustomEntity(org.bukkit.World world, Location at, public static org.bukkit.entity.Entity spawnCustomEntity(org.bukkit.World world, Location at,