Update 5.2
This commit is contained in:
parent
ea029a9466
commit
5ab083f19a
@ -6,7 +6,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'me.skymc'
|
group = 'me.skymc'
|
||||||
version = '5.19'
|
version = '5.2'
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
targetCompatibility = 1.8
|
targetCompatibility = 1.8
|
||||||
|
@ -48,8 +48,7 @@ public class TConfigWatcher {
|
|||||||
public void addSimpleListener(File file, Runnable runnable) {
|
public void addSimpleListener(File file, Runnable runnable) {
|
||||||
try {
|
try {
|
||||||
addListener(file, null, obj -> runnable.run());
|
addListener(file, null, obj -> runnable.run());
|
||||||
} catch (Throwable t) {
|
} catch (Throwable ignored) {
|
||||||
t.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,14 +48,12 @@ public class TInjectHelper {
|
|||||||
instance.add(PluginLoader.get(plugin));
|
instance.add(PluginLoader.get(plugin));
|
||||||
}
|
}
|
||||||
// TInject
|
// TInject
|
||||||
else if (TInjectCreator.getInstanceMap().entrySet().stream().anyMatch(e -> e.getKey().getType().equals(pluginClass))) {
|
if (TInjectCreator.getInstanceMap().entrySet().stream().anyMatch(e -> e.getKey().getType().equals(pluginClass))) {
|
||||||
TInjectCreator.getInstanceMap().entrySet().stream().filter(e -> e.getKey().getType().equals(pluginClass)).forEach(i -> instance.add(i.getValue().getInstance()));
|
TInjectCreator.getInstanceMap().entrySet().stream().filter(e -> e.getKey().getType().equals(pluginClass)).forEach(i -> instance.add(i.getValue().getInstance()));
|
||||||
}
|
}
|
||||||
// TListener
|
// TListener
|
||||||
else {
|
|
||||||
instance.addAll(TListenerHandler.getInstance(plugin, pluginClass));
|
instance.addAll(TListenerHandler.getInstance(plugin, pluginClass));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// Nothing
|
// Nothing
|
||||||
if (instance.isEmpty()) {
|
if (instance.isEmpty()) {
|
||||||
TLogger.getGlobalLogger().error(field.getName() + " is not a static field. (" + pluginClass.getName() + ")");
|
TLogger.getGlobalLogger().error(field.getName() + " is not a static field. (" + pluginClass.getName() + ")");
|
||||||
@ -84,9 +82,11 @@ public class TInjectHelper {
|
|||||||
instance.add(PluginLoader.get(plugin));
|
instance.add(PluginLoader.get(plugin));
|
||||||
}
|
}
|
||||||
// TInject
|
// TInject
|
||||||
else if (TInjectCreator.getInstanceMap().entrySet().stream().anyMatch(e -> e.getKey().getType().equals(pluginClass))) {
|
if (TInjectCreator.getInstanceMap().entrySet().stream().anyMatch(e -> e.getKey().getType().equals(pluginClass))) {
|
||||||
TInjectCreator.getInstanceMap().entrySet().stream().filter(e -> e.getKey().getType().equals(pluginClass)).forEach(i -> instance.add(i.getValue().getInstance()));
|
TInjectCreator.getInstanceMap().entrySet().stream().filter(e -> e.getKey().getType().equals(pluginClass)).forEach(i -> instance.add(i.getValue().getInstance()));
|
||||||
}
|
}
|
||||||
|
// TListener
|
||||||
|
instance.addAll(TListenerHandler.getInstance(plugin, pluginClass));
|
||||||
}
|
}
|
||||||
// Nothing
|
// Nothing
|
||||||
if (instance.isEmpty()) {
|
if (instance.isEmpty()) {
|
||||||
|
@ -11,7 +11,6 @@ import io.izzel.taboolib.module.nms.nbt.Attribute;
|
|||||||
import io.izzel.taboolib.module.nms.nbt.NBTBase;
|
import io.izzel.taboolib.module.nms.nbt.NBTBase;
|
||||||
import io.izzel.taboolib.module.nms.nbt.NBTCompound;
|
import io.izzel.taboolib.module.nms.nbt.NBTCompound;
|
||||||
import io.izzel.taboolib.module.nms.nbt.NBTList;
|
import io.izzel.taboolib.module.nms.nbt.NBTList;
|
||||||
import io.izzel.taboolib.util.Reflection;
|
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
@ -76,11 +75,7 @@ public class Items {
|
|||||||
public static Material asMaterial(String args) {
|
public static Material asMaterial(String args) {
|
||||||
try {
|
try {
|
||||||
Material material = Material.getMaterial(args.toUpperCase());
|
Material material = Material.getMaterial(args.toUpperCase());
|
||||||
if (material != null) {
|
return material != null ? material : Material.getMaterial(Integer.valueOf(args));
|
||||||
return material;
|
|
||||||
}
|
|
||||||
Object getById = Reflection.invokeMethod(Material.class, "getMaterial", NumberConversions.toInt(args));
|
|
||||||
return getById != null ? (Material) getById : null;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return Material.STONE;
|
return Material.STONE;
|
||||||
}
|
}
|
||||||
@ -106,11 +101,7 @@ public class Items {
|
|||||||
public static Enchantment asEnchantment(String enchant) {
|
public static Enchantment asEnchantment(String enchant) {
|
||||||
try {
|
try {
|
||||||
Enchantment enchantment = Enchantment.getByName(enchant);
|
Enchantment enchantment = Enchantment.getByName(enchant);
|
||||||
if (enchantment != null) {
|
return enchantment != null ? enchantment : Enchantment.getById(Integer.valueOf(enchant));
|
||||||
return enchantment;
|
|
||||||
}
|
|
||||||
Object getById = Reflection.invokeMethod(Enchantment.class, "getById", NumberConversions.toInt(enchant));
|
|
||||||
return getById != null ? (Enchantment) getById : null;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user