9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-19 15:09:19 +00:00

initial work

This commit is contained in:
LoJoSho
2022-11-29 20:10:53 -06:00
parent 0e92fa3f05
commit 2792396e26
71 changed files with 186 additions and 64 deletions

View File

@@ -2,8 +2,7 @@ import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
plugins { plugins {
id("java") id("java")
id("com.github.johnrengelman.shadow") version "7.1.1" id("com.github.johnrengelman.shadow") version "7.1.2"
id("io.papermc.paperweight.userdev") version "1.3.8"
id("xyz.jpenilla.run-paper") version "2.0.0" id("xyz.jpenilla.run-paper") version "2.0.0"
id("net.minecrell.plugin-yml.bukkit") version "0.5.2" id("net.minecrell.plugin-yml.bukkit") version "0.5.2"
} }
@@ -11,70 +10,38 @@ plugins {
group = "com.hibiscusmc" group = "com.hibiscusmc"
version = "Infdev" version = "Infdev"
bukkit { allprojects {
load = BukkitPluginDescription.PluginLoadOrder.POSTWORLD repositories {
main = "com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin" mavenCentral()
apiVersion = "1.19" maven("https://papermc.io/repo/repository/maven-public/")
authors = listOf("LoJoSho") maven("https://oss.sonatype.org/content/repositories/snapshots")
depend = listOf("ProtocolLib") maven("https://jitpack.io")
softDepend = listOf("ModelEngine", "Oraxen") //maven("https://repo.dmulloy2.net/repository/public/") ProtocolLib Repo, constantly down
version = "${project.version}" maven("https://repo.mineinabyss.com/releases/")
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
commands { maven("https://mvnrepository.com/artifact/com.zaxxer/HikariCP")
register("cosmetic") { maven("https://repo.citizensnpcs.co")
description = "Base command" //maven("https://mvn.lumine.io/repository/maven-public")
maven {
url = uri("https://mvn.lumine.io/repository/maven-public")
metadataSources {
artifact()
}
} }
} }
}
repositories { dependencies {
mavenCentral()
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven("https://jitpack.io")
//maven("https://repo.dmulloy2.net/repository/public/") ProtocolLib Repo, constantly down
maven("https://repo.mineinabyss.com/releases/")
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
maven("https://mvnrepository.com/artifact/com.zaxxer/HikariCP")
maven("https://repo.citizensnpcs.co")
//maven("https://mvn.lumine.io/repository/maven-public")
maven {
url = uri("https://mvn.lumine.io/repository/maven-public")
metadataSources {
artifact()
}
} }
} }
dependencies { dependencies {
paperDevBundle("1.19.2-R0.1-SNAPSHOT") implementation(project(":common"))
compileOnly("com.mojang:authlib:1.5.25") //implementation(project(":v1_19_R1"))
compileOnly("org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT") implementation(files("v1_19_R1/build/libs/1_19_R1-unspecified.jar"))
compileOnly("org.jetbrains:annotations:23.0.0")
compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0-SNAPSHOT")
compileOnly("me.clip:placeholderapi:2.11.1")
compileOnly("com.ticxo.modelengine:api:R3.0.1")
compileOnly("com.github.oraxen:oraxen:-SNAPSHOT")
compileOnly("com.github.LoneDev6:API-ItemsAdder:3.2.5") // TODO Work on this
//compileOnly("com.github.Fisher2911:FisherLib:master-SNAPSHOT")
implementation("net.kyori:adventure-api:4.11.0")
implementation ("net.kyori:adventure-text-minimessage:4.11.0")
implementation("net.kyori:adventure-platform-bukkit:4.1.2")
implementation("dev.triumphteam:triumph-gui:3.1.3")
implementation("org.spongepowered:configurate-yaml:4.1.2")
implementation("org.bstats:bstats-bukkit:3.0.0")
} }
tasks { tasks {
build {
dependsOn(shadowJar)
}
assemble {
dependsOn(reobfJar)
}
compileJava { compileJava {
options.encoding = Charsets.UTF_8.name() options.encoding = Charsets.UTF_8.name()
options.release.set(17) options.release.set(17)
@@ -89,15 +56,19 @@ tasks {
filteringCharset = Charsets.UTF_8.name() filteringCharset = Charsets.UTF_8.name()
} }
reobfJar {
outputJar.set(layout.projectDirectory.file("run/plugins/HMCCosmeticsRemapped.jar"))
}
runServer { runServer {
minecraftVersion("1.19.2") minecraftVersion("1.19.2")
} }
assemble {
dependsOn(shadowJar)
}
shadowJar { shadowJar {
dependsOn(":common:reobfJar")
dependsOn(":v1_19_R1:reobfJar")
mergeServiceFiles()
relocate("dev.triumphteam.gui", "com.hisbiscus.hmccosmetics.gui") relocate("dev.triumphteam.gui", "com.hisbiscus.hmccosmetics.gui")
relocate("me.mattstudios.mf", "com.hisbiscus.hmccosmetics.mf") relocate("me.mattstudios.mf", "com.hisbiscus.hmccosmetics.mf")
relocate("net.kyori.adventure", "com.hisbiscus.hmccosmetics.adventure") relocate("net.kyori.adventure", "com.hisbiscus.hmccosmetics.adventure")
@@ -110,10 +81,24 @@ tasks {
dependencies { dependencies {
exclude(dependency("org.yaml:snakeyaml")) exclude(dependency("org.yaml:snakeyaml"))
} }
archiveFile.get().asFile.copyTo(layout.projectDirectory.file("run/plugins/HMCCosmeticsRemapped.jar").asFile, true)
} }
} }
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17 bukkit {
)) load = BukkitPluginDescription.PluginLoadOrder.POSTWORLD
main = "com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin"
apiVersion = "1.19"
authors = listOf("LoJoSho")
depend = listOf("ProtocolLib")
softDepend = listOf("ModelEngine", "Oraxen")
version = "${project.version}"
commands {
register("cosmetic") {
description = "Base command"
}
}
} }

