Fix
This commit is contained in:
parent
5c4941f536
commit
d9a8b73b51
@ -2,13 +2,12 @@ package io.izzel.taboolib.client;
|
||||
|
||||
import io.izzel.taboolib.TabooLib;
|
||||
import io.izzel.taboolib.client.packet.Packet;
|
||||
import io.izzel.taboolib.client.packet.PacketSerializer;
|
||||
import io.izzel.taboolib.client.packet.impl.PacketCommand;
|
||||
import io.izzel.taboolib.client.packet.impl.PacketMessage;
|
||||
import io.izzel.taboolib.module.locale.TLocale;
|
||||
import io.izzel.taboolib.module.command.lite.CommandBuilder;
|
||||
import io.izzel.taboolib.client.packet.PacketSerializer;
|
||||
import io.izzel.taboolib.module.locale.TLocale;
|
||||
import io.izzel.taboolib.util.ArrayUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.util.NumberConversions;
|
||||
|
||||
import java.io.*;
|
||||
@ -34,7 +33,7 @@ public class TabooLibClient {
|
||||
public static void init() {
|
||||
if (TabooLibSettings.load()) {
|
||||
connect();
|
||||
Bukkit.getScheduler().runTaskTimerAsynchronously(TabooLib.getPlugin(), TabooLibClient::reconnect, 0, 100);
|
||||
TabooLib.getPlugin().runTaskAsync(TabooLibClient::reconnect, 0, 100);
|
||||
} else {
|
||||
TLocale.sendToConsole("COMMUNICATION.FAILED-LOAD-SETTINGS", TabooLibSettings.getThrowable().toString());
|
||||
}
|
||||
|
@ -134,11 +134,11 @@ public class ListenerCommand implements Listener {
|
||||
public void run(Player player) {
|
||||
player.sendMessage("§8[§fTabooLib§8] §7Lighting. §a(+)");
|
||||
TLight.create(player.getLocation().getBlock(), Type.BLOCK, 15);
|
||||
Bukkit.getScheduler().runTaskLater(TabooLib.getPlugin(), () -> {
|
||||
TabooLib.getPlugin().runTask(() -> {
|
||||
TLight.create(player.getLocation().getBlock(), Type.BLOCK, 5);
|
||||
player.sendMessage("§8[§fTabooLib§8] §7Lighting. §c(-)");
|
||||
}, 20);
|
||||
Bukkit.getScheduler().runTaskLater(TabooLib.getPlugin(), () -> {
|
||||
TabooLib.getPlugin().runTask(() -> {
|
||||
TLight.delete(player.getLocation().getBlock(), Type.BLOCK);
|
||||
player.sendMessage("§8[§fTabooLib§8] §7Lighting. §8(-)");
|
||||
}, 40);
|
||||
|
@ -137,4 +137,64 @@ public class InternalPlugin implements Plugin {
|
||||
public List<String> onTabComplete(CommandSender commandSender, Command command, String s, String[] strings) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void runTask(Runnable runnable) {
|
||||
Bukkit.getScheduler().runTask(this, () -> {
|
||||
try {
|
||||
runnable.run();
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void runTaskAsync(Runnable runnable) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
|
||||
try {
|
||||
runnable.run();
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void runTask(Runnable runnable, long delay) {
|
||||
Bukkit.getScheduler().runTaskLater(this, () -> {
|
||||
try {
|
||||
runnable.run();
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}, delay);
|
||||
}
|
||||
|
||||
public void runTaskAsync(Runnable runnable, long delay) {
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(this, () -> {
|
||||
try {
|
||||
runnable.run();
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}, delay);
|
||||
}
|
||||
|
||||
public void runTask(Runnable runnable, long delay, long period) {
|
||||
Bukkit.getScheduler().runTaskTimer(this, () -> {
|
||||
try {
|
||||
runnable.run();
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}, delay, period);
|
||||
}
|
||||
|
||||
public void runTaskAsync(Runnable runnable, long delay, long period) {
|
||||
Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> {
|
||||
try {
|
||||
runnable.run();
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}, delay, period);
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ public class Hologram {
|
||||
public Hologram flash(List<String> text, int period) {
|
||||
for (int i = 0; i < text.size(); i++) {
|
||||
String line = text.get(i);
|
||||
Bukkit.getScheduler().runTaskLater(TabooLib.getPlugin(), () -> flash(line), period * i);
|
||||
TabooLib.getPlugin().runTask(() -> flash(line), period * i);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@ -129,7 +129,7 @@ public class Hologram {
|
||||
|
||||
public Hologram flash(Vector vector, int period, int times) {
|
||||
for (int i = 0; i < times; i++) {
|
||||
Bukkit.getScheduler().runTaskLater(TabooLib.getPlugin(), () -> flash(location.add(vector)), period * i);
|
||||
TabooLib.getPlugin().runTask(() -> flash(location.add(vector)), period * i);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@ -156,7 +156,7 @@ public class Hologram {
|
||||
}
|
||||
|
||||
public Hologram deleteOn(int delay) {
|
||||
Bukkit.getScheduler().runTaskLater(TabooLib.getPlugin(), this::delete, delay);
|
||||
TabooLib.getPlugin().runTask(this::delete, delay);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ class THologramHandler implements Listener {
|
||||
static boolean d(Player player, Packet packet) {
|
||||
if (packet.is("PacketPlayInPosition") && !learned) {
|
||||
learned = true;
|
||||
Bukkit.getScheduler().runTask(TabooLib.getPlugin(), () -> learn(player));
|
||||
TabooLib.getPlugin().runTask(() -> learn(player));
|
||||
}
|
||||
if (packet.is("PacketPlayInUseEntity")) {
|
||||
int id = packet.read("a", Integer.TYPE);
|
||||
|
@ -35,14 +35,14 @@ class ClickListener implements Listener {
|
||||
public void e(InventoryOpenEvent e) {
|
||||
MenuBuilder builder = MenuHolder.get(e.getInventory());
|
||||
if (builder != null) {
|
||||
Bukkit.getScheduler().runTaskLater(TabooLib.getPlugin(), () -> {
|
||||
TabooLib.getPlugin().runTask(() -> {
|
||||
try {
|
||||
builder.getBuildTask().run(e.getInventory());
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}, 1);
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(TabooLib.getPlugin(), () -> {
|
||||
TabooLib.getPlugin().runTaskAsync(() -> {
|
||||
try {
|
||||
builder.getBuildTaskAsync().run(e.getInventory());
|
||||
} catch (Throwable t) {
|
||||
|
@ -3,7 +3,6 @@ package io.izzel.taboolib.util.lite;
|
||||
import io.izzel.taboolib.TabooLib;
|
||||
import io.izzel.taboolib.module.inject.PlayerContainer;
|
||||
import io.izzel.taboolib.module.inject.TListener;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -38,7 +37,7 @@ public class Catchers implements Listener {
|
||||
if (playerdata.containsKey(e.getPlayer().getName()) && contains(e.getPlayer())) {
|
||||
e.setCancelled(true);
|
||||
// 1.14 supported.
|
||||
Bukkit.getScheduler().runTask(TabooLib.getPlugin(), () -> {
|
||||
TabooLib.getPlugin().runTask(() -> {
|
||||
Catcher catcher = playerdata.get(e.getPlayer().getName()).getFirst();
|
||||
// 退出
|
||||
if (e.getMessage().split(" ")[0].matches(catcher.quit())) {
|
||||
|
@ -8,7 +8,6 @@ import io.izzel.taboolib.module.nms.impl.Position;
|
||||
import io.izzel.taboolib.module.packet.Packet;
|
||||
import io.izzel.taboolib.module.packet.TPacket;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Sign;
|
||||
@ -80,12 +79,8 @@ public class Signs {
|
||||
if (data == null) {
|
||||
return true;
|
||||
}
|
||||
Bukkit.getScheduler().runTask(TabooLib.getPlugin(), () -> {
|
||||
try {
|
||||
TabooLib.getPlugin().runTask(() -> {
|
||||
data.catcher.accept(packet.read("b", new String[0]));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
});
|
||||
signs.remove(data);
|
||||
} catch (Throwable t) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package io.izzel.taboolib.util.lite;
|
||||
|
||||
import io.izzel.taboolib.TabooLib;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -37,11 +36,11 @@ public class SoundPack {
|
||||
}
|
||||
|
||||
public void play(Player p) {
|
||||
Bukkit.getScheduler().runTaskLater(TabooLib.getPlugin(), () -> p.playSound(p.getLocation(), this.sound, this.a, this.b), delay);
|
||||
TabooLib.getPlugin().runTask(() -> p.playSound(p.getLocation(), this.sound, this.a, this.b), delay);
|
||||
}
|
||||
|
||||
public void play(Location l) {
|
||||
Bukkit.getScheduler().runTaskLater(TabooLib.getPlugin(), () -> l.getWorld().playSound(l, this.sound, this.a, this.b), delay);
|
||||
TabooLib.getPlugin().runTask(() -> l.getWorld().playSound(l, this.sound, this.a, this.b), delay);
|
||||
}
|
||||
|
||||
public void parse(String s) {
|
||||
|
Loading…
Reference in New Issue
Block a user