mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-28 02:01:35 +01:00
Reorder tablist refresh
This commit is contained in:
parent
bc16fd739d
commit
273a2b358c
@ -131,7 +131,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 + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -408,8 +408,8 @@ public class EventListen implements Listener {
|
||||
}
|
||||
|
||||
private Location roundLocation(Location input) {
|
||||
return new Location(input.getWorld(), Math.floor(input.getX()),
|
||||
Math.floor(input.getY()), Math.floor(input.getZ()));
|
||||
return new Location(input.getWorld(), Math.floor(input.getX()), Math.floor(input.getY()), Math.floor(input
|
||||
.getZ()));
|
||||
}
|
||||
|
||||
private boolean spawn(NPC npc) {
|
||||
|
@ -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.EntityPlayer;
|
||||
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.GenericAttributes;
|
||||
import net.minecraft.server.v1_8_R1.MathHelper;
|
||||
@ -232,8 +231,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
}
|
||||
moveOnCurrentHeading();
|
||||
} else if (motX != 0 || motZ != 0 || motY != 0) {
|
||||
g(0, 0); // is this necessary? it does controllable but
|
||||
// sometimes
|
||||
g(0, 0); // is this necessary? it does controllable but sometimes
|
||||
// players sink into the ground
|
||||
}
|
||||
|
||||
|
@ -87,8 +87,6 @@ public class HumanController extends AbstractEntityController {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Double check that we're still spawned and haven't changed
|
||||
// type.
|
||||
if (npc.isSpawned() && npc.getEntity().getType() == EntityType.PLAYER) {
|
||||
NMS.sendPlayerlistPacket(false, null, npc);
|
||||
}
|
||||
@ -145,8 +143,8 @@ public class HumanController extends AbstractEntityController {
|
||||
private GameProfile fillProfileProperties(YggdrasilAuthenticationService auth, GameProfile profile,
|
||||
boolean requireSecure) throws Exception {
|
||||
URL url = HttpAuthenticationService.constantURL(new StringBuilder()
|
||||
.append("https://sessionserver.mojang.com/session/minecraft/profile/")
|
||||
.append(UUIDTypeAdapter.fromUUID(profile.getId())).toString());
|
||||
.append("https://sessionserver.mojang.com/session/minecraft/profile/")
|
||||
.append(UUIDTypeAdapter.fromUUID(profile.getId())).toString());
|
||||
url = HttpAuthenticationService.concatenateURL(url,
|
||||
new StringBuilder().append("unsigned=").append(!requireSecure).toString());
|
||||
MinecraftProfilePropertiesResponse response = (MinecraftProfilePropertiesResponse) MAKE_REQUEST.invoke(
|
||||
@ -173,7 +171,7 @@ public class HumanController extends AbstractEntityController {
|
||||
if (cached != null) {
|
||||
if (Messaging.isDebugging()) {
|
||||
Messaging
|
||||
.debug("Using cached skin texture for NPC " + npc.getName() + " UUID " + npc.getUniqueId());
|
||||
.debug("Using cached skin texture for NPC " + npc.getName() + " UUID " + npc.getUniqueId());
|
||||
}
|
||||
skinProfile = new GameProfile(UUID.fromString(realUUID), "");
|
||||
skinProfile.getProperties().put("textures", cached);
|
||||
@ -185,7 +183,7 @@ public class HumanController extends AbstractEntityController {
|
||||
} catch (Exception e) {
|
||||
if ((e.getMessage() != null && e.getMessage().contains("too many requests"))
|
||||
|| (e.getCause() != null && e.getCause().getMessage() != null && e.getCause().getMessage()
|
||||
.contains("too many requests"))) {
|
||||
.contains("too many requests"))) {
|
||||
SKIN_THREAD.delay();
|
||||
SKIN_THREAD.addRunnable(this);
|
||||
}
|
||||
@ -283,21 +281,21 @@ public class HumanController extends AbstractEntityController {
|
||||
.getGameProfileRepository();
|
||||
repo.findProfilesByNames(new String[] { ChatColor.stripColor(reportedUUID) }, Agent.MINECRAFT,
|
||||
new ProfileLookupCallback() {
|
||||
@Override
|
||||
public void onProfileLookupFailed(GameProfile arg0, Exception arg1) {
|
||||
}
|
||||
@Override
|
||||
public void onProfileLookupFailed(GameProfile arg0, Exception arg1) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProfileLookupSucceeded(final GameProfile profile) {
|
||||
UUID_CACHE.put(reportedUUID, profile.getId().toString());
|
||||
if (Messaging.isDebugging()) {
|
||||
Messaging.debug("Fetched UUID " + profile.getId() + " for NPC " + npc.getName()
|
||||
+ " UUID " + npc.getUniqueId());
|
||||
}
|
||||
npc.data().setPersistent(CACHED_SKIN_UUID_METADATA, profile.getId().toString());
|
||||
npc.data().setPersistent(CACHED_SKIN_UUID_NAME_METADATA, profile.getName());
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onProfileLookupSucceeded(final GameProfile profile) {
|
||||
UUID_CACHE.put(reportedUUID, profile.getId().toString());
|
||||
if (Messaging.isDebugging()) {
|
||||
Messaging.debug("Fetched UUID " + profile.getId() + " for NPC " + npc.getName()
|
||||
+ " UUID " + npc.getUniqueId());
|
||||
}
|
||||
npc.data().setPersistent(CACHED_SKIN_UUID_METADATA, profile.getId().toString());
|
||||
npc.data().setPersistent(CACHED_SKIN_UUID_NAME_METADATA, profile.getName());
|
||||
}
|
||||
});
|
||||
return npc.data().get(CACHED_SKIN_UUID_METADATA, reportedUUID);
|
||||
}
|
||||
}
|
||||
|
@ -495,12 +495,12 @@ public class NMS {
|
||||
|
||||
public static void showNPCReset(final Player player, final NPC npc) {
|
||||
sendDestroyPacket(player, npc);
|
||||
sendPlayerlistPacket(true, player, npc);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (player.isOnline() && player.isValid() && npc.isSpawned()
|
||||
&& npc.getEntity().getType() == EntityType.PLAYER) {
|
||||
sendPlayerlistPacket(true, player, npc);
|
||||
sendSpawnPacket(player, npc);
|
||||
}
|
||||
}
|
||||
@ -513,7 +513,7 @@ public class NMS {
|
||||
sendPlayerlistPacket(false, player, npc);
|
||||
}
|
||||
}
|
||||
}, 2);
|
||||
}, 10);
|
||||
}
|
||||
|
||||
public static org.bukkit.entity.Entity spawnCustomEntity(org.bukkit.World world, Location at,
|
||||
|
Loading…
Reference in New Issue
Block a user