Fix signs
This commit is contained in:
		@@ -91,8 +91,9 @@ public class PacketSerializer implements Listener {
 | 
				
			|||||||
        Packet packet = null;
 | 
					        Packet packet = null;
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            packet = parser.parser((JsonObject) new JsonParser().parse(origin));
 | 
					            packet = parser.parser((JsonObject) new JsonParser().parse(origin));
 | 
				
			||||||
        } catch (JsonSyntaxException e) {
 | 
					        } catch (JsonSyntaxException ignore) {
 | 
				
			||||||
            e.printStackTrace();
 | 
					        } catch (Throwable t) {
 | 
				
			||||||
 | 
					            t.printStackTrace();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return packet == null ? new PacketEmpty(0) : packet;
 | 
					        return packet == null ? new PacketEmpty(0) : packet;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,7 @@ package io.izzel.taboolib.module.lite;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.google.common.collect.Maps;
 | 
					import com.google.common.collect.Maps;
 | 
				
			||||||
import io.izzel.taboolib.TabooLibAPI;
 | 
					import io.izzel.taboolib.TabooLibAPI;
 | 
				
			||||||
 | 
					import io.izzel.taboolib.module.locale.logger.TLogger;
 | 
				
			||||||
import io.izzel.taboolib.util.Ref;
 | 
					import io.izzel.taboolib.util.Ref;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.lang.reflect.Field;
 | 
					import java.lang.reflect.Field;
 | 
				
			||||||
@@ -65,11 +66,11 @@ public class SimpleReflection {
 | 
				
			|||||||
    public static void setFieldValue(Class<?> nmsClass, Object instance, String fieldName, Object value) {
 | 
					    public static void setFieldValue(Class<?> nmsClass, Object instance, String fieldName, Object value) {
 | 
				
			||||||
        Map<String, Field> fields = fieldCached.get(nmsClass.getName());
 | 
					        Map<String, Field> fields = fieldCached.get(nmsClass.getName());
 | 
				
			||||||
        if (fields == null) {
 | 
					        if (fields == null) {
 | 
				
			||||||
            throw new RuntimeException("Not Found Cache.");
 | 
					            TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        Field field = fields.get(fieldName);
 | 
					        Field field = fields.get(fieldName);
 | 
				
			||||||
        if (value == null) {
 | 
					        if (value == null) {
 | 
				
			||||||
            throw new RuntimeException("Not Found Field.");
 | 
					            TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            field.set(instance, value);
 | 
					            field.set(instance, value);
 | 
				
			||||||
@@ -81,11 +82,11 @@ public class SimpleReflection {
 | 
				
			|||||||
    public static Object getFieldValue(Class<?> nmsClass, Object instance, String fieldName) {
 | 
					    public static Object getFieldValue(Class<?> nmsClass, Object instance, String fieldName) {
 | 
				
			||||||
        Map<String, Field> fields = fieldCached.get(nmsClass.getName());
 | 
					        Map<String, Field> fields = fieldCached.get(nmsClass.getName());
 | 
				
			||||||
        if (fields == null) {
 | 
					        if (fields == null) {
 | 
				
			||||||
            throw new RuntimeException("Not Found Cache.");
 | 
					            TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        Field field = fields.get(fieldName);
 | 
					        Field field = fields.get(fieldName);
 | 
				
			||||||
        if (field == null) {
 | 
					        if (field == null) {
 | 
				
			||||||
            throw new RuntimeException("Not Found Field.");
 | 
					            TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            return field.get(instance);
 | 
					            return field.get(instance);
 | 
				
			||||||
@@ -98,11 +99,11 @@ public class SimpleReflection {
 | 
				
			|||||||
    public static <T> T getFieldValue(Class<?> nmsClass, Object instance, String fieldName, T def) {
 | 
					    public static <T> T getFieldValue(Class<?> nmsClass, Object instance, String fieldName, T def) {
 | 
				
			||||||
        Map<String, Field> fields = fieldCached.get(nmsClass.getName());
 | 
					        Map<String, Field> fields = fieldCached.get(nmsClass.getName());
 | 
				
			||||||
        if (fields == null) {
 | 
					        if (fields == null) {
 | 
				
			||||||
            throw new RuntimeException("Not Found Cache.");
 | 
					            TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        Field field = fields.get(fieldName);
 | 
					        Field field = fields.get(fieldName);
 | 
				
			||||||
        if (field == null) {
 | 
					        if (field == null) {
 | 
				
			||||||
            throw new RuntimeException("Not Found Field.");
 | 
					            TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            return (T) field.get(instance);
 | 
					            return (T) field.get(instance);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,6 @@ import io.izzel.taboolib.module.packet.TPacket;
 | 
				
			|||||||
import org.apache.commons.lang3.Validate;
 | 
					import org.apache.commons.lang3.Validate;
 | 
				
			||||||
import org.bukkit.Bukkit;
 | 
					import org.bukkit.Bukkit;
 | 
				
			||||||
import org.bukkit.Location;
 | 
					import org.bukkit.Location;
 | 
				
			||||||
import org.bukkit.Material;
 | 
					 | 
				
			||||||
import org.bukkit.block.Block;
 | 
					import org.bukkit.block.Block;
 | 
				
			||||||
import org.bukkit.block.Sign;
 | 
					import org.bukkit.block.Sign;
 | 
				
			||||||
import org.bukkit.entity.Player;
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
@@ -38,7 +37,7 @@ public class Signs {
 | 
				
			|||||||
        Location location = player.getLocation();
 | 
					        Location location = player.getLocation();
 | 
				
			||||||
        location.setY(0);
 | 
					        location.setY(0);
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            player.sendBlockChange(location, Material.WALL_SIGN, (byte) 0);
 | 
					            player.sendBlockChange(location, Materials.OAK_WALL_SIGN.parseMaterial(), (byte) 0);
 | 
				
			||||||
            player.sendSignChange(location, format(origin));
 | 
					            player.sendSignChange(location, format(origin));
 | 
				
			||||||
        } catch (Throwable t) {
 | 
					        } catch (Throwable t) {
 | 
				
			||||||
            t.printStackTrace();
 | 
					            t.printStackTrace();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user