Ignore
This commit is contained in:
@@ -19,6 +19,7 @@ import java.util.regex.Pattern;
|
||||
/**
|
||||
* The NMS helper for all the Book-API
|
||||
*/
|
||||
@SuppressWarnings({"ALL", "AliControlFlowStatementWithoutBraces"})
|
||||
public final class BookReflection {
|
||||
|
||||
private static final String version;
|
||||
@@ -66,8 +67,10 @@ public final class BookReflection {
|
||||
craftMetaBookField = craftMetaBookClass.getDeclaredField("pages");
|
||||
craftMetaBookField.setAccessible(true);
|
||||
Class<?> chatSerializer = getNmsClass("IChatBaseComponent$ChatSerializer", false);
|
||||
if (chatSerializer == null)
|
||||
//noinspection AliControlFlowStatementWithoutBraces
|
||||
if (chatSerializer == null) {
|
||||
chatSerializer = getNmsClass("ChatSerializer");
|
||||
}
|
||||
|
||||
chatSerializerA = chatSerializer.getDeclaredMethod("a", String.class);
|
||||
|
||||
@@ -257,12 +260,15 @@ public final class BookReflection {
|
||||
return craftItemStackAsNMSCopy.invoke(null, item);
|
||||
}
|
||||
|
||||
@SuppressWarnings("AliControlFlowStatementWithoutBraces")
|
||||
public static Class<?> getNmsClass(String className, boolean log) {
|
||||
try {
|
||||
return Class.forName("net.minecraft.server." + version + "." + className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
if (log)
|
||||
//noinspection AliControlFlowStatementWithoutBraces
|
||||
if (log) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,10 +35,11 @@ public interface ClickAction {
|
||||
* @return a new ClickAction
|
||||
*/
|
||||
static ClickAction openUrl(String url) {
|
||||
if (url.startsWith("http://") || url.startsWith("https://"))
|
||||
if (url.startsWith("http://") || url.startsWith("https://")) {
|
||||
return new SimpleClickAction(ClickEvent.Action.OPEN_URL, url);
|
||||
else
|
||||
} else {
|
||||
throw new IllegalArgumentException("Invalid url: \"" + url + "\", it should start with http:// or https://");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -107,8 +107,9 @@ public class PageBuilder {
|
||||
*/
|
||||
public static PageBuilder of(BaseComponent... text) {
|
||||
PageBuilder res = new PageBuilder();
|
||||
for(BaseComponent b : text)
|
||||
for(BaseComponent b : text) {
|
||||
res.add(b);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user