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
This commit is contained in:
NotAlexNoyle authored and GitHub committed 2023-08-20 17:54:15 -04:00
1 parent cb465d86a8
commit e9ebc26c1f
7 files changed
+52 -33

No files matched your search

+12 -8
View File
@@ -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
}
}
}
+12 -4
View File
@@ -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.
- Merged in and deprecated Buy-OG.
+7
View File
@@ -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
@@ -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;
}
}
}
@@ -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;
}
}
@@ -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);
+1 -1
View File
@@ -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 ]