From 087746aa08c294993c46da0ac548518d84a5de9e Mon Sep 17 00:00:00 2001 From: 502647092 Date: Thu, 9 Feb 2017 09:38:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=98=B2=E6=AD=A2=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E7=B1=BB=E6=96=B9=E6=B3=95=E8=A2=AB=E6=B7=B7=E6=B7=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- .../java/pw/yumc/YumCore/bukkit/compatible/C.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/pw/yumc/YumCore/bukkit/compatible/C.java b/src/main/java/pw/yumc/YumCore/bukkit/compatible/C.java index 3ddc201..88f9822 100644 --- a/src/main/java/pw/yumc/YumCore/bukkit/compatible/C.java +++ b/src/main/java/pw/yumc/YumCore/bukkit/compatible/C.java @@ -17,6 +17,7 @@ import org.json.simple.JSONObject; import com.google.common.base.Charsets; +import pw.yumc.YumCore.annotation.NotProguard; import pw.yumc.YumCore.bukkit.Log; import pw.yumc.YumCore.bukkit.P; @@ -121,6 +122,7 @@ public class C { * @param message * 需要发送的消息 */ + @NotProguard public static void broadcast(String message) { for (org.bukkit.entity.Player player : C.Player.getOnlinePlayers()) { send(player, message); @@ -135,6 +137,7 @@ public class C { * @param times * 需要显示的时间 */ + @NotProguard public static void broadcast(final String message, final int times) { new BukkitRunnable() { int time = times; @@ -160,6 +163,7 @@ public class C { * @param times * 需要显示的时间 */ + @NotProguard public static void broadcast(final World world, final String message, final int times) { new BukkitRunnable() { int time = times; @@ -183,6 +187,7 @@ public class C { * @param msg * ActionBar信息 */ + @NotProguard public static void send(org.bukkit.entity.Player receivingPacket, String msg) { sendJson(receivingPacket, "{\"text\":\"" + ChatColor.translateAlternateColorCodes('&', JSONObject.escape(msg)) + "\"}", 2); } @@ -197,6 +202,7 @@ public class C { * @param times * 需要显示的时间 */ + @NotProguard public static void send(final org.bukkit.entity.Player receivingPacket, final String msg, final int times) { new BukkitRunnable() { int time = times; @@ -271,6 +277,7 @@ public class C { * 玩家名称 * @return {@link OfflinePlayer} */ + @NotProguard public static OfflinePlayer getOfflinePlayer(String playerName) { try { Object gameProfile = gameProfileConstructor.newInstance(UUID.nameUUIDFromBytes(("OfflinePlayer:" + playerName).getBytes(Charsets.UTF_8)), playerName); @@ -286,6 +293,7 @@ public class C { * * @return 在线玩家 */ + @NotProguard public static Collection getOnlinePlayers() { try { return Arrays.asList((org.bukkit.entity.Player[]) getOnlinePlayers.invoke(null)); @@ -322,6 +330,7 @@ public class C { * @param subtitle * 子标题 */ + @NotProguard public static void broadcast(String title, String subtitle) { for (org.bukkit.entity.Player player : Player.getOnlinePlayers()) { send(player, title, subtitle); @@ -342,6 +351,7 @@ public class C { * @param fadeOutTime * 淡出时间 */ + @NotProguard public static void broadcast(String title, String subtitle, int fadeInTime, int stayTime, int fadeOutTime) { for (org.bukkit.entity.Player player : Player.getOnlinePlayers()) { send(player, title, subtitle, fadeInTime, stayTime, fadeOutTime); @@ -358,6 +368,7 @@ public class C { * @param subtitle * 子标题 */ + @NotProguard public static void broadcast(World world, String title, String subtitle) { C.Player.getOnlinePlayers().stream().filter(player -> player.getWorld().getName().equalsIgnoreCase(world.getName())).forEach(player -> send(player, title, subtitle)); } @@ -370,6 +381,7 @@ public class C { * @throws Exception * 异常 */ + @NotProguard public static void reset(org.bukkit.entity.Player recoverPlayer) throws Exception { // Send timings first Object player = getHandle.invoke(recoverPlayer); @@ -389,6 +401,7 @@ public class C { * @param subtitle * 子标题 */ + @NotProguard public static void send(org.bukkit.entity.Player receivingPacket, String title, String subtitle) { send(receivingPacket, title, subtitle, 1, 2, 1); } @@ -409,6 +422,7 @@ public class C { * @param fadeOutTime * 淡出时间 */ + @NotProguard public static void send(org.bukkit.entity.Player receivingPacket, String title, String subtitle, int fadeInTime, int stayTime, int fadeOutTime) { if (packetTitle != null) { try {