Fixed redundant function calls for saving player data in NoppesUtilServer when using isGUIOpen(). Added getServerTime() to NpcAPI.

This commit is contained in:
luisc committed 2021-11-22 02:33:28 -06:00
1 parent 77c2897109
commit 8a7f40189e
3 files changed
+7 -19

No files matched your search

@@ -707,16 +707,8 @@ public class NoppesUtilServer {
}
public static void isGUIOpen(ByteBuf buffer, EntityPlayer player) throws IOException {
EntityPlayer pl = MinecraftServer.getServer().getConfigurationManager().func_152612_a(player.getDisplayName());
PlayerData playerdata;
if(pl == null)
playerdata = PlayerDataController.instance.getDataFromUsername(player.getDisplayName());
else
playerdata = PlayerDataController.instance.getPlayerData(pl);
PlayerData playerdata = PlayerDataController.instance.getPlayerData(player);
boolean isGUIOpen = buffer.readBoolean();
playerdata.setGUIOpen(isGUIOpen);
sendPlayerData(EnumPlayerData.Players, (EntityPlayerMP)player, player.getDisplayName());
}
}
@@ -92,4 +92,6 @@ public abstract class NpcAPI {
public abstract ScriptItemStack createItem(String id, int damage, int size);
public abstract ScriptEntityParticle createEntityParticle(String directory);
public abstract int getServerTime();
}
@@ -227,12 +227,6 @@ public class WrapperNpcAPI extends NpcAPI {
return arr;
}
/**
* @param id The items name
* @param damage The damage value
* @param size The number of items in the item
* @return Returns the item
*/
public ScriptItemStack createItem(String id, int damage, int size){
Item item = (Item)Item.itemRegistry.getObject(id);
if(item == null)
@@ -240,11 +234,11 @@ public class WrapperNpcAPI extends NpcAPI {
return new ScriptItemStack(new ItemStack(item, size, damage));
}
/**
* @param directory The particle's texture directory. Use only forward slashes when writing a directory. Example: "customnpcs:textures/particle/tail.png"
* @return Returns ScriptEntityParticle object
*/
public ScriptEntityParticle createEntityParticle(String directory){
return new ScriptEntityParticle(directory);
}
public int getServerTime() {
return MinecraftServer.getServer().getTickCounter();
}
}