Run skin getting on the main thread

This commit is contained in:
Sam 2017-03-26 14:13:11 +01:00 committed by cnr
parent 016860b615
commit bd841762d1
2 changed files with 16 additions and 1 deletions

View File

@ -102,7 +102,14 @@ public class AprilFoolsManager extends MiniPlugin
if (_enabled) if (_enabled)
{ {
UtilGameProfile.getProfileByName("Moppletop", false, response -> _pirateSkin = response); try
{
_pirateSkin = UtilGameProfile.getProfileByName("Moppletop", false, null).get();
}
catch (Exception e)
{
e.printStackTrace();
}
for (Map.Entry<Rank, String> entry : RANK_REPLACEMENTS.entrySet()) for (Map.Entry<Rank, String> entry : RANK_REPLACEMENTS.entrySet())
{ {

View File

@ -38,6 +38,7 @@ import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -750,6 +751,13 @@ public class Titles extends MiniDbClientPlugin<TitleData> implements IPacketHand
if (packetInfo.getPacket() instanceof PacketPlayOutNamedEntitySpawn) if (packetInfo.getPacket() instanceof PacketPlayOutNamedEntitySpawn)
{ {
PacketPlayOutNamedEntitySpawn packet = (PacketPlayOutNamedEntitySpawn) packetInfo.getPacket(); PacketPlayOutNamedEntitySpawn packet = (PacketPlayOutNamedEntitySpawn) packetInfo.getPacket();
Entity entity = UtilEnt.getEntityById(packet.a);
if (!(entity instanceof Player))
{
return;
}
Player owner = (Player) UtilEnt.getEntityById(packet.a); Player owner = (Player) UtilEnt.getEntityById(packet.a);
if (_gadgetManager.getActive(owner, GadgetType.MORPH) == null) if (_gadgetManager.getActive(owner, GadgetType.MORPH) == null)
{ {