[FEAT] Paper Support
This commit is contained in:
@@ -5,12 +5,12 @@
|
||||
def projectIcon = "https://cdn.modrinth.com/data/Nn8Wasaq/a172c634683a11a2e9ae593e56eba7885743bb44.png";
|
||||
-def JDK = "21";
|
||||
-def majorMc = "1.21.2";
|
||||
-def modLoaders = "neoforge|fabric|quilt";
|
||||
-def supportedMc = "1.21.2";
|
||||
-def modLoaders = "neoforge|fabric|quilt|paper";
|
||||
-def supportedMc = "1.21.3";
|
||||
-def reltype = "port";
|
||||
+def JDK = "17";
|
||||
+def majorMc = "1.19.2";
|
||||
+def modLoaders = "forge|fabric|quilt";
|
||||
+def modLoaders = "forge|fabric|quilt|paper";
|
||||
+def supportedMc = "1.19.2";
|
||||
+def reltype = "snapshot";
|
||||
|
||||
|
@@ -0,0 +1,18 @@
|
||||
--- a/Common/src/main/java/com/hypherionmc/craterlib/api/events/common/CraterPlayerDeathEvent.java
|
||||
+++ b/Common/src/main/java/com/hypherionmc/craterlib/api/events/common/CraterPlayerDeathEvent.java
|
||||
@@ -14,8 +14,14 @@
|
||||
|
||||
private final BridgedPlayer player;
|
||||
private final DamageSource damageSource;
|
||||
+ private Component deathMessage;
|
||||
+
|
||||
+ public CraterPlayerDeathEvent(BridgedPlayer player, DamageSource source, Component deathMessage) {
|
||||
+ this(player, source);
|
||||
+ this.deathMessage = deathMessage;
|
||||
+ }
|
||||
|
||||
public Component getDeathMessage() {
|
||||
- return ChatUtils.mojangToAdventure(damageSource.getLocalizedDeathMessage(player.toMojang()));
|
||||
+ return deathMessage != null ? deathMessage : ChatUtils.mojangToAdventure(damageSource.getLocalizedDeathMessage(player.toMojang()));
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
--- a/Common/src/main/java/com/hypherionmc/craterlib/compat/FTBEssentials.java
|
||||
+++ b/Common/src/main/java/com/hypherionmc/craterlib/compat/FTBEssentials.java
|
||||
@@ -8,8 +8,8 @@
|
||||
@@ -9,8 +9,8 @@
|
||||
public class FTBEssentials {
|
||||
|
||||
public static boolean isPlayerMuted(BridgedPlayer player) {
|
||||
|
@@ -8,20 +8,19 @@
|
||||
import com.hypherionmc.craterlib.nojang.resources.ResourceIdentifier;
|
||||
import me.hypherionmc.mcdiscordformatter.discord.DiscordSerializer;
|
||||
import me.hypherionmc.mcdiscordformatter.minecraft.MinecraftSerializer;
|
||||
@@ -12,12 +10,8 @@
|
||||
@@ -12,11 +10,6 @@
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.Util;
|
||||
-// @noplugin
|
||||
-import net.minecraft.client.Minecraft;
|
||||
-// #noplugin
|
||||
-import net.minecraft.core.HolderLookup;
|
||||
-import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.Style;
|
||||
-
|
||||
public class ChatUtils {
|
||||
|
||||
private static final GsonComponentSerializer adventureSerializer = GsonComponentSerializer.builder().options(
|
||||
@@ -28,22 +22,12 @@
|
||||
@@ -30,24 +23,12 @@
|
||||
|
||||
public static Component adventureToMojang(net.kyori.adventure.text.Component inComponent) {
|
||||
final String serialised = adventureSerializer.serialize(inComponent);
|
||||
@@ -36,8 +35,10 @@
|
||||
- }
|
||||
-
|
||||
- private static HolderLookup.Provider getRegistryLookup() {
|
||||
- // @noplugin
|
||||
- if (ModloaderEnvironment.INSTANCE.getEnvironment().isClient() && Minecraft.getInstance().level != null)
|
||||
- return Minecraft.getInstance().level.registryAccess();
|
||||
- // #noplugin
|
||||
-
|
||||
- if (ModloaderEnvironment.INSTANCE.getEnvironment().isServer() && CommonPlatform.INSTANCE.getMCServer() != null)
|
||||
- return CommonPlatform.INSTANCE.getMCServer().toMojang().registryAccess();
|
||||
|
@@ -10,10 +10,10 @@
|
||||
|
||||
@@ -115,8 +114,8 @@
|
||||
setVersionType("release")
|
||||
setChangelog("https://raw.githubusercontent.com/hypherionmc/changelogs/main/craterlib/changelog-fabric.md")
|
||||
setChangelog(rootProject.file("changelog.md"))
|
||||
setProjectVersion("${minecraft_version}-${project.version}")
|
||||
- setDisplayName("[FABRIC/QUILT 1.21.2] CraterLib - ${project.version}")
|
||||
- setGameVersions("1.21.2")
|
||||
- setDisplayName("[FABRIC/QUILT 1.21.3] CraterLib - ${project.version}")
|
||||
- setGameVersions("1.21.3")
|
||||
+ setDisplayName("[FABRIC/QUILT 1.19.2] CraterLib - ${project.version}")
|
||||
+ setGameVersions("1.19.2")
|
||||
setLoaders("fabric", "quilt")
|
||||
|
@@ -13,7 +13,7 @@
|
||||
}
|
||||
@@ -107,8 +108,8 @@
|
||||
setVersionType("release")
|
||||
setChangelog("https://raw.githubusercontent.com/hypherionmc/changelogs/main/craterlib/changelog-forge.md")
|
||||
setChangelog(rootProject.file("changelog.md"))
|
||||
setProjectVersion("${minecraft_version}-${project.version}")
|
||||
- setDisplayName("[Forge 1.20.6] CraterLib - ${project.version}")
|
||||
- setGameVersions("1.20.6")
|
||||
|
@@ -16,7 +16,7 @@
|
||||
+ if (!ModloaderEnvironment.INSTANCE.isModLoaded("vmod"))
|
||||
+ return true;
|
||||
+
|
||||
+ return VanishUtil.isVanished(player.toMojangServerPlayer());
|
||||
+ return !VanishUtil.isVanished(player.toMojangServerPlayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -114,10 +114,10 @@
|
||||
- setModrinthID(modrinth_id)
|
||||
- setNightbloomID("craterlib")
|
||||
- setVersionType("release")
|
||||
- setChangelog("https://raw.githubusercontent.com/hypherionmc/changelogs/main/craterlib/changelog-forge.md")
|
||||
- setChangelog(rootProject.file("changelog.md"))
|
||||
- setProjectVersion("${minecraft_version}-${project.version}")
|
||||
- setDisplayName("[NeoForge 1.21.2] CraterLib - ${project.version}")
|
||||
- setGameVersions("1.21.2")
|
||||
- setDisplayName("[NeoForge 1.21.3] CraterLib - ${project.version}")
|
||||
- setGameVersions("1.21.3")
|
||||
- setLoaders("neoforge")
|
||||
- setArtifact(remapJar)
|
||||
- setCurseEnvironment("both")
|
||||
|
@@ -15,7 +15,7 @@
|
||||
- if (!ModloaderEnvironment.INSTANCE.isModLoaded("vmod"))
|
||||
- return true;
|
||||
-
|
||||
- return VanishUtil.isVanished(player.toMojangServerPlayer());
|
||||
- return !VanishUtil.isVanished(player.toMojangServerPlayer());
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
|
83
patches/1.19.2/Paper/build.gradle.patch
Normal file
83
patches/1.19.2/Paper/build.gradle.patch
Normal file
@@ -0,0 +1,83 @@
|
||||
--- a/Paper/build.gradle
|
||||
+++ /dev/null
|
||||
@@ -1,80 +1,0 @@
|
||||
-plugins {
|
||||
- id "io.papermc.paperweight.userdev" version "1.7.3"
|
||||
- id "xyz.jpenilla.run-paper" version "2.3.0"
|
||||
-}
|
||||
-
|
||||
-archivesBaseName = "${mod_name.replace(" ", "")}-Paper-${minecraft_version}"
|
||||
-
|
||||
-origami {
|
||||
- excludedPackages = ["com.hypherionmc.craterlib.client", "com.hypherionmc.craterlib.mixin", "com.hypherionmc.craterlib.nojang.client", "com.hypherionmc.craterlib.core.rpcsdk", "com.hypherionmc.craterlib.nojang.realmsclient"]
|
||||
- excludedResources = ["pack.mcmeta", "craterlib.mixins.json"]
|
||||
-}
|
||||
-
|
||||
-dependencies {
|
||||
- paperweight.paperDevBundle("${minecraft_version}-R0.1-SNAPSHOT")
|
||||
-
|
||||
- // Do not edit or remove
|
||||
- implementation project(":Common")
|
||||
-}
|
||||
-
|
||||
-shadowJar {
|
||||
- from sourceSets.main.output
|
||||
- configurations = [project.configurations.shade]
|
||||
-
|
||||
- dependencies {
|
||||
- exclude(dependency('com.google.code.gson:.*'))
|
||||
- exclude(dependency('net.kyori:.*'))
|
||||
-
|
||||
- relocate 'me.hypherionmc.moonconfig', 'shadow.hypherionmc.moonconfig'
|
||||
- relocate 'me.hypherionmc.mcdiscordformatter', 'shadow.hypherionmc.mcdiscordformatter'
|
||||
-
|
||||
- exclude("linux-x86-64/**", "win32-x86/**", "win32-x86-64/**", "darwin/**")
|
||||
- }
|
||||
-
|
||||
- setArchiveClassifier(null)
|
||||
- mergeServiceFiles()
|
||||
-}
|
||||
-
|
||||
-jar {
|
||||
- archiveClassifier.set "slim"
|
||||
-}
|
||||
-
|
||||
-tasks {
|
||||
- runServer {
|
||||
- minecraftVersion(project.minecraft_version)
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-processResources {
|
||||
- def buildProps = project.properties.clone()
|
||||
-
|
||||
- filesMatching(['paper-plugin.yml']) {
|
||||
- expand buildProps
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-compileTestJava.enabled = false
|
||||
-
|
||||
-tasks.assemble {
|
||||
- dependsOn(tasks.reobfJar)
|
||||
-}
|
||||
-
|
||||
-publisher {
|
||||
- apiKeys {
|
||||
- modrinth(System.getenv("MODRINTH_TOKEN"))
|
||||
- nightbloom(System.getenv("PLATFORM_KEY"))
|
||||
- }
|
||||
-
|
||||
- setModrinthID(modrinth_id)
|
||||
- setNightbloomID("craterlib")
|
||||
- setVersionType("alpha")
|
||||
- setChangelog(rootProject.file("changelog.md"))
|
||||
- setProjectVersion("${minecraft_version}-${project.version}")
|
||||
- setDisplayName("[Paper 1.21.3] CraterLib - ${project.version}")
|
||||
- setGameVersions("1.21.3")
|
||||
- setLoaders("paper")
|
||||
- setArtifact(reobfJar.outputJar)
|
||||
-}
|
||||
-
|
||||
-publishModrinth.dependsOn(reobfJar)
|
||||
-publishNightbloom.dependsOn(reobfJar)
|
@@ -0,0 +1,22 @@
|
||||
--- a/Paper/src/main/java/com/hypherionmc/craterlib/common/PaperCommonHelper.java
|
||||
+++ /dev/null
|
||||
@@ -1,19 +1,0 @@
|
||||
-package com.hypherionmc.craterlib.common;
|
||||
-
|
||||
-import com.hypherionmc.craterlib.core.platform.CommonPlatform;
|
||||
-import com.hypherionmc.craterlib.nojang.server.BridgedMinecraftServer;
|
||||
-import net.minecraft.server.MinecraftServer;
|
||||
-
|
||||
-/**
|
||||
- * @author HypherionSA
|
||||
- */
|
||||
-public class PaperCommonHelper implements CommonPlatform {
|
||||
-
|
||||
- public PaperCommonHelper() {
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public BridgedMinecraftServer getMCServer() {
|
||||
- return BridgedMinecraftServer.of(MinecraftServer.getServer());
|
||||
- }
|
||||
-}
|
@@ -0,0 +1,81 @@
|
||||
--- a/Paper/src/main/java/com/hypherionmc/craterlib/common/PaperCompatHelper.java
|
||||
+++ /dev/null
|
||||
@@ -1,78 +1,0 @@
|
||||
-package com.hypherionmc.craterlib.common;
|
||||
-
|
||||
-import com.hypherionmc.craterlib.core.platform.CompatUtils;
|
||||
-import com.hypherionmc.craterlib.core.platform.ModloaderEnvironment;
|
||||
-import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
|
||||
-import com.hypherionmc.craterlib.utils.ChatUtils;
|
||||
-import org.bukkit.Bukkit;
|
||||
-import org.bukkit.entity.Player;
|
||||
-import org.bukkit.metadata.MetadataValue;
|
||||
-import org.bukkit.plugin.Plugin;
|
||||
-
|
||||
-import java.lang.reflect.Method;
|
||||
-
|
||||
-public class PaperCompatHelper implements CompatUtils {
|
||||
-
|
||||
- @Override
|
||||
- public boolean isPlayerActive(BridgedPlayer player) {
|
||||
- // Essentials Vanish
|
||||
- if (ModloaderEnvironment.INSTANCE.isModLoaded("Essentials")) {
|
||||
- return !isEssentialsVanished(player);
|
||||
- }
|
||||
-
|
||||
- // PhantomAdmin Vanish
|
||||
- if (ModloaderEnvironment.INSTANCE.isModLoaded("PhantomAdmin"))
|
||||
- return !isPhantomVanished(player);
|
||||
-
|
||||
- // Other vanish mods
|
||||
- try {
|
||||
- Player p = (Player) player.toMojangServerPlayer();
|
||||
- for (MetadataValue meta : p.getMetadata("vanished")) {
|
||||
- if (meta.asBoolean()) return true;
|
||||
- }
|
||||
- } catch (Exception ignored) {}
|
||||
-
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public String getSkinUUID(BridgedPlayer player) {
|
||||
- return player.getStringUUID();
|
||||
- }
|
||||
-
|
||||
- private boolean isEssentialsVanished(BridgedPlayer player) {
|
||||
- try {
|
||||
- Plugin p = Bukkit.getPluginManager().getPlugin("Essentials");
|
||||
- if (p == null)
|
||||
- return false;
|
||||
-
|
||||
- Method getUser = p.getClass().getMethod("getUser", String.class);
|
||||
- Object essentialsPlayer = getUser.invoke(p, ChatUtils.resolve(player.getName(), false));
|
||||
-
|
||||
- if (essentialsPlayer != null) {
|
||||
- Method isVanished = essentialsPlayer.getClass().getMethod("isVanished");
|
||||
- return (boolean) isVanished.invoke(essentialsPlayer);
|
||||
- }
|
||||
- } catch (Exception ignored) {}
|
||||
-
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- private boolean isPhantomVanished(BridgedPlayer player) {
|
||||
- try {
|
||||
- Plugin p = Bukkit.getPluginManager().getPlugin("PhantomAdmin");
|
||||
- if (p == null)
|
||||
- return false;
|
||||
-
|
||||
- Method isInvisible = p.getClass().getDeclaredMethod("isInvisible", Player.class);
|
||||
- isInvisible.setAccessible(true);
|
||||
-
|
||||
- return (boolean) isInvisible.invoke(p, (Player) player.toMojangServerPlayer());
|
||||
- } catch (Exception ignored) {
|
||||
- ignored.printStackTrace();
|
||||
- }
|
||||
-
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
-}
|
@@ -0,0 +1,73 @@
|
||||
--- a/Paper/src/main/java/com/hypherionmc/craterlib/common/PaperLoaderHelper.java
|
||||
+++ /dev/null
|
||||
@@ -1,70 +1,0 @@
|
||||
-package com.hypherionmc.craterlib.common;
|
||||
-
|
||||
-import com.hypherionmc.craterlib.core.platform.Environment;
|
||||
-import com.hypherionmc.craterlib.core.platform.LoaderType;
|
||||
-import com.hypherionmc.craterlib.core.platform.ModloaderEnvironment;
|
||||
-import net.minecraft.SharedConstants;
|
||||
-import org.bukkit.Bukkit;
|
||||
-import org.bukkit.plugin.Plugin;
|
||||
-
|
||||
-import java.io.File;
|
||||
-import java.util.Arrays;
|
||||
-
|
||||
-/**
|
||||
- * @author HypherionSA
|
||||
- */
|
||||
-public class PaperLoaderHelper implements ModloaderEnvironment {
|
||||
-
|
||||
- public PaperLoaderHelper() {
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public boolean isFabric() {
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public LoaderType getLoaderType() {
|
||||
- return LoaderType.PAPER;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public String getGameVersion() {
|
||||
- return SharedConstants.getCurrentVersion().getName();
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public File getGameFolder() {
|
||||
- return new File(".");
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public File getConfigFolder() {
|
||||
- return new File("config");
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public File getModsFolder() {
|
||||
- return Bukkit.getPluginsFolder();
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public Environment getEnvironment() {
|
||||
- return Environment.SERVER;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public boolean isModLoaded(String modid) {
|
||||
- return Bukkit.getPluginManager().isPluginEnabled(modid);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public boolean isDevEnv() {
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public int getModCount() {
|
||||
- return (int) Arrays.stream(Bukkit.getPluginManager().getPlugins()).filter(Plugin::isEnabled).count();
|
||||
- }
|
||||
-}
|
@@ -0,0 +1,16 @@
|
||||
--- a/Paper/src/main/java/com/hypherionmc/craterlib/paper/CraterLibBootstrap.java
|
||||
+++ /dev/null
|
||||
@@ -1,13 +1,0 @@
|
||||
-package com.hypherionmc.craterlib.paper;
|
||||
-
|
||||
-import com.hypherionmc.craterlib.CraterConstants;
|
||||
-import io.papermc.paper.plugin.bootstrap.BootstrapContext;
|
||||
-import io.papermc.paper.plugin.bootstrap.PluginBootstrap;
|
||||
-
|
||||
-public class CraterLibBootstrap implements PluginBootstrap {
|
||||
-
|
||||
- @Override
|
||||
- public void bootstrap(BootstrapContext bootstrapContext) {
|
||||
- CraterConstants.LOG.info("Hello from CraterLib");
|
||||
- }
|
||||
-}
|
@@ -0,0 +1,34 @@
|
||||
--- a/Paper/src/main/java/com/hypherionmc/craterlib/paper/CraterLibPlugin.java
|
||||
+++ /dev/null
|
||||
@@ -1,31 +1,0 @@
|
||||
-package com.hypherionmc.craterlib.paper;
|
||||
-
|
||||
-import com.hypherionmc.craterlib.api.events.server.CraterRegisterCommandEvent;
|
||||
-import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
||||
-import com.hypherionmc.craterlib.core.platform.CommonPlatform;
|
||||
-import com.hypherionmc.craterlib.utils.InternalServiceUtil;
|
||||
-import net.minecraft.server.MinecraftServer;
|
||||
-import org.bukkit.plugin.java.JavaPlugin;
|
||||
-
|
||||
-public class CraterLibPlugin extends JavaPlugin {
|
||||
-
|
||||
- private final PaperEventListener listener = new PaperEventListener();
|
||||
-
|
||||
- public CraterLibPlugin() {
|
||||
- super();
|
||||
- InternalServiceUtil.loader = getClassLoader();
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void onLoad() {
|
||||
- listener.onServerStarting(MinecraftServer.getServer());
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void onEnable() {
|
||||
- CraterEventBus.INSTANCE.postEvent(new CraterRegisterCommandEvent(MinecraftServer.getServer().createCommandSourceStack().dispatcher()));
|
||||
- getServer().getPluginManager().registerEvents(listener, this);
|
||||
- getServer().getScheduler().scheduleSyncDelayedTask(this, listener::onServerStarted);
|
||||
- }
|
||||
-
|
||||
-}
|
@@ -0,0 +1,116 @@
|
||||
--- a/Paper/src/main/java/com/hypherionmc/craterlib/paper/PaperEventListener.java
|
||||
+++ /dev/null
|
||||
@@ -1,113 +1,0 @@
|
||||
-package com.hypherionmc.craterlib.paper;
|
||||
-
|
||||
-import com.hypherionmc.craterlib.api.events.common.CraterPlayerDeathEvent;
|
||||
-import com.hypherionmc.craterlib.api.events.server.PlayerPreLoginEvent;
|
||||
-import com.hypherionmc.craterlib.api.events.server.*;
|
||||
-import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
||||
-import com.hypherionmc.craterlib.nojang.advancements.BridgedAdvancement;
|
||||
-import com.hypherionmc.craterlib.nojang.authlib.BridgedGameProfile;
|
||||
-import com.hypherionmc.craterlib.nojang.server.BridgedMinecraftServer;
|
||||
-import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
|
||||
-import com.mojang.authlib.GameProfile;
|
||||
-import com.mojang.brigadier.CommandDispatcher;
|
||||
-import com.mojang.brigadier.ParseResults;
|
||||
-import io.papermc.paper.event.player.AsyncChatEvent;
|
||||
-import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
-import net.minecraft.commands.CommandSourceStack;
|
||||
-import net.minecraft.server.MinecraftServer;
|
||||
-import org.bukkit.command.ConsoleCommandSender;
|
||||
-import org.bukkit.craftbukkit.advancement.CraftAdvancement;
|
||||
-import org.bukkit.craftbukkit.damage.CraftDamageSource;
|
||||
-import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
-import org.bukkit.event.EventHandler;
|
||||
-import org.bukkit.event.EventPriority;
|
||||
-import org.bukkit.event.Listener;
|
||||
-import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
-import org.bukkit.event.player.*;
|
||||
-import org.bukkit.event.server.ServerCommandEvent;
|
||||
-
|
||||
-public class PaperEventListener implements Listener {
|
||||
-
|
||||
- @EventHandler(priority = EventPriority.HIGHEST)
|
||||
- public void onPlayerDeath(PlayerDeathEvent event) {
|
||||
- CraterEventBus.INSTANCE.postEvent(
|
||||
- new CraterPlayerDeathEvent(BridgedPlayer.of(((CraftPlayer) event.getPlayer()).getHandle()), ((CraftDamageSource) event.getDamageSource()).getHandle())
|
||||
- );
|
||||
- }
|
||||
-
|
||||
- @EventHandler(priority = EventPriority.HIGHEST)
|
||||
- public void onAdvancement(PlayerAdvancementDoneEvent event) {
|
||||
- if (((CraftAdvancement) event.getAdvancement()).getHandle().value().display().isEmpty() || !((CraftAdvancement) event.getAdvancement()).getHandle().value().display().get().shouldAnnounceChat())
|
||||
- return;
|
||||
-
|
||||
- CraterEventBus.INSTANCE.postEvent(
|
||||
- new CraterAdvancementEvent(BridgedPlayer.of(((CraftPlayer) event.getPlayer()).getHandle()), BridgedAdvancement.of(((CraftAdvancement) event.getAdvancement()).getHandle().value()))
|
||||
- );
|
||||
- }
|
||||
-
|
||||
- @EventHandler(priority = EventPriority.HIGHEST)
|
||||
- public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
- CraterEventBus.INSTANCE.postEvent(new CraterPlayerEvent.PlayerLoggedIn(BridgedPlayer.of(((CraftPlayer) event.getPlayer()).getHandle())));
|
||||
- }
|
||||
-
|
||||
- @EventHandler(priority = EventPriority.HIGHEST)
|
||||
- public void onPlayerLeave(PlayerQuitEvent event) {
|
||||
- CraterEventBus.INSTANCE.postEvent(new CraterPlayerEvent.PlayerLoggedOut(BridgedPlayer.of(((CraftPlayer) event.getPlayer()).getHandle())));
|
||||
- }
|
||||
-
|
||||
- @EventHandler(priority = EventPriority.HIGHEST)
|
||||
- public void onServerChat(AsyncChatEvent event) {
|
||||
- CraterEventBus.INSTANCE.postEvent(
|
||||
- new CraterServerChatEvent(BridgedPlayer.of(((CraftPlayer) event.getPlayer()).getHandle()), PlainTextComponentSerializer.plainText().serialize(event.message()), event.message())
|
||||
- );
|
||||
- }
|
||||
-
|
||||
- public void onServerStarting(MinecraftServer server) {
|
||||
- CraterEventBus.INSTANCE.postEvent(new CraterServerLifecycleEvent.Starting(BridgedMinecraftServer.of(server)));
|
||||
- }
|
||||
-
|
||||
- public void onServerStarted() {
|
||||
- CraterEventBus.INSTANCE.postEvent(new CraterServerLifecycleEvent.Started(BridgedMinecraftServer.of(MinecraftServer.getServer())));
|
||||
- }
|
||||
-
|
||||
- @EventHandler(priority = EventPriority.HIGHEST)
|
||||
- public void onCommandEvent(PlayerCommandPreprocessEvent event) {
|
||||
- CommandSourceStack stack = null;
|
||||
-
|
||||
- if (event.getPlayer() instanceof CraftPlayer craftPlayer) {
|
||||
- stack = craftPlayer.getHandle().createCommandSourceStack();
|
||||
- } else if (event.getPlayer() instanceof ConsoleCommandSender) {
|
||||
- stack = MinecraftServer.getServer().createCommandSourceStack();
|
||||
- }
|
||||
-
|
||||
- if (stack == null)
|
||||
- return;
|
||||
-
|
||||
- String cmd = event.getMessage().substring(1);
|
||||
-
|
||||
- CommandDispatcher<CommandSourceStack> dispatcher = MinecraftServer.getServer().getCommands().getDispatcher();
|
||||
- ParseResults<CommandSourceStack> parseResults = dispatcher.parse(cmd, stack);
|
||||
- CraterEventBus.INSTANCE.postEvent(CraterCommandEvent.of(parseResults, cmd));
|
||||
- }
|
||||
-
|
||||
- @EventHandler(priority = EventPriority.HIGHEST)
|
||||
- public void onServerCommandEvent(ServerCommandEvent event) {
|
||||
- CommandSourceStack stack = MinecraftServer.getServer().createCommandSourceStack();
|
||||
-
|
||||
- String cmd = event.getCommand();
|
||||
-
|
||||
- CommandDispatcher<CommandSourceStack> dispatcher = MinecraftServer.getServer().getCommands().getDispatcher();
|
||||
- ParseResults<CommandSourceStack> parseResults = dispatcher.parse(cmd, stack);
|
||||
- CraterEventBus.INSTANCE.postEvent(CraterCommandEvent.of(parseResults, cmd));
|
||||
- }
|
||||
-
|
||||
- @EventHandler(priority = EventPriority.HIGHEST)
|
||||
- public void onPreLogin(AsyncPlayerPreLoginEvent event) {
|
||||
- PlayerPreLoginEvent playerPreLoginEvent = new PlayerPreLoginEvent(null, BridgedGameProfile.of(new GameProfile(event.getUniqueId(), event.getName())));
|
||||
- CraterEventBus.INSTANCE.postEvent(playerPreLoginEvent);
|
||||
-
|
||||
- if (playerPreLoginEvent.wasCancelled() || playerPreLoginEvent.getMessage() != null) {
|
||||
- event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, playerPreLoginEvent.getMessage());
|
||||
- }
|
||||
- }
|
||||
-}
|
@@ -0,0 +1,4 @@
|
||||
--- a/Paper/src/main/resources/META-INF/services/com.hypherionmc.craterlib.core.platform.CommonPlatform
|
||||
+++ /dev/null
|
||||
@@ -1,1 +1,0 @@
|
||||
-com.hypherionmc.craterlib.common.PaperCommonHelper
|
@@ -0,0 +1,4 @@
|
||||
--- a/Paper/src/main/resources/META-INF/services/com.hypherionmc.craterlib.core.platform.CompatUtils
|
||||
+++ /dev/null
|
||||
@@ -1,1 +1,0 @@
|
||||
-com.hypherionmc.craterlib.common.PaperCompatHelper
|
@@ -0,0 +1,4 @@
|
||||
--- a/Paper/src/main/resources/META-INF/services/com.hypherionmc.craterlib.core.platform.ModloaderEnvironment
|
||||
+++ /dev/null
|
||||
@@ -1,1 +1,0 @@
|
||||
-com.hypherionmc.craterlib.common.PaperLoaderHelper
|
@@ -0,0 +1,11 @@
|
||||
--- a/Paper/src/main/resources/paper-plugin.yml
|
||||
+++ /dev/null
|
||||
@@ -1,8 +1,0 @@
|
||||
-name: CraterLib
|
||||
-version: ${version}
|
||||
-description: "A Modding API used to create 'universal' mods"
|
||||
-main: com.hypherionmc.craterlib.paper.CraterLibPlugin
|
||||
-author: HypherionSA
|
||||
-api-version: '1.21.3'
|
||||
-bootstrapper: com.hypherionmc.craterlib.paper.CraterLibBootstrap
|
||||
-load: STARTUP
|
@@ -1,6 +1,6 @@
|
||||
--- a/build.gradle
|
||||
+++ b/build.gradle
|
||||
@@ -7,21 +7,15 @@
|
||||
@@ -8,21 +8,15 @@
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
identifier("${relType}")
|
||||
}
|
||||
}
|
||||
@@ -35,14 +29,13 @@
|
||||
apply plugin: 'com.github.johnrengelman.shadow'
|
||||
apply plugin: 'com.hypherionmc.modutils.modpublisher'
|
||||
@@ -40,14 +34,13 @@
|
||||
apply plugin: 'com.hypherionmc.modutils.orion.origami'
|
||||
}
|
||||
|
||||
- sourceCompatibility = JavaVersion.VERSION_21
|
||||
- targetCompatibility = JavaVersion.VERSION_21
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
maven {
|
||||
name = "Modrinth"
|
||||
@@ -68,7 +61,7 @@
|
||||
@@ -73,7 +66,7 @@
|
||||
shade "me.hypherionmc.moon-config:toml:${moon_config}"
|
||||
shade "me.hypherionmc.moon-config:json:${moon_config}"
|
||||
shade "com.hypherionmc:rpcsdk:${rpc_sdk}"
|
||||
@@ -49,7 +49,7 @@
|
||||
shade "net.kyori:adventure-api:${adventure}"
|
||||
shade "net.kyori:adventure-text-serializer-gson:${adventure}"
|
||||
shade "net.kyori:adventure-text-minimessage:${adventure}"
|
||||
@@ -117,7 +110,7 @@
|
||||
@@ -124,7 +117,7 @@
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
it.options.encoding = 'UTF-8'
|
||||
|
@@ -4,13 +4,13 @@
|
||||
mod_name=CraterLib
|
||||
|
||||
# Shared
|
||||
-minecraft_version=1.21.2
|
||||
-minecraft_version=1.21.3
|
||||
+minecraft_version=1.19.2
|
||||
project_group=com.hypherionmc.craterlib
|
||||
|
||||
# Fabric
|
||||
-fabric_loader=0.16.7
|
||||
-fabric_api=0.106.1+1.21.2
|
||||
-fabric_api=0.107.3+1.21.3
|
||||
+fabric_loader=0.15.11
|
||||
+fabric_api=0.76.0+1.19.2
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
-forge_version=50.0.6
|
||||
-
|
||||
-# NeoForged
|
||||
-neoforge_version=0-beta
|
||||
-neoforge_version=16-beta
|
||||
+forge_version=43.4.0
|
||||
|
||||
# Dependencies
|
||||
|
@@ -1,10 +1,12 @@
|
||||
--- a/settings.gradle
|
||||
+++ b/settings.gradle
|
||||
@@ -13,5 +13,5 @@
|
||||
@@ -13,7 +13,5 @@
|
||||
}
|
||||
}
|
||||
|
||||
-rootProject.name = 'CraterLib'
|
||||
-include("Common", "Fabric", "NeoForge")
|
||||
-include 'Paper'
|
||||
-
|
||||
+rootProject.name = 'CraterLib-1.19.2'
|
||||
+include("Common", "Fabric", "Forge")
|
||||
|
Reference in New Issue
Block a user