mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 13:25:10 +00:00
Remove runTack()
This commit is contained in:
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()));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user