diff --git a/build.gradle.kts b/build.gradle.kts index 2e42e49b..b0bd013a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -36,7 +36,7 @@ plugins { } group = "com.dre.brewery" -version = "3.4.6" +version = "3.4.7" val langVersion: Int = 17 val encoding: String = "UTF-8" @@ -163,17 +163,13 @@ tasks { println("Publishing a new release to: modrinth, hangar, and maven") dependsOn(modrinth) finalizedBy("publishPluginPublicationToHangar") - //finalizedBy(hangarPublish) finalizedBy(publish) doLast { // Much rather use a task in Gradle than a GitHub action for this, // but, may want to look into finding a small plugin for this since BreweryX has // a variety of addons that would also need this code copied into them. - val webhook = DiscordWebhook(System.getenv("DISCORD_WEBHOOK") ?: run { - println("No Discord Webhook found, skipping Discord announcement.") - return@doLast - }) + val webhook = DiscordWebhook(System.getenv("DISCORD_WEBHOOK") ?: return@doLast) webhook.message = "@everyone" webhook.embedTitle = "BreweryX - v${project.version}" webhook.embedDescription = readChangeLog() @@ -185,6 +181,7 @@ tasks { java { toolchain.languageVersion = JavaLanguageVersion.of(langVersion) + //withSourcesJar() -> Add conditional for this } @@ -228,7 +225,6 @@ publishing { modrinth { token.set(System.getenv("MODRINTH_TOKEN") ?: run { - println("No Modrinth API key found, skipping Modrinth publication.") return@modrinth }) projectId.set(project.name) // This can be the project ID or the slug. Either will work! @@ -247,18 +243,15 @@ hangarPublish { version.set(project.version.toString()) channel.set("Release") id.set(project.name) - apiKey.set(System.getenv("HANGAR_TOKEN") ?: run { - println("No Hangar API key found, skipping Hangar publication.") - return@register - }) + apiKey.set(System.getenv("HANGAR_TOKEN") ?: return@register) + changelog.set(readChangeLog()) platforms { register(Platforms.PAPER) { + // TODO: Ask in paper discord url.set("https://modrinth.com/plugin/breweryx/versions") - //jar.set(tasks.shadowJar.flatMap { it.archiveFile }) platformVersions.set(listOf("1.13.x", "1.14.x", "1.15.x", "1.16.x", "1.17.x", "1.18.x", "1.19.x", "1.20.x", "1.21.x")) } } - changelog.set(readChangeLog()) } } diff --git a/src/main/java/com/dre/brewery/BarrelAsset.java b/src/main/java/com/dre/brewery/BarrelAsset.java index 48492f39..80d3f0cb 100644 --- a/src/main/java/com/dre/brewery/BarrelAsset.java +++ b/src/main/java/com/dre/brewery/BarrelAsset.java @@ -52,6 +52,9 @@ public static void addBarrelAsset(BarrelAsset asset, Material... materials) { } public static boolean isBarrelAsset(BarrelAsset assetType, Material material) { + if (material == null) { + return false; + } return BARREL_ASSET_LIST_MAP.get(assetType).contains(material); } } diff --git a/src/main/java/com/dre/brewery/configuration/files/Config.java b/src/main/java/com/dre/brewery/configuration/files/Config.java index cb53d309..e5008310 100644 --- a/src/main/java/com/dre/brewery/configuration/files/Config.java +++ b/src/main/java/com/dre/brewery/configuration/files/Config.java @@ -117,7 +117,9 @@ public List getPukeItem() { @LocalizedComment("config.stumblePercent") private int stumblePercent = 100; - public float getStumblePercent() { return stumblePercent / 100f; } + public float getStumblePercent() { + return stumblePercent / 100f; + } @LocalizedComment("config.showStatusOnDrink") private boolean showStatusOnDrink = true; diff --git a/src/main/java/com/dre/brewery/listeners/PlayerListener.java b/src/main/java/com/dre/brewery/listeners/PlayerListener.java index 4a3abfa9..4ab69d5c 100644 --- a/src/main/java/com/dre/brewery/listeners/PlayerListener.java +++ b/src/main/java/com/dre/brewery/listeners/PlayerListener.java @@ -105,10 +105,13 @@ public static void handlePlayerInteract(PlayerInteractEvent event) { return; } - if (player.isSneaking()) return; + Material heldItem = event.getItem() != null ? event.getItem().getType() : null; + if (player.isSneaking() && !BarrelAsset.isBarrelAsset(BarrelAsset.SIGN, heldItem)) { + return; + } // -- Interacting with a Cauldron -- - if (MaterialUtil.isWaterCauldron(type)) { + if (MaterialUtil.isWaterCauldron(type) && !player.isSneaking()) { // Handle the Cauldron Interact // The Event might get cancelled in here BCauldron.clickCauldron(event);