From e9ebc26c1f7177a448e085e5bf81cb1ac2020b35 Mon Sep 17 00:00:00 2001 From: Alex Noyle Date: Sun, 20 Aug 2023 21:54:15 +0000 Subject: [PATCH] 1.3.2 Update by @NotAlexNoyle (#3) * Add Jitpack config for API * Adapt jitpack.yml for gradle * Fit Jitpack again * Fix the Jitpack Fix * Fix the fix to the fix to the jitpack * Refactor phantom toggling * Fix to the fix to the fix to the fix to the jitpack * Final jitpack fix hopefully * 1.3.2 Update --- build.gradle | 20 +++++++++++-------- changelog.txt | 16 +++++++++++---- jitpack.yml | 7 +++++++ .../Listeners/DisablePhantomSpawns.java | 5 ++--- .../utilitiesog/Utilities_OG.java | 18 ++++++++--------- .../modules/PhantomToggleModule.java | 17 ++++++++-------- src/main/resources/plugin.yml | 2 +- 7 files changed, 52 insertions(+), 33 deletions(-) create mode 100644 jitpack.yml diff --git a/build.gradle b/build.gradle index f34a38c..4f51aa7 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,11 @@ plugins { id 'java' + id 'maven-publish' id("com.github.johnrengelman.shadow") version "7.1.2" } group = 'me.barny1094875' -version = '1.3' +version = '1.3.2' repositories { @@ -59,10 +60,13 @@ processResources { } } -//shadowJar { -// relocate("de.tr7zw.changeme.nbtapi", "me.barny1094875.utilitiesog.itemnbtapi") -//} -// -//build{ -// dependsOn(shadowJar) -//} +publishing { + publications { + mavenJava(MavenPublication) { + groupId = 'me.barny1094875' + artifactId = 'utilities-og' + version = '1.3.2' + from components.java + } + } +} diff --git a/changelog.txt b/changelog.txt index c6e2446..6d3ea6e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,12 @@ -1.3: +**1.3.2**: +- Refactor phantom toggle logic. +- Enable phantom spawning by default. +- Fix Jitpack build. + +**1.3.1:** +- Make bamboo wood named bamboo wood. + +**1.3:** - Added new /ping command. Supports ping lookup for self and others. - Added /bing command to replicate the functionality of the old /ping command. @@ -7,15 +15,15 @@ - New per-command permissions (described in README.md). - Added ranks menu and ping API. -1.2: +**1.2:** - Add "bamboo" wood recipe. -1.1: +**1.1:** - Added about message. - Fixed NullPointerException. - Expanded documentation. - Improved chat formatting. - Block per-player commands from console. -- Merged in and deprecated Buy-OG. \ No newline at end of file +- Merged in and deprecated Buy-OG. diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000..bc5f0b4 --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,7 @@ +jdk: + - 17.0.8 +before_install: + - sdk install java 17.0.8-graalce + - sdk use java 17.0.8-graalce +install: + - ./gradlew build publishToMavenLocal \ No newline at end of file diff --git a/src/main/java/me/barny1094875/utilitiesog/Listeners/DisablePhantomSpawns.java b/src/main/java/me/barny1094875/utilitiesog/Listeners/DisablePhantomSpawns.java index f8c5332..4afcd40 100644 --- a/src/main/java/me/barny1094875/utilitiesog/Listeners/DisablePhantomSpawns.java +++ b/src/main/java/me/barny1094875/utilitiesog/Listeners/DisablePhantomSpawns.java @@ -24,17 +24,16 @@ public class DisablePhantomSpawns implements Listener if (event.getEntityType().equals(EntityType.PHANTOM)) { // Store the contents of phantomDisabledUsers.yml file as a YAML object. - YamlConfiguration phantomDisabledPlayers = Utilities_OG.getPhantomDisabledPlayers(); + YamlConfiguration phantomsAreDisabled = Utilities_OG.getPhantomPreferences(); for (Player player : Bukkit.getServer().getOnlinePlayers()) { // Check if the player has disabled phantom spawns. - if (phantomDisabledPlayers.getBoolean(player.getUniqueId().toString())) + if (phantomsAreDisabled.getBoolean(player.getUniqueId().toString())) { // Check if the phantom is close enough to the player to count as their spawn. if (event.getEntity().getLocation().distance(player.getLocation()) < 48) { event.setCancelled(true); - break; } } } diff --git a/src/main/java/me/barny1094875/utilitiesog/Utilities_OG.java b/src/main/java/me/barny1094875/utilitiesog/Utilities_OG.java index d363487..280427d 100644 --- a/src/main/java/me/barny1094875/utilitiesog/Utilities_OG.java +++ b/src/main/java/me/barny1094875/utilitiesog/Utilities_OG.java @@ -27,8 +27,8 @@ public final class Utilities_OG extends JavaPlugin private static Utilities_OG plugin; private static final MiniMessage mm = MiniMessage.miniMessage(); private static FileConfiguration config; - private static File phantomDisabledPlayersFile; - private static YamlConfiguration phantomDisabledPlayers; + private static File phantomPreferencesFile; + private static YamlConfiguration phantomPreferences; @Override public void onEnable() @@ -44,13 +44,13 @@ public final class Utilities_OG extends JavaPlugin config = this.getConfig(); - phantomDisabledPlayersFile = new File(this.getDataFolder(), "phantomDisabledUsers.yml"); + phantomPreferencesFile = new File(this.getDataFolder(), "phantomDisabledUsers.yml"); try { - if (!phantomDisabledPlayersFile.exists()) + if (! phantomPreferencesFile.exists()) { - phantomDisabledPlayersFile.createNewFile(); + phantomPreferencesFile.createNewFile(); } } catch (IOException e) @@ -60,7 +60,7 @@ public final class Utilities_OG extends JavaPlugin } - phantomDisabledPlayers = YamlConfiguration.loadConfiguration(phantomDisabledPlayersFile); + phantomPreferences = YamlConfiguration.loadConfiguration(phantomPreferencesFile); // Set up each feature here, using the config to enable only that which is desired, // be sure to label, using comments, what each block is enabling. @@ -141,14 +141,14 @@ public final class Utilities_OG extends JavaPlugin return mm; } - public static YamlConfiguration getPhantomDisabledPlayers() + public static YamlConfiguration getPhantomPreferences() { - return phantomDisabledPlayers; + return phantomPreferences; } public static File getPhantomDisabledPlayersFile() { - return phantomDisabledPlayersFile; + return phantomPreferencesFile; } } diff --git a/src/main/java/me/barny1094875/utilitiesog/modules/PhantomToggleModule.java b/src/main/java/me/barny1094875/utilitiesog/modules/PhantomToggleModule.java index 731129b..e2b244c 100644 --- a/src/main/java/me/barny1094875/utilitiesog/modules/PhantomToggleModule.java +++ b/src/main/java/me/barny1094875/utilitiesog/modules/PhantomToggleModule.java @@ -29,22 +29,22 @@ public class PhantomToggleModule implements CommandExecutor if (player.hasPermission("utilities.togglephantoms")) { // Store the contents of phantomDisabledUsers.yml file as a YAML object. - YamlConfiguration phantomDisabledPlayers = Utilities_OG.getPhantomDisabledPlayers(); + YamlConfiguration phantomPreferences = Utilities_OG.getPhantomPreferences(); // Cherry pick the command runner's phantom status from the YAML data set. - boolean playerDisabled = phantomDisabledPlayers.getBoolean(((Player) player).getUniqueId().toString()); + boolean phantomToggleState = phantomPreferences.getBoolean(player.getUniqueId().toString()); // Flip the true/false value to the opposite of what it currently is. - phantomDisabledPlayers.set(((Player) player).getUniqueId().toString(), ! playerDisabled); + phantomPreferences.set(player.getUniqueId().toString(), ! phantomToggleState); - // If the command sender's phantom is not disabled, do this... - if (! playerDisabled) + // If the command sender's phantom spawning is turned on, do this... + if (phantomToggleState) { // Send formatted "true" message using MiniMessage API. Component parsed = Utilities_OG.getMM().deserialize("<#AAAAAA>[<#00AA00>Utilities<#AA0000>-OG<#AAAAAA>] <#55FF55>Phantom spawning turned <#00AA00>ON<#55FF55>."); player.sendMessage(parsed); } - // If the command sender's phantom is disabled, do this... + // If the command sender's phantom spawning is turned off, do this... else { // Send formatted "false" message using MiniMessage API. @@ -55,8 +55,9 @@ public class PhantomToggleModule implements CommandExecutor try { // Save changes to YAML data to disk. - phantomDisabledPlayers.save(Utilities_OG.getPhantomDisabledPlayersFile()); - } catch (IOException error) + phantomPreferences.save(Utilities_OG.getPhantomDisabledPlayersFile()); + } + catch (IOException error) { // Throw a runtime error if the YAML data could not be saved to disk. throw new RuntimeException(error); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 0e501df..6ed50d2 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: Utilities-OG authors: [ christianniehaus, NotAlexNoyle ] -version: '1.3' +version: '1.3.2' main: me.barny1094875.utilitiesog.Utilities_OG api-version: 1.18 depend: [ NBTAPI ]