Update 5.2
This commit is contained in:
		@@ -48,8 +48,7 @@ public class TConfigWatcher {
 | 
			
		||||
    public void addSimpleListener(File file, Runnable runnable) {
 | 
			
		||||
        try {
 | 
			
		||||
            addListener(file, null, obj -> runnable.run());
 | 
			
		||||
        } catch (Throwable t) {
 | 
			
		||||
            t.printStackTrace();
 | 
			
		||||
        } catch (Throwable ignored) {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -48,13 +48,11 @@ public class TInjectHelper {
 | 
			
		||||
                instance.add(PluginLoader.get(plugin));
 | 
			
		||||
            }
 | 
			
		||||
            // 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()));
 | 
			
		||||
            }
 | 
			
		||||
            // TListener
 | 
			
		||||
            else {
 | 
			
		||||
                instance.addAll(TListenerHandler.getInstance(plugin, pluginClass));
 | 
			
		||||
            }
 | 
			
		||||
            instance.addAll(TListenerHandler.getInstance(plugin, pluginClass));
 | 
			
		||||
        }
 | 
			
		||||
        // Nothing
 | 
			
		||||
        if (instance.isEmpty()) {
 | 
			
		||||
@@ -84,9 +82,11 @@ public class TInjectHelper {
 | 
			
		||||
                instance.add(PluginLoader.get(plugin));
 | 
			
		||||
            }
 | 
			
		||||
            // 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()));
 | 
			
		||||
            }
 | 
			
		||||
            // TListener
 | 
			
		||||
            instance.addAll(TListenerHandler.getInstance(plugin, pluginClass));
 | 
			
		||||
        }
 | 
			
		||||
        // Nothing
 | 
			
		||||
        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.NBTCompound;
 | 
			
		||||
import io.izzel.taboolib.module.nms.nbt.NBTList;
 | 
			
		||||
import io.izzel.taboolib.util.Reflection;
 | 
			
		||||
import org.bukkit.Color;
 | 
			
		||||
import org.bukkit.Material;
 | 
			
		||||
import org.bukkit.configuration.ConfigurationSection;
 | 
			
		||||
@@ -76,11 +75,7 @@ public class Items {
 | 
			
		||||
    public static Material asMaterial(String args) {
 | 
			
		||||
        try {
 | 
			
		||||
            Material material = Material.getMaterial(args.toUpperCase());
 | 
			
		||||
            if (material != null) {
 | 
			
		||||
                return material;
 | 
			
		||||
            }
 | 
			
		||||
            Object getById = Reflection.invokeMethod(Material.class, "getMaterial", NumberConversions.toInt(args));
 | 
			
		||||
            return getById != null ? (Material) getById : null;
 | 
			
		||||
            return material != null ? material : Material.getMaterial(Integer.valueOf(args));
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            return Material.STONE;
 | 
			
		||||
        }
 | 
			
		||||
@@ -106,11 +101,7 @@ public class Items {
 | 
			
		||||
    public static Enchantment asEnchantment(String enchant) {
 | 
			
		||||
        try {
 | 
			
		||||
            Enchantment enchantment = Enchantment.getByName(enchant);
 | 
			
		||||
            if (enchantment != null) {
 | 
			
		||||
                return enchantment;
 | 
			
		||||
            }
 | 
			
		||||
            Object getById = Reflection.invokeMethod(Enchantment.class, "getById", NumberConversions.toInt(enchant));
 | 
			
		||||
            return getById != null ? (Enchantment) getById : null;
 | 
			
		||||
            return enchantment != null ? enchantment : Enchantment.getById(Integer.valueOf(enchant));
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user