feat: 添加Clone方法

Signed-off-by: 502647092 <admin@yumc.pw>
merge/1/MERGE
502647092 2016-12-07 19:49:34 +08:00
parent c3215f2cf4
commit 1b37f3689e
1 changed files with 17 additions and 8 deletions

View File

@ -1,29 +1,28 @@
package pw.yumc.YumCore.tellraw;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import pw.yumc.YumCore.bukkit.Log;
import pw.yumc.YumCore.bukkit.P;
import pw.yumc.YumCore.bukkit.compatible.C;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* TellRaw
*
* @since 2016810 7:10:08
* @author
*/
public class Tellraw {
static boolean isPaper = Bukkit.getVersion().contains("Paper");
public class Tellraw implements Cloneable {
static boolean isPaper = Bukkit.getVersion().contains("Paper") || Bukkit.getVersion().contains("Torch");
private List<MessagePart> messageParts = new ArrayList<>();
private String json = null;
private String oldjson = null;
public Tellraw(String text) {
messageParts.add(new MessagePart(text));
@ -307,6 +306,16 @@ public class Tellraw {
return msg.toString();
}
public Tellraw setMessageParts(List<MessagePart> messageParts) {
this.messageParts = new ArrayList<>(messageParts);
return this;
}
@Override
public Tellraw clone() throws CloneNotSupportedException {
return ((Tellraw) super.clone()).setMessageParts(messageParts);
}
/**
*
* JSON