mirror of
https://e.coding.net/circlecloud/YumCore.git
synced 2024-11-22 01:48:50 +00:00
feat: 添加Clone方法
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
c3215f2cf4
commit
1b37f3689e
@ -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 2016年8月10日 下午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格式支持客户端。
|
||||
|
Loading…
Reference in New Issue
Block a user