Fix
This commit is contained in:
@@ -21,6 +21,13 @@ public class TScheduleLoader implements TabooLibLoader.Loader {
|
||||
|
||||
static Map<String, List<TScheduleData>> schedules = Maps.newHashMap();
|
||||
|
||||
public static void run(Plugin plugin) {
|
||||
List<TScheduleData> list = schedules.get(plugin.getName());
|
||||
if (list != null) {
|
||||
list.forEach(data -> run(plugin, data.getRunnable(), data.getAnnotation().delay(), data.getAnnotation().period(), data.getAnnotation().async()));
|
||||
}
|
||||
}
|
||||
|
||||
public static void run(Plugin plugin, BukkitRunnable runnable, int delay, int period, boolean async) {
|
||||
if (async) {
|
||||
runnable.runTaskTimerAsynchronously(plugin, delay, period);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class SimpleI18n {
|
||||
}
|
||||
|
||||
public static String getName(Entity entity) {
|
||||
return entity == null ? "-" : lang.getString(NMS.getHandler().getName(entity).replace(".", "_"), entity.getName());
|
||||
return entity == null ? "-" : lang.getString(NMS.handle().getName(entity).replace(".", "_"), entity.getName());
|
||||
}
|
||||
|
||||
public static String getName(ItemStack item) {
|
||||
@@ -69,7 +69,7 @@ public class SimpleI18n {
|
||||
}
|
||||
if (!Version.isAfter(Version.v1_11)) {
|
||||
if (item.getType().name().equals("MONSTER_EGG")) {
|
||||
NBTCompound nbtCompound = NMS.getHandler().loadNBT(item);
|
||||
NBTCompound nbtCompound = NMS.handle().loadNBT(item);
|
||||
if (nbtCompound.containsKey("EntityTag")) {
|
||||
return lang.getString("item_monsterPlacer_name") + " " + lang.getString("entity_" + nbtCompound.get("EntityTag").asCompound().get("id").asString() + "_name");
|
||||
}
|
||||
@@ -79,11 +79,11 @@ public class SimpleI18n {
|
||||
if (itemMeta instanceof SpawnEggMeta) {
|
||||
String spawnEggType = lang.getString("entity_" + ((SpawnEggMeta) itemMeta).getSpawnedType().getEntityClass().getSimpleName().replace(".", "_") + "_name");
|
||||
if (spawnEggType != null) {
|
||||
return lang.getString(NMS.getHandler().getName(item).replace(".", "_"), item.getType().name().toLowerCase().replace("_", "")) + " " + spawnEggType;
|
||||
return lang.getString(NMS.handle().getName(item).replace(".", "_"), item.getType().name().toLowerCase().replace("_", "")) + " " + spawnEggType;
|
||||
}
|
||||
}
|
||||
}
|
||||
return lang.getString(NMS.getHandler().getName(item).replace(".", "_"), item.getType().name().toLowerCase().replace("_", ""));
|
||||
return lang.getString(NMS.handle().getName(item).replace(".", "_"), item.getType().name().toLowerCase().replace("_", ""));
|
||||
}
|
||||
|
||||
private static void releaseLocales(Plugin plugin) {
|
||||
|
||||
@@ -96,11 +96,11 @@ public class TLocale {
|
||||
}
|
||||
|
||||
public static void sendTitle(Player player, String title, String subTitle, int fadein, int stay, int fadeout) {
|
||||
NMS.getHandler().sendTitle(player, title, fadein, stay, fadeout, subTitle, fadein, stay, fadeout);
|
||||
NMS.handle().sendTitle(player, title, fadein, stay, fadeout, subTitle, fadein, stay, fadeout);
|
||||
}
|
||||
|
||||
public static void sendActionBar(Player player, String text) {
|
||||
NMS.getHandler().sendActionBar(player, text);
|
||||
NMS.handle().sendActionBar(player, text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,10 @@ public class TLocaleLoader {
|
||||
}
|
||||
}
|
||||
|
||||
public static void unload(Plugin plugin) {
|
||||
map.remove(plugin.getName());
|
||||
}
|
||||
|
||||
public static boolean isLocaleLoaded(Plugin plugin) {
|
||||
return map.containsKey(plugin.getName());
|
||||
}
|
||||
|
||||
@@ -15,15 +15,15 @@ import org.bukkit.inventory.ItemStack;
|
||||
@TFunction(enable = "init")
|
||||
public abstract class NMS {
|
||||
|
||||
private static NMS handler;
|
||||
private static NMS impl;
|
||||
|
||||
public static NMS getHandler() {
|
||||
return handler;
|
||||
public static NMS handle() {
|
||||
return impl;
|
||||
}
|
||||
|
||||
static void init() {
|
||||
try {
|
||||
handler = (NMS) SimpleVersionControl.createNMS("io.izzel.taboolib.module.nms.NMSHandlerImpl").translate().newInstance();
|
||||
impl = (NMS) SimpleVersionControl.createNMS("io.izzel.taboolib.module.nms.NMSImpl").translate().newInstance();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user