mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-13 06:14:30 +01:00
Add paper support to folia implementation
This commit is contained in:
parent
4663eb715b
commit
e1701c4754
@ -5,6 +5,7 @@ plugins {
|
||||
id ("com.github.node-gradle.node") version "3.0.1"
|
||||
id ("com.github.johnrengelman.shadow") version "7.1.2"
|
||||
id ("com.modrinth.minotaur") version "2.+"
|
||||
id ("io.papermc.hangar-publish-plugin") version "0.1.0"
|
||||
}
|
||||
|
||||
group = "de.bluecolored.bluemap.bukkit"
|
||||
@ -39,7 +40,7 @@ dependencies {
|
||||
exclude( group = "com.google.code.gson", module = "gson" )
|
||||
}
|
||||
|
||||
shadow ("dev.folia:folia-api:1.19.4-R0.1-SNAPSHOT")
|
||||
shadow ("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
|
||||
implementation ("org.bstats:bstats-bukkit:2.2.1")
|
||||
|
||||
testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2")
|
||||
@ -118,14 +119,35 @@ modrinth {
|
||||
token.set(System.getenv("MODRINTH_TOKEN"))
|
||||
projectId.set("swbUV1cr")
|
||||
versionNumber.set("${project.version}-${project.name}")
|
||||
changelog.set("Releasenotes and Changelog:\nhttps://github.com/BlueMap-Minecraft/BlueMap/releases/tag/v${project.version}")
|
||||
changelog.set("Releasenotes and Changelog: \nhttps://github.com/BlueMap-Minecraft/BlueMap/releases/tag/v${project.version}")
|
||||
uploadFile.set(tasks.findByName("shadowJar"))
|
||||
loaders.addAll("folia")
|
||||
loaders.addAll("paper","purpur","folia")
|
||||
gameVersions.addAll(
|
||||
"1.19.4", "1.20", "1.20.1"
|
||||
"1.20", "1.20.1"
|
||||
)
|
||||
}
|
||||
|
||||
hangarPublish {
|
||||
publications.register("plugin") {
|
||||
version.set(project.version as String)
|
||||
id.set("BlueMap")
|
||||
channel.set("Release")
|
||||
changelog.set("Releasenotes and Changelog: \nhttps://github.com/BlueMap-Minecraft/BlueMap/releases/tag/v${project.version}")
|
||||
|
||||
apiKey.set(System.getenv("HANGAR_TOKEN"))
|
||||
|
||||
// register platforms
|
||||
platforms {
|
||||
register(io.papermc.hangarpublishplugin.model.Platforms.PAPER) {
|
||||
jar.set(tasks.shadowJar.flatMap { it.archiveFile })
|
||||
platformVersions.set(listOf(
|
||||
"1.20", "1.20.1"
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("publish") {
|
||||
dependsOn("modrinth")
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
rootProject.name = "folia"
|
||||
rootProject.name = "paper"
|
||||
|
||||
includeBuild("../../BlueMapCommon")
|
@ -34,7 +34,6 @@
|
||||
import org.bukkit.command.BlockCommandSender;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
@ -51,12 +50,7 @@ public BukkitCommandSource(Plugin plugin, CommandSender delegate) {
|
||||
|
||||
@Override
|
||||
public void sendMessage(Text text) {
|
||||
if (delegate instanceof Player player) {
|
||||
player.sendMessage(GsonComponentSerializer.gson().deserialize(text.toJSONString()));
|
||||
return;
|
||||
}
|
||||
|
||||
delegate.sendMessage(text.toPlainString());
|
||||
delegate.sendMessage(GsonComponentSerializer.gson().deserialize(text.toJSONString()));
|
||||
}
|
||||
|
||||
@Override
|
@ -31,15 +31,17 @@
|
||||
import com.mojang.brigadier.tree.CommandNode;
|
||||
import de.bluecolored.bluemap.common.plugin.Plugin;
|
||||
import de.bluecolored.bluemap.common.plugin.commands.Commands;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.RemoteConsoleCommandSender;
|
||||
import org.bukkit.command.defaults.BukkitCommand;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.server.TabCompleteEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -118,7 +120,7 @@ protected CommandProxy(String name) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
|
||||
public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, String[] args) {
|
||||
String command = commandLabel;
|
||||
if (args.length > 0) {
|
||||
command += " " + StringUtils.join(args, ' ');
|
||||
@ -127,10 +129,10 @@ public boolean execute(CommandSender sender, String commandLabel, String[] args)
|
||||
try {
|
||||
return dispatcher.execute(command, sender) > 0;
|
||||
} catch (CommandSyntaxException ex) {
|
||||
sender.sendMessage(ChatColor.RED + ex.getRawMessage().getString());
|
||||
sender.sendMessage(Component.text(ex.getRawMessage().getString()).color(NamedTextColor.RED));
|
||||
|
||||
String context = ex.getContext();
|
||||
if (context != null) sender.sendMessage(ChatColor.GRAY + context);
|
||||
if (context != null) sender.sendMessage(Component.text(context).color(NamedTextColor.GRAY));
|
||||
|
||||
return false;
|
||||
}
|
@ -28,7 +28,6 @@
|
||||
import de.bluecolored.bluemap.common.serverinterface.ServerWorld;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@ -85,7 +84,14 @@ public Optional<String> getName() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean persistWorldChanges() throws IOException {
|
||||
public boolean persistWorldChanges() {
|
||||
/* Not supported by folia
|
||||
World world = delegate.get();
|
||||
if (world != null) {
|
||||
world.save();
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
@ -24,12 +24,13 @@
|
||||
*/
|
||||
package de.bluecolored.bluemap.bukkit;
|
||||
|
||||
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
|
||||
import de.bluecolored.bluemap.common.plugin.text.Text;
|
||||
import de.bluecolored.bluemap.common.serverinterface.ServerEventListener;
|
||||
import io.papermc.paper.event.player.AsyncChatEvent;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
@ -63,8 +64,8 @@ public synchronized void onPlayerLeave(PlayerQuitEvent evt) {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public synchronized void onPlayerChat(AsyncPlayerChatEvent evt) {
|
||||
String message = String.format(evt.getFormat(), evt.getPlayer().getDisplayName(), evt.getMessage());
|
||||
public synchronized void onPlayerChat(AsyncChatEvent evt) {
|
||||
String message = String.format(PlainTextComponentSerializer.plainText().serialize(evt.message()));
|
||||
for (ServerEventListener listener : listeners) listener.onChatMessage(Text.of(message));
|
||||
}
|
||||
|
@ -24,14 +24,14 @@
|
||||
*/
|
||||
package de.bluecolored.bluemap.bukkit;
|
||||
|
||||
import de.bluecolored.bluemap.core.logger.AbstractLogger;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import de.bluecolored.bluemap.core.logger.AbstractLogger;
|
||||
|
||||
public class JavaLogger extends AbstractLogger {
|
||||
|
||||
private Logger out;
|
||||
private final Logger out;
|
||||
|
||||
public JavaLogger(Logger out) {
|
||||
this.out = out;
|
@ -5,7 +5,6 @@ plugins {
|
||||
id ("com.github.node-gradle.node") version "3.0.1"
|
||||
id ("com.github.johnrengelman.shadow") version "7.1.2"
|
||||
id ("com.modrinth.minotaur") version "2.+"
|
||||
id ("io.papermc.hangar-publish-plugin") version "0.0.4"
|
||||
}
|
||||
|
||||
group = "de.bluecolored.bluemap.bukkit"
|
||||
@ -137,35 +136,6 @@ modrinth {
|
||||
)
|
||||
}
|
||||
|
||||
hangarPublish {
|
||||
publications.register("plugin") {
|
||||
version.set(project.version as String)
|
||||
namespace("Blue", "BlueMap")
|
||||
channel.set("Release")
|
||||
changelog.set("Releasenotes and Changelog: \nhttps://github.com/BlueMap-Minecraft/BlueMap/releases/tag/v${project.version}")
|
||||
|
||||
apiKey.set(System.getenv("HANGAR_TOKEN"))
|
||||
|
||||
// register platforms
|
||||
platforms {
|
||||
register(io.papermc.hangarpublishplugin.model.Platforms.PAPER) {
|
||||
jar.set(tasks.shadowJar.flatMap { it.archiveFile })
|
||||
platformVersions.set(listOf(
|
||||
"1.13.2",
|
||||
"1.14", "1.14.1", "1.14.2", "1.14.3", "1.14.4",
|
||||
"1.15", "1.15.1", "1.15.2",
|
||||
"1.16", "1.16.1", "1.16.2", "1.16.3", "1.16.4", "1.16.5",
|
||||
"1.17", "1.17.1",
|
||||
"1.18", "1.18.1", "1.18.2",
|
||||
"1.19", "1.19.1", "1.19.2", "1.19.3", "1.19.4",
|
||||
"1.20", "1.20.1"
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("publish") {
|
||||
dependsOn("modrinth")
|
||||
dependsOn("publishPluginPublicationToHangar")
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ includeBuild("implementations/forge-1.19.4")
|
||||
includeBuild("implementations/forge-1.20")
|
||||
|
||||
includeBuild("implementations/spigot")
|
||||
includeBuild("implementations/folia")
|
||||
includeBuild("implementations/paper")
|
||||
|
||||
includeBuild("implementations/sponge-8.0.0")
|
||||
includeBuild("implementations/sponge-9.0.0")
|
||||
|
Loading…
Reference in New Issue
Block a user