mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2024-10-31 19:44:03 +01:00
finished kyori impl
This commit is contained in:
parent
d7a4acc2f5
commit
c4789b7db0
19
build.gradle
19
build.gradle
@ -13,21 +13,21 @@ version "2.10.10-DEV-${System.getProperty("BUILD_NUMBER")}"
|
||||
description "An awesome placeholder provider!"
|
||||
|
||||
repositories {
|
||||
maven({ url = "https://oss.sonatype.org/content/repositories/snapshots/" })
|
||||
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
|
||||
maven({ url = "https://repo.codemc.org/repository/maven-public" })
|
||||
maven({ url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" })
|
||||
maven({ url = "https://oss.sonatype.org/content/repositories/snapshots/" })
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.google.code.gson:gson:2.8.6"
|
||||
implementation "org.bstats:bstats-bukkit:2.2.1"
|
||||
|
||||
implementation "net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT"
|
||||
|
||||
compileOnly "org.spigotmc:spigot:+"
|
||||
compileOnly "org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT"
|
||||
compileOnly "org.jetbrains:annotations:19.0.0"
|
||||
|
||||
testImplementation "org.openjdk.jmh:jmh-core:1.23"
|
||||
@ -63,20 +63,7 @@ tasks.withType(Javadoc) {
|
||||
shadowJar {
|
||||
archiveClassifier.set("")
|
||||
|
||||
// destinationDirectory.set(file("server/1.17/plugins"))
|
||||
// doLast {
|
||||
// def path = "build/libs/PlaceholderAPI-2.10.10-DEV-null.jar"
|
||||
//
|
||||
// ["1.17", "1.8"].each {dest ->
|
||||
// copy {
|
||||
// from path
|
||||
// into "server/${dest}/plugins/"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
relocate "org.bstats", "me.clip.placeholderapi.metrics"
|
||||
relocate "com.google.gson", "me.clip.placeholderapi.libs.gson"
|
||||
relocate "net.kyori", "me.clip.placeholderapi.libs.kyori"
|
||||
}
|
||||
|
||||
|
0
gradlew
vendored
Normal file → Executable file
0
gradlew
vendored
Normal file → Executable file
@ -33,6 +33,7 @@ import me.clip.placeholderapi.expansion.manager.LocalExpansionManager;
|
||||
import me.clip.placeholderapi.listeners.ServerLoadEventListener;
|
||||
import me.clip.placeholderapi.updatechecker.UpdateChecker;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.serializer.craftbukkit.MinecraftComponentSerializer;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bstats.charts.AdvancedPie;
|
||||
import org.bstats.charts.SimplePie;
|
||||
|
@ -44,16 +44,10 @@ import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.adventure.text.event.HoverEvent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.minecraft.network.chat.ChatMessageType;
|
||||
import net.minecraft.network.chat.IChatBaseComponent;
|
||||
import net.minecraft.network.protocol.game.PacketPlayOutChat;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import static net.kyori.adventure.text.Component.*;
|
||||
import static net.kyori.adventure.text.format.NamedTextColor.*;
|
||||
@ -138,8 +132,7 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
|
||||
|
||||
builder.append(" &bPage&7: &a")
|
||||
.append(page)
|
||||
.append("&r")
|
||||
.append('\n');
|
||||
.append("&r");
|
||||
}
|
||||
|
||||
private static Component getMessage(@NotNull final List<CloudExpansion> expansions,
|
||||
@ -187,12 +180,31 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
|
||||
);
|
||||
|
||||
line.hoverEvent(HoverEvent.showText(hoverText.build()));
|
||||
line.append(newline());
|
||||
|
||||
if (index != expansions.size() - 1) {
|
||||
line.append(newline());
|
||||
}
|
||||
|
||||
message.append(line.build());
|
||||
}
|
||||
|
||||
message.append(text("test").hoverEvent(HoverEvent.showText(text("testtt"))));
|
||||
if (limit > 1) {
|
||||
message.append(newline());
|
||||
|
||||
final TextComponent.Builder left = text("◀", page > 1 ? GRAY : DARK_GRAY).toBuilder();
|
||||
|
||||
if (page > 1) {
|
||||
left.clickEvent(ClickEvent.runCommand("/papi ecloud list " + target + " " + (page - 1)));
|
||||
}
|
||||
|
||||
final TextComponent.Builder right = text("▶", page < limit ? GRAY : DARK_GRAY).toBuilder();
|
||||
|
||||
if (page < limit) {
|
||||
right.clickEvent(ClickEvent.runCommand("/papi ecloud list " + target + " " + (page + 1)));
|
||||
}
|
||||
|
||||
message.append(left, text(" " + page + " ", GREEN), right);
|
||||
}
|
||||
|
||||
return message.build();
|
||||
}
|
||||
@ -314,10 +326,7 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
|
||||
final int limit = (int) Math.ceil((double) expansions.size() / PAGE_SIZE);
|
||||
|
||||
final Component message = getMessage(values, page, limit, params.get(0));
|
||||
// plugin.getAdventure().player((Player) sender).sendMessage(message);
|
||||
System.out.println(GsonComponentSerializer.gson().serialize(message));
|
||||
((CraftPlayer) sender).getHandle().b.sendPacket(new PacketPlayOutChat(IChatBaseComponent.ChatSerializer.a(GsonComponentSerializer.gson().serialize(message)), ChatMessageType.a, ((CraftPlayer) sender).getUniqueId()));
|
||||
//message.send(((Player) sender));
|
||||
plugin.getAdventure().player((Player) sender).sendMessage(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user