pandalib-chat API changes (+ some javadoc) and pandalib-reflect imports fixes
This commit is contained in:
@@ -40,8 +40,7 @@ public abstract class ChatStatic {
|
||||
*
|
||||
* @param plainText the text to use as he content of the new Chat instance.
|
||||
* @return a Chat instance with the provided text as its main text content.
|
||||
*
|
||||
* @throws IllegalArgumentException If the {@code plainText} parameter is instance of {@link Chat} or
|
||||
* @throws IllegalArgumentException if the {@code plainText} parameter is instance of {@link Chat} or
|
||||
* {@link Component}. The caller should use {@link #chatComponent(ComponentLike)}
|
||||
* instead.
|
||||
*/
|
||||
@@ -58,7 +57,6 @@ public abstract class ChatStatic {
|
||||
*
|
||||
* @param legacyText the text to use as he content of the new Chat instance.
|
||||
* @return a Chat instance with the provided text as its main text content.
|
||||
*
|
||||
* @throws IllegalArgumentException If the {@code plainText} parameter is instance of {@link Chat} or
|
||||
* {@link Component}. The caller should use {@link #chatComponent(ComponentLike)}
|
||||
* instead.
|
||||
@@ -107,34 +105,90 @@ public abstract class ChatStatic {
|
||||
}
|
||||
|
||||
public static FormatableChat translation(String key, Object... with) {
|
||||
return new FormatableChat(Component.translatable()
|
||||
.key(key)
|
||||
.args(Chat.filterObjToComponentLike(with))
|
||||
);
|
||||
return new FormatableChat(Component.translatable().key(key).args(Chat.filterObjToComponentLike(with)));
|
||||
}
|
||||
|
||||
public static FormatableChat keybind(String key) {
|
||||
return new FormatableChat(Component.keybind()
|
||||
.keybind(key)
|
||||
);
|
||||
return new FormatableChat(Component.keybind().keybind(key));
|
||||
}
|
||||
|
||||
public static FormatableChat score(String name, String objective) {
|
||||
return new FormatableChat(Component.score()
|
||||
.name(name)
|
||||
.objective(objective)
|
||||
);
|
||||
return new FormatableChat(Component.score().name(name).objective(objective));
|
||||
}
|
||||
|
||||
public static FormatableChat clickableURL(Chat inner, String url, Chat hover) {
|
||||
Objects.requireNonNull(url, "url");
|
||||
if (inner == null)
|
||||
inner = text(url);
|
||||
if (hover == null)
|
||||
hover = text(ChatUtil.wrapInLimitedPixels(url, 240));
|
||||
return (FormatableChat) chat().clickURL(url).urlColor().hover(hover).then(inner);
|
||||
}
|
||||
|
||||
public static FormatableChat clickableURL(Chat inner, String url) {
|
||||
return clickableURL(inner, url, null);
|
||||
}
|
||||
|
||||
public static FormatableChat clickableURL(String url, Chat hover) {
|
||||
return clickableURL(null, url, hover);
|
||||
}
|
||||
|
||||
public static FormatableChat clickableURL(String url) {
|
||||
return clickableURL(null, url, null);
|
||||
}
|
||||
|
||||
public static FormatableChat clickableCommand(Chat inner, String commandWithSlash, Chat hover) {
|
||||
Objects.requireNonNull(commandWithSlash, "commandWithSlash");
|
||||
if (!commandWithSlash.startsWith("/"))
|
||||
throw new IllegalArgumentException("commandWithSlash must start with a '/' character.");
|
||||
if (inner == null)
|
||||
inner = text(commandWithSlash);
|
||||
if (hover == null)
|
||||
hover = text(ChatUtil.wrapInLimitedPixels(commandWithSlash, 240));
|
||||
return (FormatableChat) chat().clickCommand(commandWithSlash).commandColor().hover(hover).then(inner);
|
||||
}
|
||||
|
||||
public static FormatableChat clickableCommand(Chat inner, String commandWithSlash) {
|
||||
return clickableCommand(inner, commandWithSlash, null);
|
||||
}
|
||||
|
||||
public static FormatableChat clickableCommand(String commandWithSlash, Chat hover) {
|
||||
return clickableCommand(null, commandWithSlash, hover);
|
||||
}
|
||||
|
||||
public static FormatableChat clickableCommand(String commandWithSlash) {
|
||||
return clickableCommand(null, commandWithSlash, null);
|
||||
}
|
||||
|
||||
public static FormatableChat clickableSuggest(Chat inner, String commandWithSlash, Chat hover) {
|
||||
Objects.requireNonNull(commandWithSlash, "commandWithSlash");
|
||||
if (!commandWithSlash.startsWith("/"))
|
||||
throw new IllegalArgumentException("commandWithSlash must start with a '/' character.");
|
||||
if (inner == null)
|
||||
inner = text(commandWithSlash);
|
||||
if (hover == null)
|
||||
hover = text(ChatUtil.wrapInLimitedPixels(commandWithSlash, 240));
|
||||
return (FormatableChat) chat().clickSuggest(commandWithSlash).commandColor().hover(hover).then(inner);
|
||||
}
|
||||
|
||||
public static FormatableChat clickableSuggest(Chat inner, String commandWithSlash) {
|
||||
return clickableSuggest(inner, commandWithSlash, null);
|
||||
}
|
||||
|
||||
public static FormatableChat clickableSuggest(String commandWithSlash, Chat hover) {
|
||||
return clickableSuggest(null, commandWithSlash, hover);
|
||||
}
|
||||
|
||||
public static FormatableChat clickableSuggest(String commandWithSlash) {
|
||||
return clickableSuggest(null, commandWithSlash, null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static Component prefixedAndColored(ComponentLike message) {
|
||||
return prefixedAndColored(Chat.chatComponent(message)).getAdv();
|
||||
}
|
||||
|
||||
public static Chat prefixedAndColored(Chat message) {
|
||||
public static Chat prefixedAndColored(ComponentLike message) {
|
||||
return Chat.chat()
|
||||
.broadcastColor()
|
||||
.then(Chat.getConfig().prefix.get())
|
||||
|
Reference in New Issue
Block a user