Update Text to 3

Dieser Commit ist enthalten in:
Kenzie Togami 2019-05-05 01:37:11 -07:00 committet von Kenzie Togami
Ursprung 4355f8cbf7
Commit 1c54a04fd1
7 geänderte Dateien mit 36 neuen und 23 gelöschten Zeilen

Datei anzeigen

@ -32,7 +32,7 @@ import org.enginehub.piston.inject.InjectedValueAccess;
import java.util.List; import java.util.List;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static com.sk89q.worldedit.util.formatting.text.Component.space; import static com.sk89q.worldedit.util.formatting.text.TextComponent.space;
public class CommaSeparatedValuesConverter<T> implements ArgumentConverter<T> { public class CommaSeparatedValuesConverter<T> implements ArgumentConverter<T> {
@ -61,7 +61,7 @@ public class CommaSeparatedValuesConverter<T> implements ArgumentConverter<T> {
TextComponent.Builder result = TextComponent.builder(""); TextComponent.Builder result = TextComponent.builder("");
if (maximum > -1) { if (maximum > -1) {
result.append(TextComponent.of("up to ")) result.append(TextComponent.of("up to "))
.append(Component.of(maximum)) .append(TextComponent.of(maximum))
.append(space()); .append(space());
} }
result.append(TextComponent.of("comma separated values of: ")) result.append(TextComponent.of("comma separated values of: "))

Datei anzeigen

@ -87,16 +87,16 @@ public class CommandListBox extends PaginationBox {
TextComponentProducer line = new TextComponentProducer(); TextComponentProducer line = new TextComponentProducer();
if (!hideHelp) { if (!hideHelp) {
line.append(SubtleFormat.wrap("? ") line.append(SubtleFormat.wrap("? ")
.clickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "//help " + insertion)) .clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, "//help " + insertion))
.hoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Additional Help")))); .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Additional Help"))));
} }
TextComponent command = TextComponent.of(alias, TextColor.GOLD); TextComponent command = TextComponent.of(alias, TextColor.GOLD);
if (insertion == null) { if (insertion == null) {
line.append(command); line.append(command);
} else { } else {
line.append(command line.append(command
.clickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, insertion)) .clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, insertion))
.hoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to select")))); .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to select"))));
} }
return line.append(TextComponent.of(": ")).append(description).create(); return line.append(TextComponent.of(": ")).append(description).create();
} }

Datei anzeigen

@ -55,11 +55,11 @@ public class MessageBox extends TextComponentProducer {
if (side > 1) { if (side > 1) {
line.append(createBorder(side - 1)); line.append(createBorder(side - 1));
} }
line.append(Component.space()); line.append(TextComponent.space());
} }
line.append(text); line.append(text);
if (side > 0) { if (side > 0) {
line.append(Component.space()); line.append(TextComponent.space());
if (side > 1) { if (side > 1) {
line.append(createBorder(side - 1)); line.append(createBorder(side - 1));
} }

Datei anzeigen

@ -105,15 +105,15 @@ public abstract class PaginationBox extends MessageBox {
TextComponentProducer navProducer = new TextComponentProducer(); TextComponentProducer navProducer = new TextComponentProducer();
if (page > 1) { if (page > 1) {
TextComponent prevComponent = TextComponent.of("<<< ", TextColor.GOLD) TextComponent prevComponent = TextComponent.of("<<< ", TextColor.GOLD)
.clickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, pageCommand.replace("%page%", String.valueOf(page - 1)))) .clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, pageCommand.replace("%page%", String.valueOf(page - 1))))
.hoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to navigate"))); .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to navigate")));
navProducer.append(prevComponent); navProducer.append(prevComponent);
} }
navProducer.append(pageNumberComponent); navProducer.append(pageNumberComponent);
if (page < pageCount) { if (page < pageCount) {
TextComponent nextComponent = TextComponent.of(" >>>", TextColor.GOLD) TextComponent nextComponent = TextComponent.of(" >>>", TextColor.GOLD)
.clickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, pageCommand.replace("%page%", String.valueOf(page + 1)))) .clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, pageCommand.replace("%page%", String.valueOf(page + 1))))
.hoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to navigate"))); .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to navigate")));
navProducer.append(nextComponent); navProducer.append(nextComponent);
} }
getContents().append(centerAndBorder(navProducer.create())); getContents().append(centerAndBorder(navProducer.create()));

Datei anzeigen

@ -59,12 +59,12 @@ public class SchematicPaginationBox extends PaginationBox {
.content("") .content("")
.append(TextComponent.of("[L]") .append(TextComponent.of("[L]")
.color(TextColor.GOLD) .color(TextColor.GOLD)
.clickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem load " + path)) .clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, "/schem load " + path))
.hoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to load")))) .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to load"))))
.append(Component.space()) .append(TextComponent.space())
.append(TextComponent.of(path) .append(TextComponent.of(path)
.color(TextColor.DARK_GREEN) .color(TextColor.DARK_GREEN)
.hoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.of(format)))) .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of(format))))
.build(); .build();
} }

Datei anzeigen

@ -58,7 +58,7 @@ public class TextComponentProducer {
* @return The producer, for chaining * @return The producer, for chaining
*/ */
public TextComponentProducer newline() { public TextComponentProducer newline() {
getBuilder().append(Component.newline()); getBuilder().append(TextComponent.newline());
return this; return this;
} }

Datei anzeigen

@ -88,13 +88,14 @@ configure(subprojects + project("core:ap")) {
build.dependsOn(jar, sourcesJar) build.dependsOn(jar, sourcesJar)
} }
def textVersion = "3.0.0"
project("core") { project("core") {
def pistonVersion = '0.1.2' def pistonVersion = '0.2.0'
dependencies { dependencies {
shade 'net.kyori:text-api:2.0.0' shade "net.kyori:text-api:$textVersion"
shade 'net.kyori:text-serializer-gson:2.0.0' shade "net.kyori:text-serializer-gson:$textVersion"
shade 'net.kyori:text-serializer-legacy:2.0.0' shade "net.kyori:text-serializer-legacy:$textVersion"
shade('com.sk89q:jchronic:0.2.4a') { shade('com.sk89q:jchronic:0.2.4a') {
exclude(group: "junit", module: "junit") exclude(group: "junit", module: "junit")
} }
@ -113,13 +114,25 @@ project("core") {
} }
} }
project("bukkit") { project("bukkit") {
repositories {
maven {
name = "SpigotMC"
url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
}
}
dependencies { dependencies {
shade 'net.kyori:text-adapter-bukkit:2.0.0-SNAPSHOT' shade "net.kyori:text-adapter-bukkit:$textVersion"
} }
} }
project("sponge") { project("sponge") {
repositories {
maven {
name = "Sponge"
url = "https://repo.spongepowered.org/maven"
}
}
dependencies { dependencies {
shade 'net.kyori:text-adapter-spongeapi:2.0.0-SNAPSHOT' shade "net.kyori:text-adapter-spongeapi:$textVersion"
} }
} }