Remove runTack()

This commit is contained in:
Kam committed 2023-05-16 19:16:34 -04:00
1 parent a6cd55fcea
commit 6df7d3643f
4 files changed
+11 -34

No files matched your search

@@ -174,7 +174,7 @@ public class NoppesUtilServer {
if(npc instanceof EntityDialogNpc || dia.id < 0){
dialog.hideNPC = true;
Server.sendDataDelayed((EntityPlayerMP)player, EnumPacketClient.DIALOG_DUMMY, 100, npc.getCommandSenderName(), dialog.writeToNBT(new NBTTagCompound()));
Server.sendData((EntityPlayerMP)player, EnumPacketClient.DIALOG_DUMMY, npc.getCommandSenderName(), dialog.writeToNBT(new NBTTagCompound()));
}
else
Server.sendData((EntityPlayerMP)player, EnumPacketClient.DIALOG, npc.getEntityId(), dialog.writeToNBT(new NBTTagCompound()));
-13
View File
@@ -25,19 +25,6 @@ public class Server {
sendDataChecked(player, enu, obs);
}
public static void sendDataDelayed(final EntityPlayerMP player, final EnumPacketClient type, int delay, final Object... obs) {
CustomNPCsThreader.runTack(() -> {
PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());
try {
if (!fillBuffer(buffer, type, obs))
return;
CustomNpcs.Channel.sendTo(new FMLProxyPacket(buffer, "CustomNPCs"), player);
} catch (IOException e) {
LogWriter.error(type + " Errored", e);
}
}, delay);
}
public static boolean sendDataChecked(EntityPlayerMP player, EnumPacketClient type, Object... obs) {
PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());
try {
@@ -100,18 +100,16 @@ public class BankData {
NoppesUtilServer.sendOpenGui(player, EnumGuiType.PlayerBankSmall, npc, slot, bank.id, 0);
}
final ItemStack item = currency;
CustomNPCsThreader.runTack(() -> {
NBTTagCompound compound = new NBTTagCompound();
compound.setInteger("MaxSlots", bank.getMaxSlots());
compound.setInteger("UnlockedSlots", unlockedSlots);
if (item != null) {
compound.setTag("Currency", NoppesUtilServer.writeItem(item, new NBTTagCompound()));
ContainerNPCBankInterface container = getContainer(player);
if (container != null)
container.setCurrency(item);
}
Server.sendDataChecked((EntityPlayerMP) player, EnumPacketClient.GUI_DATA, compound);
}, 300);
NBTTagCompound compound = new NBTTagCompound();
compound.setInteger("MaxSlots", bank.getMaxSlots());
compound.setInteger("UnlockedSlots", unlockedSlots);
if (item != null) {
compound.setTag("Currency", NoppesUtilServer.writeItem(item, new NBTTagCompound()));
ContainerNPCBankInterface container = getContainer(player);
if (container != null)
container.setCurrency(item);
}
Server.sendDataChecked((EntityPlayerMP) player, EnumPacketClient.GUI_DATA, compound);
}
private ContainerNPCBankInterface getContainer(EntityPlayer player){
Container con = player.openContainer;
@@ -8,12 +8,4 @@ import java.util.concurrent.TimeUnit;
public class CustomNPCsThreader {
private final static ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
public static final Executor playerDataThread = Executors.newSingleThreadExecutor();
public static void runTack(Runnable task, int delay){
executor.schedule(task, delay, TimeUnit.MILLISECONDS);
}
public static void runTack(Runnable task){
executor.schedule(task, 0, TimeUnit.MILLISECONDS);
}
}