37
common/build.gradle.kts Normal file
View File

@@ -0,0 +1,37 @@
plugins {
id("java")
id("com.github.johnrengelman.shadow") apply false
id("io.papermc.paperweight.userdev") version "1.3.8"
}
dependencies {
paperDevBundle("1.19.2-R0.1-SNAPSHOT")
compileOnly("com.mojang:authlib:1.5.25")
compileOnly("org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT")
compileOnly("org.jetbrains:annotations:23.0.0")
compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0-SNAPSHOT")
compileOnly("me.clip:placeholderapi:2.11.1")
compileOnly("com.ticxo.modelengine:api:R3.0.1")
compileOnly("com.github.oraxen:oraxen:-SNAPSHOT")
compileOnly("com.github.LoneDev6:API-ItemsAdder:3.2.5") // TODO Work on this
//compileOnly("com.github.Fisher2911:FisherLib:master-SNAPSHOT")
implementation("net.kyori:adventure-api:4.11.0")
implementation ("net.kyori:adventure-text-minimessage:4.11.0")
implementation("net.kyori:adventure-platform-bukkit:4.1.2")
implementation("dev.triumphteam:triumph-gui:3.1.3")
implementation("org.spongepowered:configurate-yaml:4.1.2")
implementation("org.bstats:bstats-bukkit:3.0.0")
}
tasks {
build {
dependsOn(reobfJar)
}
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17
))
}

View File

@@ -0,0 +1,8 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven("https://repo.papermc.io/repository/maven-public/")
}
}
rootProject.name = "HMCCosmetics"

View File

@@ -13,6 +13,7 @@ import com.hibiscusmc.hmccosmetics.gui.Menus;
import com.hibiscusmc.hmccosmetics.hooks.items.ItemHooks; import com.hibiscusmc.hmccosmetics.hooks.items.ItemHooks;
import com.hibiscusmc.hmccosmetics.listener.PlayerConnectionListener; import com.hibiscusmc.hmccosmetics.listener.PlayerConnectionListener;
import com.hibiscusmc.hmccosmetics.listener.PlayerGameListener; import com.hibiscusmc.hmccosmetics.listener.PlayerGameListener;
import com.hibiscusmc.hmccosmetics.nms.NMSHandlers;
import com.hibiscusmc.hmccosmetics.util.misc.Translation; import com.hibiscusmc.hmccosmetics.util.misc.Translation;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
@@ -34,6 +35,13 @@ public final class HMCCosmeticsPlugin extends JavaPlugin {
// Plugin startup logic // Plugin startup logic
instance = this; instance = this;
// NMS version check
if (!NMSHandlers.getHandler().getSupported()) {
getLogger().severe("This version is not supported! Consider switching versions?");
getServer().getPluginManager().disablePlugin(this);
return;
}
// File setup // File setup
if (!getDataFolder().exists()) { if (!getDataFolder().exists()) {
saveDefaultConfig(); saveDefaultConfig();

View File

@@ -0,0 +1,10 @@
package com.hibiscusmc.hmccosmetics.nms;
public interface NMSHandler {
int getNextEntityId();
default boolean getSupported () {
return false;
}
}

View File

@@ -0,0 +1,31 @@
package com.hibiscusmc.hmccosmetics.nms;
import java.lang.reflect.InvocationTargetException;
public class NMSHandlers {
private static final String[] SUPPORTED_VERSION = new String[]{"v1_19_R1"};
private static NMSHandler handler;
public static NMSHandler getHandler() {
if (handler != null) {
return handler;
} else {
setup();
}
return handler;
}
public static void setup() {
if (handler != null) return;
for (String version : SUPPORTED_VERSION) {
try {
//Class.forName("org.bukkit.craftbukkit." + version + ".block.CraftBlock").getName();
handler = (NMSHandler) Class.forName("com.hibiscusmc.hmccosmetics.nms." + version + ".NMSHandler").getConstructor().newInstance();
} catch (ClassNotFoundException | InvocationTargetException | InstantiationException |
IllegalAccessException | NoSuchMethodException e) {
throw new RuntimeException(e);
}
}
}
}

View File

@@ -4,5 +4,8 @@ pluginManagement {
maven("https://repo.papermc.io/repository/maven-public/") maven("https://repo.papermc.io/repository/maven-public/")
} }
} }
rootProject.name = "HMCCosmetics"
rootProject.name = "HMCCosmetics" include(
"common",
"v1_19_R1"
)

22
v1_19_R1/build.gradle.kts Normal file
View File

@@ -0,0 +1,22 @@
plugins {
id("java")
id("io.papermc.paperweight.userdev") version "1.3.8"
}
dependencies {
paperDevBundle("1.19.2-R0.1-SNAPSHOT")
implementation(project(":common"))
}
tasks {
compileJava {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
}
javadoc {
options.encoding = Charsets.UTF_8.name()
}
processResources {
filteringCharset = Charsets.UTF_8.name()
}
}

View File

@@ -0,0 +1,18 @@
package com.hibiscusmc.hmccosmetics.nms.v1_19_R1;
import net.minecraft.world.entity.Entity;
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
public class NMSHandler implements com.hibiscusmc.hmccosmetics.nms.NMSHandler {
@Override
public int getNextEntityId() {
return Entity.nextEntityId();
}
@Override
public boolean getSupported() {
return true;
}
}