Skip to content

Commit

Permalink
Support 1.18.x & 1.19.x
Browse files Browse the repository at this point in the history
  • Loading branch information
CECoffee committed Jan 24, 2023
1 parent 6b03251 commit cb2cdf2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ plugins {
`java-library`
id ("com.github.johnrengelman.shadow") version "7.1.2"
id("io.papermc.paperweight.userdev") version "1.3.6"
id("xyz.jpenilla.run-paper") version "1.0.6" // Adds runServer and runMojangMappedServer tasks for testing
id("xyz.jpenilla.run-paper") version "2.0.1" // Adds runServer and runMojangMappedServer tasks for testing
id("net.minecrell.plugin-yml.bukkit") version "0.5.2"
}

group = "me.chickenstyle.luckyblocks"
version = "1.0.8"
version = "1.0.9"
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
Expand All @@ -23,13 +23,14 @@ repositories {
includeGroup("io.papermc.paper")
includeGroup("net.kyori")
}
}
};
maven("https://plugins.gradle.org/m2/")
}
dependencies {
paperDevBundle("1.18.2-R0.1-SNAPSHOT")
paperDevBundle("1.19.3-R0.1-SNAPSHOT")

//Shaded
implementation("net.kyori:adventure-text-minimessage:4.11.0-SNAPSHOT") {
implementation("net.kyori:adventure-text-minimessage:4.12.0") {
exclude(group = "net.kyori", module = "adventure-api")
exclude(group = "net.kyori", module = "adventure-bom")
}
Expand Down Expand Up @@ -73,9 +74,9 @@ tasks {
bukkit {
name = "LuckyCubes"
main = "me.chickenstyle.luckyblocks.Main"
apiVersion = "1.18"
authors = listOf("ChickenStyle")
version = "1.0.7"
apiVersion = "1.19"
authors = listOf("ChickenStyle", "CECoffee")
version = "1.0.9"
description = "implements cool luckyblocks to the game"
commands {
register("luckycubes") {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/me/chickenstyle/luckyblocks/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import me.chickenstyle.luckyblocks.events.CloseInventory;
import me.chickenstyle.luckyblocks.events.PlaceBlockEvent;
import me.chickenstyle.luckyblocks.events.PlayerStandManipulateEvent;
import me.chickenstyle.luckyblocks.versions.Handler_1_18_R2;
import me.chickenstyle.luckyblocks.versions.Handler_18_19;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -97,12 +97,12 @@ public void getServerVersion() {
String version = Bukkit.getServer().getClass().getPackage().getName();
version = version.substring(version.lastIndexOf(".") + 1);
boolean isValid = true;
if (!"v1_18_R2".equals(version)) {
if (!(version.startsWith("v1_18") || version.startsWith("v1_19"))) {
isValid = false;
getServer().getConsoleSender().sendMessage(parse("<RED>LuckyCubes >>> This version isn't supported!"));
getServer().getConsoleSender().sendMessage(parse("<YELLOW>LuckyCubes >>> LuckyCubes will run anyways. However, I cannot guarantee that it will work."));
}
versionHandler = new Handler_1_18_R2();
versionHandler = new Handler_18_19();
if (isValid) {
getServer().getConsoleSender().sendMessage(parse("<GREEN>LuckyCubes >>> NMS Version Detected: " + version));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack;

public class Handler_1_18_R2 implements NMSHandler {
public class Handler_18_19 implements NMSHandler {

@Override
public ItemStack addLuckyBlockID(ItemStack item,int id) {
Expand Down

0 comments on commit cb2cdf2

Please sign in to comment.