This commit is contained in:
Izzel_Aliz
2018-05-09 13:04:58 +08:00
parent 3f4940c6b7
commit 2b14457309
72 changed files with 1249 additions and 1318 deletions

View File

@@ -47,6 +47,10 @@ public final class BookAchievement {
achievements.put(OVERPOWERED, "overpowered");
}
private BookAchievement() {
}
/**
* Gets the json id from the bukkit achievement passed as argument
*
@@ -56,8 +60,4 @@ public final class BookAchievement {
public static String toId(Achievement achievement) {
return achievements.get(achievement);
}
private BookAchievement() {
}
}

View File

@@ -233,30 +233,6 @@ public final class BookReflection {
}
}
/**
* An error thrown when this NMS-helper class doesn't support the running MC version
*/
public static class UnsupportedVersionException extends RuntimeException {
/**
* serialVersionUID
*/
private static final long serialVersionUID = 6835583513394319946L;
/**
* The current running version
*/
private final String version = BookReflection.version;
public String getVersion() {
return version;
}
public UnsupportedVersionException(Exception e) {
super("Error while executing reflections, submit to developers the following log (version: " + BookReflection.version + ")", e);
}
}
/**
* Gets the EntityPlayer handled by the argument
*
@@ -291,11 +267,6 @@ public final class BookReflection {
}
}
public static Class<?> getNmsClass(String className) {
return getNmsClass(className, true);
}
private static Class<?> getCraftClass(String path) {
try {
return Class.forName("org.bukkit.craftbukkit." + version + "." + path);
@@ -304,4 +275,31 @@ public final class BookReflection {
return null;
}
}
public static Class<?> getNmsClass(String className) {
return getNmsClass(className, true);
}
/**
* An error thrown when this NMS-helper class doesn't support the running MC version
*/
public static class UnsupportedVersionException extends RuntimeException {
/**
* serialVersionUID
*/
private static final long serialVersionUID = 6835583513394319946L;
/**
* The current running version
*/
private final String version = BookReflection.version;
public UnsupportedVersionException(Exception e) {
super("Error while executing reflections, submit to developers the following log (version: " + BookReflection.version + ")", e);
}
public String getVersion() {
return version;
}
}
}

View File

@@ -8,21 +8,6 @@ import net.md_5.bungee.api.chat.ClickEvent;
*/
public interface ClickAction {
/**
* Get the Chat-Component action
*
* @return the Chat-Component action
*/
ClickEvent.Action action();
/**
* The value paired to the action
*
* @return the value paired tot the action
*/
String value();
/**
* Creates a command action: when the player clicks, the command passed as parameter gets executed with the clicker as sender
*
@@ -66,6 +51,20 @@ public interface ClickAction {
return new SimpleClickAction(ClickEvent.Action.CHANGE_PAGE, Integer.toString(page));
}
/**
* Get the Chat-Component action
*
* @return the Chat-Component action
*/
ClickEvent.Action action();
/**
* The value paired to the action
*
* @return the value paired tot the action
*/
String value();
class SimpleClickAction implements ClickAction {
private final ClickEvent.Action action;

View File

@@ -18,21 +18,6 @@ import java.util.UUID;
@SuppressWarnings("deprecation")
public interface HoverAction {
/**
* Get the Chat-Component action
*
* @return the Chat-Component action
*/
HoverEvent.Action action();
/**
* The value paired to the action
*
* @return the value paired tot the action
*/
BaseComponent[] value();
/**
* Creates a show_text action: when the component is hovered the text used as parameter will be displayed
*
@@ -139,6 +124,20 @@ public interface HoverAction {
return new SimpleHoverAction(HoverEvent.Action.SHOW_ACHIEVEMENT, new TextComponent("statistic." + statisticId));
}
/**
* Get the Chat-Component action
*
* @return the Chat-Component action
*/
HoverEvent.Action action();
/**
* The value paired to the action
*
* @return the value paired tot the action
*/
BaseComponent[] value();
class SimpleHoverAction implements HoverAction {
private final HoverEvent.Action action;
private final BaseComponent[] value;

View File

@@ -17,6 +17,23 @@ public class TextBuilder {
private ClickAction onClick = null;
private HoverAction onHover = null;
public TextBuilder() {
}
public TextBuilder(String text) {
this.text = text;
}
/**
* Creates a new TextBuilder with the parameter as his initial text
*
* @param text initial text
* @return a new TextBuilder with the parameter as his initial text
*/
public static TextBuilder of(String text) {
return new TextBuilder(text);
}
public String getText() {
return text;
}
@@ -41,13 +58,6 @@ public class TextBuilder {
this.onHover = onHover;
}
public TextBuilder() {
}
public TextBuilder(String text) {
this.text = text;
}
/**
* Creates the component representing the built text
*
@@ -63,14 +73,4 @@ public class TextBuilder {
}
return res;
}
/**
* Creates a new TextBuilder with the parameter as his initial text
*
* @param text initial text
* @return a new TextBuilder with the parameter as his initial text
*/
public static TextBuilder of(String text) {
return new TextBuilder(text);
}
}