diff --git a/pom.xml b/pom.xml
index b22d8db..e2cdbec 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
me.skymc
TabooLib
- 4.12
+ 4.13
UTF-8
diff --git a/src/main/java/com/ilummc/tlib/resources/TLocale.java b/src/main/java/com/ilummc/tlib/resources/TLocale.java
index c696a4d..9d4363f 100644
--- a/src/main/java/com/ilummc/tlib/resources/TLocale.java
+++ b/src/main/java/com/ilummc/tlib/resources/TLocale.java
@@ -140,6 +140,8 @@ public class TLocale {
public static class Tellraw extends TLocale {
+ private static final Class> chatSerializer = NMSUtils.getNMSClassSilent("ChatSerializer", "IChatBaseComponent");
+ private static final Method chatSerializerA = NMSUtils.getMethodSilent(chatSerializer, "a", String.class);
private static final Field playerConnection = NMSUtils.getFieldSilent(NMSUtil19.class_EntityPlayer, "playerConnection");
private static final Method sendPacket = NMSUtils.getMethodSilent(NMSUtil19.class_PlayerConnection, "sendPacket", NMSUtil19.class_Packet);
private static final Constructor> PacketPlayOutChat = NMSUtils.getConstructorSilent(NMSUtil19.class_PacketPlayOutChat, NMSUtil19.class_IChatBaseComponent);
@@ -147,7 +149,7 @@ public class TLocale {
public static void send(CommandSender sender, String rawMessage) {
if (sender instanceof Player) {
try {
- sendPacket.invoke(playerConnection.get(NMSUtils.getHandle(sender)), PacketPlayOutChat.newInstance(rawMessage));
+ sendPacket.invoke(playerConnection.get(NMSUtils.getHandle(sender)), PacketPlayOutChat.newInstance(chatSerializerA.invoke(null, rawMessage)));
} catch (Exception e) {
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "tellraw " + sender.getName() + " " + rawMessage);
}
diff --git a/src/main/java/me/skymc/taboolib/Main.java b/src/main/java/me/skymc/taboolib/Main.java
index 53aacd2..6185548 100644
--- a/src/main/java/me/skymc/taboolib/Main.java
+++ b/src/main/java/me/skymc/taboolib/Main.java
@@ -254,7 +254,7 @@ public class Main extends JavaPlugin implements Listener {
}
// 提示信息
- TLocale.Logger.error("NOTIFY.SUCCESS-DISABLE");
+ TLocale.Logger.info("NOTIFY.SUCCESS-DISABLE");
// 结束连接
if (connection != null && connection.isConnection()) {
diff --git a/src/main/java/me/skymc/taboolib/json/tellraw/TellrawJson.java b/src/main/java/me/skymc/taboolib/json/tellraw/TellrawJson.java
index 15d3caf..0e88dd6 100644
--- a/src/main/java/me/skymc/taboolib/json/tellraw/TellrawJson.java
+++ b/src/main/java/me/skymc/taboolib/json/tellraw/TellrawJson.java
@@ -13,6 +13,7 @@ import me.skymc.taboolib.string.VariableFormatter;
import org.bukkit.command.CommandSender;
import org.bukkit.inventory.ItemStack;
+import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collections;
@@ -55,6 +56,14 @@ public class TellrawJson {
return this;
}
+ public TellrawJson append(TellrawJson json) {
+ BaseComponent[] newArray = new BaseComponent[components.length + json.components.length];
+ System.arraycopy(components, 0, newArray, 0, components.length);
+ System.arraycopy(json.components, 0, newArray, components.length, json.components.length);
+ components = newArray;
+ return this;
+ }
+
public TellrawJson hoverText(String text) {
getLatestComponent().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(text).create()));
return this;
diff --git a/src/main/java/me/skymc/taboolib/nms/NMSUtil19.java b/src/main/java/me/skymc/taboolib/nms/NMSUtil19.java
index 95e6be3..5a59bf6 100644
--- a/src/main/java/me/skymc/taboolib/nms/NMSUtil19.java
+++ b/src/main/java/me/skymc/taboolib/nms/NMSUtil19.java
@@ -539,7 +539,7 @@ public class NMSUtil19 {
class_NBTTagList_getDoubleMethod = class_NBTTagList.getMethod("e", Integer.TYPE);
}
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred while registering NBTTagList.getDouble, loading entities from schematics will not work", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred while registering NBTTagList.getDouble, loading entities from schematics will not work");
class_NBTTagList_getDoubleMethod = null;
}
@@ -577,7 +577,7 @@ public class NMSUtil19 {
}
}
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred while registering entity movement accessors, vehicle control will not work", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred while registering entity movement accessors, vehicle control will not work");
class_Entity_jumpingField = null;
class_Entity_moveStrafingField = null;
class_Entity_moveForwardField = null;
@@ -589,7 +589,7 @@ public class NMSUtil19 {
Class> craftMagicNumbers = fixBukkitClass("org.bukkit.craftbukkit.util.CraftMagicNumbers");
class_CraftMagicNumbers_getBlockMethod = craftMagicNumbers.getMethod("getBlock", Material.class);
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred while registering block durability accessor, durability-based block checks will not work", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred while registering block durability accessor, durability-based block checks will not work");
class_Block_durabilityField = null;
class_CraftMagicNumbers_getBlockMethod = null;
}
@@ -614,7 +614,7 @@ public class NMSUtil19 {
class_PacketPlayOutChat_constructor = class_PacketPlayOutChat.getConstructor(class_IChatBaseComponent, Byte.TYPE);
}
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred while registering action bar methods, action bar messages will not work", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred while registering action bar methods, action bar messages will not work");
class_PacketPlayOutChat = null;
}
@@ -631,7 +631,7 @@ public class NMSUtil19 {
class_CraftWorld_spawnMethod = class_CraftWorld.getMethod("spawn", Location.class, Class.class, CreatureSpawnEvent.SpawnReason.class);
}
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred while registering custom spawn method, spawn reasons will not work", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred while registering custom spawn method, spawn reasons will not work");
class_CraftWorld_spawnMethod = null;
class_Consumer = null;
}
@@ -642,7 +642,7 @@ public class NMSUtil19 {
class_TileEntity_updateMethod = class_TileEntity.getMethod("update");
class_TileEntity_saveMethod = class_TileEntity.getMethod("save", class_NBTTagCompound);
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred, handling of tile entities may not work well", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred, handling of tile entities may not work well");
class_TileEntity_loadMethod = null;
class_TileEntity_updateMethod = null;
class_TileEntity_saveMethod = null;
@@ -651,7 +651,7 @@ public class NMSUtil19 {
try {
class_NBTCompressedStreamTools_loadFileMethod = class_NBTCompressedStreamTools.getMethod("a", InputStream.class);
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred, schematics will not load", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred, schematics will not load");
}
try {
@@ -659,7 +659,7 @@ public class NMSUtil19 {
class_DamageSource_getMagicSourceMethod = class_DamageSource.getMethod("b", class_Entity, class_Entity);
class_DamageSource_MagicField = class_DamageSource.getField("MAGIC");
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred, magic damage will not work, using normal damage instead", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred, magic damage will not work, using normal damage instead");
class_EntityLiving_damageEntityMethod = null;
class_DamageSource_getMagicSourceMethod = null;
class_DamageSource_MagicField = null;
@@ -699,7 +699,7 @@ public class NMSUtil19 {
}
}
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred, armor stand slots cannot be locked", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred, armor stand slots cannot be locked");
class_EntityArmorStand_disabledSlotsField = null;
}
if (class_EntityArmorStand_disabledSlotsField != null) {
@@ -730,7 +730,7 @@ public class NMSUtil19 {
}
}
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred, chest locking and unlocking will not work", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred, chest locking and unlocking will not work");
class_TileEntityContainer_setLock = null;
class_TileEntityContainer_getLock = null;
}
@@ -750,7 +750,7 @@ public class NMSUtil19 {
class_PlayerConnection_floatCountField.setAccessible(true);
}
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred, player flight exemption will not work", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred, player flight exemption will not work");
class_PlayerConnection_floatCountField = null;
}
@@ -769,7 +769,7 @@ public class NMSUtil19 {
}
}
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred, setting arrow lifespan will not work", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred, setting arrow lifespan will not work");
class_EntityArrow_lifeField = null;
}
if (class_EntityArrow_lifeField != null) {
@@ -780,7 +780,7 @@ public class NMSUtil19 {
// 1.9 and up
class_EntityDamageSource_setThornsMethod = class_EntityDamageSource.getMethod("w");
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred, thorn damage override to hurt ender dragon will not work", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred, thorn damage override to hurt ender dragon will not work");
class_EntityDamageSource_setThornsMethod = null;
}
@@ -801,7 +801,7 @@ public class NMSUtil19 {
class_Entity_saveMethod = class_Entity.getMethod("e", class_NBTTagCompound);
}
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred, saving entities to spawn eggs will not work", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred, saving entities to spawn eggs will not work");
class_Entity_getTypeMethod = null;
class_Entity_saveMethod = null;
}
@@ -819,7 +819,7 @@ public class NMSUtil19 {
class_ItemStack_createStackMethod = class_ItemStack.getMethod("createStack", class_NBTTagCompound);
}
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred, restoring inventories from schematics will not work", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred, restoring inventories from schematics will not work");
class_ItemStack_createStackMethod = null;
}
@@ -827,7 +827,7 @@ public class NMSUtil19 {
class_EntityArrow_damageField = class_EntityArrow.getDeclaredField("damage");
class_EntityArrow_damageField.setAccessible(true);
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred, setting arrow damage will not work", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred, setting arrow damage will not work");
class_EntityArrow_damageField = null;
}
@@ -844,7 +844,7 @@ public class NMSUtil19 {
class_Entity_isSilentMethod = class_Entity.getDeclaredMethod("ad");
}
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred, silent entities will not work", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred, silent entities will not work");
class_Entity_setSilentMethod = null;
class_Entity_isSilentMethod = null;
}
@@ -861,7 +861,7 @@ public class NMSUtil19 {
class_ArmorStand_setGravity = class_EntityArmorStand.getDeclaredMethod("setGravity", Boolean.TYPE);
}
} catch (Throwable ex) {
- Bukkit.getLogger().log(Level.WARNING, "An error occurred, hacky no-gravity armor stands won't work", ex);
+ Bukkit.getLogger().log(Level.WARNING, "An error occurred, hacky no-gravity armor stands won't work");
class_Entity_setNoGravity = null;
class_ArmorStand_setGravity = null;
}
@@ -876,7 +876,7 @@ public class NMSUtil19 {
}
} catch (Throwable ex) {
failed = true;
- Bukkit.getLogger().log(Level.SEVERE, "An unexpected error occurred initializing Magic", ex);
+ Bukkit.getLogger().log(Level.SEVERE, "An unexpected error occurred initializing Magic");
}
}