feat: 防止兼容类方法被混淆

Signed-off-by: 502647092 <admin@yumc.pw>
merge/1/MERGE
502647092 2017-02-09 09:38:53 +08:00
parent 2fc123df5c
commit 087746aa08
1 changed files with 14 additions and 0 deletions

View File

@ -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<? extends org.bukkit.entity.Player> 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 {