> getMessages() {
+ return messages;
+ }
+
+}
diff --git a/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCache.java b/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCache.java
index eaca6f85a..67af85a63 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCache.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCache.java
@@ -206,6 +206,33 @@ public PlayerCachePlayerData removePlayerData( PlayerCachePlayerData playerData
}
+ /**
+ * This function will return a null if the player is not loaded in the cache.
+ * Null is a valid value even if the player is online.
+ * This function should NEVER be used
+ * for any critical data such as tracking blocks, time, earnings, or inventory.
+ * Examples of acceptable loss would be with messaging. Loss of a few messages is
+ * not that critical, and actually would be a very rare situation. Example, if a
+ * player is mining then their cache should already be loaded so calling this function
+ * should never find the situation where the player's cache entry does not exist.
+ *
+ *
+ * Since this function will fail with the return a null if the player is not loaded,
+ * this function will not cause blocking on the runnable thread.
+ *
+ *
+ * If the player is not loaded, and a null is returned, then an async task
+ * will be submitted to load it.
+ *
+ *
+ * @param player
+ * @return
+ */
+ public PlayerCachePlayerData getOnlinePlayer( Player player ) {
+ PlayerCachePlayerData playerData = getPlayer( player );
+
+ return playerData;
+ }
/**
* This returns the cached player object. If they have not been loaded
diff --git a/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCachePlayerData.java b/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCachePlayerData.java
index befae9dc1..315a1a0fd 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCachePlayerData.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCachePlayerData.java
@@ -5,6 +5,7 @@
import java.util.Date;
import java.util.TreeMap;
+import tech.mcprison.prison.autofeatures.PlayerMessaging;
import tech.mcprison.prison.internal.Player;
import tech.mcprison.prison.internal.block.PrisonBlock;
import tech.mcprison.prison.placeholders.PlaceholdersUtil;
@@ -82,6 +83,11 @@ public class PlayerCachePlayerData {
// sessionLastLocation is used for afk calculations:
// private transient Location sessionLastLocation = null;
+
+ private transient PlayerMessaging playerMessaging;
+
+
+
private transient boolean dirty = false;
@@ -111,6 +117,8 @@ public PlayerCachePlayerData() {
// this.sessionLastLocation = null;
+ this.playerMessaging = new PlayerMessaging();
+
}
public PlayerCachePlayerData( Player player, File playerFile ) {
@@ -524,6 +532,13 @@ public void setEarningsByMine( TreeMap earningsByMine ) {
this.earningsByMine = earningsByMine;
}
+ public PlayerMessaging getPlayerMessaging() {
+ return playerMessaging;
+ }
+ public void setPlayerMessaging( PlayerMessaging playerMessaging ) {
+ this.playerMessaging = playerMessaging;
+ }
+
public boolean isDirty() {
return dirty;
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/tasks/PlayerMessagingTask.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/tasks/PlayerMessagingTask.java
new file mode 100644
index 000000000..5a30bba0c
--- /dev/null
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/tasks/PlayerMessagingTask.java
@@ -0,0 +1,92 @@
+package tech.mcprison.prison.spigot.utils.tasks;
+
+import org.bukkit.entity.Player;
+
+import tech.mcprison.prison.autofeatures.PlayerMessageData;
+import tech.mcprison.prison.autofeatures.PlayerMessaging;
+import tech.mcprison.prison.autofeatures.PlayerMessaging.MessageType;
+import tech.mcprison.prison.cache.PlayerCache;
+import tech.mcprison.prison.cache.PlayerCachePlayerData;
+import tech.mcprison.prison.spigot.compat.SpigotCompatibility;
+import tech.mcprison.prison.spigot.game.SpigotPlayer;
+import tech.mcprison.prison.tasks.PrisonRunnable;
+import tech.mcprison.prison.tasks.PrisonTaskSubmitter;
+
+public class PlayerMessagingTask
+ implements PrisonRunnable
+{
+ private Player player;
+ private PlayerMessageData messageData = null;
+
+
+ public PlayerMessagingTask( Player player, PlayerMessageData messageData ) {
+ super();
+
+ this.player = player;
+ this.messageData = messageData;
+ }
+
+ public static void submitTask( Player player, MessageType messageType, String message ) {
+
+ SpigotPlayer bPlayer = new SpigotPlayer( player );
+
+ PlayerCachePlayerData playerCache = PlayerCache.getInstance().getOnlinePlayer( bPlayer );
+ if ( playerCache != null ) {
+
+
+ PlayerMessaging messagingData = playerCache.getPlayerMessaging();
+
+ PlayerMessageData mData = messagingData.addMessage( messageType, message );
+
+ if ( mData.getTaskId() == -1 ) {
+
+ PlayerMessagingTask messagingTask = new PlayerMessagingTask( player, mData );
+
+ int jobId = PrisonTaskSubmitter.runTaskLater( messagingTask, 0 );
+ messagingTask.setTaskId( jobId );
+ }
+
+
+ }
+ }
+
+ public void submit() {
+ PrisonTaskSubmitter.runTaskLater(this, 0);
+ }
+
+
+ @Override
+ public void run()
+ {
+ switch ( messageData.getMessageType() )
+ {
+ case actionBar:
+ {
+
+ SpigotCompatibility.getInstance().sendActionBar( player, messageData.getMessage() );
+ break;
+ }
+
+ case title:
+ {
+ SpigotCompatibility.getInstance().sendTitle( player, messageData.getMessage(),
+ null, 10, 20, 10 );
+
+ break;
+ }
+
+ default:
+
+ // Do nothing... let the task end since the message type was not valid
+ }
+
+
+ }
+
+
+ private void setTaskId( int taskId ) {
+ if ( messageData != null ) {
+ messageData.setTaskId( taskId );
+ }
+ }
+}
From 2b202d456d9a5db7d0fbbeeccf6c475349d1e914 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Wed, 8 Sep 2021 08:45:21 -0400
Subject: [PATCH 052/283] Hooked up XSeries' Titles to the compatibility class
instead of using version specific code. XSeries says they support 1.8.8
through 1.17.1. Deleted the support for the Spigot110 classes since it was
only to support the use of the ActionBar and also the Title, which are no
longer needed for 1.10+.
---
docs/changelog_v3.3.x.md | 7 +++++-
.../prison/spigot/compat/Spigot110.java | 23 -------------------
.../prison/spigot/compat/Spigot110Player.java | 22 ------------------
.../prison/spigot/compat/Spigot113Blocks.java | 2 +-
.../prison/spigot/compat/Spigot18Player.java | 7 ++++--
.../prison/spigot/compat/Spigot19Player.java | 9 ++++++--
.../spigot/compat/SpigotCompatibility.java | 10 ++++----
7 files changed, 24 insertions(+), 56 deletions(-)
delete mode 100644 prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot110.java
delete mode 100644 prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot110Player.java
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index 7b2062ba9..33ec1cdd5 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -13,7 +13,12 @@ These build logs represent the work that has been going on within prison.
*Will continue as v3.3.0-alpha.7 2021-06-?? in the near future.*
-# 3.2.11-alpha.1 2021-09-07
+# 3.2.11-alpha.1 2021-09-08
+
+
+* **Hooked up XSeries' Titles to the compatibility class instead of using version specific code.**
+XSeries says they support 1.8.8 through 1.17.1.
+Deleted the support for the Spigot110 classes since it was only to support the use of the ActionBar and also the Title, which are no longer needed for 1.10+.
* **Adding a player messaging component to the PlayerCache.**
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot110.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot110.java
deleted file mode 100644
index bee66b0a8..000000000
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot110.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package tech.mcprison.prison.spigot.compat;
-
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-
-/**
- * Important note: Spigot 1.10 support is represented in Spigot110 and is
- * identical to Spigot19 except for two spigot 1.10 functions: sendTitle()
- * and sendActionBar(). Therefore, all that needs to be done is to have
- * the class Spigot110Player extend Spigot19 and then Override
- * those two functons.
- *
- */
-public class Spigot110
- extends Spigot110Player
- implements Compatibility {
-
- @Override
- public void setItemInMainHand(Player p, ItemStack itemStack){
- p.getInventory().setItemInMainHand(itemStack);
- }
-
-}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot110Player.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot110Player.java
deleted file mode 100644
index 5baef8ed9..000000000
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot110Player.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package tech.mcprison.prison.spigot.compat;
-
-import org.bukkit.entity.Player;
-
-public abstract class Spigot110Player
- extends Spigot19
-{
- @Override
- public void sendTitle( Player player, String title, String subtitle, int fadeIn, int stay, int fadeOut ) {
- player.sendTitle( title, subtitle, fadeIn, stay, fadeOut );
- }
-
-
- // NOTE: Just use the Spigot19Player class's sendActionBar():
-// @Override
-// public void sendActionBar( Player player, String actionBar ) {
-// player.spigot().sendMessage( ChatMessageType.ACTION_BAR,
-// new TextComponent( actionBar ) );
-//
-//// player.sendTitle( null, actionBar );
-// }
-}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot113Blocks.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot113Blocks.java
index f04001871..562e6859c 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot113Blocks.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot113Blocks.java
@@ -21,7 +21,7 @@
import tech.mcprison.prison.util.Location;
public abstract class Spigot113Blocks
- extends Spigot110Player
+ extends Spigot19Player
implements CompatibilityBlocks {
@Override
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot18Player.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot18Player.java
index 7cf95d577..4862f8e3d 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot18Player.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot18Player.java
@@ -3,6 +3,7 @@
import org.bukkit.entity.Player;
import com.cryptomorin.xseries.messages.ActionBar;
+import com.cryptomorin.xseries.messages.Titles;
public abstract class Spigot18Player
extends CompatibilityCache
@@ -39,9 +40,11 @@ public void setMaxHealth( Player player, double maxHealth ) {
* @param fadeOut - parameter ignored
*/
@Override
- @SuppressWarnings( "deprecation" )
public void sendTitle( Player player, String title, String subtitle, int fadeIn, int stay, int fadeOut ) {
- player.sendTitle( title, subtitle );
+ //player.sendTitle( title, subtitle );
+
+ Titles.sendTitle( player, fadeIn, stay, fadeOut, title, subtitle );
+
}
/**
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot19Player.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot19Player.java
index e9f203d63..71a0cdb67 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot19Player.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot19Player.java
@@ -5,6 +5,7 @@
import org.bukkit.entity.Player;
import com.cryptomorin.xseries.messages.ActionBar;
+import com.cryptomorin.xseries.messages.Titles;
public abstract class Spigot19Player
extends Spigot18Blocks
@@ -34,9 +35,13 @@ public double getMaxHealth( Player player ) {
}
@Override
- @SuppressWarnings( "deprecation" )
+ //@SuppressWarnings( "deprecation" )
public void sendTitle( Player player, String title, String subtitle, int fadeIn, int stay, int fadeOut ) {
- player.sendTitle( title, subtitle );
+
+ //player.sendTitle( title, subtitle );
+
+ Titles.sendTitle( player, fadeIn, stay, fadeOut, title, subtitle );
+
}
@Override
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/SpigotCompatibility.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/SpigotCompatibility.java
index c6824ed01..60381bd77 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/SpigotCompatibility.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/SpigotCompatibility.java
@@ -37,14 +37,14 @@ private static synchronized void setup() {
results = new Spigot18();
}
- else if ( svData.compareTo( new BluesSemanticVersionData( "1.10.0" ) ) < 0 ) {
-
- results = new Spigot19();
- }
else if ( svData.compareTo( new BluesSemanticVersionData( "1.13.0" ) ) < 0 ) {
- results = new Spigot110();
+ results = new Spigot19();
}
+// else if ( svData.compareTo( new BluesSemanticVersionData( "1.13.0" ) ) < 0 ) {
+//
+// results = new Spigot110();
+// }
else {
results = new Spigot113();
From db2534641be20d4c352b33ba9ca9cc0deb70066e Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Wed, 8 Sep 2021 09:46:01 -0400
Subject: [PATCH 053/283] Prevented a problem when unloading players, and when
a player is null. The condition that was causing a null player was that the
player was unloaded when the player left the server at the same time when the
server was shut down. Basically a race condition with two parallel async
tasks trying to shut down the player cache object, each focusing on a
different aspect (player vs. server).
---
docs/changelog_v3.3.x.md | 4 ++
.../prison/cache/PlayerCacheFiles.java | 57 ++++++++++---------
2 files changed, 34 insertions(+), 27 deletions(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index 33ec1cdd5..f4f720f99 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -16,6 +16,10 @@ These build logs represent the work that has been going on within prison.
# 3.2.11-alpha.1 2021-09-08
+* **Prevented a problem when unloading players, and when a player is null.**
+The condition that was causing a null player was that the player was unloaded when the player left the server at the same time when the server was shut down. Basically a race condition with two parallel async tasks trying to shut down the player cache object, each focusing on a different aspect (player vs. server).
+
+
* **Hooked up XSeries' Titles to the compatibility class instead of using version specific code.**
XSeries says they support 1.8.8 through 1.17.1.
Deleted the support for the Spigot110 classes since it was only to support the use of the ActionBar and also the Title, which are no longer needed for 1.10+.
diff --git a/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCacheFiles.java b/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCacheFiles.java
index 0241bfdef..0bfd8d57a 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCacheFiles.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCacheFiles.java
@@ -90,36 +90,39 @@ public String toJson( PlayerCachePlayerData player ) {
*/
public void toJsonFile( PlayerCachePlayerData player) {
- File playerFile = player.getPlayerFile();
- File outTemp = createTempFile( playerFile );
- boolean success = false;
-
- try (
- FileWriter fw = new FileWriter( outTemp );
- ){
- getGson().toJson( player, fw );
+ if ( player != null ) {
- success = true;
- }
- catch ( JsonIOException | IOException e ) {
- e.printStackTrace();
- }
-
- if ( success && ( !playerFile.exists() || playerFile.delete()) ) {
- outTemp.renameTo( playerFile );
- }
- else {
-
- boolean removed = false;
- if ( outTemp.exists() ) {
- removed = outTemp.delete();
+ File playerFile = player.getPlayerFile();
+ File outTemp = createTempFile( playerFile );
+ boolean success = false;
+
+ try (
+ FileWriter fw = new FileWriter( outTemp );
+ ){
+ getGson().toJson( player, fw );
+
+ success = true;
+ }
+ catch ( JsonIOException | IOException e ) {
+ e.printStackTrace();
}
-
- String message = String.format(
- "Unable to rename PlayerCache temp file. It was %sremoved: %s",
- (removed ? "" : "not "), outTemp.getAbsolutePath() );
- Output.get().logWarn( message );
+ if ( success && ( !playerFile.exists() || playerFile.delete()) ) {
+ outTemp.renameTo( playerFile );
+ }
+ else {
+
+ boolean removed = false;
+ if ( outTemp.exists() ) {
+ removed = outTemp.delete();
+ }
+
+ String message = String.format(
+ "Unable to rename PlayerCache temp file. It was %sremoved: %s",
+ (removed ? "" : "not "), outTemp.getAbsolutePath() );
+
+ Output.get().logWarn( message );
+ }
}
}
From 75efc240c684ca1168c02a1d57f79fad88fb550c Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Wed, 8 Sep 2021 09:56:37 -0400
Subject: [PATCH 054/283] The player cache, when being shut down Prevented a
problem when unloading players, and when a player is null. The condition that
was causing a null player was that the player was unloaded when the player
left the server at the same time when the server was shut down. Basically a
race condition with two parallel async tasks trying to shut down the player
cache object, each focusing on a different aspect (player vs. server). This
function was making a new collection based upon the original player cache
copy of players, of which, when a few of the players are removed, then they
were resulting in nulls.
---
docs/changelog_v3.3.x.md | 4 +++
.../cache/PlayerCacheCheckTimersTask.java | 26 +++++++++----------
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index f4f720f99..ba92fb060 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -16,6 +16,10 @@ These build logs represent the work that has been going on within prison.
# 3.2.11-alpha.1 2021-09-08
+* **The player cache, when being shut down ran in to a problem if the players were removed when they logged off.**
+This function was making a new collection based upon the original player cache copy of players, of which, when a few of the players are removed, then they were resulting in nulls.
+
+
* **Prevented a problem when unloading players, and when a player is null.**
The condition that was causing a null player was that the player was unloaded when the player left the server at the same time when the server was shut down. Basically a race condition with two parallel async tasks trying to shut down the player cache object, each focusing on a different aspect (player vs. server).
diff --git a/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCacheCheckTimersTask.java b/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCacheCheckTimersTask.java
index 84292dc31..c1efb2f4a 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCacheCheckTimersTask.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCacheCheckTimersTask.java
@@ -1,8 +1,5 @@
package tech.mcprison.prison.cache;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* This periodically ran task will go through all cached players and update
* their status with the timers and earnings. This is a light weight task
@@ -43,21 +40,22 @@ public void run()
PlayerCache pCache = PlayerCache.getInstance();
- List keys = new ArrayList<>( pCache.getPlayers().keySet() );
-
- for ( String key : keys )
- {
- PlayerCachePlayerData playerData = pCache.getPlayers().get( key );
+ if ( pCache.getPlayers() != null && pCache.getPlayers().keySet().size() > 0 ) {
- if ( playerData != null ) {
+ for ( String key : pCache.getPlayers().keySet() )
+ {
+ PlayerCachePlayerData playerData = pCache.getPlayers().get( key );
- playerData.checkTimers();
+ if ( playerData != null ) {
+
+ playerData.checkTimers();
+
+ // By adding a zero earnings, this will force the earnings "cache" to
+ // progress, even if the player stopped mining.
+ playerData.addEarnings( 0 );
+ }
- // By adding a zero earnings, this will force the earnings "cache" to
- // progress, even if the player stopped mining.
- playerData.addEarnings( 0 );
}
-
}
}
From c99aba235785c849f41ce35ec39e05969d1b7a9f Mon Sep 17 00:00:00 2001
From: AnonymousGCA
Date: Sat, 11 Sep 2021 20:55:24 +0200
Subject: [PATCH 055/283] Changelogs: - Full transition of the messages .yml
file to the .properties. - Some changes all over the code. - Some fixes.
---
docs/changelog_v3.3.x.md | 9 +
.../resources/lang/spigot/en_US.properties | 136 ++++-
.../mcprison/prison/spigot/SpigotPrison.java | 14 +-
.../autofeatures/AutoManagerFeatures.java | 83 ++-
.../spigot/backpacks/BackpacksUtil.java | 4 +-
.../PrisonSpigotBackpackCommands.java | 63 ++-
.../commands/PrisonSpigotBaseCommands.java | 5 +-
.../commands/PrisonSpigotGUICommands.java | 27 +-
.../PrisonSpigotPrestigeCommands.java | 19 +-
.../commands/PrisonSpigotSellAllCommands.java | 150 +++---
.../prison/spigot/configs/MessagesConfig.java | 477 ++++++++++--------
.../spigot/configs/NewMessagesConfig.java | 167 ------
.../spigot/gui/ListenersPrisonManager.java | 212 ++++----
.../prison/spigot/gui/PrisonSetupGUI.java | 22 +-
.../prison/spigot/gui/SpigotPrisonGUI.java | 14 +-
.../gui/autofeatures/SpigotAutoBlockGUI.java | 8 +-
.../autofeatures/SpigotAutoFeaturesGUI.java | 18 +-
.../gui/autofeatures/SpigotAutoPickupGUI.java | 8 +-
.../gui/autofeatures/SpigotAutoSmeltGUI.java | 8 +-
.../gui/backpacks/BackpacksAdminGUI.java | 8 +-
.../gui/backpacks/BackpacksAdminListGUI.java | 10 +-
.../BackpacksAdminPlayerListGUI.java | 8 +-
.../gui/backpacks/BackpacksListPlayerGUI.java | 16 +-
.../gui/guiutility/SpigotGUIComponents.java | 23 +-
.../spigot/gui/mine/SpigotBlocksListGUI.java | 8 +-
.../gui/mine/SpigotBlocksMineListGUI.java | 8 +-
.../mine/SpigotMineBlockPercentageGUI.java | 12 +-
.../spigot/gui/mine/SpigotMineInfoGUI.java | 48 +-
.../mine/SpigotMineNotificationRadiusGUI.java | 12 +-
.../gui/mine/SpigotMineNotificationsGUI.java | 16 +-
.../gui/mine/SpigotMineResetTimeGUI.java | 8 +-
.../spigot/gui/mine/SpigotMinesBlocksGUI.java | 14 +-
.../gui/mine/SpigotMinesConfirmGUI.java | 6 +-
.../spigot/gui/mine/SpigotMinesGUI.java | 24 +-
.../spigot/gui/mine/SpigotPlayerMinesGUI.java | 14 +-
.../gui/rank/SpigotConfirmPrestigeGUI.java | 12 +-
.../spigot/gui/rank/SpigotLaddersGUI.java | 10 +-
.../gui/rank/SpigotPlayerPrestigesGUI.java | 10 +-
.../spigot/gui/rank/SpigotPlayerRanksGUI.java | 10 +-
.../spigot/gui/rank/SpigotRankManagerGUI.java | 18 +-
.../spigot/gui/rank/SpigotRankPriceGUI.java | 8 +-
.../gui/rank/SpigotRankUPCommandsGUI.java | 14 +-
.../spigot/gui/rank/SpigotRanksGUI.java | 24 +-
.../gui/sellall/SellAllAdminAutoSellGUI.java | 12 +-
.../gui/sellall/SellAllAdminBlocksGUI.java | 17 +-
.../spigot/gui/sellall/SellAllAdminGUI.java | 44 +-
.../spigot/gui/sellall/SellAllDelayGUI.java | 8 +-
.../spigot/gui/sellall/SellAllPlayerGUI.java | 10 +-
.../SellAllPrestigesMultiplierGUI.java | 16 +-
.../SellAllPrestigesSetMultiplierGUI.java | 10 +-
.../spigot/gui/sellall/SellAllPriceGUI.java | 10 +-
.../prison/spigot/sellall/SellAllUtil.java | 28 +-
52 files changed, 954 insertions(+), 986 deletions(-)
delete mode 100644 prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/NewMessagesConfig.java
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index ba92fb060..28fcd442c 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -16,6 +16,15 @@ These build logs represent the work that has been going on within prison.
# 3.2.11-alpha.1 2021-09-08
+* **Fixed an error about backpacks and lore transition:** A single lore was being used for the backpacks utility, if a server
+was new and fresh, this would've been missing and an error could occur, this now got fixed with the full transition.
+
+
+* **Full transition of all messages to the .properties lang:** All messages are now on the .properties file and the old
+.yml one is unused from now on, you can delete it and start translating the new one. Please note that some messages may
+be wrong, as it's still in a young stage and a lot of messages got transitioned.
+
+
* **The player cache, when being shut down ran in to a problem if the players were removed when they logged off.**
This function was making a new collection based upon the original player cache copy of players, of which, when a few of the players are removed, then they were resulting in nulls.
diff --git a/prison-core/src/main/resources/lang/spigot/en_US.properties b/prison-core/src/main/resources/lang/spigot/en_US.properties
index fba061e0e..ee4df1d54 100644
--- a/prison-core/src/main/resources/lang/spigot/en_US.properties
+++ b/prison-core/src/main/resources/lang/spigot/en_US.properties
@@ -49,7 +49,7 @@
## /prison support submit.
##
-messages__version=3
+messages__version=4
messages__auto_refresh=true
## Click to do something
@@ -142,9 +142,9 @@ spigot_gui_lore_ranks_setup_2=If you want continue the setup.
spigot_gui_lore_ranks_setup_3=All Ranks and Mines from A to Z will be made
spigot_gui_lore_ranks_setup_4=With &adefault &3values!
spigot_gui_lore_ranks_setup_5=You can also use:
-spigot_gui_lore_ranks_setup_6=&1/ranks autoConfigure full !
-spigot_gui_lore_ranks_setup_7=&3Please replace the X with the starting price and
-spigot_gui_lore_ranks_setup_8=&3multiplier, default price = 50000, multiplier = 1.5.
+spigot_gui_lore_ranks_setup_6=/ranks autoConfigure full !
+spigot_gui_lore_ranks_setup_7=Please replace the X with the starting price and
+spigot_gui_lore_ranks_setup_8=multiplier, default price = 50000, multiplier = 1.5.
spigot_gui_lore_sellall_delay_use_1=Short delay before using again
spigot_gui_lore_sellall_delay_use_2=the &3/sellall sell &8command.
spigot_gui_lore_set_mine_delay_instruction_1=Set a mine's delay
@@ -173,4 +173,132 @@ spigot_gui_lore_tp_to_mine=Click to teleport to Mine.
## Messages
spigot_message_missing_permission=Sorry, You don't have the permission to use that!
+spigot_message_chat_event_time_end=You ran out of time, event cancelled!
+spigot_message_event_cancelled=Event cancelled.
+spigot_message_command_wrong_format=Sorry, wrong command format.
+spigot_message_console_error=Sorry, you need to be a player to use that.
+## Ladder Messages
+spigot_message_ladder_default_empty=Sorry, the Default Ladder's empty.
+
+## Mine Messages
+spigot_message_mines_disabled=Sorry, Mines are disabled.
+spigot_message_mines_name_chat_1=Please write the &6mineName &7you'd like to use and &6submit&7.
+spigot_message_mines_name_chat_2=Input &cclose &7to cancel or wait &c30 seconds&7.
+spigot_message_mines_name_chat_cancelled=Rename Mine &cclosed&7, nothing got changed!
+spigot_message_mines_item_show_edit_success=Mine show item edited with success.
+spigot_message_mines_or_gui_disabled=Sorry, Mines or GUIs are disabled.
+
+## Backpack Messages
+spigot_message_backpack_cant_own=Sorry, you can't own Backpacks.
+spigot_message_backpack_delete_error=Sorry, can't delete Backpack.
+spigot_message_backpack_delete_success=Backpack deleted with success.
+spigot_message_backpack_format_error=Sorry, the command format isn't right, maybe some arguments are missing.
+spigot_message_backpack_limit_decrement_fail=The Backpack Limit can't be negative.
+spigot_message_backpack_limit_edit_success=Backpack Limit edited with success.
+spigot_message_backpack_limit_not_number=Sorry, the Backpack Limit isn't a number.
+spigot_message_backpack_limit_reached=Sorry, you can't own more Backpacks.
+spigot_message_backpack_missing_playername=Sorry, please add a valid Player name.
+spigot_message_backpack_resize_success=If the Backpack exists, it got resized with success.
+spigot_message_backpack_size_must_be_multiple_of_9=The Backpack size must be a multiple of 9 and not exceed 64!
+
+
+## Prestige Messages
+spigot_message_prestiges_disabled=Sorry, Prestiges are disabled.
+spigot_message_prestiges_empty=Sorry, there aren't Prestiges.
+spigot_message_prestiges_or_gui_disabled=Sorry, Prestiges or GUIs are disabled.
+spigot_message_prestiges_confirm=Confirm&7: Type the word &aconfirm&7 to confirm.
+spigot_message_prestiges_cancel=Cancel&7: Type the word &ccancel&7 to cancel, &cyou've 30 seconds.
+spigot_message_prestiges_cancelled=Prestige cancelled.
+spigot_message_prestiges_cancelled_wrong_keyword=Prestige &ccancelled&7, you didn't type the word: &aconfirm&7.
+
+## Ranks Messages
+spigot_message_ranks_disabled=Sorry, Ranks are disabled.
+spigot_message_ranks_or_gui_disabled=Sorry, Ranks or GUIs are disabled.
+spigot_message_ranks_tag_chat_rename_1=Please write the &6tag &7you'd like to use and &6submit&7.
+spigot_message_ranks_tag_chat_rename_2=Input &cclose &7to cancel or wait &c30 seconds&7.
+spigot_message_ranks_tag_chat_cancelled=Rename tag &cclosed&7, nothing got changed!
+
+## SellAll Messages
+spigot_message_sellall_auto_already_enabled=Sellall Auto already enabled.
+spigot_message_sellall_auto_already_disabled=SellAll Auto already disabled.
+spigot_message_sellall_auto_disabled=SellAll Auto disabled with success.
+spigot_message_sellall_auto_disabled_cant_use=Sorry, you need to enable AutoSell to use this.
+spigot_message_sellall_auto_enabled=SellAll Auto enabled with success.
+spigot_message_sellall_auto_perusertoggleable_enabled=Sellall Auto perUserToggleable enabled with success.
+spigot_message_sellall_auto_perusertoggleable_disabled=Sellall Auto perUserToggleable disabled with success.
+spigot_message_sellall_auto_perusertoggleable_already_enabled=Sellall Auto perUserToggleable already enabled.
+spigot_message_sellall_auto_perusertoggleable_already_disabled=Sellall Auto perUserToggleable already disabled.
+spigot_message_sellall_boolean_input_invalid=The boolean value isn't valid (Valid values are True or False).
+spigot_message_sellall_cant_find_item_config=Sorry, can't find your item in the config.
+spigot_message_sellall_currency_chat_1=&3Started setup of new currency for SellAll!
+spigot_message_sellall_currency_chat_2=Type &ccancel &7to cancel.
+spigot_message_sellall_currency_chat_3=Type &3default &7to set to default currency.
+spigot_message_sellall_currency_chat_4=Type the &aCurrency name &7to set the new currency.
+spigot_message_sellall_currency_edit_success=SellAll Currency edited with success.
+spigot_message_sellall_currency_not_found=Sorry, currency not found.
+spigot_message_sellall_hand_disabled=SellAll Hand disabled with success.
+spigot_message_sellall_hand_enabled=Sellall Hand enabled with success.
+spigot_message_sellall_hand_is_disabled=SellAll Hand is disabled.
+spigot_message_sellall_item_add_success=Item added with success.
+spigot_message_sellall_item_already_added=You've already added this item, please use the edit command instead.
+spigot_message_sellall_item_delete_success=Item deleted with success.
+spigot_message_sellall_item_edit_success=SellAll Item edited with success.
+spigot_message_sellall_item_id_not_found=Sorry, invalid Item Name/ID.
+spigot_message_sellall_item_missing_name=Please add the Item Name/ID argument.
+spigot_message_sellall_item_missing_price=Please add Item Value argument.
+spigot_message_sellall_item_not_found=SellAll Item not found in the config.
+spigot_message_sellall_default_values_success=SellAll Default values set with success.
+spigot_message_sellall_delay_already_enabled=SellAll Delay already enabled.
+spigot_message_sellall_delay_already_disabled=SellAll Delay already disabled.
+spigot_message_sellall_delay_disabled=SellAll Delay disabled with success.
+spigot_message_sellall_delay_disabled_cant_use=Sorry, please enable SellAll Delay to use this.
+spigot_message_sellall_delay_edit_success=Sellall Delay edited with success.
+spigot_message_sellall_delay_enabled=SellAll Delay enabled with success.
+spigot_message_sellall_delay_not_number=SellAll Delay number isn't valid.
+spigot_message_sellall_delay_wait=Please wait the end of the delay before using again the command.
+spigot_message_sellall_gui_disabled=SellAll GUI is disabled.
+spigot_message_sellall_money_earned=You got &a$
+spigot_message_sellall_multiplier_add_success=SellAll Multiplier added with success.
+spigot_message_sellall_multiplier_are_disabled=Sorry, SellAll Multipliers are disabled.
+spigot_message_sellall_multiplier_cant_find=Sorry, can't find SellAll Multiplier.
+spigot_message_sellall_multiplier_delete_success=SellAll Multiplier deleted with success.
+spigot_message_sellall_multiplier_disabled=SellAll Multipliers Disabled with success.
+spigot_message_sellall_multiplier_edit_success=SellAll Multiplier edited with success.
+spigot_message_sellall_multiplier_enabled=SellAll Multipliers Enabled with success.
+spigot_message_sellall_sell_empty=Sorry, there aren't items in the SellAll shop.
+spigot_message_sellall_sell_nothing_sellable=Sorry but you've nothing to sell.
+spigot_message_sellall_sell_sign_only=You can use SellAll Sell only with Signs.
+spigot_message_sellall_sell_sign_notify=You sold trough a sign with success.
+spigot_message_sellall_trigger_already_disabled=SellAll Trigger already disabled.
+spigot_message_sellall_trigger_already_enabled=SellAll Trigger already enabled.
+spigot_message_sellall_trigger_disabled=SellAll Trigger disabled with success.
+spigot_message_sellall_trigger_enabled=SellAll Trigger enabled with success.
+spigot_message_sellall_trigger_is_disabled=Sorry, SellAll Trigger is disabled.
+spigot_message_sellall_trigger_item_add_success=SellAll Item Trigger added with success.
+spigot_message_sellall_trigger_item_cant_find=SellAll Item Trigger item not found in the config.
+spigot_message_sellall_trigger_item_delete_success=SellAll Item Trigger deleted with success.
+spigot_message_sellall_trigger_item_missing=Please add Item Name/ID to the command.
+
+## GUI Messages
+spigot_message_gui_backpack_disabled=Can't open GUI, Backpacks are disabled.
+spigot_message_gui_backpack_empty=Sorry, there aren't Backpacks to show.
+spigot_message_gui_backpack_too_many=Sorry, there are too many Backpacks and the GUI can't show them.
+spigot_message_gui_close_success=GUI closed with success.
+spigot_message_gui_error=Can't open GUI, disabled or error.
+spigot_message_gui_error_empty=Can't open GUI, it's empty.
+spigot_message_gui_ladder_empty=Sorry, there aren't Ladders to show.
+spigot_message_gui_ladder_too_many=Sorry, there are too many Ladders and the GUI can't show them.
+spigot_message_gui_mines_empty=Sorry, there aren't Mines to show.
+spigot_message_gui_mines_too_many=Sorry, there are too many Mines for the GUI to show.
+spigot_message_gui_prestiges_empty=Sorry, there aren't Prestiges to show.
+spigot_message_gui_prestiges_too_many=Sorry, there are too many Prestiges and the GUI can't show them.
+spigot_message_gui_ranks_empty=Sorry, there aren't Ranks in this Ladder to show.
+spigot_message_gui_ranks_rankup_commands_empty=Sorry, there aren't Rankup Commands to show.
+spigot_message_gui_ranks_rankup_commands_too_many=Sorry, there are too many Rankup Commands and the GUI can't show them.
+spigot_message_gui_ranks_too_many=Sorry, there are too many Ranks and the GUI can't show them.
+spigot_message_gui_reload_success=GUIs reloaded with success!
+spigot_message_gui_sellall_disabled=Sorry, SellAll is disabled.
+spigot_message_gui_sellall_empty=Sorry, there's nothing to show.
+spigot_message_gui_too_high=Sorry, but the value is too high (above maximum possible).
+spigot_message_gui_too_low_value=Sorry, but the value is too low (below minimum possible).
\ No newline at end of file
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPrison.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPrison.java
index 70935316e..4cb55132d 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPrison.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPrison.java
@@ -116,7 +116,6 @@ public class SpigotPrison
private AutoManagerFeatures autoFeatures = null;
// private FileConfiguration autoFeaturesConfig = null;
- private NewMessagesConfig newMessagesConfig;
private MessagesConfig messagesConfig;
private GuiConfig guiConfig;
private SellAllConfig sellAllConfig;
@@ -393,19 +392,12 @@ public FileConfiguration updateSellAllConfig() {
return sellAllConfig.getFileSellAllConfig();
}
- public FileConfiguration getMessagesConfig() {
+ public MessagesConfig getMessagesConfig() {
if (messagesConfig == null) {
- messagesConfig = new MessagesConfig();
+ messagesConfig = MessagesConfig.get();
}
- return messagesConfig.getFileGuiMessagesConfig();
- }
-
- public NewMessagesConfig getNewMessagesConfig(){
- if (newMessagesConfig == null){
- newMessagesConfig = NewMessagesConfig.get();
- }
- return newMessagesConfig;
+ return messagesConfig;
}
public FileConfiguration getBackpacksConfig() {
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java
index b0b9b03e3..aa97437bc 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java
@@ -40,6 +40,7 @@
import tech.mcprison.prison.spigot.commands.PrisonSpigotSellAllCommands;
import tech.mcprison.prison.spigot.compat.SpigotCompatibility;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
+import tech.mcprison.prison.spigot.sellall.SellAllUtil;
import tech.mcprison.prison.spigot.spiget.BluesSpigetSemVerComparator;
import tech.mcprison.prison.util.BlockType;
import tech.mcprison.prison.util.Text;
@@ -759,62 +760,48 @@ protected void autoBlock( boolean autoBlock, XMaterial source, XMaterial target,
private void dropExtra( HashMap extra, Player player ) {
if ( extra != null && extra.size() > 0 ) {
+ if (SpigotPrison.getInstance().isSellAllEnabled()) {
-
- Configuration sellAllConfig = SpigotPrison.getInstance().updateSellAllConfig();
-
- if ( isBoolean( sellAllConfig, "Options.Full_Inv_AutoSell") ) {
- if ( isBoolean( sellAllConfig, "Options.Full_Inv_AutoSell_perUserToggleable") ){
-
- UUID playerUUID = player.getUniqueId();
+ SellAllUtil sellAllUtil = SellAllUtil.get();
- if (isBoolean( sellAllConfig, "Users." + playerUUID + ".isEnabled") ) {
-
- if (isBoolean( sellAllConfig, "Options.Full_Inv_AutoSell_Notification") ) {
- Output.get().sendInfo(new SpigotPlayer(player), SpigotPrison.format(
- SpigotPrison.getInstance().getMessagesConfig().getString("Message.SellAllAutoSell")));
+ if (sellAllUtil != null && sellAllUtil.isAutoSellEnabled) {
+ if (sellAllUtil.isAutoSellPerUserToggleable) {
+ if (sellAllUtil.isPlayerAutoSellEnabled(player)) {
+ if (sellAllUtil.isAutoSellNotificationEnabled) {
+ SellAllUtil.get().sellAllSell(player, false, false, true, true, false, true);
+ } else {
+ SellAllUtil.get().sellAllSell(player, false, true, false, false, false, true);
}
-
- PrisonSpigotSellAllCommands.get().sellAllSellCommand( new SpigotPlayer( player ), "" );
-
-// String registeredCmd = Prison.get().getCommandHandler().findRegisteredCommand( "sellall sell" );
-// Bukkit.dispatchCommand(player, registeredCmd);
-// return;
- }
- } else {
- if (isBoolean( sellAllConfig, "Options.Full_Inv_AutoSell_Notification") ) {
- Output.get().sendInfo(new SpigotPlayer(player), SpigotPrison.format(
- SpigotPrison.getInstance().getMessagesConfig().getString("Message.SellAllAutoSell")));
+ }
+ } else {
+ if (sellAllUtil.isAutoSellNotificationEnabled) {
+ SellAllUtil.get().sellAllSell(player, false, false, true, true, false, true);
+ } else {
+ SellAllUtil.get().sellAllSell(player, false, true, false, false, false, true);
+ }
}
- PrisonSpigotSellAllCommands.get().sellAllSellCommand( new SpigotPlayer( player ), "" );
-// String registeredCmd = Prison.get().getCommandHandler().findRegisteredCommand( "sellall sell" );
-// Bukkit.dispatchCommand(player, registeredCmd);
-// return;
- }
-
- // Now that something might have been sold, try to add all the extra inventory items back to the
- // player's inventory so it is not lost then pass the moreExtras along to be handled as the
- // configurations require.
- HashMap moreExtras = new HashMap<>();
- for ( SpigotItemStack itemStack : extra.values() ) {
- moreExtras.putAll( SpigotUtil.addItemToPlayerInventory( player, itemStack ));
+ // Now that something might have been sold, try to add all the extra inventory items back to the
+ // player's inventory so it is not lost then pass the moreExtras along to be handled as the
+ // configurations require.
+ HashMap moreExtras = new HashMap<>();
+ for (SpigotItemStack itemStack : extra.values()) {
+ moreExtras.putAll(SpigotUtil.addItemToPlayerInventory(player, itemStack));
+ }
+ extra = moreExtras;
}
- extra = moreExtras;
- }
-
- for ( SpigotItemStack itemStack : extra.values() ) {
-
- if ( isBoolean( AutoFeatures.dropItemsIfInventoryIsFull ) ) {
-
- SpigotUtil.dropPlayerItems( player, itemStack );
- notifyPlayerThatInventoryIsFull( player );
- }
- else {
- notifyPlayerThatInventoryIsFullLosingItems( player );
+
+ for (SpigotItemStack itemStack : extra.values()) {
+
+ if (isBoolean(AutoFeatures.dropItemsIfInventoryIsFull)) {
+
+ SpigotUtil.dropPlayerItems(player, itemStack);
+ notifyPlayerThatInventoryIsFull(player);
+ } else {
+ notifyPlayerThatInventoryIsFullLosingItems(player);
+ }
}
}
-
}
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/BackpacksUtil.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/BackpacksUtil.java
index c436bcf7c..d01a8cf4a 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/BackpacksUtil.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/BackpacksUtil.java
@@ -27,6 +27,7 @@
import tech.mcprison.prison.spigot.compat.Compatibility;
import tech.mcprison.prison.spigot.compat.SpigotCompatibility;
import tech.mcprison.prison.spigot.configs.BackpacksConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
/**
@@ -35,7 +36,6 @@
public class BackpacksUtil {
private static BackpacksUtil instance;
- private final Configuration messages = SpigotPrison.getInstance().getMessagesConfig();
private Configuration backpacksConfig = SpigotPrison.getInstance().getBackpacksConfig();
private File backpacksFile = new File(SpigotPrison.getInstance().getDataFolder() + "/backpacks/backpacksData.yml");
private FileConfiguration backpacksDataConfig = YamlConfiguration.loadConfiguration(backpacksFile);
@@ -1281,7 +1281,7 @@ private void backPackItem(Player p) {
ItemStack item;
List itemLore = createLore(
- messages.getString("Lore.ClickToOpenBackpack")
+ SpigotPrison.getInstance().getMessagesConfig().getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open)
);
item = createButton(SpigotUtil.getXMaterial(backpacksConfig.getString("Options.BackPack_Item")).parseItem(), itemLore, backpacksConfig.getString("Options.BackPack_Item_Title"));
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotBackpackCommands.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotBackpackCommands.java
index 92cff7af5..9913c3c4d 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotBackpackCommands.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotBackpackCommands.java
@@ -1,8 +1,6 @@
package tech.mcprison.prison.spigot.commands;
-import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack;
import org.bukkit.Bukkit;
-import org.bukkit.configuration.Configuration;
import org.bukkit.entity.Player;
import tech.mcprison.prison.Prison;
@@ -12,6 +10,7 @@
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.SpigotPrison;
import tech.mcprison.prison.spigot.backpacks.BackpacksUtil;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.backpacks.BackpacksAdminGUI;
import tech.mcprison.prison.spigot.gui.backpacks.BackpacksListPlayerGUI;
@@ -22,7 +21,7 @@
* */
public class PrisonSpigotBackpackCommands extends PrisonSpigotBaseCommands {
- private final Configuration messages = SpigotPrison.getInstance().getMessagesConfig();
+ private final MessagesConfig messages = SpigotPrison.getInstance().getMessagesConfig();
@Command(identifier = "backpack", description = "Backpacks", onlyPlayers = false)
private void backpackMainCommand(CommandSender sender,
@@ -49,7 +48,7 @@ private void backpackItemGive(CommandSender sender){
Player p = getSpigotPlayer(sender);
if (p == null) {
- Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString("Message.CantGiveItemFromConsole")));
+ Output.get().sendInfo(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_console_error)));
return;
}
@@ -64,7 +63,7 @@ private void backpacksListCommand(CommandSender sender){
Player p = getSpigotPlayer(sender);
if (p == null) {
- Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString("Message.CantGiveItemFromConsole")));
+ Output.get().sendInfo(sender, SpigotPrison.format( messages.getString(MessagesConfig.StringID.spigot_message_console_error)));
return;
}
@@ -81,7 +80,7 @@ private void deleteBackpackCommand(CommandSender sender,
@Arg(name = "id", description = "The backpack ID optional", def = "null") String id){
if (name.equalsIgnoreCase("null")){
- Output.get().sendWarn(sender, SpigotPrison.format(getMessages().getString("Message.BackPackNeedPlayer")));
+ Output.get().sendWarn(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_backpack_missing_playername)));
return;
}
@@ -101,9 +100,9 @@ private void deleteBackpackCommand(CommandSender sender,
}
}
if (success) {
- Output.get().sendInfo(sender, SpigotPrison.format(getMessages().getString("Message.BackPackDeleteOperationSuccess")));
+ Output.get().sendInfo(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_backpack_delete_success)));
} else {
- Output.get().sendWarn(sender, SpigotPrison.format(getMessages().getString("Message.BackPackDeleteOperationFail")));
+ Output.get().sendWarn(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_backpack_delete_error)));
}
}
@@ -114,7 +113,7 @@ private void resizeBackpackCommand(CommandSender sender,
@Arg(name = "id", description = "The backpack ID optional", def = "null") String id){
if (name.equalsIgnoreCase("null")){
- Output.get().sendWarn(sender, SpigotPrison.format(getMessages().getString("Message.BackPackNeedPlayer")));
+ Output.get().sendWarn(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_backpack_missing_playername)));
return;
}
@@ -122,13 +121,13 @@ private void resizeBackpackCommand(CommandSender sender,
try{
sizeInt = Integer.parseInt(size);
} catch (NumberFormatException ex){
- Output.get().sendWarn(sender, SpigotPrison.format(getMessages().getString("Message.BackPackResizeNotInt")));
+ Output.get().sendWarn(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_backpack_size_must_be_multiple_of_9)));
return;
}
// Must be multiple of 9.
if ((sizeInt % 9 != 0 || sizeInt > 54) && sizeInt != 0){
- Output.get().sendWarn(sender, SpigotPrison.format(getMessages().getString("Message.BackPackResizeNotMultiple9")));
+ Output.get().sendWarn(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_backpack_size_must_be_multiple_of_9)));
return;
}
@@ -155,7 +154,7 @@ private void resizeBackpackCommand(CommandSender sender,
}
}
- Output.get().sendInfo(sender, SpigotPrison.format(getMessages().getString("Message.BackPackResizeDone")));
+ Output.get().sendInfo(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_backpack_resize_success)));
}
@Command(identifier = "backpack limit", permissions = "prison.admin", description = "Backpacks limit for player, to use this multiple backpacks must be enabled from the backpacks config or it won't have effect.", onlyPlayers = false)
@@ -169,7 +168,7 @@ private void setBackpackLimitCommand(CommandSender sender,
@Arg(name = "Limit", description = "The Backpacks limit that a player can own", def = "null") String limit) {
if (name.equalsIgnoreCase("null") || limit.equalsIgnoreCase("null")){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.BackPackLimitMissingParam")));
+ Output.get().sendWarn(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_command_wrong_format)));
return;
}
@@ -177,7 +176,7 @@ private void setBackpackLimitCommand(CommandSender sender,
try{
limitInt = Integer.parseInt(limit);
} catch (NumberFormatException ex){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.BackPackLimitNotNumber")));
+ Output.get().sendWarn(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_backpack_limit_not_number)));
return;
}
@@ -187,16 +186,16 @@ private void setBackpackLimitCommand(CommandSender sender,
BackpacksUtil.get().setBackpacksLimit(BackpacksUtil.get().getBackpackOwnerOffline(name), limitInt);
}
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.BackPackLimitSuccess")));
+ Output.get().sendInfo(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_backpack_limit_edit_success)));
}
- @Command(identifier = "backpack limit add", permissions = "prison.admin", description = "Increment backpacks limit of a player, to use this multiple backpacks must be enabled or it won't have effect.", onlyPlayers = false)
+ @Command(identifier = "backpack limit add", permissions = "prison.admin", description = "Increment backpacks limit of a player, multiple backpacks must be enabled or this won't take effect.", onlyPlayers = false)
private void addBackpackLimitCommand(CommandSender sender,
@Arg(name = "Owner", description = "The backpack owner name", def = "null") String name,
@Arg(name = "Limit", description = "The Backpacks increment value", def = "null") String limit) {
if (name.equalsIgnoreCase("null") || limit.equalsIgnoreCase("null")){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.BackPackLimitMissingParam")));
+ Output.get().sendWarn(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_command_wrong_format)));
return;
}
@@ -204,7 +203,7 @@ private void addBackpackLimitCommand(CommandSender sender,
try{
limitInt = Integer.parseInt(limit);
} catch (NumberFormatException ex){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.BackPackLimitNotNumber")));
+ Output.get().sendWarn(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_backpack_limit_not_number)));
return;
}
@@ -216,7 +215,7 @@ private void addBackpackLimitCommand(CommandSender sender,
BackpacksUtil.get().setBackpacksLimit(BackpacksUtil.get().getBackpackOwnerOffline(name), limitInt);
}
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.BackPackLimitSuccess")));
+ Output.get().sendInfo(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_backpack_limit_edit_success)));
}
@Command(identifier = "backpack limit decrement", permissions = "prison.admin", description = "Decrement backpacks limit of a player, to use this multiple backpacks must be enabled or it won't have effect.", onlyPlayers = false)
@@ -225,7 +224,7 @@ private void decrementBackpackLimitCommand(CommandSender sender,
@Arg(name = "Value", description = "The Backpacks decrement value", def = "null") String limit) {
if (name.equalsIgnoreCase("null") || limit.equalsIgnoreCase("null")){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.BackPackLimitMissingParam")));
+ Output.get().sendWarn(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_command_wrong_format)));
return;
}
@@ -233,7 +232,7 @@ private void decrementBackpackLimitCommand(CommandSender sender,
try{
limitInt = Integer.parseInt(limit);
} catch (NumberFormatException ex){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.BackPackLimitNotNumber")));
+ Output.get().sendWarn(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_backpack_limit_not_number)));
return;
}
@@ -242,7 +241,7 @@ private void decrementBackpackLimitCommand(CommandSender sender,
if (limitInt >= 0) {
BackpacksUtil.get().setBackpacksLimit(Bukkit.getPlayerExact(name), limitInt);
} else {
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.BackPackLimitDecrementFail")));
+ Output.get().sendWarn(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_backpack_limit_decrement_fail)));
return;
}
} else {
@@ -250,12 +249,12 @@ private void decrementBackpackLimitCommand(CommandSender sender,
if (limitInt >= 0) {
BackpacksUtil.get().setBackpacksLimit(BackpacksUtil.get().getBackpackOwnerOffline(name), limitInt);
} else {
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.BackPackLimitDecrementFail")));
+ Output.get().sendWarn(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_backpack_limit_decrement_fail)));
return;
}
}
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.BackPackLimitSuccess")));
+ Output.get().sendInfo(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_backpack_limit_edit_success)));
}
@Command(identifier = "backpack admin", description = "Open backpack admin GUI", permissions = "prison.admin", onlyPlayers = true)
@@ -264,7 +263,7 @@ private void openBackpackAdminGUI(CommandSender sender){
Player p = getSpigotPlayer(sender);
if (p == null) {
- Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString("Message.CantGiveItemFromConsole")));
+ Output.get().sendInfo(sender, SpigotPrison.format( messages.getString(MessagesConfig.StringID.spigot_message_console_error)));
return;
}
@@ -279,24 +278,24 @@ private void backpackGUIOpenCommand(CommandSender sender,
Player p = getSpigotPlayer(sender);
if (p == null) {
- Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString("Message.CantRunGUIFromConsole")));
+ Output.get().sendInfo(sender, SpigotPrison.format( messages.getString(MessagesConfig.StringID.spigot_message_console_error)));
return;
}
if (isDisabledWorld(p)) return;
if (getBoolean(BackpacksUtil.get().getBackpacksConfig().getString("Options.Multiple-BackPacks-For-Player-Enabled")) && (BackpacksUtil.get().reachedBackpacksLimit(p) && !BackpacksUtil.get().getBackpacksIDs(p).contains(id))){
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.BackPackOwnLimitReached") + " [" + BackpacksUtil.get().getNumberOwnedBackpacks(p) + "]"));
+ Output.get().sendInfo(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_backpack_limit_reached) + " [" + BackpacksUtil.get().getNumberOwnedBackpacks(p) + "]"));
return;
}
if (getBoolean(BackpacksUtil.get().getBackpacksConfig().getString("Options.BackPack_Use_Permission_Enabled")) && !p.hasPermission(BackpacksUtil.get().getBackpacksConfig().getString("Options.BackPack_Use_Permission"))){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.MissingPermission") + " [" + BackpacksUtil.get().getBackpacksConfig().getString("Options.BackPack_Use_Permission") + "]"));
+ Output.get().sendWarn(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_missing_permission) + " [" + BackpacksUtil.get().getBackpacksConfig().getString("Options.BackPack_Use_Permission") + "]"));
return;
}
if (!BackpacksUtil.get().canOwnBackpack(p)){
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.BackPackCantOwn")));
+ Output.get().sendInfo(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_backpack_cant_own)));
return;
}
@@ -313,7 +312,7 @@ private void backpackListGUICommand(CommandSender sender){
Player p = getSpigotPlayer(sender);
if (p == null) {
- Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString("Message.CantRunGUIFromConsole")));
+ Output.get().sendInfo(sender, SpigotPrison.format( messages.getString(MessagesConfig.StringID.spigot_message_console_error)));
return;
}
@@ -322,7 +321,7 @@ private void backpackListGUICommand(CommandSender sender){
// New method.
if (getBoolean(BackpacksUtil.get().getBackpacksConfig().getString("Options.Multiple-BackPacks-For-Player-Enabled"))){
if (getBoolean(BackpacksUtil.get().getBackpacksConfig().getString("Options.BackPack_Use_Permission_Enabled")) && !p.hasPermission(BackpacksUtil.get().getBackpacksConfig().getString("Options.BackPack_Use_Permission"))){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.MissingPermission") + " [" + BackpacksUtil.get().getBackpacksConfig().getString("Options.BackPack_Use_Permission") + "]"));
+ Output.get().sendWarn(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_missing_permission) + " [" + BackpacksUtil.get().getBackpacksConfig().getString("Options.BackPack_Use_Permission") + "]"));
return;
}
BackpacksListPlayerGUI gui = new BackpacksListPlayerGUI(p);
@@ -336,7 +335,7 @@ private void openBackpackAdminCommandGUI(CommandSender sender){
Player p = getSpigotPlayer(sender);
if (p == null) {
- Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString("Message.CantGiveItemFromConsole")));
+ Output.get().sendInfo(sender, SpigotPrison.format( messages.getString(MessagesConfig.StringID.spigot_message_console_error)));
return;
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotBaseCommands.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotBaseCommands.java
index 699e3b90e..729a9b43b 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotBaseCommands.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotBaseCommands.java
@@ -5,6 +5,7 @@
import tech.mcprison.prison.internal.CommandSender;
import tech.mcprison.prison.spigot.SpigotPrison;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotCommandSender;
/**
@@ -12,9 +13,9 @@
*/
public class PrisonSpigotBaseCommands {
- private final Configuration messages = SpigotPrison.getInstance().getMessagesConfig();
+ private final MessagesConfig messages = SpigotPrison.getInstance().getMessagesConfig();
- public Configuration getMessages() {
+ public MessagesConfig getMessages() {
return messages;
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotGUICommands.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotGUICommands.java
index e89db1c57..65d94a4bd 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotGUICommands.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotGUICommands.java
@@ -8,6 +8,7 @@
import tech.mcprison.prison.internal.CommandSender;
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.SpigotPrison;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.SpigotGUIComponents;
import tech.mcprison.prison.spigot.gui.SpigotPrisonGUI;
import tech.mcprison.prison.spigot.gui.mine.SpigotPlayerMinesGUI;
@@ -20,7 +21,7 @@
*/
public class PrisonSpigotGUICommands extends PrisonSpigotBaseCommands {
- private final Configuration messages = getMessages();
+ private final MessagesConfig messages = getMessages();
/**
* NOTE: onlyPlayers needs to be false so players can use /gui help on the command, even from console.
@@ -37,7 +38,7 @@ private void prisonManagerGUI(CommandSender sender) {
Player player = getSpigotPlayer(sender);
if (player == null) {
- Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString("Message.CantRunGUIFromConsole")));
+ Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString(MessagesConfig.StringID.spigot_message_console_error)));
return;
}
@@ -55,13 +56,13 @@ private void prisonManagerGUI(CommandSender sender) {
private void prisonManagerPrestiges( CommandSender sender ) {
if ( !isPrisonConfig("prestiges") && !isPrisonConfig( "prestige.enabled" ) ) {
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.PrestigesAreDisabled")));
+ Output.get().sendInfo(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_prestiges_disabled)));
return;
}
if ( !isPrisonConfig("prison-gui-enabled") || !isConfig("Options.Prestiges.GUI_Enabled")){
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.GuiOrPrestigesDisabled")));
+ Output.get().sendInfo(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_prestiges_or_gui_disabled)));
return;
}
@@ -69,7 +70,7 @@ private void prisonManagerPrestiges( CommandSender sender ) {
String perm = getConfig( "Options.Prestiges.Permission_GUI");
if ( !sender.hasPermission( perm ) ){
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.missingGuiPrestigesPermission") + " [" +
+ Output.get().sendInfo(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_missing_permission) + " [" +
perm + "]"));
return;
}
@@ -78,7 +79,7 @@ private void prisonManagerPrestiges( CommandSender sender ) {
Player player = getSpigotPlayer( sender );
if (player == null) {
- Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString("Message.CantRunGUIFromConsole")));
+ Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString(MessagesConfig.StringID.spigot_message_console_error)));
return;
}
@@ -93,12 +94,12 @@ private void prisonManagerMines(CommandSender sender) {
Player player = getSpigotPlayer(sender);
if (player == null) {
- Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString("Message.CantRunGUIFromConsole")));
+ Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString(MessagesConfig.StringID.spigot_message_console_error)));
return;
}
if ( !isPrisonConfig("prison-gui-enabled") || !isConfig("Options.Mines.GUI_Enabled") ){
- Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString("Message.mineOrGuiDisabled")));
+ Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString(MessagesConfig.StringID.spigot_message_mines_or_gui_disabled)));
return;
}
@@ -107,7 +108,7 @@ private void prisonManagerMines(CommandSender sender) {
String perm = getConfig( "Options.Mines.Permission_GUI");
if ( !sender.hasPermission( perm ) ){
- Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString("Message.mineMissingGuiPermission") + " [" +
+ Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString(MessagesConfig.StringID.spigot_message_missing_permission) + " [" +
perm + "]"));
return;
}
@@ -124,13 +125,13 @@ private void prisonManagerRanks(CommandSender sender) {
Player player = getSpigotPlayer(sender);
if (player == null) {
- Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString("Message.CantRunGUIFromConsole")));
+ Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString(MessagesConfig.StringID.spigot_message_console_error)));
return;
}
if (!isPrisonConfig("prison-gui-enabled") || !isConfig("Options.Ranks.GUI_Enabled")) {
Output.get().sendInfo(sender, SpigotPrison.format(String.format(String.format(
- getMessages().getString("Message.rankGuiDisabledOrAllGuiDisabled"),
+ getMessages().getString(MessagesConfig.StringID.spigot_message_ranks_or_gui_disabled),
getPrisonConfig("prison-gui-enabled"), getConfig("Options.Ranks.GUI_Enabled") ))));
return;
}
@@ -139,7 +140,7 @@ private void prisonManagerRanks(CommandSender sender) {
String perm = getConfig( "Options.Ranks.Permission_GUI");
if (!sender.hasPermission(perm)) {
- Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString("Message.rankGuiMissingPermission") + " [" +
+ Output.get().sendInfo(sender, SpigotPrison.format( getMessages().getString(MessagesConfig.StringID.spigot_message_missing_permission) + " [" +
perm + "]"));
return;
}
@@ -163,6 +164,6 @@ public void reloadGUICommand(CommandSender sender){
SpigotGUIComponents.updateMessages();
SpigotGUIComponents.updateSellAllConfig();
SpigotGUIComponents.updateGUIConfig();
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.GUIReloadSuccess")));
+ Output.get().sendInfo(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_gui_reload_success)));
}
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotPrestigeCommands.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotPrestigeCommands.java
index 9200d6062..3e6048ffe 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotPrestigeCommands.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotPrestigeCommands.java
@@ -14,7 +14,7 @@
import tech.mcprison.prison.ranks.data.RankLadder;
import tech.mcprison.prison.ranks.managers.LadderManager;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.ListenersPrisonManager;
import tech.mcprison.prison.spigot.gui.rank.SpigotConfirmPrestigeGUI;
@@ -24,13 +24,13 @@
public class PrisonSpigotPrestigeCommands
extends PrisonSpigotBaseCommands {
- private final Configuration messages = SpigotPrison.getInstance().getMessagesConfig();
+ private final MessagesConfig messages = SpigotPrison.getInstance().getMessagesConfig();
@Command(identifier = "prestiges", onlyPlayers = true)
public void prestigesGUICommand(CommandSender sender) {
if ( !isPrisonConfig( "prestiges") && !isPrisonConfig( "prestige.enabled" ) ) {
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.PrestigesDisabledDefault")));
+ Output.get().sendInfo(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_prestiges_disabled)));
return;
}
@@ -76,7 +76,7 @@ public void prisonManagerPrestige(CommandSender sender ) {
if ( ( ladderDefault == null ||
!(ladderDefault.getLowestRank().isPresent()) ||
ladderDefault.getLowestRank().get().getName() == null)) {
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.DefaultLadderEmpty")));
+ Output.get().sendInfo(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_ladder_default_empty)));
return;
}
@@ -84,7 +84,7 @@ public void prisonManagerPrestige(CommandSender sender ) {
if ( ( ladderPrestiges == null ||
!(ladderPrestiges.getLowestRank().isPresent()) ||
ladderPrestiges.getLowestRank().get().getName() == null)) {
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.CantFindPrestiges")));
+ Output.get().sendInfo(sender, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_prestiges_empty)));
return;
}
}
@@ -119,13 +119,12 @@ private void prestigeByChat(CommandSender sender) {
ListenersPrisonManager listenersPrisonManager = ListenersPrisonManager.get();
listenersPrisonManager.chatEventActivator();
- NewMessagesConfig newMessages = SpigotPrison.getInstance().getNewMessagesConfig();
- Output.get().sendInfo(sender, newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_prestige_warning_1) + " "
- + newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_prestige_warning_2) + " " + newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_prestige_warning_3));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_gui_lore_prestige_warning_1) + " "
+ + messages.getString(MessagesConfig.StringID.spigot_gui_lore_prestige_warning_2) + " " + messages.getString(MessagesConfig.StringID.spigot_gui_lore_prestige_warning_3));
- Output.get().sendInfo(sender, messages.getString("Message.ConfirmPrestige"));
- Output.get().sendInfo(sender, messages.getString("Message.CancelPrestige"));
+ Output.get().sendInfo(sender, "&a" + messages.getString(MessagesConfig.StringID.spigot_message_prestiges_confirm));
+ Output.get().sendInfo(sender, "&c" + messages.getString(MessagesConfig.StringID.spigot_message_prestiges_cancel));
final Player player = getSpigotPlayer( sender );
listenersPrisonManager.chatInteractData(player, ListenersPrisonManager.ChatMode.Prestige);
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotSellAllCommands.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotSellAllCommands.java
index 022843241..d635719b4 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotSellAllCommands.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotSellAllCommands.java
@@ -17,6 +17,7 @@
import tech.mcprison.prison.spigot.SpigotPlatform;
import tech.mcprison.prison.spigot.SpigotPrison;
import tech.mcprison.prison.spigot.compat.Compatibility;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.sellall.SellAllBlockData;
import tech.mcprison.prison.spigot.sellall.SellAllUtil;
@@ -30,7 +31,7 @@
public class PrisonSpigotSellAllCommands extends PrisonSpigotBaseCommands {
private static PrisonSpigotSellAllCommands instance;
- private final Configuration messages = SpigotPrison.getInstance().getMessagesConfig();
+ private final MessagesConfig messages = SpigotPrison.getInstance().getMessagesConfig();
private final Compatibility compat = SpigotPrison.getInstance().getCompatibility();
/**
@@ -59,7 +60,7 @@ private void sellAllCurrency(CommandSender sender,
EconomyCurrencyIntegration currencyEcon = PrisonAPI.getIntegrationManager().getEconomyForCurrency(currency);
if (currencyEcon == null && !currency.equalsIgnoreCase("default")) {
- Output.get().sendError(sender, SpigotPrison.format(messages.getString("Message.SellAllCurrencyNotFound")), currency);
+ Output.get().sendError(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_currency_not_found), currency);
return;
}
@@ -69,7 +70,7 @@ private void sellAllCurrency(CommandSender sender,
}
if (sellAllUtil.setCurrency(currency)){
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllCurrencyEditedSuccess") + " [" + currency + "]"));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_currency_edit_success) + " [" + currency + "]");
}
}
@@ -94,7 +95,7 @@ private void sellAllDelay(CommandSender sender,
if (!isEnabled()) return;
if (!(enable.equalsIgnoreCase("true") || enable.equalsIgnoreCase("false"))){
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.InvalidBooleanInput")));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_boolean_input_invalid));
return;
}
@@ -107,18 +108,18 @@ private void sellAllDelay(CommandSender sender,
boolean enableBoolean = getBoolean(enable);
if (sellAllUtil.isSellAllDelayEnabled == enableBoolean){
if (enableBoolean){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllDelayAlreadyEnabled")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_delay_already_enabled));
} else {
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllDelayAlreadyDisabled")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_delay_already_disabled));
}
return;
}
if (sellAllUtil.setDelayEnable(enableBoolean)){
if (enableBoolean){
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllDelayEnabled")));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_delay_enabled));
} else {
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllDelayDisabled")));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_delay_disabled));
}
}
}
@@ -138,12 +139,12 @@ private void sellAllDelaySet(CommandSender sender,
try {
delayValue = Integer.parseInt(delay);
} catch (NumberFormatException ex){
- Output.get().sendError(sender, SpigotPrison.format(messages.getString("Message.SellAllDelayNotNumber")));
+ Output.get().sendError(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_delay_not_number));
return;
}
if (sellAllUtil.setDelay(delayValue)){
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllDelayEditedWithSuccess") + " [" + delayValue + "s]"));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_delay_edit_success) + " [" + delayValue + "s]");
}
}
@@ -159,7 +160,7 @@ private void sellAllAutoSell(CommandSender sender,
}
if (!(enable.equalsIgnoreCase("true") || enable.equalsIgnoreCase("false"))){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.InvalidBooleanInput")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_boolean_input_invalid));
return;
}
@@ -171,18 +172,18 @@ private void sellAllAutoSell(CommandSender sender,
boolean enableBoolean = getBoolean(enable);
if (sellAllUtil.isAutoSellEnabled == enableBoolean){
if (enableBoolean){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllAutoSellAlreadyEnabled")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_auto_already_enabled));
} else {
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllAutoSellAlreadyDisabled")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_auto_already_disabled));
}
return;
}
if (sellAllUtil.setAutoSell(enableBoolean)){
if (enableBoolean){
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllAutoSellEnabled")));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_auto_enabled));
} else {
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllAutoSellDisabled")));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_auto_disabled));
}
}
}
@@ -194,7 +195,7 @@ private void sellAllAutoSellPerUserToggleable(CommandSender sender,
if (!isEnabled()) return;
if (!(enable.equalsIgnoreCase("true") || enable.equalsIgnoreCase("false"))){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.InvalidBooleanInput")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_boolean_input_invalid));
return;
}
@@ -206,18 +207,18 @@ private void sellAllAutoSellPerUserToggleable(CommandSender sender,
boolean enableBoolean = getBoolean(enable);
if (sellAllUtil.isAutoSellPerUserToggleable == enableBoolean){
if (enableBoolean){
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllAutoPerUserToggleableAlreadyEnabled")));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_auto_perusertoggleable_already_enabled));
} else {
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllAutoPerUserToggleableAlreadyDisabled")));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_auto_perusertoggleable_already_disabled));
}
return;
}
if (sellAllUtil.setAutoSellPerUserToggleable(enableBoolean)){
if (enableBoolean){
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllAutoPerUserToggleableEnabled")));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_auto_perusertoggleable_enabled));
} else {
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllAutoPerUserToggleableDisabled")));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_auto_perusertoggleable_disabled));
}
}
}
@@ -233,7 +234,7 @@ public void sellAllSellCommand(CommandSender sender,
Player p = getSpigotPlayer(sender);
if (p == null){
- Output.get().sendInfo(sender, SpigotPrison.format("&cSorry but you can't use that from the console!"));
+ Output.get().sendInfo(sender, "&cSorry but you can't use that from the console!");
return;
}
@@ -247,7 +248,7 @@ public void sellAllSellCommand(CommandSender sender,
if (sellAllUtil.isSellAllSellPermissionEnabled){
String permission = sellAllUtil.permissionSellAllSell;
if (permission == null || !p.hasPermission(permission)){
- Output.get().sendWarn(new SpigotPlayer(p), SpigotPrison.format(messages.getString("Message.SellAllMissingPermission") + " [" + permission + "]"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_missing_permission) + " [" + permission + "]");
return;
}
}
@@ -276,7 +277,7 @@ public void sellAllSellHandCommand(CommandSender sender){
Player p = getSpigotPlayer(sender);
if (p == null){
- Output.get().sendInfo(sender, SpigotPrison.format("&cSorry but you can't use that from the console!"));
+ Output.get().sendInfo(sender, "&cSorry but you can't use that from the console!");
return;
}
@@ -285,7 +286,7 @@ public void sellAllSellHandCommand(CommandSender sender){
if (sellAllUtil.isSellAllSellPermissionEnabled){
String permission = sellAllUtil.permissionSellAllSell;
if (permission == null || !p.hasPermission(permission)){
- Output.get().sendWarn(new SpigotPlayer(p), SpigotPrison.format(messages.getString("Message.SellAllMissingPermission") + " [" + permission + "]"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_missing_permission) + " [" + permission + "]");
return;
}
}
@@ -305,7 +306,7 @@ public void sellAllSell(Player p){
if (!isEnabled()) return;
if (p == null){
- Output.get().sendInfo(new SpigotPlayer(p), SpigotPrison.format("&cSorry but you can't use that from the console!"));
+ Output.get().sendInfo(new SpigotPlayer(p), "&cSorry but you can't use that from the console!");
return;
}
@@ -319,7 +320,7 @@ public void sellAllSell(Player p){
if (sellAllUtil.isSellAllSellPermissionEnabled){
String permission = sellAllUtil.permissionSellAllSell;
if (permission == null || !p.hasPermission(permission)){
- Output.get().sendWarn(new SpigotPlayer(p), SpigotPrison.format(messages.getString("Message.SellAllMissingPermission") + " [" + permission + "]"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_missing_permission) + " [" + permission + "]");
return;
}
}
@@ -339,7 +340,7 @@ public void sellAllSellWithDelayCommand(CommandSender sender){
Player p = getSpigotPlayer(sender);
if (p == null){
- Output.get().sendInfo(sender, SpigotPrison.format("&cSorry but you can't use that from the console!"));
+ Output.get().sendInfo(sender, "&cSorry but you can't use that from the console!");
return;
}
@@ -353,7 +354,7 @@ public void sellAllSellWithDelayCommand(CommandSender sender){
if (sellAllUtil.isSellAllSellPermissionEnabled){
String permission = sellAllUtil.permissionSellAllSell;
if (permission == null || !p.hasPermission(permission)){
- Output.get().sendWarn(new SpigotPlayer(p), SpigotPrison.format(messages.getString("Message.SellAllMissingPermission") + " [" + permission + "]"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_missing_permission) + " [" + permission + "]");
return;
}
}
@@ -376,7 +377,7 @@ private void sellAllAutoEnableUser(CommandSender sender){
// Sender must be a Player, not something else like the Console.
if (p == null) {
- Output.get().sendError(sender, SpigotPrison.format(getMessages().getString("Message.CantRunGUIFromConsole")));
+ Output.get().sendError(sender, getMessages().getString(MessagesConfig.StringID.spigot_message_console_error));
return;
}
@@ -393,15 +394,15 @@ private void sellAllAutoEnableUser(CommandSender sender){
String permission = sellAllUtil.permissionAutoSellPerUserToggleable;
if (sellAllUtil.isAutoSellPerUserToggleablePermEnabled && (permission != null && !p.hasPermission(permission))){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllMissingPermissionToToggleAutoSell") + " [" + permission + "]"));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_missing_permission) + " [" + permission + "]");
return;
}
if (sellAllUtil.setAutoSellPlayer(p, !sellAllUtil.isPlayerAutoSellEnabled(p))){
if (sellAllUtil.isPlayerAutoSellEnabled(p)){
- Output.get().sendInfo(new SpigotPlayer(p), SpigotPrison.format(messages.getString("Message.SellAllAutoEnabled")));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_auto_enabled));
} else {
- Output.get().sendInfo(new SpigotPlayer(p), SpigotPrison.format(messages.getString("Message.SellAllAutoDisabled")));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_auto_disabled));
}
}
}
@@ -415,7 +416,7 @@ private void sellAllGuiCommand(CommandSender sender){
// Sender must be a Player, not something else like the Console.
if (p == null) {
- Output.get().sendError(sender, SpigotPrison.format(getMessages().getString("Message.CantRunGUIFromConsole")));
+ Output.get().sendError(sender, getMessages().getString(MessagesConfig.StringID.spigot_message_console_error));
return;
}
@@ -427,7 +428,7 @@ private void sellAllGuiCommand(CommandSender sender){
if (!sellAllUtil.openSellAllGUI(p)){
// If the sender's an admin (OP or have the prison.admin permission) it'll send an error message.
if (p.hasPermission("prison.admin")) {
- Output.get().sendError(sender, SpigotPrison.format(messages.getString("Message.SellAllGUIDisabled")));
+ Output.get().sendError(sender, messages.getString(MessagesConfig.StringID.spigot_message_gui_sellall_disabled));
}
}
}
@@ -440,13 +441,13 @@ private void sellAllAddCommand(CommandSender sender,
if (!isEnabled()) return;
if (itemID == null){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllPleaseAddItem")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_missing_name));
return;
}
itemID = itemID.toUpperCase();
if (value == null){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllAddPrice")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_missing_price));
return;
}
@@ -456,7 +457,7 @@ private void sellAllAddCommand(CommandSender sender,
}
if (sellAllUtil.sellAllConfig.getConfigurationSection("Items." + itemID) != null){
- Output.get().sendWarn(sender, SpigotPrison.format(itemID + messages.getString("Message.SellAllAlreadyAdded")));
+ Output.get().sendWarn(sender, itemID + " " + messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_already_added));
return;
}
@@ -465,16 +466,16 @@ private void sellAllAddCommand(CommandSender sender,
try {
blockAdd = XMaterial.valueOf(itemID);
} catch (IllegalArgumentException ex){
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllWrongID") + " [" + itemID + "]"));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_id_not_found) + " [" + itemID + "]");
return;
}
if (sellAllUtil.addSellAllBlock(blockAdd, value)){
- Output.get().sendInfo(sender, SpigotPrison.format("&3 ITEM [" + itemID + ", " + value + messages.getString("Message.SellAllAddSuccess")));
+ Output.get().sendInfo(sender, "&3 ITEM [" + itemID + ", " + value + " " + messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_add_success));
}
} catch (IllegalArgumentException ex){
- Output.get().sendError(sender, SpigotPrison.format(messages.getString("Message.SellAllWrongID") + " [" + itemID + "]"));
+ Output.get().sendError(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_id_not_found) + " [" + itemID + "]");
}
}
@@ -502,7 +503,7 @@ public void sellAllAddCommand(XMaterial blockAdd, Double value){
if (sellAllUtil.addSellAllBlock(blockAdd, value)) return;
- Output.get().logInfo(SpigotPrison.format("&3 ITEM [" + itemID + ", " + value + messages.getString("Message.SellAllAddSuccess")));
+ Output.get().logInfo("&3 ITEM [" + itemID + ", " + value + " " + messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_add_success));
}
@Command(identifier = "sellall delete", description = "SellAll delete command, remove an item from shop.", permissions = "prison.admin", onlyPlayers = false)
@@ -511,7 +512,7 @@ private void sellAllDeleteCommand(CommandSender sender, @Arg(name = "Item_ID", d
if (!isEnabled()) return;
if (itemID == null){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllMissingID")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_missing_name));
return;
}
itemID = itemID.toUpperCase();
@@ -522,13 +523,13 @@ private void sellAllDeleteCommand(CommandSender sender, @Arg(name = "Item_ID", d
}
if (sellAllUtil.sellAllConfig.getConfigurationSection("Items." + itemID) == null){
- Output.get().sendWarn(sender, SpigotPrison.format(itemID + messages.getString("Message.SellAllNotFoundStringConfig")));
+ Output.get().sendWarn(sender, itemID + " " + messages.getString(MessagesConfig.StringID.spigot_message_sellall_cant_find_item_config));
return;
}
if (XMaterial.matchXMaterial(itemID).isPresent()) {
if (sellAllUtil.removeSellAllBlock(XMaterial.matchXMaterial(itemID).get())) {
- Output.get().sendInfo(sender, SpigotPrison.format(itemID + messages.getString("Message.SellAllDeletedSuccess")));
+ Output.get().sendInfo(sender, itemID + " " + messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_delete_success));
}
}
}
@@ -541,13 +542,13 @@ private void sellAllEditCommand(CommandSender sender,
if (!isEnabled()) return;
if (itemID == null){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllPleaseAddItem")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_missing_name));
return;
}
itemID = itemID.toUpperCase();
if (value == null){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllAddPrice")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_missing_price));
return;
}
@@ -557,7 +558,7 @@ private void sellAllEditCommand(CommandSender sender,
}
if (sellAllUtil.sellAllConfig.getConfigurationSection("Items." + itemID) == null){
- Output.get().sendWarn(sender, SpigotPrison.format(itemID + messages.getString("Message.SellAllNotFoundEdit")));
+ Output.get().sendWarn(sender, itemID + " " + messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_not_found));
return;
}
@@ -566,16 +567,16 @@ private void sellAllEditCommand(CommandSender sender,
try{
blockAdd = XMaterial.valueOf(itemID);
} catch (IllegalArgumentException ex){
- Output.get().sendError(sender, SpigotPrison.format(messages.getString("Message.SellAllWrongID") + " [" + itemID + "]"));
+ Output.get().sendError(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_id_not_found) + " [" + itemID + "]");
return;
}
if (sellAllUtil.editPrice(blockAdd, value)){
- Output.get().sendInfo(sender, SpigotPrison.format("&3ITEM [" + itemID + ", " + value + messages.getString("Message.SellAllCommandEditSuccess")));
+ Output.get().sendInfo(sender, "&3ITEM [" + itemID + ", " + value + " " + messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_edit_success));
}
} catch (IllegalArgumentException ex){
- Output.get().sendError(sender, SpigotPrison.format(messages.getString("Message.SellAllWrongID") + " [" + itemID + "]"));
+ Output.get().sendError(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_id_not_found) + " [" + itemID + "]");
}
}
@@ -590,7 +591,7 @@ private void sellAllMultiplierCommand(CommandSender sender){
}
if (!sellAllUtil.isSellAllMultiplierEnabled){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllMultipliersAreDisabled")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_multiplier_are_disabled));
return;
}
@@ -614,12 +615,12 @@ private void sellAllAddMultiplierCommand(CommandSender sender,
}
if (!sellAllUtil.isSellAllMultiplierEnabled){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllMultipliersAreDisabled")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_multiplier_are_disabled));
return;
}
if (sellAllUtil.addPrestigeMultiplier(prestige, multiplier)){
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllMultiplierEditSaveSuccess")));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_multiplier_add_success));
}
}
@@ -635,22 +636,22 @@ private void sellAllDeleteMultiplierCommand(CommandSender sender,
}
if (!sellAllUtil.isSellAllMultiplierEnabled){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllMultipliersAreDisabled")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_multiplier_are_disabled));
return;
}
if (prestige == null){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllMultiplierFormat")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_command_wrong_format));
return;
}
if (sellAllUtil.sellAllConfig.getConfigurationSection("Multiplier." + prestige) == null){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllCantFindMultiplier") + prestige + messages.getString("Message.SellAllCantFindMultiplier2")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_multiplier_cant_find) + " [" + prestige + "]");
return;
}
if (sellAllUtil.removePrestigeMultiplier(prestige)){
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllMultiplierDeleteSuccess")));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_multiplier_delete_success));
}
}
@@ -667,7 +668,7 @@ private void sellAllToolsTriggerToggle(CommandSender sender,
}
if (!enable.equalsIgnoreCase("true") && !enable.equalsIgnoreCase("false")){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.InvalidBooleanInput")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_boolean_input_invalid));
return;
}
@@ -679,18 +680,18 @@ private void sellAllToolsTriggerToggle(CommandSender sender,
boolean enableInput = getBoolean(enable);
if (sellAllUtil.isSellAllItemTriggerEnabled == enableInput) {
if (sellAllUtil.isSellAllItemTriggerEnabled) {
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllTriggerAlreadyEnabled")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_trigger_already_enabled));
} else {
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllTriggerAlreadyDisabled")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_trigger_already_disabled));
}
return;
}
if (sellAllUtil.setItemTrigger(enableInput)){
if (enableInput){
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllTriggerEnabled")));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_trigger_enabled));
} else {
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllTriggerDisabled")));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_trigger_disabled));
}
}
}
@@ -707,12 +708,12 @@ private void sellAllTriggerAdd(CommandSender sender,
}
if (!sellAllUtil.isSellAllItemTriggerEnabled){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllTriggerIsDisabled")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_trigger_is_disabled));
return;
}
if (itemID == null){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllTriggerMissingItem")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_missing_name));
return;
}
itemID = itemID.toUpperCase();
@@ -722,15 +723,15 @@ private void sellAllTriggerAdd(CommandSender sender,
try{
blockAdd = XMaterial.valueOf(itemID);
} catch (IllegalArgumentException ex){
- Output.get().sendError(sender, SpigotPrison.format(messages.getString("Message.SellAllWrongID") + " [" + itemID + "]"));
+ Output.get().sendError(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_id_not_found) + " [" + itemID + "]");
return;
}
if (sellAllUtil.addItemTrigger(blockAdd)){
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllTriggerItemAddSuccess") + " [" + itemID + "]"));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_trigger_item_add_success) + " [" + itemID + "]");
}
} catch (IllegalArgumentException ex){
- Output.get().sendError(sender, SpigotPrison.format(messages.getString("Message.SellAllWrongID") + " [" + itemID + "]"));
+ Output.get().sendError(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_id_not_found) + " [" + itemID + "]");
}
}
@@ -746,29 +747,29 @@ private void sellAllTriggerDelete(CommandSender sender,
}
if (!sellAllUtil.isSellAllItemTriggerEnabled){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllTriggerIsDisabled")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_trigger_is_disabled));
return;
}
if (itemID == null){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllTriggerMissingItem")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_missing_name));
return;
}
itemID = itemID.toUpperCase();
if (!XMaterial.matchXMaterial(itemID).isPresent()){
- Output.get().sendError(sender, SpigotPrison.format(messages.getString("Message.SellAllWrongID") + " [" + itemID + "]"));
+ Output.get().sendError(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_id_not_found) + " [" + itemID + "]");
return;
}
XMaterial xMaterial = XMaterial.matchXMaterial(itemID).get();
if (!sellAllUtil.getItemTriggerXMaterials().contains(xMaterial)){
- Output.get().sendWarn(sender, SpigotPrison.format(messages.getString("Message.SellAllTriggerMissingItem")));
+ Output.get().sendWarn(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_item_missing_name));
return;
}
if (sellAllUtil.removeItemTrigger(xMaterial)) {
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllTriggerItemDeleteSuccess") + " [" + itemID + "]"));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_trigger_item_delete_success) + " [" + itemID + "]");
}
}
@@ -785,7 +786,6 @@ private void sellAllSetDefaultCommand(CommandSender sender){
sellAllAddCommand(sender, xMatCost.getBlock().name(), xMatCost.getPrice() );
}
- Output.get().sendInfo(sender, SpigotPrison.format(messages.getString("Message.SellAllDefaultSuccess")));
+ Output.get().sendInfo(sender, messages.getString(MessagesConfig.StringID.spigot_message_sellall_default_values_success));
}
-}
-
+}
\ No newline at end of file
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/MessagesConfig.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/MessagesConfig.java
index f6473f621..4035b6d67 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/MessagesConfig.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/MessagesConfig.java
@@ -1,228 +1,289 @@
package tech.mcprison.prison.spigot.configs;
-import java.io.File;
-import java.io.IOException;
-
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.configuration.file.YamlConfiguration;
-
-import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.SpigotPrison;
-/**
- * @author GABRYCA
- **/
-public class MessagesConfig extends SpigotConfigComponents{
+import java.io.*;
+import java.util.Properties;
- // Initialize parameters and variables
- private FileConfiguration conf;
- private int changeCount = 0;
-
- public MessagesConfig() {
- initialize();
- }
+public class MessagesConfig {
- public void initialize() {
+ private static MessagesConfig instance;
+ private Properties properties = new Properties();
+ private final String defaultLanguage = SpigotPrison.getInstance().getConfig().getString("default-language");
+ private final String path = "/module_conf/spigot/lang/";
- // Filepath
- File file = new File(SpigotPrison.getInstance().getDataFolder() + "/module_conf/lang/" + SpigotPrison.getInstance().getConfig().getString("default-language") + ".yml");
+ /**
+ * Get MessagesConfig class and initialize it if necessary.
+ * */
+ public static MessagesConfig get(){
+ if (instance == null){
+ instance = new MessagesConfig();
+ instance.initConfig();
+ }
+ return instance;
+ }
- // Check if the config exists
- fileMaker(file);
+ /**
+ * Initialize the config, reading and caching data.
+ * */
+ private void initConfig(){
+ try(FileInputStream data = new FileInputStream(SpigotPrison.getInstance().getDataFolder() + path + defaultLanguage + ".properties")){
- // Get the config
- conf = YamlConfiguration.loadConfiguration(file);
-
- // Call method
- values();
+ Properties temp = new Properties();
+ temp.load(new InputStreamReader(data));
+ properties = temp;
- if (changeCount > 0) {
- try {
- conf.save(file);
- Output.get().logInfo("&aThere were &b%d &anew values added for the language files " + "used by the GuiConfig.yml file located at &b%s", changeCount, file.getAbsoluteFile());
- }
- catch (IOException e) {
- Output.get().logInfo("&4Failed to save &b%d &4new values for the language files " + "used by the GuiConfig.yml file located at &b%s&4. " + "&a %s", changeCount, file.getAbsoluteFile(), e.getMessage());
- }
+ } catch (IOException ex){
+ ex.printStackTrace();
}
-
- conf = YamlConfiguration.loadConfiguration(file);
}
- private void dataConfig(String key, String value){
- if (conf.get(key) == null) {
- conf.set(key, value);
- changeCount++;
- }
+ /**
+ * Get String.
+ * */
+ public String getString(StringID message){
+ return properties.getProperty(message.toString());
}
- private void dataConfig(String key, boolean value){
- if (conf.get(key) == null) {
- conf.set(key, value);
- changeCount++;
- }
+ public void reload(){
+ initConfig();
}
- // All the strings should be here
- private void values(){
- dataConfig("Message.BackPackIsDisabled", "Backpacks are disabled in the config.yml, you can't use this!");
- dataConfig("Message.BackPackNeedPlayer", "Please add a playername.");
- dataConfig("Message.BackPackDeleteOperationSuccess", "The backpack should've been deleted with success!");
- dataConfig("Message.BackPackDeleteOperationFail", "Can't find the backpack or something went wrong...?");
- dataConfig("Message.BackPackPlayerNotFound", "Player not found.");
- dataConfig("Message.BackPackDoNotOwnAny", "Sorry but you don't own any inventory, please use /backpack to make one.");
- dataConfig("Message.BackPackOwnLimitReached", "Sorry but you already have the max amount of backpacks allowed for Player!");
- dataConfig("Message.BackPackResizeNotInt", "Backpack's size value isn't a number.");
- dataConfig("Message.BackPackResizeNotMultiple9", "Backpack's size must be a multiple of 9 and max 54.");
- dataConfig("Message.BackPackResizeDone", "If the Backpack wasn't missing, it got resized with success!");
- dataConfig("Message.BackPackLimitMissingParam", "You're missing some arguments required to set the backpacks limit!");
- dataConfig("Message.BackPackLimitNotNumber", "The Backpacks Limit number isn't a number!");
- dataConfig("Message.BackPackLimitSuccess", "The Backpacks Limit got edited with success!");
- dataConfig("Message.BackPackLimitDecrementFail", "The Backpacks limit decremented of that value would be negative, operation canceled!");
- dataConfig("Message.BackPackListEmpty", "There aren't backpacks in this server.");
- dataConfig("Message.BackPackCantOwn", "Sorry but looks like you can't own Backpacks!");
- dataConfig("Message.CantGetRanksAdmin", "Can't get Ranks, there might be &cno ranks&7 or the Ranks module's &cdisabled&7.");
- dataConfig("Message.CantRunGUIFromConsole", "You cannot run the GUI from the console.");
- dataConfig("Message.CantGiveItemFromConsole", "You can't get an item as the console.");
- dataConfig("Message.DefaultLadderEmpty", "The default ladder is &cempty&7.");
- dataConfig("Message.NoSellAllItems", "Sorry but &cthere aren't&7 SellAll Items to show.");
- dataConfig("Message.EmptyGui", "Sorry, the GUI's &cempty.");
- dataConfig("Message.EnableAutoSellToUse", "Sorry, but AutoSell's &cdisabled&7, please enable it!");
- dataConfig("Message.EnableSellDelayToUse", "Sorry, but the SellAll Delay's &cdisabled&7, please enable it!");
- dataConfig("Message.EventCancelled", "&cEvent cancelled.");
- dataConfig("Message.InvalidBooleanInput", "Sorry, you should type &a-true-&7 or &c-false-&7 here.");
- dataConfig("Message.MissingPermission", "Sorry but you don't have the &cpermission&7 to use that!");
- dataConfig("Message.NoBlocksMine", "Sorry but this Mine's &cempty&7.");
- dataConfig("Message.NoMines", "Sorry but &cthere aren't &7Mines to show.");
- dataConfig("Message.NoRankupCommands", "Sorry, but there &caren't rankUpCommands&7 for this Rank!");
- dataConfig("Message.NoLadders", "Sorry but &cthere aren't &7ladders to show.");
- dataConfig("Message.NoRanksPrestigesLadder", "There &caren't ranks&7 in the -prestiges- ladder!");
- dataConfig("Message.NoRanksFoundAdmin", "Sorry, the Ladder's &cempty&7!");
- dataConfig("Message.NoRanksFound", "Sorry, but this Ladder's &cempty&7!");
- dataConfig("Message.NoRanksFoundHelp1", "Sorry, the Ladder's &cempty&7 or &7[");
- dataConfig("Message.NoRanksFoundHelp2", "] &cdoesn't exists!");
- dataConfig("Message.LadderPrestigesNotFound", "Ladder -prestiges- &cnot found&7!");
- dataConfig("Message.TooManyBlocks", "Sorry, but there're &ctoo many&7 Blocks and the max's 54 for the GUI");
- dataConfig("Message.TooManyLadders", "Sorry, but there're &ctoo many&7 Ladders and the max's 54 for the GUI");
- dataConfig("Message.TooManyMines", "Sorry, but there're &ctoo many&7 Mines and the max's 54 for the GUI");
- dataConfig("Message.TooManyRankupCommands", "Sorry, but there're &ctoo many&7 RankupCommands and the max's 54 for the GUI");
- dataConfig("Message.TooManyRanks", "Sorry, but there're &ctoo many&7 Ranks and the max's 54 for the GUI");
- dataConfig("Message.TooManySellAllItems", "There are &ctoo many&7 Items and the MAX for the GUI's 54!");
- dataConfig("Message.mineNameRename", "Please write the &6mineName &7you'd like to use and &6submit&7.");
- dataConfig("Message.mineNameRenameClose", "Input &cclose &7to cancel or wait &c30 seconds&7.");
- dataConfig("Message.mineNameRenameClosed", "Rename Mine &cclosed&7, nothing got changed!");
- dataConfig("Message.mineOrGuiDisabled", "GUI and/or GUI Mines is &cdisabled&7. Check GuiConfig.yml.");
- dataConfig("Message.mineMissingGuiPermission", "You lack the &cpermissions&7 to use GUI Mines");
- dataConfig("Message.MineShowItemEditSuccess", "Mine show item edited with success.");
- dataConfig("Message.OutOfTimeNoChanges", "You ran out of time, &cnothing changed&7.");
- dataConfig("Message.PrestigeCancelled", "Prestige &ccancelled&7!");
- dataConfig("Message.PrestigeCancelledWrongKeyword", "Prestige &ccancelled&7, you didn't type the word: &aconfirm&7.");
- dataConfig("Message.PrestigeRanOutOfTime", "You ran out of time, &cPrestige cancelled&7.");
- dataConfig("Message.PrestigesDisabledDefault", "Prestiges are &cdisabled&7 by default, please edit it in your config.yml!");
- dataConfig("Message.ConfirmPrestige", "&aConfirm&7: Type the word &aconfirm&7 to confirm");
- dataConfig("Message.CancelPrestige", "&cCancel&7: Type the word &ccancel&7 to cancel, &cyou've 30 seconds.");
- dataConfig("Message.PrestigesAreDisabled", "Prestiges are &cdisabled&7. Check config.yml.");
- dataConfig("Message.GuiOrPrestigesDisabled", "GUI and/or GUI Prestiges is &cdisabled&7. Check GuiConfig.yml.");
- dataConfig("Message.GuiClosedWithSuccess", "The GUI got closed.");
- dataConfig("Message.CantFindPrestiges", "The prestige ladder has &cno prestiges&7!");
- dataConfig("Message.missingGuiPrestigesPermission", "You lack the &cpermissions&7 to use GUI prestiges");
- dataConfig("Message.rankTagRename", "Please write the &6tag &7you'd like to use and &6submit&7.");
- dataConfig("Message.rankTagRenameClose", "Input &cclose &7to cancel or wait &c30 seconds&7.");
- dataConfig("Message.rankTagRenameClosed", "Rename tag &cclosed&7, nothing got changed!");
- dataConfig("Message.rankGuiDisabledOrAllGuiDisabled", "GUI and/or GUI Ranks is &cdisabled&7. Check GuiConfig.yml (%s %s)");
- dataConfig("Message.rankGuiMissingPermission", "You lack the &cpermissions&7 to use the Ranks GUI.");
- dataConfig("Message.SellAllAutoSellEarnedMoney", "You earned with AutoSell: ");
- dataConfig("Message.SellAllAutoSellEarnedMoneyCurrency", "$");
- dataConfig("Message.SellAllAutoSellMissingPermission", "You don't have the &cpermission&7 to edit AutoSell.");
- dataConfig("Message.SellAllAutoSellEnabled", "Autosell has been &aenabled&7.");
- dataConfig("Message.SellAllAutoSellDisabled", "Autosell has been &cdisabled&7.");
- dataConfig("Message.SellAllAutoSellAlreadyEnabled", "AutoSell has already been &aenabled&7!");
- dataConfig("Message.SellAllAutoSellAlreadyDisabled", "AutoSell has already been &cdisabled&7!");
- dataConfig("Message.SellAllAutoPerUserToggleableAlreadyEnabled", "AutoSell perUserToggleable's already &aenabled&7!");
- dataConfig("Message.SellAllAutoPerUserToggleableAlreadyDisabled", "AutoSell perUserToggleable's already &cdisabled&7!");
- dataConfig("Message.SellAllAutoPerUserToggleableEnabled", "SellAll PerUserToggleable &aEnabled&7!");
- dataConfig("Message.SellAllAutoPerUserToggleableDisabled", "SellAll PerUserToggleable &cDisabled&7!");
- dataConfig("Message.SellAllCurrencyChat1", "&3Started setup of new currency for SellAll!");
- dataConfig("Message.SellAllCurrencyChat2", "Type &ccancel &7to cancel.");
- dataConfig("Message.SellAllCurrencyChat3", "Type &3default &7to set to default currency.");
- dataConfig("Message.SellAllCurrencyChat4", "Type the &aCurrency name &7to set the new currency.");
- dataConfig("Message.SellAllCurrencyEditedSuccess", "SellAll Currency edited with success!");
- dataConfig("Message.SellAllCurrencyEditCancelled", "SellAll edit currency &ccancelled&7.");
- dataConfig("Message.SellAllCurrencyNotFound", "No active economy supports the currency named '%s'.");
- dataConfig("Message.SellAllDefaultSuccess", "Default Values added with &asuccess&7!");
- dataConfig("Message.SellAllDefaultMissingPermission", "Sorry but you're missing the &cpermission!");
- dataConfig("Message.SellAllIsDisabled", "Sorry but the SellAll Feature's &cdisabled&7 in the config.yml");
- dataConfig("Message.SellAllEditedWithSuccess", "&7] edited with &asuccess&7!");
- dataConfig("Message.SellAllSubCommandNotFound", "Sub-command &cnot found&7, please use /sellall help for help!");
- dataConfig("Message.SellAllMultipliersAreDisabled", "Multipliers are &cdisabled&7 in the SellAll config!");
- dataConfig("Message.SellAllMultiplierWrongFormat", "&cWrong format&7, please use /sellall multiplier add/delete ");
- dataConfig("Message.SellAllMissingPermission", "Sorry, but you don't have the &cpermission&7");
- dataConfig("Message.SellAllMissingPermissionToToggleAutoSell", "Sorry but you're missing the &cpermission&7 to use that! ");
- dataConfig("Message.SellAllRanksDisabled", "The Ranks module's &cdisabled&7 or not found!");
- dataConfig("Message.SellAllPrestigeLadderNotFound", "&cCan't find&7 the Prestiges Ladder, they might be &cdisabled&7 in the config.yml!");
- dataConfig("Message.SellAllCantFindPrestigeOrRank", "&cCan't find&7 the Prestige/Rank: ");
- dataConfig("Message.SellAllRankNotFoundInPrestigeLadder", "The -prestiges- ladder &cdoesn't contain&7 the Rank: ");
- dataConfig("Message.SellAllMultiplierNotANumber", "Sorry but the multiplier &cisn't a number&7!");
- dataConfig("Message.SellAllMultiplierNotNumber2", " Here-> ");
- dataConfig("Message.SellAllConfigSaveFail", "Sorry, &csomething went wrong&7 while saving the config!");
- dataConfig("Message.SellAllMultiplierEditSaveSuccess", "Multiplier got added or edited with &asuccess&7!");
- dataConfig("Message.SellAllMultiplierFormat", "Please use this format: /sellall multiplier delete .");
- dataConfig("Message.SellAllCantFindMultiplier", "&cCan't find&7 the Multiplier of the prestige ");
- dataConfig("Message.SellAllCantFindMultiplier2", " &7in the sellallconfig.yml");
- dataConfig("Message.SellAllMultiplierDeleteSuccess", "Multiplier &cdeleted&7 with &asuccess&7!");
- dataConfig("Message.SellAllWrongFormatCommand", "&cWrong format&7, use /sellall help for help.");
- dataConfig("Message.SellAllPleaseAddItem", "Please &aadd&7 an ITEM_ID [example: /sellall add COAL_ORE ]");
- dataConfig("Message.SellAllAddPrice", "Please &aadd&7 a price or value for the item [example: /sellall add COAL_ORE 100]");
- dataConfig("Message.SellAllWrongID", "Sorry but the &cITEM_ID's wrong&7, please check it!");
- dataConfig("Message.SellAllValueNotNumber", "Sorry but the value &cisn't a number&7!");
- dataConfig("Message.SellAllMissingID", "Please &aadd&7 an ITEM_ID [example: /sellall delete COAL_ORE]");
- dataConfig("Message.SellAllNotFoundStringConfig", " not found in the config or got already &cdeleted&7.");
- dataConfig("Message.SellAllNotFoundEdit", " not found in the config!");
- dataConfig("Message.SellAllDeletedSuccess", " &cDeleted&7 with &asuccess&7!");
- dataConfig("Message.SellAllAddSuccess", "] &aadded&7 with &asuccess&7!");
- dataConfig("Message.SellAllAlreadyAdded", " &cgot already added before&7, to edit it please use the /sellall edit command!");
- dataConfig("Message.SellAllCommandEditSuccess", "] &aedited&7 with &asuccess&7!");
- dataConfig("Message.SellAllYouArentPlayer", "You &caren't&a a player");
- dataConfig("Message.SellAllNothingToSell", "You have &cnothing&7 to sell!");
- dataConfig("Message.SellAllYouGotMoney", "You got &a$");
- dataConfig("Message.SellAllGUIDisabled", "Sorry but the GUI's &cdisabled&7 in the SellAllConfig.yml.");
- dataConfig("Message.SellAllAutoSell", "Your inventory's full, &aAutoSell activated&7!");
- dataConfig("Message.SellAllSignOnly", "Sorry but you can use SellAll only by touching a sign (or with the ByPass permission).");
- dataConfig("Message.SellAllSignNotify", "Using &aSellAll&7 from a Sign with &asuccess&7!");
- dataConfig("Message.SellAllSignMissingPermission", "Sorry, but you don't have the &cpermission&7 to use this!");
- dataConfig("Message.SellAllEmpty", "&cThere aren't&7 items in the sellall config,\n please add one and/or restart the server!");
- dataConfig("Message.SellAllAutoEnabled", "SellAll-Auto &aenabled &7with &asuccess&7!");
- dataConfig("Message.SellAllAutoDisabled", "SellAll-Auto &cdisabled &7with &asuccess&7!");
- dataConfig("Message.SellAllWaitDelay", "Please &cwait&7 before using this command again!");
- dataConfig("Message.SellAllDelayAlreadyEnabled", "SellAll Delay already &aenabled&7!");
- dataConfig("Message.SellAllDelayAlreadyDisabled", "SellAll Delay already &cdisabled&7!");
- dataConfig("Message.SellAllDelayEnabled", "SellAll Delay &aenabled &7with &asuccess&7!");
- dataConfig("Message.SellAllDelayDisabled", "SellAll Delay &cdisabled &7with &asuccess&7!");
- dataConfig("Message.SellAllDelayEditedWithSuccess", "SellAll Delay edited with &asuccess&7!");
- dataConfig("Message.SellAllDelayNotNumber", "Delay value &cisn't&7 a number!");
- dataConfig("Message.SellAllGUIEmpty", "Sorry but there &caren't&7 Blocks in the SellAll Shop!");
- dataConfig("Message.SellAllGUIEmpty2", "&7[&cTIP&7] &7You can &aadd&7 one using the command /sellall add!");
- dataConfig("Message.SellAllTriggerAlreadyEnabled", "SellAll trigger's already &aenabled&7.");
- dataConfig("Message.SellAllTriggerAlreadyDisabled", "SellAll trigger's already &cdisabled&7.");
- dataConfig("Message.SellAllTriggerEnabled", "SellAll trigger &aEnabled&7.");
- dataConfig("Message.SellAllTriggerDisabled", "SellAll trigger &cDisabled&7.");
- dataConfig("Message.SellAllTriggerIsDisabled", "SellAll trigger's &cdisabled&7 in the SellAllConfig.yml.");
- dataConfig("Message.SellAllTriggerMissingItem", "Please add a valid Item ID for SellAll Shift+Right Click Trigger.");
- dataConfig("Message.SellAllTriggerItemAddSuccess", "SellAll trigger Item added with &asuccess&7!");
- dataConfig("Message.SellAllTriggerItemEditSuccess", "SellAll trigger Item edited with &asuccess&7!");
- dataConfig("Message.SellAllTriggerItemDeleteSuccess", "SellAll trigger Item deleted with &asuccess&7!");
- dataConfig("Message.SellAllTriggerMissingItem", "There isn't an item in the SellAllConfig.yml trigger like that.");
- dataConfig("Message.TooLowValue", "&cToo low value.");
- dataConfig("Message.TooHighValue", "&cToo high value.");
- dataConfig("Message.GUIReloadSuccess", "GUIs reloaded with success!");
- dataConfig("Setup.Message.MissingPermission", "Sorry but you don't have the &cpermission&7 [-prison.setup- or -prison.admin-]!");
- dataConfig("Setup.Message.WrongFormat", "You're &cmissing&7 the last argument -mines- or -ranks-, / setup -mines- or -ranks- !");
- dataConfig("Setup.Message.WelcomeToRanksSetup", "Hi and welcome to the Ranks Setup, please &cwait&7 until it'll be completed!");
- dataConfig("Setup.Message.SuccessRanksSetup", "The Ranks Setup got &acompleted&7 with &asuccess&7 and the Ranks got &aadded&7 to the default ladder, please check the logs if something's missing!");
- dataConfig("Setup.Message.Aborted", "Prison Setup &cCancelled&7.");
- }
+ public enum StringID {
+
+ spigot_gui_lore_click_to_add,
+ spigot_gui_lore_click_to_add_backpack,
+ spigot_gui_lore_click_to_cancel,
+ spigot_gui_lore_click_to_close,
+ spigot_gui_lore_click_to_confirm,
+ spigot_gui_lore_click_to_decrease,
+ spigot_gui_lore_click_to_delete,
+ spigot_gui_lore_click_to_disable,
+ spigot_gui_lore_click_to_edit,
+ spigot_gui_lore_click_to_enable,
+ spigot_gui_lore_click_to_increase,
+ spigot_gui_lore_click_to_manage_rank,
+ spigot_gui_lore_click_to_open,
+ spigot_gui_lore_click_to_rankup,
+ spigot_gui_lore_click_to_rename,
+ spigot_gui_lore_click_to_select,
+ spigot_gui_lore_click_to_start_block_setup,
+ spigot_gui_lore_click_to_teleport,
+ spigot_gui_lore_click_to_use,
+
+ spigot_gui_lore_click_left_to_confirm,
+ spigot_gui_lore_click_left_to_edit,
+ spigot_gui_lore_click_left_to_open,
+ spigot_gui_lore_click_left_to_reset,
+
+ spigot_gui_lore_click_right_to_cancel,
+ spigot_gui_lore_click_right_to_delete,
+ spigot_gui_lore_click_right_to_disable,
+ spigot_gui_lore_click_right_to_enable,
+ spigot_gui_lore_click_right_to_toggle,
+
+ spigot_gui_lore_click_right_and_shift_to_delete,
+ spigot_gui_lore_click_right_and_shift_to_disable,
+ spigot_gui_lore_click_right_and_shift_to_toggle,
+
+ spigot_gui_lore_backpack_id,
+ spigot_gui_lore_blocks,
+ spigot_gui_lore_blocktype,
+ spigot_gui_lore_chance,
+ spigot_gui_lore_command,
+ spigot_gui_lore_currency,
+ spigot_gui_lore_delay,
+ spigot_gui_lore_id,
+ spigot_gui_lore_info,
+ spigot_gui_lore_minename,
+ spigot_gui_lore_multiplier,
+ spigot_gui_lore_name,
+ spigot_gui_lore_owner,
+ spigot_gui_lore_percentage,
+ spigot_gui_lore_permission,
+ spigot_gui_lore_players_at_rank,
+ spigot_gui_lore_prestige_name,
+ spigot_gui_lore_price,
+ spigot_gui_lore_radius,
+ spigot_gui_lore_rank_tag,
+ spigot_gui_lore_reset_time,
+ spigot_gui_lore_show_item,
+ spigot_gui_lore_size,
+ spigot_gui_lore_spawnpoint,
+ spigot_gui_lore_volume,
+ spigot_gui_lore_value,
+ spigot_gui_lore_world,
+
+ spigot_gui_lore_disabled,
+ spigot_gui_lore_enabled,
+ spigot_gui_lore_locked,
+ spigot_gui_lore_next_page,
+ spigot_gui_lore_prior_page,
+ spigot_gui_lore_rankup,
+ spigot_gui_lore_selected,
+ spigot_gui_lore_unlocked,
+
+ spigot_gui_lore_add_backpack_instruction_1,
+ spigot_gui_lore_add_backpack_instruction_2,
+ spigot_gui_lore_add_backpack_instruction_3,
+ spigot_gui_lore_prestige_warning_1,
+ spigot_gui_lore_prestige_warning_2,
+ spigot_gui_lore_prestige_warning_3,
+ spigot_gui_lore_ranks_setup_1,
+ spigot_gui_lore_ranks_setup_2,
+ spigot_gui_lore_ranks_setup_3,
+ spigot_gui_lore_ranks_setup_4,
+ spigot_gui_lore_ranks_setup_5,
+ spigot_gui_lore_ranks_setup_6,
+ spigot_gui_lore_ranks_setup_7,
+ spigot_gui_lore_ranks_setup_8,
+ spigot_gui_lore_sellall_delay_use_1,
+ spigot_gui_lore_sellall_delay_use_2,
+ spigot_gui_lore_set_mine_delay_instruction_1,
+ spigot_gui_lore_set_mine_delay_instruction_2,
+ spigot_gui_lore_set_mine_delay_instruction_3,
+ spigot_gui_lore_show_item_description_1,
+ spigot_gui_lore_show_item_description_2,
+ spigot_gui_lore_show_item_description_3,
+ spigot_gui_lore_skip_reset_instruction_1,
+ spigot_gui_lore_skip_reset_instruction_2,
+ spigot_gui_lore_skip_reset_instruction_3,
+
+ spigot_gui_lore_autofeatures_button_description,
+ spigot_gui_lore_backpacks_button_description,
+ spigot_gui_lore_disable_notifications,
+ spigot_gui_lore_enable_radius_mode,
+ spigot_gui_lore_enable_within_mode,
+ spigot_gui_lore_mines_button_description,
+ spigot_gui_lore_no_multipliers,
+ spigot_gui_lore_ranks_button_description,
+ spigot_gui_lore_rankup_if_enough_money,
+ spigot_gui_lore_sellall_button_description,
+ spigot_gui_lore_sellall_edit_info,
+ spigot_gui_lore_tp_to_mine,
+
+
+ spigot_message_missing_permission,
+ spigot_message_chat_event_time_end,
+ spigot_message_event_cancelled,
+ spigot_message_command_wrong_format,
+ spigot_message_console_error,
+
+ spigot_message_ladder_default_empty,
+
+ spigot_message_mines_disabled,
+ spigot_message_mines_name_chat_1,
+ spigot_message_mines_name_chat_2,
+ spigot_message_mines_name_chat_cancelled,
+ spigot_message_mines_item_show_edit_success,
+ spigot_message_mines_or_gui_disabled,
+
+ spigot_message_backpack_cant_own,
+ spigot_message_backpack_delete_error,
+ spigot_message_backpack_delete_success,
+ spigot_message_backpack_format_error,
+ spigot_message_backpack_limit_decrement_fail,
+ spigot_message_backpack_limit_edit_success,
+ spigot_message_backpack_limit_not_number,
+ spigot_message_backpack_limit_reached,
+ spigot_message_backpack_missing_playername,
+ spigot_message_backpack_resize_success,
+ spigot_message_backpack_size_must_be_multiple_of_9,
+
+ spigot_message_prestiges_disabled,
+ spigot_message_prestiges_empty,
+ spigot_message_prestiges_or_gui_disabled,
+ spigot_message_prestiges_confirm,
+ spigot_message_prestiges_cancel,
+ spigot_message_prestiges_cancelled,
+ spigot_message_prestiges_cancelled_wrong_keyword,
+
+ spigot_message_ranks_disabled,
+ spigot_message_ranks_or_gui_disabled,
+ spigot_message_ranks_tag_chat_rename_1,
+ spigot_message_ranks_tag_chat_rename_2,
+ spigot_message_ranks_tag_chat_cancelled,
+
+ spigot_message_sellall_auto_already_enabled,
+ spigot_message_sellall_auto_already_disabled,
+ spigot_message_sellall_auto_disabled,
+ spigot_message_sellall_auto_disabled_cant_use,
+ spigot_message_sellall_auto_enabled,
+ spigot_message_sellall_auto_perusertoggleable_enabled,
+ spigot_message_sellall_auto_perusertoggleable_disabled,
+ spigot_message_sellall_auto_perusertoggleable_already_enabled,
+ spigot_message_sellall_auto_perusertoggleable_already_disabled,
+ spigot_message_sellall_boolean_input_invalid,
+ spigot_message_sellall_cant_find_item_config,
+ spigot_message_sellall_currency_chat_1,
+ spigot_message_sellall_currency_chat_2,
+ spigot_message_sellall_currency_chat_3,
+ spigot_message_sellall_currency_chat_4,
+ spigot_message_sellall_currency_edit_success,
+ spigot_message_sellall_currency_not_found,
+ spigot_message_sellall_hand_disabled,
+ spigot_message_sellall_hand_enabled,
+ spigot_message_sellall_hand_is_disabled,
+ spigot_message_sellall_item_add_success,
+ spigot_message_sellall_item_already_added,
+ spigot_message_sellall_item_delete_success,
+ spigot_message_sellall_item_edit_success,
+ spigot_message_sellall_item_id_not_found,
+ spigot_message_sellall_item_missing_name,
+ spigot_message_sellall_item_missing_price,
+ spigot_message_sellall_item_not_found,
+ spigot_message_sellall_default_values_success,
+ spigot_message_sellall_delay_already_enabled,
+ spigot_message_sellall_delay_already_disabled,
+ spigot_message_sellall_delay_disabled,
+ spigot_message_sellall_delay_disabled_cant_use,
+ spigot_message_sellall_delay_edit_success,
+ spigot_message_sellall_delay_enabled,
+ spigot_message_sellall_delay_not_number,
+ spigot_message_sellall_delay_wait,
+ spigot_message_sellall_gui_disabled,
+ spigot_message_sellall_money_earned,
+ spigot_message_sellall_multiplier_add_success,
+ spigot_message_sellall_multiplier_are_disabled,
+ spigot_message_sellall_multiplier_cant_find,
+ spigot_message_sellall_multiplier_delete_success,
+ spigot_message_sellall_multiplier_disabled,
+ spigot_message_sellall_multiplier_edit_success,
+ spigot_message_sellall_multiplier_enabled,
+ spigot_message_sellall_sell_empty,
+ spigot_message_sellall_sell_nothing_sellable,
+ spigot_message_sellall_sell_sign_only,
+ spigot_message_sellall_sell_sign_notify,
+ spigot_message_sellall_trigger_already_disabled,
+ spigot_message_sellall_trigger_already_enabled,
+ spigot_message_sellall_trigger_disabled,
+ spigot_message_sellall_trigger_enabled,
+ spigot_message_sellall_trigger_is_disabled,
+ spigot_message_sellall_trigger_item_add_success,
+ spigot_message_sellall_trigger_item_cant_find,
+ spigot_message_sellall_trigger_item_delete_success,
+ spigot_message_sellall_trigger_item_missing,
- public FileConfiguration getFileGuiMessagesConfig(){
- return conf;
+ spigot_message_gui_backpack_disabled,
+ spigot_message_gui_backpack_empty,
+ spigot_message_gui_backpack_too_many,
+ spigot_message_gui_close_success,
+ spigot_message_gui_error,
+ spigot_message_gui_error_empty,
+ spigot_message_gui_ladder_empty,
+ spigot_message_gui_ladder_too_many,
+ spigot_message_gui_mines_empty,
+ spigot_message_gui_mines_too_many,
+ spigot_message_gui_prestiges_empty,
+ spigot_message_gui_prestiges_too_many,
+ spigot_message_gui_ranks_empty,
+ spigot_message_gui_ranks_rankup_commands_empty,
+ spigot_message_gui_ranks_rankup_commands_too_many,
+ spigot_message_gui_ranks_too_many,
+ spigot_message_gui_reload_success,
+ spigot_message_gui_sellall_disabled,
+ spigot_message_gui_sellall_empty,
+ spigot_message_gui_too_high,
+ spigot_message_gui_too_low_value,
}
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/NewMessagesConfig.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/NewMessagesConfig.java
deleted file mode 100644
index e613c1fed..000000000
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/NewMessagesConfig.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package tech.mcprison.prison.spigot.configs;
-
-import tech.mcprison.prison.spigot.SpigotPrison;
-
-import java.io.*;
-import java.util.Properties;
-
-public class NewMessagesConfig {
-
- private static NewMessagesConfig instance;
- private Properties properties = new Properties();
- private final String defaultLanguage = SpigotPrison.getInstance().getConfig().getString("default-language");
- private final String path = "/module_conf/spigot/lang/";
-
- /**
- * Get MessagesConfig class and initialize it if necessary.
- * */
- public static NewMessagesConfig get(){
- if (instance == null){
- instance = new NewMessagesConfig();
- instance.initConfig();
- }
- return instance;
- }
-
- /**
- * Initialize the config, reading and caching data.
- * */
- private void initConfig(){
- try(FileInputStream data = new FileInputStream(SpigotPrison.getInstance().getDataFolder() + path + defaultLanguage + ".properties")){
-
- Properties temp = new Properties();
- temp.load(new InputStreamReader(data));
- properties = temp;
-
- } catch (IOException ex){
- ex.printStackTrace();
- }
- }
-
- /**
- * Get String.
- * */
- public String getString(StringID message){
- return properties.getProperty(message.toString());
- }
-
- public void reload(){
- initConfig();
- }
-
- public enum StringID {
-
- spigot_gui_lore_click_to_add,
- spigot_gui_lore_click_to_add_backpack,
- spigot_gui_lore_click_to_cancel,
- spigot_gui_lore_click_to_close,
- spigot_gui_lore_click_to_confirm,
- spigot_gui_lore_click_to_decrease,
- spigot_gui_lore_click_to_delete,
- spigot_gui_lore_click_to_disable,
- spigot_gui_lore_click_to_edit,
- spigot_gui_lore_click_to_enable,
- spigot_gui_lore_click_to_increase,
- spigot_gui_lore_click_to_manage_rank,
- spigot_gui_lore_click_to_open,
- spigot_gui_lore_click_to_rankup,
- spigot_gui_lore_click_to_rename,
- spigot_gui_lore_click_to_select,
- spigot_gui_lore_click_to_start_block_setup,
- spigot_gui_lore_click_to_teleport,
- spigot_gui_lore_click_to_use,
-
- spigot_gui_lore_click_left_to_confirm,
- spigot_gui_lore_click_left_to_edit,
- spigot_gui_lore_click_left_to_open,
- spigot_gui_lore_click_left_to_reset,
-
- spigot_gui_lore_click_right_to_cancel,
- spigot_gui_lore_click_right_to_delete,
- spigot_gui_lore_click_right_to_disable,
- spigot_gui_lore_click_right_to_enable,
- spigot_gui_lore_click_right_to_toggle,
-
- spigot_gui_lore_click_right_and_shift_to_delete,
- spigot_gui_lore_click_right_and_shift_to_disable,
- spigot_gui_lore_click_right_and_shift_to_toggle,
-
- spigot_gui_lore_backpack_id,
- spigot_gui_lore_blocks,
- spigot_gui_lore_blocktype,
- spigot_gui_lore_chance,
- spigot_gui_lore_command,
- spigot_gui_lore_currency,
- spigot_gui_lore_delay,
- spigot_gui_lore_id,
- spigot_gui_lore_info,
- spigot_gui_lore_minename,
- spigot_gui_lore_multiplier,
- spigot_gui_lore_name,
- spigot_gui_lore_owner,
- spigot_gui_lore_percentage,
- spigot_gui_lore_permission,
- spigot_gui_lore_players_at_rank,
- spigot_gui_lore_prestige_name,
- spigot_gui_lore_price,
- spigot_gui_lore_radius,
- spigot_gui_lore_rank_tag,
- spigot_gui_lore_reset_time,
- spigot_gui_lore_show_item,
- spigot_gui_lore_size,
- spigot_gui_lore_spawnpoint,
- spigot_gui_lore_volume,
- spigot_gui_lore_value,
- spigot_gui_lore_world,
-
- spigot_gui_lore_disabled,
- spigot_gui_lore_enabled,
- spigot_gui_lore_locked,
- spigot_gui_lore_next_page,
- spigot_gui_lore_prior_page,
- spigot_gui_lore_rankup,
- spigot_gui_lore_selected,
- spigot_gui_lore_unlocked,
-
- spigot_gui_lore_add_backpack_instruction_1,
- spigot_gui_lore_add_backpack_instruction_2,
- spigot_gui_lore_add_backpack_instruction_3,
- spigot_gui_lore_prestige_warning_1,
- spigot_gui_lore_prestige_warning_2,
- spigot_gui_lore_prestige_warning_3,
- spigot_gui_lore_ranks_setup_1,
- spigot_gui_lore_ranks_setup_2,
- spigot_gui_lore_ranks_setup_3,
- spigot_gui_lore_ranks_setup_4,
- spigot_gui_lore_ranks_setup_5,
- spigot_gui_lore_ranks_setup_6,
- spigot_gui_lore_ranks_setup_7,
- spigot_gui_lore_ranks_setup_8,
- spigot_gui_lore_sellall_delay_use_1,
- spigot_gui_lore_sellall_delay_use_2,
- spigot_gui_lore_set_mine_delay_instruction_1,
- spigot_gui_lore_set_mine_delay_instruction_2,
- spigot_gui_lore_set_mine_delay_instruction_3,
- spigot_gui_lore_show_item_description_1,
- spigot_gui_lore_show_item_description_2,
- spigot_gui_lore_show_item_description_3,
- spigot_gui_lore_skip_reset_instruction_1,
- spigot_gui_lore_skip_reset_instruction_2,
- spigot_gui_lore_skip_reset_instruction_3,
-
- spigot_gui_lore_autofeatures_button_description,
- spigot_gui_lore_backpacks_button_description,
- spigot_gui_lore_disable_notifications,
- spigot_gui_lore_enable_radius_mode,
- spigot_gui_lore_enable_within_mode,
- spigot_gui_lore_mines_button_description,
- spigot_gui_lore_no_multipliers,
- spigot_gui_lore_ranks_button_description,
- spigot_gui_lore_rankup_if_enough_money,
- spigot_gui_lore_sellall_button_description,
- spigot_gui_lore_sellall_edit_info,
- spigot_gui_lore_tp_to_mine,
-
- spigot_general_missing_permission
- }
-}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/ListenersPrisonManager.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/ListenersPrisonManager.java
index 7b74cc0b7..a5d8cf9ed 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/ListenersPrisonManager.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/ListenersPrisonManager.java
@@ -42,10 +42,9 @@
import tech.mcprison.prison.spigot.SpigotPrison;
import tech.mcprison.prison.spigot.SpigotUtil;
import tech.mcprison.prison.spigot.backpacks.BackpacksUtil;
-import tech.mcprison.prison.spigot.commands.PrisonSpigotSellAllCommands;
import tech.mcprison.prison.spigot.compat.Compatibility;
import tech.mcprison.prison.spigot.compat.SpigotCompatibility;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.autofeatures.SpigotAutoBlockGUI;
import tech.mcprison.prison.spigot.gui.autofeatures.SpigotAutoFeaturesGUI;
@@ -94,10 +93,8 @@ public class ListenersPrisonManager implements Listener {
private String tempChatVariable;
private final Configuration config = SpigotPrison.getInstance().getConfig();
private final Configuration guiConfig = SpigotPrison.getInstance().getGuiConfig();
-
- private final Configuration messages = SpigotPrison.getInstance().getMessagesConfig();
- private final NewMessagesConfig newMessages = SpigotPrison.getInstance().getNewMessagesConfig();
- boolean guiNotEnabled = !(config.getString("prison-gui-enabled").equalsIgnoreCase("true"));
+ private final MessagesConfig messages = SpigotPrison.getInstance().getMessagesConfig();
+ boolean guiNotEnabled = !getBoolean(config.getString("prison-gui-enabled"));
private Optional ladder;
public ChatMode mode;
@@ -186,93 +183,92 @@ public void onPlayerInteractEvent(PlayerInteractEvent e){
SellAllUtil sellAllUtil = SpigotPrison.getInstance().getSellAllUtil();
- // Check if SellAll Shift + Right Click is enabled.
- if (sellAllUtil.isSellAllItemTriggerEnabled) {
- // Check if the action if Shift + Right Click.
- Player p = e.getPlayer();
- if (e.getAction().equals(Action.RIGHT_CLICK_AIR) && p.isSneaking()) {
+ if (sellAllUtil != null) {
+ // Check if SellAll Shift + Right Click is enabled.
+ if (sellAllUtil.isSellAllItemTriggerEnabled) {
+ // Check if the action if Shift + Right Click.
+ Player p = e.getPlayer();
+ if (e.getAction().equals(Action.RIGHT_CLICK_AIR) && p.isSneaking()) {
- // Check if a permission's required.
- if (sellAllUtil.isSellAllItemTriggerPermissionEnabled) {
- String permission = sellAllUtil.permissionItemTrigger;
- if (permission != null && !p.hasPermission(permission)) {
- return;
+ // Check if a permission's required.
+ if (sellAllUtil.isSellAllItemTriggerPermissionEnabled) {
+ String permission = sellAllUtil.permissionItemTrigger;
+ if (permission != null && !p.hasPermission(permission)) {
+ return;
+ }
}
- }
- // Get the Items config section
- ArrayList items = sellAllUtil.getItemTriggerXMaterials();
+ // Get the Items config section
+ ArrayList items = sellAllUtil.getItemTriggerXMaterials();
- if (items != null && items.size() != 0) {
- XMaterial inHandXMaterial = null;
- if (e.getItem() != null){
- inHandXMaterial = SpigotUtil.getXMaterial(e.getItem().getType());
- }
- if (inHandXMaterial != null) {
- for (XMaterial xMaterialConf : items) {
- if (xMaterialConf == inHandXMaterial) {
- String registeredCmd = Prison.get().getCommandHandler().findRegisteredCommand("sellall sell");
- Bukkit.dispatchCommand(p, registeredCmd);
- return;
- } else if (xMaterialConf == SpigotUtil.getXMaterial(p.getInventory().getItemInMainHand().getType())) {
- String registeredCmd = Prison.get().getCommandHandler().findRegisteredCommand("sellall sell");
- Bukkit.dispatchCommand(p, registeredCmd);
- return;
+ if (items != null && items.size() != 0) {
+ XMaterial inHandXMaterial = null;
+ if (e.getItem() != null) {
+ inHandXMaterial = SpigotUtil.getXMaterial(e.getItem().getType());
+ }
+ if (inHandXMaterial != null) {
+ for (XMaterial xMaterialConf : items) {
+ if (xMaterialConf == inHandXMaterial) {
+ sellAllUtil.sellAllSell(p, false, false, true, false, false, true);
+ return;
+ } else if (xMaterialConf == SpigotUtil.getXMaterial(p.getInventory().getItemInMainHand().getType())) {
+ sellAllUtil.sellAllSell(p, false, false, true, false, false, true);
+ return;
+ }
}
}
}
}
}
- }
- // Check if the feature's enabled.
- if (sellAllUtil.isSellAllSignEnabled) {
+ // Check if the feature's enabled.
+ if (sellAllUtil.isSellAllSignEnabled) {
- // Get clicked block.
- Material clickedBlock = null;
- if (e.getClickedBlock() != null){
- clickedBlock = e.getClickedBlock().getType();
- }
+ // Get clicked block.
+ Material clickedBlock = null;
+ if (e.getClickedBlock() != null) {
+ clickedBlock = e.getClickedBlock().getType();
+ }
- // Check if the clicked block's a sign
- if (clickedBlock == Material.SIGN || clickedBlock == Material.WALL_SIGN) {
+ // Check if the clicked block's a sign
+ if (clickedBlock == Material.SIGN || clickedBlock == Material.WALL_SIGN) {
- // Get the player
- Player p = e.getPlayer();
- String signTag = sellAllUtil.sellAllSignTag;
- if (signTag == null) {
- signTag = "&7[&3SellAll&7]";
- }
+ // Get the player
+ Player p = e.getPlayer();
+ String signTag = sellAllUtil.sellAllSignTag;
+ if (signTag == null) {
+ signTag = "&7[&3SellAll&7]";
+ }
- // Get the action
- Action action = e.getAction();
+ // Get the action
+ Action action = e.getAction();
- // Check if the action's a click
- if (action == Action.RIGHT_CLICK_BLOCK || action == Action.LEFT_CLICK_BLOCK) {
+ // Check if the action's a click
+ if (action == Action.RIGHT_CLICK_BLOCK || action == Action.LEFT_CLICK_BLOCK) {
- // Get sign
- Sign sign = (Sign) e.getClickedBlock().getState();
+ // Get sign
+ Sign sign = (Sign) e.getClickedBlock().getState();
- // If there aren't lines in the sign this will void an error
- try {
+ // If there aren't lines in the sign this will void an error
+ try {
- // Check if the first like of the sign have the right tag
- if (sign.getLine(0).equalsIgnoreCase(SpigotPrison.format(signTag))) {
- String permissionUseSign = sellAllUtil.permissionUseSign;
- if (sellAllUtil.isSellAllSignPermissionToUseEnabled && !p.hasPermission(permissionUseSign)) {
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.SellAllSignMissingPermission") + " [&3" + permissionUseSign + "&7]");
- return;
- }
+ // Check if the first like of the sign have the right tag
+ if (sign.getLine(0).equalsIgnoreCase(SpigotPrison.format(signTag))) {
+ String permissionUseSign = sellAllUtil.permissionUseSign;
+ if (sellAllUtil.isSellAllSignPermissionToUseEnabled && !p.hasPermission(permissionUseSign)) {
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_missing_permission) + " [&3" + permissionUseSign + "&7]");
+ return;
+ }
- if (sellAllUtil.isSellAllSignNotifyEnabled) {
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.SellAllSignNotify"));
- }
+ if (sellAllUtil.isSellAllSignNotifyEnabled) {
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_sell_sign_notify));
+ }
- if (PrisonSpigotSellAllCommands.get() != null){
- PrisonSpigotSellAllCommands.get().sellAllSell(p);
+ sellAllUtil.sellAllSell(p, true, false, true, false, false, true);
}
+ } catch (IndexOutOfBoundsException ignored) {
}
- } catch (IndexOutOfBoundsException ignored) {}
+ }
}
}
}
@@ -352,7 +348,7 @@ public void chatInteractData(Player p, ChatMode activeMode) {
id = Bukkit.getScheduler().scheduleSyncDelayedTask(SpigotPrison.getInstance(), () -> {
if (isChatEventActive) {
removeChatEventPlayer(p);
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.OutOfTimeNoChanges"));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_chat_event_time_end));
isChatEventActive = false;
}
mode = null;
@@ -412,7 +408,7 @@ public void onClick(InventoryClickEvent e){
// Close GUI button globally.
if (buttonNameMain.equalsIgnoreCase("Close")) {
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.GuiClosedWithSuccess"));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_close_success));
p.closeInventory();
return;
}
@@ -816,12 +812,11 @@ private void showBlock(InventoryClickEvent e, Player p, String[] parts) {
conf.set("Options.Mines.MaterialType." + parts[1], parts[0]);
conf.save(sellAllFile);
} catch (IOException ex){
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.SellAllConfigSaveFail"));
ex.printStackTrace();
return;
}
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.MineShowItemEditSuccess") + " [" + parts[0] + "]");
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_mines_item_show_edit_success) + " [" + parts[0] + "]");
p.closeInventory();
}
@@ -894,7 +889,7 @@ private void setSellAllPrestigeMultiplier(InventoryClickEvent e, Player p, Strin
} else {
// Tell to the player that the value's too low
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.TooLowValue"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_too_low_value));
e.setCancelled(true);
@@ -920,7 +915,7 @@ private void setSellAllPrestigeMultiplier(InventoryClickEvent e, Player p, Strin
} else {
// Close the GUI and tell it to the player
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.TooHighValue"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_too_high));
e.setCancelled(true);
p.closeInventory();
return;
@@ -1006,7 +1001,7 @@ private void sellAllDelayGUI(InventoryClickEvent e, Player p, String[] parts) {
} else if (e.isRightClick()){
// Send a message to the player
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.EventCancelled"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_event_cancelled));
e.setCancelled(true);
@@ -1038,7 +1033,7 @@ private void sellAllDelayGUI(InventoryClickEvent e, Player p, String[] parts) {
} else {
// Tell to the player that the value's too low
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.TooLowValue"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_too_low_value));
e.setCancelled(true);
@@ -1064,7 +1059,7 @@ private void sellAllDelayGUI(InventoryClickEvent e, Player p, String[] parts) {
} else {
// Close the GUI and tell it to the player
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.TooHighValue"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_too_high));
e.setCancelled(true);
p.closeInventory();
return;
@@ -1158,7 +1153,7 @@ private void sellAllAdminGUI(InventoryClickEvent e, Player p, String buttonNameM
SellAllAdminGUI gui = new SellAllAdminGUI(p);
gui.open();
} else {
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.EnableAutoSellToUse"));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_auto_disabled_cant_use));
}
break;
}
@@ -1200,7 +1195,7 @@ private void sellAllAdminGUI(InventoryClickEvent e, Player p, String buttonNameM
SellAllAdminGUI gui = new SellAllAdminGUI(p);
gui.open();
} else {
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.EnableSellDelayToUse"));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_delay_disabled_cant_use));
}
break;
}
@@ -1208,10 +1203,10 @@ private void sellAllAdminGUI(InventoryClickEvent e, Player p, String buttonNameM
case "SellAll-Currency":{
// Send messages to the player
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.SellAllCurrencyChat1"));
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.SellAllCurrencyChat2"));
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.SellAllCurrencyChat3"));
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.SellAllCurrencyChat4"));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_currency_chat_1));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_currency_chat_2));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_currency_chat_3));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_currency_chat_4));
chatInteractData(p, ChatMode.SellAll_Currency);
p.closeInventory();
@@ -1224,13 +1219,13 @@ private void sellAllAdminGUI(InventoryClickEvent e, Player p, String buttonNameM
boolean multiplierEnabled = getBoolean(sellAllConfig.getString("Options.Multiplier_Enabled"));
if (!multiplierEnabled){
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.SellAllMultipliersAreDisabled"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_multiplier_are_disabled));
return;
} else {
if (sellAllConfig.getConfigurationSection("Multiplier").getKeys(false).size() == 0) {
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.EmptyGui"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_error_empty));
e.setCancelled(true);
return;
} else {
@@ -1273,7 +1268,7 @@ private void prisonSetupConfirmGUI(InventoryClickEvent e, Player p, String[] par
if (parts[0].equalsIgnoreCase("Confirm:")){
Bukkit.dispatchCommand(p, "ranks autoConfigure");
} else if (parts[0].equalsIgnoreCase("Cancel:")){
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Setup.Message.Aborted"));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_event_cancelled));
}
p.closeInventory();
e.setCancelled(true);
@@ -1327,25 +1322,6 @@ private void mineBlockPercentage(InventoryClickEvent e, Player p, String[] parts
return;
}
- // If Close, part 4 won't be defined so handle the close first.
-
- // What?
- /*if (part1.equalsIgnoreCase( "Close" )) {
-
- int pos = 0;
- try {
- pos = Integer.parseInt( part3 );
- }
- catch(NumberFormatException ignored) {}
-
- SpigotBlocksListGUI gui = new SpigotBlocksListGUI(p, part2, pos);
-
- p.closeInventory();
-
- gui.open();
- return;
- }*/
-
String part4 = null;
try{
part4 = parts[3];
@@ -1833,8 +1809,8 @@ private void rankManagerGUI(InventoryClickEvent e, Player p, String[] parts) {
} else if (buttonName.equalsIgnoreCase("RankTag")){
// Send messages to the player.
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.rankTagRename"));
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.rankTagRenameClose"));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_ranks_tag_chat_rename_1));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_ranks_tag_chat_rename_2));
// Start the async task.
tempChatVariable = rankName;
chatInteractData(p, ChatMode.RankName);
@@ -1848,7 +1824,7 @@ private void rankManagerGUI(InventoryClickEvent e, Player p, String[] parts) {
private void playerRanksGUI(InventoryClickEvent e, Player p, String buttonNameMain) {
// Check the buttonName and do the actions.
- if (buttonNameMain.equals(SpigotPrison.format(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_rankup).substring(2)))){
+ if (buttonNameMain.equals(SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_gui_lore_rankup).substring(2)))){
Bukkit.dispatchCommand(p, "rankup " + guiConfig.getString("Options.Ranks.Ladder"));
p.closeInventory();
}
@@ -2121,8 +2097,8 @@ private void mineInfoGUI(InventoryClickEvent e, Player p, String[] parts) {
case "Mine_Name:": {
// Send messages to the player
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.mineNameRename"));
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.mineNameRenameClose"));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_mines_name_chat_1));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_mines_name_chat_2));
// Start the async task
tempChatVariable = mineName;
@@ -2809,7 +2785,7 @@ private void sellAllCurrencyChat(AsyncPlayerChatEvent e, Player p, String messag
// Check message and do the action
String registeredCmd = Prison.get().getCommandHandler().findRegisteredCommand( "sellall set currency" );
if (message.equalsIgnoreCase("cancel")){
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.SellAllCurrencyEditCancelled"));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_event_cancelled));
} else if (message.equalsIgnoreCase("default")){
Bukkit.getScheduler().runTask(SpigotPrison.getInstance(), () -> Bukkit.getServer().dispatchCommand(p, registeredCmd + " default"));
} else {
@@ -2826,11 +2802,11 @@ private void prestigeAction(AsyncPlayerChatEvent e, Player p, String message) {
// Check the chat message and do the actions
if (message.equalsIgnoreCase("cancel")) {
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.PrestigeCancelled"));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_prestiges_cancelled));
} else if (message.equalsIgnoreCase("confirm")) {
Bukkit.getScheduler().runTask(SpigotPrison.getInstance(), () -> Bukkit.getServer().dispatchCommand(p, "rankup prestiges"));
} else {
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.PrestigeCancelledWrongKeyword"));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_prestiges_cancelled_wrong_keyword));
}
// Cancel the event
e.setCancelled(true);
@@ -2842,7 +2818,7 @@ private void mineAction(AsyncPlayerChatEvent e, Player p, String message) {
// Check the chat message and do the action
if (message.equalsIgnoreCase("close")) {
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.mineNameRenameClosed"));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_mines_name_chat_cancelled));
} else {
Bukkit.getScheduler().runTask(SpigotPrison.getInstance(), () -> Bukkit.getServer().dispatchCommand(p, "mines rename " + tempChatVariable + " " + message));
}
@@ -2854,7 +2830,7 @@ private void mineAction(AsyncPlayerChatEvent e, Player p, String message) {
private void rankAction(AsyncPlayerChatEvent e, Player p, String message) {
// Check the chat message and do the action
if (message.equalsIgnoreCase("close")) {
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.rankTagRenameClosed"));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_ranks_tag_chat_cancelled));
} else {
Bukkit.getScheduler().runTask(SpigotPrison.getInstance(), () -> Bukkit.getServer().dispatchCommand(p, "ranks set tag " + tempChatVariable + " " + message));
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/PrisonSetupGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/PrisonSetupGUI.java
index 483a423f2..ed4227bd8 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/PrisonSetupGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/PrisonSetupGUI.java
@@ -2,7 +2,7 @@
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.entity.Player;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -25,22 +25,22 @@ public void open(){
PrisonGUI gui = new PrisonGUI(p, 9, "&3Prison Setup -> Confirmation");
// Create lore.
- ButtonLore lore = new ButtonLore(createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_confirm)), createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_ranks_setup_1),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_ranks_setup_2),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_ranks_setup_3),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_ranks_setup_4),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_ranks_setup_5),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_ranks_setup_6),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_ranks_setup_7),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_ranks_setup_8)));
+ ButtonLore lore = new ButtonLore(createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_confirm)), createLore(
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_ranks_setup_1),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_ranks_setup_2),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_ranks_setup_3),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_ranks_setup_4),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_ranks_setup_5),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_ranks_setup_6),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_ranks_setup_7),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_ranks_setup_8)));
// Add button.
gui.addButton(new Button(2, XMaterial.EMERALD_BLOCK, lore, "&3Confirm: Setup"));
// Add button.
gui.addButton(new Button(6, XMaterial.REDSTONE_BLOCK, createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_cancel)), "&3Cancel: Setup"));
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_cancel)), "&3Cancel: Setup"));
// Open Prison GUI.
gui.open();
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotPrisonGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotPrisonGUI.java
index ff44db784..c9a7b3e35 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotPrisonGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotPrisonGUI.java
@@ -3,7 +3,7 @@
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.entity.Player;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -27,12 +27,12 @@ public void open() {
PrisonGUI gui = new PrisonGUI(p, dimension, "&3PrisonManager");
// Create and add buttons.
- gui.addButton(new Button(10, XMaterial.TRIPWIRE_HOOK, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_ranks_button_description)), "&3Ranks - Ladders"));
- gui.addButton(new Button(13, XMaterial.IRON_PICKAXE, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_autofeatures_button_description)), SpigotPrison.format("&3AutoManager")));
- gui.addButton(new Button(16, XMaterial.DIAMOND_ORE, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_mines_button_description)), SpigotPrison.format("&3Mines")));
- gui.addButton(new Button(29, XMaterial.CHEST, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_sellall_button_description)), SpigotPrison.format("&3SellAll")));
- gui.addButton(new Button(33, XMaterial.CHEST_MINECART, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_backpacks_button_description)), SpigotPrison.format("&3Backpacks")));
- gui.addButton(new Button(44, XMaterial.RED_STAINED_GLASS_PANE, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_close), null), SpigotPrison.format("&cClose")));
+ gui.addButton(new Button(10, XMaterial.TRIPWIRE_HOOK, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open), messages.getString(MessagesConfig.StringID.spigot_gui_lore_ranks_button_description)), "&3Ranks - Ladders"));
+ gui.addButton(new Button(13, XMaterial.IRON_PICKAXE, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open), messages.getString(MessagesConfig.StringID.spigot_gui_lore_autofeatures_button_description)), SpigotPrison.format("&3AutoManager")));
+ gui.addButton(new Button(16, XMaterial.DIAMOND_ORE, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open), messages.getString(MessagesConfig.StringID.spigot_gui_lore_mines_button_description)), SpigotPrison.format("&3Mines")));
+ gui.addButton(new Button(29, XMaterial.CHEST, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open), messages.getString(MessagesConfig.StringID.spigot_gui_lore_sellall_button_description)), SpigotPrison.format("&3SellAll")));
+ gui.addButton(new Button(33, XMaterial.CHEST_MINECART, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open), messages.getString(MessagesConfig.StringID.spigot_gui_lore_backpacks_button_description)), SpigotPrison.format("&3Backpacks")));
+ gui.addButton(new Button(44, XMaterial.RED_STAINED_GLASS_PANE, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_close), null), SpigotPrison.format("&cClose")));
gui.open();
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoBlockGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoBlockGUI.java
index f74105fcb..68ebf3934 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoBlockGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoBlockGUI.java
@@ -6,7 +6,7 @@
import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig;
import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig.AutoFeatures;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -30,9 +30,9 @@ public void open() {
PrisonGUI gui = new PrisonGUI(p, 36, "&3AutoFeatures -> AutoBlock");
// Lores
- ButtonLore enabledLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_disable), null);
- ButtonLore disabledLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_enable), null);
- gui.addButton(new Button(35, XMaterial.RED_STAINED_GLASS_PANE, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_close), null), "&cClose"));
+ ButtonLore enabledLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_disable), null);
+ ButtonLore disabledLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_enable), null);
+ gui.addButton(new Button(35, XMaterial.RED_STAINED_GLASS_PANE, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_close), null), "&cClose"));
if (afConfig != null) {
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoFeaturesGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoFeaturesGUI.java
index 17d1bd20c..b7998b3e3 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoFeaturesGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoFeaturesGUI.java
@@ -7,7 +7,7 @@
import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig;
import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig.AutoFeatures;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -31,12 +31,12 @@ public void open() {
PrisonGUI gui;
- ButtonLore closeGUILore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_close), null);
+ ButtonLore closeGUILore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_close), null);
if (afConfig != null && afConfig.isFeatureBoolean(AutoFeatures.isAutoManagerEnabled)) {
- ButtonLore disable = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_disable), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_enabled));
- ButtonLore enable = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_enable), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_disabled));
+ ButtonLore disable = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_disable), messages.getString(MessagesConfig.StringID.spigot_gui_lore_enabled));
+ ButtonLore enable = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_enable), messages.getString(MessagesConfig.StringID.spigot_gui_lore_disabled));
gui = new PrisonGUI(p, dimension, "&3PrisonManager -> AutoFeatures");
gui.addButton(new Button(dimension -1,XMaterial.RED_STAINED_GLASS_PANE, closeGUILore, SpigotPrison.format("&cClose")));
@@ -60,13 +60,13 @@ public void open() {
}
disable.setLoreAction(createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_left_to_open),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_disable)
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_left_to_open),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_disable)
));
enable.setLoreAction(createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_left_to_open),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_enable)
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_left_to_open),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_enable)
));
if (afConfig.isFeatureBoolean(AutoFeatures.autoPickupEnabled)) {
@@ -93,7 +93,7 @@ public void open() {
gui = new PrisonGUI(p, 9, "&3PrisonManager -> AutoFeatures");
- ButtonLore lore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_enable), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_disabled));
+ ButtonLore lore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_enable), messages.getString(MessagesConfig.StringID.spigot_gui_lore_disabled));
Button enabledOrDisabled = new Button(2, XMaterial.LIME_STAINED_GLASS_PANE, lore, SpigotPrison.format("&cAll Disabled"));
gui.addButton(enabledOrDisabled);
gui.addButton(new Button(6,XMaterial.RED_STAINED_GLASS_PANE, closeGUILore, SpigotPrison.format("&cClose")));
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoPickupGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoPickupGUI.java
index b1a668281..8f46a98eb 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoPickupGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoPickupGUI.java
@@ -7,7 +7,7 @@
import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig.AutoFeatures;
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
@@ -31,9 +31,9 @@ public void open() {
int dimension = 36;
PrisonGUI gui = new PrisonGUI(p, dimension, "&3AutoFeatures -> AutoPickup");
- ButtonLore enabledLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_disable), null);
- ButtonLore disabledLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_enable), null);
- ButtonLore closeGUILore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_close), null);
+ ButtonLore enabledLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_disable), null);
+ ButtonLore disabledLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_enable), null);
+ ButtonLore closeGUILore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_close), null);
gui.addButton(new Button(35, XMaterial.RED_STAINED_GLASS_PANE, closeGUILore, SpigotPrison.format("&cClose")));
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoSmeltGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoSmeltGUI.java
index 059a4fa2d..5c9147ace 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoSmeltGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoSmeltGUI.java
@@ -7,7 +7,7 @@
import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig.AutoFeatures;
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
@@ -31,9 +31,9 @@ public void open() {
int dimension = 36;
PrisonGUI gui = new PrisonGUI(p, dimension, "&3AutoFeatures -> AutoSmelt");
- ButtonLore enabledLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_disable), null);
- ButtonLore disabledLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_enable), null);
- ButtonLore closeGUILore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_close), null);
+ ButtonLore enabledLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_disable), null);
+ ButtonLore disabledLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_enable), null);
+ ButtonLore closeGUILore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_close), null);
gui.addButton(new Button(35, XMaterial.RED_STAINED_GLASS_PANE, closeGUILore, SpigotPrison.format("&cClose")));
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksAdminGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksAdminGUI.java
index 9ba2b3417..107aef8dd 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksAdminGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksAdminGUI.java
@@ -4,7 +4,7 @@
import org.bukkit.entity.Player;
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.backpacks.BackpacksUtil;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
@@ -25,7 +25,7 @@ public BackpacksAdminGUI(Player p) {
public void open(){
if (!BackpacksUtil.isEnabled()){
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.BackPackIsDisabled"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_backpack_disabled));
p.closeInventory();
return;
}
@@ -33,11 +33,11 @@ public void open(){
int dimension = 27;
PrisonGUI gui = new PrisonGUI(p, dimension, "&3Backpacks-Admin");
- ButtonLore lore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open), null);
+ ButtonLore lore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open), null);
gui.addButton(new Button(11, XMaterial.CHEST, lore, "&3Backpacks-List"));
gui.addButton(new Button(15, XMaterial.PAPER, lore, "&3Backpack-Settings"));
- gui.addButton(new Button(dimension -1, XMaterial.RED_STAINED_GLASS_PANE, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_close), null), "&cClose"));
+ gui.addButton(new Button(dimension -1, XMaterial.RED_STAINED_GLASS_PANE, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_close), null), "&cClose"));
gui.open();
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksAdminListGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksAdminListGUI.java
index eee18f5d1..52671fa96 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksAdminListGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksAdminListGUI.java
@@ -4,7 +4,7 @@
import org.bukkit.configuration.Configuration;
import org.bukkit.entity.Player;
import tech.mcprison.prison.spigot.backpacks.BackpacksUtil;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -20,10 +20,10 @@ public class BackpacksAdminListGUI extends SpigotGUIComponents {
private final Player p;
private final String playerBackpackName;
private final Configuration backpacksData = BackpacksUtil.get().getBackpacksData();
- private final String loreShiftAndRightClickToDelete = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_delete);
- private final String loreInfo = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_info);
- private final String lorePlayerOwner = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_owner);
- private final String loreBackpackID = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_backpack_id);
+ private final String loreShiftAndRightClickToDelete = messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_delete);
+ private final String loreInfo = messages.getString(MessagesConfig.StringID.spigot_gui_lore_info);
+ private final String lorePlayerOwner = messages.getString(MessagesConfig.StringID.spigot_gui_lore_owner);
+ private final String loreBackpackID = messages.getString(MessagesConfig.StringID.spigot_gui_lore_backpack_id);
public BackpacksAdminListGUI(Player p, String playerBackpackName){
this.p = p;
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksAdminPlayerListGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksAdminPlayerListGUI.java
index 09e7fc459..d536adef9 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksAdminPlayerListGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksAdminPlayerListGUI.java
@@ -5,7 +5,7 @@
import org.bukkit.entity.Player;
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.backpacks.BackpacksUtil;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
@@ -21,7 +21,7 @@ public class BackpacksAdminPlayerListGUI extends SpigotGUIComponents {
private final Player p;
private final Configuration backpacksData = BackpacksUtil.get().getBackpacksData();
- private final String clickToOpen = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open);
+ private final String clickToOpen = messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open);
public BackpacksAdminPlayerListGUI(Player p){
this.p = p;
@@ -33,7 +33,7 @@ public void open(){
PrisonGUI gui = new PrisonGUI(p, dimension, "&3Backpacks-Admin-Players");
if (backpacksData.getConfigurationSection("Inventories") == null){
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.BackPackListEmpty"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_backpack_empty));
return;
}
@@ -41,7 +41,7 @@ public void open(){
try {
playerUUID = backpacksData.getConfigurationSection("Inventories").getKeys(false);
} catch (NullPointerException ex){
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.BackPackListEmpty"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_backpack_empty));
return;
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksListPlayerGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksListPlayerGUI.java
index 11037a97a..01a894136 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksListPlayerGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksListPlayerGUI.java
@@ -5,7 +5,7 @@
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.SpigotPrison;
import tech.mcprison.prison.spigot.backpacks.BackpacksUtil;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
@@ -26,20 +26,20 @@ public BackpacksListPlayerGUI(Player p) {
public void open(){
if (BackpacksUtil.get().getBackpacksLimit(p) == 0){
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.BackPackCantOwn"));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_backpack_cant_own));
return;
}
int dimension = 54;
PrisonGUI gui = new PrisonGUI(p, dimension, "&3" + p.getName() + " -> Backpacks");
- ButtonLore loreAddBackpackButton = new ButtonLore(createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_add_backpack)), createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_add_backpack_instruction_1),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_add_backpack_instruction_2),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_add_backpack_instruction_3)));
+ ButtonLore loreAddBackpackButton = new ButtonLore(createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_add_backpack)), createLore(
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_add_backpack_instruction_1),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_add_backpack_instruction_2),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_add_backpack_instruction_3)));
// Global Strings.
- String loreClickToOpen = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open);
+ String loreClickToOpen = messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open);
if (!BackpacksUtil.get().getBackpacksIDs(p).isEmpty()) {
int slot = 0;
@@ -64,7 +64,7 @@ public void open(){
gui.addButton(new Button(49, XMaterial.EMERALD_BLOCK, loreAddBackpackButton, "&aNew Backpack"));
}
- gui.addButton(new Button(dimension-1, XMaterial.RED_STAINED_GLASS_PANE, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_close), null), "&cClose"));
+ gui.addButton(new Button(dimension-1, XMaterial.RED_STAINED_GLASS_PANE, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_close), null), "&cClose"));
gui.open();
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/guiutility/SpigotGUIComponents.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/guiutility/SpigotGUIComponents.java
index 3d3b30bfb..3e6cb0480 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/guiutility/SpigotGUIComponents.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/guiutility/SpigotGUIComponents.java
@@ -20,7 +20,7 @@
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.ranks.PrisonRanks;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.ListenersPrisonManager;
import tech.mcprison.prison.spigot.sellall.SellAllUtil;
@@ -31,8 +31,7 @@
*/
public abstract class SpigotGUIComponents {
- public static NewMessagesConfig newMessages = getNewMessages();
- public static Configuration messages = getMessages();
+ public static MessagesConfig messages = getMessages();
public static Configuration guiConfig = getGuiConfig();
public static Configuration sellAllConfig = getSellAll();
@@ -130,14 +129,14 @@ protected boolean checkRanks(Player p){
/**
* Get new Messages config.
* */
- protected static NewMessagesConfig getNewMessages(){
- return SpigotPrison.getInstance().getNewMessagesConfig();
+ protected static MessagesConfig getmessages(){
+ return SpigotPrison.getInstance().getMessagesConfig();
}
/**
* Get Messages config.
* */
- protected static Configuration getMessages(){
+ protected static MessagesConfig getMessages(){
return SpigotPrison.getInstance().getMessagesConfig();
}
@@ -171,20 +170,12 @@ public static AutoFeaturesFileConfig afConfig() {
return AutoFeaturesWrapper.getInstance().getAutoFeaturesConfig();
}
- /**
- * Reload new Messages config for GUIs.
- * */
- public static void updateNewMessages(){
- NewMessagesConfig.get().reload();
- newMessages = NewMessagesConfig.get();
- }
-
/**
* Reload messages config for GUIs.
* */
public static void updateMessages(){
- File file = new File(SpigotPrison.getInstance().getDataFolder() + "/module_conf/lang/" + SpigotPrison.getInstance().getConfig().getString("default-language") + ".yml");
- messages = YamlConfiguration.loadConfiguration(file);
+ MessagesConfig.get().reload();
+ messages = MessagesConfig.get();
}
/**
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotBlocksListGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotBlocksListGUI.java
index 448c75b38..e9e49b0cd 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotBlocksListGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotBlocksListGUI.java
@@ -10,7 +10,7 @@
import tech.mcprison.prison.internal.block.PrisonBlock;
import tech.mcprison.prison.internal.block.PrisonBlockTypes;
import tech.mcprison.prison.spigot.SpigotUtil;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -40,7 +40,7 @@ public void open(){
// Create the inventory
PrisonGUI gui = new PrisonGUI(p, dimension, "&3Mines -> BlocksList");
- ButtonLore lore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_start_block_setup), null);
+ ButtonLore lore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_start_block_setup), null);
// This will skip all BlockTypes that are invalid for the versions of MC that the server is running:
PrisonBlockTypes prisonBlockTypes = Prison.get().getPlatform().getPrisonBlockTypes();
@@ -64,10 +64,10 @@ public void open(){
prisonBlock.getBlockName().toUpperCase() + " &0" + mineName + " " + counter));
}
if ( i < blockTypes.size() ) {
- gui.addButton(new Button(53, XMaterial.BOOK, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_next_page), null), "&7Next &0" + mineName + " " + (i + 1)));
+ gui.addButton(new Button(53, XMaterial.BOOK, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_next_page), null), "&7Next &0" + mineName + " " + (i + 1)));
}
if ( i >= (pageSize * 2) ) {
- gui.addButton(new Button(51, XMaterial.BOOK, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_prior_page), null), "&7Prior &0" + mineName + " " + (i - (pageSize * 2) - 1)));
+ gui.addButton(new Button(51, XMaterial.BOOK, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_prior_page), null), "&7Prior &0" + mineName + " " + (i - (pageSize * 2) - 1)));
}
// Open the inventory
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotBlocksMineListGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotBlocksMineListGUI.java
index 7709696c7..32abe6b10 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotBlocksMineListGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotBlocksMineListGUI.java
@@ -6,7 +6,7 @@
import tech.mcprison.prison.internal.block.PrisonBlock;
import tech.mcprison.prison.internal.block.PrisonBlockTypes;
import tech.mcprison.prison.spigot.SpigotUtil;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -38,7 +38,7 @@ public void open(){
// Create the inventory
PrisonGUI gui = new PrisonGUI(p, dimension, "&3Select -> ShowBlock");
- ButtonLore lore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_select), null);
+ ButtonLore lore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_select), null);
// This will skip all BlockTypes that are invalid for the versions of MC that the server is running:
PrisonBlockTypes prisonBlockTypes = Prison.get().getPlatform().getPrisonBlockTypes();
@@ -62,10 +62,10 @@ public void open(){
prisonBlock.getBlockName().toUpperCase() + " " + mineName + " " + counter));
}
if ( i < blockTypes.size() ) {
- gui.addButton(new Button(53, XMaterial.BOOK, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_next_page), null), "&7Next " + mineName + " " + (i + 1)));
+ gui.addButton(new Button(53, XMaterial.BOOK, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_next_page), null), "&7Next " + mineName + " " + (i + 1)));
}
if ( i >= (pageSize * 2) ) {
- gui.addButton(new Button(51, XMaterial.BOOK, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_prior_page), null), "&7Prior " + mineName + " " + (i - (pageSize * 2) - 1)));
+ gui.addButton(new Button(51, XMaterial.BOOK, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_prior_page), null), "&7Prior " + mineName + " " + (i - (pageSize * 2) - 1)));
}
// Open the inventory
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineBlockPercentageGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineBlockPercentageGUI.java
index 16a16350d..4a3395b3c 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineBlockPercentageGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineBlockPercentageGUI.java
@@ -6,14 +6,12 @@
import tech.mcprison.prison.internal.block.PrisonBlock;
import tech.mcprison.prison.spigot.SpigotUtil;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
import tech.mcprison.prison.spigot.gui.guiutility.SpigotGUIComponents;
-import java.util.List;
-
/**
* @author GABRYCA (AnonymousGCA)
*/
@@ -37,9 +35,9 @@ public void open() {
int dimension = 45;
PrisonGUI gui = new PrisonGUI(p, dimension, "&3MineInfo -> BlockPercentage");
- ButtonLore changeDecreaseValueLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_decrease), null);
- ButtonLore confirmButtonLore = new ButtonLore(createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_confirm), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_cancel)), createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_percentage) + " " + val));
- ButtonLore changeIncreaseValueLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_decrease), null);
+ ButtonLore changeDecreaseValueLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_decrease), null);
+ ButtonLore confirmButtonLore = new ButtonLore(createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_confirm), messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_cancel)), createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_percentage) + " " + val));
+ ButtonLore changeIncreaseValueLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_decrease), null);
XMaterial decreaseMaterial = XMaterial.REDSTONE_BLOCK;
@@ -62,7 +60,7 @@ public void open() {
gui.addButton(new Button(43, increaseMat, changeIncreaseValueLore, "&3" + mineName + " " + blockName + " " + val + " + 100 &0" + counter));
// Close gui:
- gui.addButton(new Button(40, XMaterial.RED_STAINED_GLASS_PANE, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_close), null), "&cClose &0" + mineName + " " + counter));
+ gui.addButton(new Button(40, XMaterial.RED_STAINED_GLASS_PANE, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_close), null), "&cClose &0" + mineName + " " + counter));
// Show the selected block at the top center position:
XMaterial xMat = SpigotUtil.getXMaterial( blockName );
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineInfoGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineInfoGUI.java
index c13203450..37a3aaf7c 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineInfoGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineInfoGUI.java
@@ -1,14 +1,12 @@
package tech.mcprison.prison.spigot.gui.mine;
-import java.util.List;
-
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.entity.Player;
import tech.mcprison.prison.mines.data.Mine;
import tech.mcprison.prison.spigot.SpigotPrison;
import tech.mcprison.prison.spigot.SpigotUtil;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -35,25 +33,25 @@ public void open(){
PrisonGUI gui = new PrisonGUI(p, dimension, SpigotPrison.format("&3Mines -> MineInfo"));
ButtonLore resetMineLore = new ButtonLore(createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_left_to_reset),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_toggle),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_toggle)),
- createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_skip_reset_instruction_1),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_skip_reset_instruction_2),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_skip_reset_instruction_3),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_left_to_reset),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_toggle),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_toggle)),
+ createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_skip_reset_instruction_1),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_skip_reset_instruction_2),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_skip_reset_instruction_3),
"",
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_set_mine_delay_instruction_1),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_set_mine_delay_instruction_2),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_set_mine_delay_instruction_3)));
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_set_mine_delay_instruction_1),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_set_mine_delay_instruction_2),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_set_mine_delay_instruction_3)));
- ButtonLore mineSpawnLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_use), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_spawnpoint));
- ButtonLore minesNotificationsLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_edit));
- ButtonLore minesTpLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_teleport), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_tp_to_mine));
- ButtonLore blocksOfTheMineLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_blocks));
- ButtonLore mineResetTimeLore = new ButtonLore(createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open)), createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_reset_time) + " &7" + mine.getResetTime()));
- ButtonLore mineRenameLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_rename), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_minename) + " " + mineName);
- ButtonLore closeGUILore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_close), null);
+ ButtonLore mineSpawnLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_use), messages.getString(MessagesConfig.StringID.spigot_gui_lore_spawnpoint));
+ ButtonLore minesNotificationsLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open), messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_edit));
+ ButtonLore minesTpLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_teleport), messages.getString(MessagesConfig.StringID.spigot_gui_lore_tp_to_mine));
+ ButtonLore blocksOfTheMineLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open), messages.getString(MessagesConfig.StringID.spigot_gui_lore_blocks));
+ ButtonLore mineResetTimeLore = new ButtonLore(createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open)), createLore(
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_reset_time) + " &7" + mine.getResetTime()));
+ ButtonLore mineRenameLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_rename), messages.getString(MessagesConfig.StringID.spigot_gui_lore_minename) + " " + mineName);
+ ButtonLore closeGUILore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_close), null);
// Create the button, set the material, amount, lore and name
gui.addButton(new Button(dimension-1, XMaterial.RED_STAINED_GLASS_PANE, closeGUILore, SpigotPrison.format("&cClose")));
@@ -76,11 +74,11 @@ public void open(){
}
// Lore
- ButtonLore mineShowItemLore = new ButtonLore(createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_edit)), createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_show_item) + " &7" + xMaterial.name(),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_show_item_description_1),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_show_item_description_2),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_show_item_description_3)
+ ButtonLore mineShowItemLore = new ButtonLore(createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_edit)), createLore(
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_show_item) + " &7" + xMaterial.name(),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_show_item_description_1),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_show_item_description_2),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_show_item_description_3)
));
// ItemStack
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineNotificationRadiusGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineNotificationRadiusGUI.java
index 88dc77b01..8cc8453dc 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineNotificationRadiusGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineNotificationRadiusGUI.java
@@ -2,7 +2,7 @@
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.entity.Player;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -31,11 +31,11 @@ public void open() {
int dimension = 45;
PrisonGUI gui = new PrisonGUI(p, dimension, "&3MineNotifications -> Radius");
- ButtonLore changeDecreaseValueLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_decrease), null);
- ButtonLore confirmButtonLore = new ButtonLore(createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_left_to_confirm)), createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_radius) + " " + val,
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_cancel)));
- ButtonLore changeIncreaseValueLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_increase), null);
+ ButtonLore changeDecreaseValueLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_decrease), null);
+ ButtonLore confirmButtonLore = new ButtonLore(createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_left_to_confirm)), createLore(
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_radius) + " " + val,
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_cancel)));
+ ButtonLore changeIncreaseValueLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_increase), null);
// XMaterials.
XMaterial decreaseMat = XMaterial.REDSTONE_BLOCK;
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineNotificationsGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineNotificationsGUI.java
index f5afba8d9..5c626ed13 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineNotificationsGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineNotificationsGUI.java
@@ -6,7 +6,7 @@
import tech.mcprison.prison.mines.PrisonMines;
import tech.mcprison.prison.mines.data.Mine;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -36,10 +36,10 @@ public void open() {
Mine m = pMines.getMine(mineName);
String enabledOrDisabled = m.getNotificationMode().name();
- ButtonLore modeWithinLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_select), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_enable_within_mode));
- ButtonLore modeRadiusLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_select), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_enable_radius_mode));
- ButtonLore disabledModeLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_select), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_disable_notifications));
- ButtonLore closeGUILore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_close), null);
+ ButtonLore modeWithinLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_select), messages.getString(MessagesConfig.StringID.spigot_gui_lore_enable_within_mode));
+ ButtonLore modeRadiusLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_select), messages.getString(MessagesConfig.StringID.spigot_gui_lore_enable_radius_mode));
+ ButtonLore disabledModeLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_select), messages.getString(MessagesConfig.StringID.spigot_gui_lore_disable_notifications));
+ ButtonLore closeGUILore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_close), null);
// Add button.
gui.addButton(new Button(26, XMaterial.RED_STAINED_GLASS_PANE, closeGUILore, "&cClose"));
@@ -48,17 +48,17 @@ public void open() {
if (enabledOrDisabled.equalsIgnoreCase("disabled")){
// Add the selected lore
- disabledModeLore.addLineLoreDescription(SpigotPrison.format(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_selected)));
+ disabledModeLore.addLineLoreDescription(SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_gui_lore_selected)));
} else if (enabledOrDisabled.equalsIgnoreCase("within")){
// Add the selected lore
- modeWithinLore.addLineLoreDescription(SpigotPrison.format(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_selected)));
+ modeWithinLore.addLineLoreDescription(SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_gui_lore_selected)));
} else if (enabledOrDisabled.equalsIgnoreCase("radius")){
// Add the selected lore
- modeRadiusLore.addLineLoreDescription(SpigotPrison.format(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_selected)));
+ modeRadiusLore.addLineLoreDescription(SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_gui_lore_selected)));
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineResetTimeGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineResetTimeGUI.java
index 3f43c71f8..eb82c9cf9 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineResetTimeGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineResetTimeGUI.java
@@ -2,7 +2,7 @@
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.entity.Player;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -30,9 +30,9 @@ public void open() {
PrisonGUI gui = new PrisonGUI(p, dimension, "&3MineInfo -> ResetTime");
- ButtonLore changeDecreaseValueLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_decrease), null);
- ButtonLore confirmButtonLore = new ButtonLore(createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_left_to_confirm), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_cancel)), createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_reset_time) + " " + val));
- ButtonLore changeIncreaseValueLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_increase), null);
+ ButtonLore changeDecreaseValueLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_decrease), null);
+ ButtonLore confirmButtonLore = new ButtonLore(createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_left_to_confirm), messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_cancel)), createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_reset_time) + " " + val));
+ ButtonLore changeIncreaseValueLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_increase), null);
// XMaterials.
XMaterial decreaseMat = XMaterial.REDSTONE_BLOCK;
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesBlocksGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesBlocksGUI.java
index 492bdeb6c..b5443b669 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesBlocksGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesBlocksGUI.java
@@ -9,7 +9,7 @@
import tech.mcprison.prison.mines.data.Mine;
import tech.mcprison.prison.spigot.SpigotPrison;
import tech.mcprison.prison.spigot.SpigotUtil;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -25,11 +25,11 @@ public class SpigotMinesBlocksGUI extends SpigotGUIComponents {
private final String mineName;
// Global Strings.
- private final String loreShiftRightClickToDelete = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_delete);
- private final String loreClickToEditBlock = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_edit);
- private final String loreInfo = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_info);
- private final String loreChance = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_chance);
- private final String loreBlockType = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_blocktype);
+ private final String loreShiftRightClickToDelete = messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_delete);
+ private final String loreClickToEditBlock = messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_edit);
+ private final String loreInfo = messages.getString(MessagesConfig.StringID.spigot_gui_lore_info);
+ private final String loreChance = messages.getString(MessagesConfig.StringID.spigot_gui_lore_chance);
+ private final String loreBlockType = messages.getString(MessagesConfig.StringID.spigot_gui_lore_blocktype);
public SpigotMinesBlocksGUI(Player p, String mineName){
this.p = p;
@@ -45,7 +45,7 @@ public void open(){
Mine m = PrisonMines.getInstance().getMine(mineName);
boolean useNewBlockModel = Prison.get().getPlatform().isUseNewPrisonBlockModel();
- ButtonLore addBlockLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_add), null);
+ ButtonLore addBlockLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_add), null);
// Add the button to the GUI.
gui.addButton(new Button(dimension - 1, XMaterial.LIME_STAINED_GLASS_PANE, addBlockLore, "&aAdd " + mineName));
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesConfirmGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesConfirmGUI.java
index 1d95b3ebc..0b4355ae4 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesConfirmGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesConfirmGUI.java
@@ -2,7 +2,7 @@
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.entity.Player;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -27,8 +27,8 @@ public void open(){
int dimension = 9;
PrisonGUI gui = new PrisonGUI(p, dimension, "&3Mines -> Delete");
- ButtonLore confirmLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_confirm), null);
- ButtonLore cancelLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_cancel), null);
+ ButtonLore confirmLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_confirm), null);
+ ButtonLore cancelLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_cancel), null);
// Position of the button
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesGUI.java
index aab8b94cf..fdf07c89b 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesGUI.java
@@ -9,7 +9,7 @@
import tech.mcprison.prison.mines.data.Mine;
import tech.mcprison.prison.mines.data.PrisonSortableResults;
import tech.mcprison.prison.mines.managers.MineManager.MineSortOrder;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.PrisonSetupGUI;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
@@ -54,15 +54,15 @@ public void open(){
PrisonGUI gui = new PrisonGUI(p, dimension, "&3MinesManager -> Mines");
// Global Strings.
- String loreLeftClickOpen = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_left_to_open);
- String loreShiftRightClickToDelete = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_delete);
- String loreInfo = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_info);
- String loreWorld = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_world);
- String loreSpawnPoint = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_spawnpoint);
- String loreResetTime = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_reset_time);
- String loreSizeOfMine = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_size);
- String loreVolume = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_volume);
- String loreBlocks = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_blocks);
+ String loreLeftClickOpen = messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_left_to_open);
+ String loreShiftRightClickToDelete = messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_delete);
+ String loreInfo = messages.getString(MessagesConfig.StringID.spigot_gui_lore_info);
+ String loreWorld = messages.getString(MessagesConfig.StringID.spigot_gui_lore_world);
+ String loreSpawnPoint = messages.getString(MessagesConfig.StringID.spigot_gui_lore_spawnpoint);
+ String loreResetTime = messages.getString(MessagesConfig.StringID.spigot_gui_lore_reset_time);
+ String loreSizeOfMine = messages.getString(MessagesConfig.StringID.spigot_gui_lore_size);
+ String loreVolume = messages.getString(MessagesConfig.StringID.spigot_gui_lore_volume);
+ String loreBlocks = messages.getString(MessagesConfig.StringID.spigot_gui_lore_blocks);
// Global boolean.
boolean useNewBlockModel = Prison.get().getPlatform().isUseNewPrisonBlockModel();
@@ -126,10 +126,10 @@ public void open(){
}
if (i < mines.getSortedList().size()) {
- gui.addButton(new Button(53, XMaterial.BOOK, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_next_page), null), "&7Next " + (i + 1)));
+ gui.addButton(new Button(53, XMaterial.BOOK, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_next_page), null), "&7Next " + (i + 1)));
}
if (i >= (pageSize * 2)) {
- gui.addButton(new Button(51, XMaterial.BOOK, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_prior_page), null), "&7Prior " + (i - (pageSize * 2) - 1)));
+ gui.addButton(new Button(51, XMaterial.BOOK, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_prior_page), null), "&7Prior " + (i - (pageSize * 2) - 1)));
}
// Open the GUI.
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotPlayerMinesGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotPlayerMinesGUI.java
index 97531b68b..9c12936d8 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotPlayerMinesGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotPlayerMinesGUI.java
@@ -13,7 +13,7 @@
import tech.mcprison.prison.spigot.SpigotPrison;
import tech.mcprison.prison.spigot.SpigotUtil;
import tech.mcprison.prison.spigot.configs.GuiConfig;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
@@ -29,9 +29,9 @@ public class SpigotPlayerMinesGUI extends SpigotGUIComponents {
private final Player p;
private final SpigotPlayer spigotPlayer;
private final String permissionWarpPlugin = guiConfig.getString("Options.Mines.PermissionWarpPlugin");
- private final String statusUnlockedMine = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_unlocked);
- private final String clickToTeleport = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_teleport);
- private final String statusLockedMine = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_locked);
+ private final String statusUnlockedMine = messages.getString(MessagesConfig.StringID.spigot_gui_lore_unlocked);
+ private final String clickToTeleport = messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_teleport);
+ private final String statusLockedMine = messages.getString(MessagesConfig.StringID.spigot_gui_lore_locked);
public SpigotPlayerMinesGUI(Player p) {
this.p = p;
@@ -49,14 +49,14 @@ public void open(){
// If the inventory is empty
if (dimension == 0){
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.NoMines"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_mines_empty));
p.closeInventory();
return;
}
// If the dimension's too big, don't open the GUI
if (dimension > 54){
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.TooManyMines"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_mines_too_many));
p.closeInventory();
return;
}
@@ -107,7 +107,7 @@ public void open(){
p.hasPermission(permission.substring(0, permission.length() - 1))){
material = ( mineMaterial == null ? Material.COAL_ORE : mineMaterial);
minesLore.addLineLoreDescription(SpigotPrison.format(statusUnlockedMine));
- minesLore.addLineLoreDescription(SpigotPrison.format(clickToTeleport));
+ minesLore.addLineLoreAction(SpigotPrison.format(clickToTeleport));
} else {
material = XMaterial.REDSTONE_BLOCK.parseMaterial();
minesLore.addLineLoreDescription(SpigotPrison.format(statusLockedMine));
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotConfirmPrestigeGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotConfirmPrestigeGUI.java
index c6df32492..3e95cce1e 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotConfirmPrestigeGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotConfirmPrestigeGUI.java
@@ -3,7 +3,7 @@
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.entity.Player;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -26,12 +26,12 @@ public void open(){
int dimension = 9;
PrisonGUI gui = new PrisonGUI(p, dimension, "&3Prestige -> Confirmation");
- ButtonLore confirmLore = new ButtonLore(createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_confirm)), createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_prestige_warning_1),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_prestige_warning_2),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_prestige_warning_3)));
+ ButtonLore confirmLore = new ButtonLore(createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_confirm)), createLore(
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_prestige_warning_1),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_prestige_warning_2),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_prestige_warning_3)));
- ButtonLore cancelLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_cancel), null);
+ ButtonLore cancelLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_cancel), null);
// Create the button, set up the material, amount, lore and name
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotLaddersGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotLaddersGUI.java
index 49015eecf..68f05b4b8 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotLaddersGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotLaddersGUI.java
@@ -7,7 +7,7 @@
import tech.mcprison.prison.ranks.data.RankLadder;
import tech.mcprison.prison.ranks.managers.LadderManager;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
@@ -39,7 +39,7 @@ public void open(){
// If the inventory is empty
if (lm.getLadders().size() == 0){
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.NoLadders"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_ladder_empty));
p.closeInventory();
return;
}
@@ -50,7 +50,7 @@ public void open(){
PrisonGUI gui = new PrisonGUI(p, dimension, "&3RanksManager -> Ladders");
- ButtonLore laddersLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_delete));
+ ButtonLore laddersLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open), messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_delete));
// Only loop over the blocks that we need to show:
int i = counter;
@@ -63,10 +63,10 @@ public void open(){
}
if (i < lm.getLadders().size()) {
- gui.addButton(new Button(53, XMaterial.BOOK, 1, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_next_page), null), "&7Next " + (i + 1)));
+ gui.addButton(new Button(53, XMaterial.BOOK, 1, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_next_page), null), "&7Next " + (i + 1)));
}
if (i >= (pageSize * 2)) {
- gui.addButton(new Button(51, XMaterial.BOOK, 1, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_prior_page), null),
+ gui.addButton(new Button(51, XMaterial.BOOK, 1, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_prior_page), null),
"&7Prior " + (i - (pageSize * 2) - 1)));
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java
index 281094c69..de6ad766c 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java
@@ -21,7 +21,7 @@
import tech.mcprison.prison.ranks.managers.LadderManager;
import tech.mcprison.prison.ranks.managers.PlayerManager;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
@@ -127,7 +127,7 @@ public void open() {
// }
if (!ladder.getLowestRank().isPresent()){
- Output.get().sendWarn(new SpigotPlayer(player), messages.getString("Message.NoRanksPrestigesLadder"));
+ Output.get().sendWarn(new SpigotPlayer(player), messages.getString(MessagesConfig.StringID.spigot_message_prestiges_empty));
return;
}
@@ -146,8 +146,8 @@ public void open() {
int hackyCounterEnchant = 0;
// Global strings.
- String loreInfo = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_info);
- String lorePrice3 = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_price);
+ String loreInfo = messages.getString(MessagesConfig.StringID.spigot_gui_lore_info);
+ String lorePrice3 = messages.getString(MessagesConfig.StringID.spigot_gui_lore_price);
// Global boolean.
boolean enchantmentEffectEnabled = getBoolean(guiConfig.getString("Options.Ranks.Enchantment_effect_current_rank"));
@@ -186,7 +186,7 @@ public void open() {
rank = rank.getRankNext();
}
- ButtonLore rankupLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_rankup), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_rankup_if_enough_money));
+ ButtonLore rankupLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_rankup), messages.getString(MessagesConfig.StringID.spigot_gui_lore_rankup_if_enough_money));
// Add button to GUI.
gui.addButton(new Button(dimension - 5, XMaterial.EMERALD_BLOCK, rankupLore, SpigotPrison.format("&aPrestige")));
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerRanksGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerRanksGUI.java
index c8145878f..4b7b320fa 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerRanksGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerRanksGUI.java
@@ -25,7 +25,7 @@
import tech.mcprison.prison.ranks.managers.LadderManager;
import tech.mcprison.prison.ranks.managers.PlayerManager;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
@@ -110,14 +110,14 @@ public void open() {
// Ensure ladder is present and that it has a rank:
if ( ladder == null || !ladder.getLowestRank().isPresent()){
- Output.get().sendWarn(new SpigotPlayer(getPlayer()), messages.getString("Message.NoRanksFoundHelp1") + guiConfig.getString("Options.Ranks.Ladder") + messages.getString("Message.NoRanksFoundHelp2"));
+ Output.get().sendWarn(new SpigotPlayer(getPlayer()), messages.getString(MessagesConfig.StringID.spigot_message_gui_ladder_empty) + " [" + guiConfig.getString("Options.Ranks.Ladder") + "]");
getPlayer().closeInventory();
return;
}
// Get the dimensions and if needed increases them
if (ladder.getRanks().size() == 0) {
- Output.get().sendWarn(new SpigotPlayer(getPlayer()), messages.getString("Message.NoRanksFound"));
+ Output.get().sendWarn(new SpigotPlayer(getPlayer()), messages.getString(MessagesConfig.StringID.spigot_message_gui_ranks_empty));
return;
}
@@ -184,10 +184,10 @@ public void open() {
rank = rank.getRankNext();
}
- ButtonLore rankupLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_rankup), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_rankup_if_enough_money));
+ ButtonLore rankupLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_rankup), messages.getString(MessagesConfig.StringID.spigot_gui_lore_rankup_if_enough_money));
// Add button.
- gui.addButton(new Button(dimension - 5, XMaterial.EMERALD_BLOCK, rankupLore, SpigotPrison.format(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_rankup))));
+ gui.addButton(new Button(dimension - 5, XMaterial.EMERALD_BLOCK, rankupLore, SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_gui_lore_rankup))));
// Open GUI.
gui.open();
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankManagerGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankManagerGUI.java
index e9a4f612c..c8a1a034d 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankManagerGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankManagerGUI.java
@@ -12,7 +12,7 @@
import tech.mcprison.prison.ranks.data.Rank;
import tech.mcprison.prison.ranks.data.RankPlayer;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
@@ -42,7 +42,7 @@ public void open() {
int dimension = 27;
PrisonGUI gui = new PrisonGUI(p, dimension, "&3Ranks -> RankManager");
- ButtonLore rankupCommandsLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open), null);
+ ButtonLore rankupCommandsLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open), null);
// Decimal Rank cost format.
DecimalFormat formatDecimal = new DecimalFormat("###,##0.00");
@@ -58,16 +58,16 @@ public void open() {
rankCost = "Can't get";
}
- ButtonLore editPriceLore = new ButtonLore(createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open)), createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_info),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_price) + " " + rankCost));
+ ButtonLore editPriceLore = new ButtonLore(createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open)), createLore(
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_info),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_price) + " " + rankCost));
- ButtonLore editTagLore = new ButtonLore(createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open)), createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_info),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_rank_tag) + " " + rank.getTag()));
+ ButtonLore editTagLore = new ButtonLore(createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open)), createLore(
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_info),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_rank_tag) + " " + rank.getTag()));
- ButtonLore closeGUILore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_close), null);
+ ButtonLore closeGUILore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_close), null);
// Create the button
gui.addButton(new Button(26, XMaterial.RED_STAINED_GLASS_PANE, closeGUILore, SpigotPrison.format("&cClose")));
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankPriceGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankPriceGUI.java
index 9af9b042e..cd79f8a7c 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankPriceGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankPriceGUI.java
@@ -3,7 +3,7 @@
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.entity.Player;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -34,9 +34,9 @@ public void open() {
int dimension = 45;
PrisonGUI gui = new PrisonGUI(p, dimension, "&3RankManager -> RankPrice");
- ButtonLore changeDecreaseValueLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_decrease), null);
- ButtonLore confirmButtonLore = new ButtonLore(createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_left_to_confirm), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_cancel)), createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_price) + " " + val));
- ButtonLore changeIncreaseValueLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_increase), null);
+ ButtonLore changeDecreaseValueLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_decrease), null);
+ ButtonLore confirmButtonLore = new ButtonLore(createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_left_to_confirm), messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_cancel)), createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_price) + " " + val));
+ ButtonLore changeIncreaseValueLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_increase), null);
XMaterial decreaseMat = XMaterial.REDSTONE_BLOCK;
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankUPCommandsGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankUPCommandsGUI.java
index e5dc8cf02..876d66491 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankUPCommandsGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankUPCommandsGUI.java
@@ -6,7 +6,7 @@
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.ranks.data.Rank;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
@@ -22,9 +22,9 @@ public class SpigotRankUPCommandsGUI extends SpigotGUIComponents {
private final Rank rank;
// Global Strings.
- private final String shiftRightClickToDelete = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_delete);
- private final String loreInfo = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_info);
- private final String loreCommand = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_command);
+ private final String shiftRightClickToDelete = messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_delete);
+ private final String loreInfo = messages.getString(MessagesConfig.StringID.spigot_gui_lore_info);
+ private final String loreCommand = messages.getString(MessagesConfig.StringID.spigot_gui_lore_command);
public SpigotRankUPCommandsGUI(Player p, Rank rank) {
this.p = p;
@@ -39,7 +39,7 @@ public void open() {
}
if (rank.getRankUpCommands().size() == 0){
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.NoRankupCommands"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_ranks_rankup_commands_empty));
return;
}
@@ -48,14 +48,14 @@ public void open() {
// If the inventory is empty
if (dimension == 0){
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.EmptyGui"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_error_empty));
p.closeInventory();
return;
}
// If the dimension's too big, don't open the GUI
if (dimension > 54){
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.TooManyRankupCommands"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_ranks_rankup_commands_too_many));
p.closeInventory();
return;
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRanksGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRanksGUI.java
index 9e647048d..d9fff77be 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRanksGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRanksGUI.java
@@ -14,7 +14,7 @@
import tech.mcprison.prison.ranks.data.Rank;
import tech.mcprison.prison.ranks.data.RankLadder;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
@@ -45,7 +45,7 @@ public void open(){
// Get the dimensions and if needed increases them
if (!ladder.isPresent() || ladder.get().getRanks().size() == 0) {
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.NoRanksFoundAdmin"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_ranks_empty));
return;
}
@@ -56,14 +56,14 @@ public void open(){
PrisonGUI gui = new PrisonGUI(p, dimension, "&3Ladders -> Ranks");
// Global Strings.
- String loreShiftRightClickDelete = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_delete);
- String loreClickToManageRank = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_manage_rank);
- String loreInfo = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_info);
- String loreId = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_id);
- String loreName = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_name);
- String loreTag2 = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_rank_tag);
- String lorePrice3 = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_price);
- String lorePlayersWithRank = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_players_at_rank);
+ String loreShiftRightClickDelete = messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_and_shift_to_delete);
+ String loreClickToManageRank = messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_manage_rank);
+ String loreInfo = messages.getString(MessagesConfig.StringID.spigot_gui_lore_info);
+ String loreId = messages.getString(MessagesConfig.StringID.spigot_gui_lore_id);
+ String loreName = messages.getString(MessagesConfig.StringID.spigot_gui_lore_name);
+ String loreTag2 = messages.getString(MessagesConfig.StringID.spigot_gui_lore_rank_tag);
+ String lorePrice3 = messages.getString(MessagesConfig.StringID.spigot_gui_lore_price);
+ String lorePlayersWithRank = messages.getString(MessagesConfig.StringID.spigot_gui_lore_players_at_rank);
// Decimal Rank cost format.
DecimalFormat formatDecimal = new DecimalFormat("###,##0.00");
@@ -105,10 +105,10 @@ public void open(){
}
if (i < ladder.get().getRanks().size()) {
- gui.addButton(new Button(53, XMaterial.BOOK, 1, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_next_page), null), "&7Next " + (i + 1)));
+ gui.addButton(new Button(53, XMaterial.BOOK, 1, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_next_page), null), "&7Next " + (i + 1)));
}
if (i >= (pageSize * 2)) {
- gui.addButton(new Button(51, XMaterial.BOOK, 1, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_prior_page), null),
+ gui.addButton(new Button(51, XMaterial.BOOK, 1, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_prior_page), null),
"&7Prior " + (i - (pageSize * 2) - 1)));
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllAdminAutoSellGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllAdminAutoSellGUI.java
index be95a8507..f57604ca7 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllAdminAutoSellGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllAdminAutoSellGUI.java
@@ -3,7 +3,7 @@
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.entity.Player;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -27,7 +27,7 @@ public void open() {
PrisonGUI gui = new PrisonGUI(p, dimension, "&3SellAll -> AutoSell");
- ButtonLore closeGUILore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_close), null);
+ ButtonLore closeGUILore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_close), null);
ButtonLore perUserToggleableLore = new ButtonLore();
ButtonLore enableDisableLore = new ButtonLore();
@@ -35,18 +35,18 @@ public void open() {
Button enableDisableButton;
if (sellAllConfig.getString("Options.Full_Inv_AutoSell_perUserToggleable").equalsIgnoreCase("true")){
- perUserToggleableLore.setLoreAction(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_disable));
+ perUserToggleableLore.setLoreAction(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_disable));
perUserToggleableButton = new Button(11, XMaterial.LIME_STAINED_GLASS_PANE, perUserToggleableLore, "&3PerUserToggleable");
} else {
- perUserToggleableLore.setLoreAction(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_enable));
+ perUserToggleableLore.setLoreAction(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_enable));
perUserToggleableButton = new Button(11, XMaterial.RED_STAINED_GLASS_PANE, perUserToggleableLore, "&cPerUserToggleable-Disabled");
}
if (sellAllConfig.getString("Options.Full_Inv_AutoSell").equalsIgnoreCase("true")){
- enableDisableLore.setLoreAction(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_disable));
+ enableDisableLore.setLoreAction(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_disable));
enableDisableButton = new Button(15, XMaterial.LIME_STAINED_GLASS_PANE, enableDisableLore, "&3AutoSell");
} else {
- enableDisableLore.setLoreAction(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_enable));
+ enableDisableLore.setLoreAction(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_enable));
enableDisableButton = new Button(15, XMaterial.RED_STAINED_GLASS_PANE, enableDisableLore, "&cAutoSell-Disabled");
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllAdminBlocksGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllAdminBlocksGUI.java
index d232d4824..a4e00ba9d 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllAdminBlocksGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllAdminBlocksGUI.java
@@ -5,7 +5,7 @@
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.SpigotPrison;
import tech.mcprison.prison.spigot.SpigotUtil;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
@@ -48,8 +48,7 @@ public void open() {
if (emptyInv){
SpigotPlayer spigotPlayer = new SpigotPlayer(p);
- Output.get().sendWarn(spigotPlayer, messages.getString("Message.SellAllGUIEmpty"));
- Output.get().sendWarn(spigotPlayer, messages.getString("Message.SellAllGUIEmpty2"));
+ Output.get().sendWarn(spigotPlayer, messages.getString(MessagesConfig.StringID.spigot_message_gui_sellall_empty));
return;
}
@@ -57,11 +56,11 @@ public void open() {
Set items = sellAllConfig.getConfigurationSection("Items").getKeys(false);
// Global strings.
- String loreLine1 = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_delete);
- String loreLine2 = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_left_to_edit);
- String lorePermission = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_permission);
+ String loreLine1 = messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_delete);
+ String loreLine2 = messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_left_to_edit);
+ String lorePermission = messages.getString(MessagesConfig.StringID.spigot_gui_lore_permission);
String permissionSellAllBlock = sellAllConfig.getString("Options.Sell_Per_Block_Permission");
- String loreValue = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_value);
+ String loreValue = messages.getString(MessagesConfig.StringID.spigot_gui_lore_value);
boolean sellAllPerBlockPermissionEnabled = getBoolean(sellAllConfig.getString("Options.Sell_Per_Block_Permission_Enabled"));
@@ -72,11 +71,11 @@ public void open() {
if (itemsRead >= startingItem) {
if (startingItem != 0){
- gui.addButton(new Button(45, XMaterial.BOOK, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_prior_page), null), "&7Prior " + (startingItem - 45)));
+ gui.addButton(new Button(45, XMaterial.BOOK, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_prior_page), null), "&7Prior " + (startingItem - 45)));
}
if (itemsAdded >= 45){
- gui.addButton(new Button(53, XMaterial.BOOK, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_next_page), null), "&7Next " + (startingItem + itemsAdded)));
+ gui.addButton(new Button(53, XMaterial.BOOK, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_next_page), null), "&7Next " + (startingItem + itemsAdded)));
}
if (itemsAdded < 45) {
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllAdminGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllAdminGUI.java
index ef6eb9154..4f498d549 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllAdminGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllAdminGUI.java
@@ -4,7 +4,7 @@
import org.bukkit.entity.Player;
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
@@ -26,7 +26,7 @@ public SellAllAdminGUI(Player p) {
public void open() {
if (!SpigotPrison.getInstance().getConfig().getString("sellall").equalsIgnoreCase("true")){
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.SellAllIsDisabled"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_sellall_disabled));
return;
}
@@ -34,12 +34,12 @@ public void open() {
PrisonGUI gui = new PrisonGUI(p, dimension, "&3Prison -> SellAll-Admin");
- ButtonLore blocksLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open), null);
- ButtonLore closeGUILore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_close), null);
- ButtonLore setCurrencyLore = new ButtonLore(createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_edit)), createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_currency) + sellAllConfig.getString("Options.SellAll_Currency"),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_edit)));
- ButtonLore multipliersLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_edit));
+ ButtonLore blocksLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open), null);
+ ButtonLore closeGUILore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_close), null);
+ ButtonLore setCurrencyLore = new ButtonLore(createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_edit)), createLore(
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_currency) + " " + sellAllConfig.getString("Options.SellAll_Currency"),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_edit)));
+ ButtonLore multipliersLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open), messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_edit));
ButtonLore autoSellLore = new ButtonLore();
ButtonLore sellAllDelayLore = new ButtonLore();
@@ -48,45 +48,45 @@ public void open() {
if (sellAllConfig.getString("Options.Full_Inv_AutoSell").equalsIgnoreCase("true")){
autoSellLore.setLoreAction(createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_disable)
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_disable)
));
autoSellButton = new Button(13, XMaterial.CHEST, autoSellLore, "&3AutoSell");
} else {
- autoSellLore.setLoreAction(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_enable));
+ autoSellLore.setLoreAction(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_enable));
autoSellButton = new Button(13, XMaterial.CHEST, autoSellLore, "&cAutoSell-Disabled");
}
if (sellAllConfig.getString("Options.Sell_Delay_Enabled").equalsIgnoreCase("true")){
sellAllDelayLore.setLoreAction(createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_open),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_disable)));
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_open),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_disable)));
sellAllDelayLore.setLoreDescription(createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_delay) + sellAllConfig.getString("Options.Sell_Delay_Seconds") + "s",
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_sellall_delay_use_1),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_sellall_delay_use_2)));
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_delay) + " " + sellAllConfig.getString("Options.Sell_Delay_Seconds") + "s",
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_sellall_delay_use_1),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_sellall_delay_use_2)));
sellAllDelayButton = new Button(11, XMaterial.CLOCK, sellAllDelayLore, "&3Delay-Enabled");
} else {
- sellAllDelayLore.setLoreAction(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_enable));
+ sellAllDelayLore.setLoreAction(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_enable));
sellAllDelayLore.setLoreDescription(createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_sellall_delay_use_1),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_sellall_delay_use_2)));
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_sellall_delay_use_1),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_sellall_delay_use_2)));
sellAllDelayButton = new Button(11, XMaterial.CLOCK, sellAllDelayLore, "&cDelay-Disabled");
}
try {
if (sellAllConfig.getConfigurationSection("Multiplier") == null) {
- multipliersLore.addLineLoreDescription(SpigotPrison.format(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_no_multipliers)));
+ multipliersLore.addLineLoreDescription(SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_gui_lore_no_multipliers)));
} else if (sellAllConfig.getConfigurationSection("Multiplier").getKeys(false).size() == 0) {
- multipliersLore.addLineLoreDescription(SpigotPrison.format(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_no_multipliers)));
+ multipliersLore.addLineLoreDescription(SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_gui_lore_no_multipliers)));
}
} catch (NullPointerException ex){
- multipliersLore.addLineLoreDescription(SpigotPrison.format(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_no_multipliers)));
+ multipliersLore.addLineLoreDescription(SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_gui_lore_no_multipliers)));
}
gui.addButton(new Button(15, XMaterial.EMERALD, setCurrencyLore, SpigotPrison.format("&3SellAll-Currency")));
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllDelayGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllDelayGUI.java
index 6275aeb63..5d0938aec 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllDelayGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllDelayGUI.java
@@ -3,7 +3,7 @@
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.entity.Player;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -30,9 +30,9 @@ public void open() {
int dimension = 45;
PrisonGUI gui = new PrisonGUI(p, dimension, "&3SellAll -> Delay");
- ButtonLore changeDecreaseValueLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_decrease), null);
- ButtonLore confirmButtonLore = new ButtonLore(createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_left_to_confirm), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_cancel)), createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_delay) + " " + val + "s"));
- ButtonLore changeIncreaseValueLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_increase), null);
+ ButtonLore changeDecreaseValueLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_decrease), null);
+ ButtonLore confirmButtonLore = new ButtonLore(createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_left_to_confirm), messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_cancel)), createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_delay) + " " + val + "s"));
+ ButtonLore changeIncreaseValueLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_increase), null);
XMaterial decreaseMat = XMaterial.REDSTONE_BLOCK;
XMaterial increaseMat = XMaterial.EMERALD_BLOCK;
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPlayerGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPlayerGUI.java
index fa5b2df78..1b8416e95 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPlayerGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPlayerGUI.java
@@ -4,7 +4,7 @@
import org.bukkit.entity.Player;
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.SpigotUtil;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
@@ -43,7 +43,7 @@ public void open() {
}
if (emptyInv){
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.NoSellAllItems"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_gui_sellall_empty));
return;
}
@@ -51,7 +51,7 @@ public void open() {
Set items = sellAllConfig.getConfigurationSection("Items").getKeys(false);
// Global strings.
- String loreValue = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_value);
+ String loreValue = messages.getString(MessagesConfig.StringID.spigot_gui_lore_value);
int itemsAdded = 0, itemsRead = 0;
for (String key : items) {
@@ -60,11 +60,11 @@ public void open() {
if (itemsRead >= startingItem) {
if (startingItem != 0){
- gui.addButton(new Button(45, XMaterial.BOOK, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_prior_page), null), "&7Prior " + (startingItem - 45)));
+ gui.addButton(new Button(45, XMaterial.BOOK, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_prior_page), null), "&7Prior " + (startingItem - 45)));
}
if (itemsAdded >= 45){
- gui.addButton(new Button(53, XMaterial.BOOK, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_next_page), null), "&7Next " + (startingItem + itemsAdded)));
+ gui.addButton(new Button(53, XMaterial.BOOK, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_next_page), null), "&7Next " + (startingItem + itemsAdded)));
}
if (itemsAdded < 45) {
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPrestigesMultiplierGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPrestigesMultiplierGUI.java
index c50f844ca..03926f73b 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPrestigesMultiplierGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPrestigesMultiplierGUI.java
@@ -2,14 +2,12 @@
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.entity.Player;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
import tech.mcprison.prison.spigot.gui.guiutility.SpigotGUIComponents;
-import java.util.List;
-
/**
* @author GABRYCA
*/
@@ -34,10 +32,10 @@ public void open() {
int pageSize = 45;
// Global strings.
- String lorePrestigeName = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_prestige_name);
- String lorePrestigeMultiplier = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_multiplier);
- String loreClickToEdit = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_edit);
- String loreClickToDelete = newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_delete);
+ String lorePrestigeName = messages.getString(MessagesConfig.StringID.spigot_gui_lore_prestige_name);
+ String lorePrestigeMultiplier = messages.getString(MessagesConfig.StringID.spigot_gui_lore_multiplier);
+ String loreClickToEdit = messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_edit);
+ String loreClickToDelete = messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_delete);
// Only loop over the blocks that we need to show:
int i = counter;
@@ -61,10 +59,10 @@ public void open() {
}
if (i < sellAllConfig.getConfigurationSection("Multiplier").getKeys(false).size()) {
- gui.addButton(new Button(53, XMaterial.BOOK, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_next_page), null), "&7Next " + (i + 1)));
+ gui.addButton(new Button(53, XMaterial.BOOK, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_next_page), null), "&7Next " + (i + 1)));
}
if (i >= (pageSize * 2)) {
- gui.addButton(new Button(51, XMaterial.BOOK, new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_prior_page), null), "&7Prior " + (i - (pageSize * 2) - 1)));
+ gui.addButton(new Button(51, XMaterial.BOOK, new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_prior_page), null), "&7Prior " + (i - (pageSize * 2) - 1)));
}
gui.open();
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPrestigesSetMultiplierGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPrestigesSetMultiplierGUI.java
index 1c2f8d649..6774209d1 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPrestigesSetMultiplierGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPrestigesSetMultiplierGUI.java
@@ -3,7 +3,7 @@
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.entity.Player;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -31,11 +31,11 @@ public void open() {
int dimension = 45;
PrisonGUI gui = new PrisonGUI(p, dimension, "&3Edit -> Multiplier");
- ButtonLore changeDecreaseValueLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_decrease), null);
+ ButtonLore changeDecreaseValueLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_decrease), null);
ButtonLore confirmButtonLore = new ButtonLore(createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_left_to_confirm),
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_cancel)), createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_multiplier) + " " + "x" + val));
- ButtonLore changeIncreaseValueLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_increase), null);
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_left_to_confirm),
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_cancel)), createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_multiplier) + " " + "x" + val));
+ ButtonLore changeIncreaseValueLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_increase), null);
XMaterial decreaseMat = XMaterial.REDSTONE_BLOCK;
XMaterial increaseMat = XMaterial.EMERALD_BLOCK;
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPriceGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPriceGUI.java
index b61df22d9..55ece4a1b 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPriceGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPriceGUI.java
@@ -3,14 +3,12 @@
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.entity.Player;
import tech.mcprison.prison.spigot.SpigotPrison;
-import tech.mcprison.prison.spigot.configs.NewMessagesConfig;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
import tech.mcprison.prison.spigot.gui.guiutility.SpigotGUIComponents;
-import java.util.List;
-
/**
* @author GABRYCA
*/
@@ -33,10 +31,10 @@ public void open() {
int dimension = 45;
PrisonGUI gui = new PrisonGUI(p, dimension, "&3SellAll -> ItemValue");
- ButtonLore changeDecreaseValueLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_decrease), null);
+ ButtonLore changeDecreaseValueLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_decrease), null);
ButtonLore confirmButtonLore = new ButtonLore(createLore(
- newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_left_to_confirm), newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_right_to_cancel)), createLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_price) + " " + val));
- ButtonLore changeIncreaseValueLore = new ButtonLore(newMessages.getString(NewMessagesConfig.StringID.spigot_gui_lore_click_to_increase), null);
+ messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_left_to_confirm), messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_right_to_cancel)), createLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_price) + " " + val));
+ ButtonLore changeIncreaseValueLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_increase), null);
XMaterial decreaseMat = XMaterial.REDSTONE_BLOCK;
XMaterial increaseMat = XMaterial.EMERALD_BLOCK;
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/sellall/SellAllUtil.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/sellall/SellAllUtil.java
index c007874c2..d0f4d740e 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/sellall/SellAllUtil.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/sellall/SellAllUtil.java
@@ -25,6 +25,7 @@
import tech.mcprison.prison.spigot.SpigotPrison;
import tech.mcprison.prison.spigot.backpacks.BackpacksUtil;
import tech.mcprison.prison.spigot.compat.Compatibility;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.gui.sellall.SellAllAdminGUI;
import tech.mcprison.prison.spigot.gui.sellall.SellAllPlayerGUI;
@@ -50,7 +51,7 @@ public class SellAllUtil {
private ArrayList sellAllItemTriggers;
private ArrayList activePlayerDelay = new ArrayList<>();
private List sellAllDisabledWorlds;
- private Configuration messages;
+ private MessagesConfig messages;
private double defaultMultiplier;
private int defaultSellAllDelay;
private int defaultAutoSellEarningNotificationDelay;
@@ -1181,7 +1182,7 @@ public void removeFromDelay(Player p){
* */
public void removeFromAutoSellDelayAndNotify(Player p){
if (autoSellEarningsNotificationWaiting.containsKey(p) && autoSellEarningsNotificationWaiting.get(p) > 0.00){
- Output.get().sendInfo(new SpigotPlayer(p), SpigotPrison.format(messages.getString("Message.SellAllAutoSellEarnedMoney") + autoSellEarningsNotificationWaiting.get(p) + messages.getString("Message.SellAllAutoSellEarnedMoneyCurrency")));
+ Output.get().sendInfo(new SpigotPlayer(p), SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_message_sellall_money_earned) + autoSellEarningsNotificationWaiting.get(p)));
}
autoSellEarningsNotificationWaiting.remove(p);
}
@@ -1267,7 +1268,6 @@ public boolean setAutoSellPlayer(Player p, boolean enable){
conf.set("Users." + p.getUniqueId() + ".isEnabled", enable);
conf.save(sellAllFile);
} catch (IOException e) {
- Output.get().sendError(new SpigotPlayer(p), SpigotPrison.format(messages.getString("Message.SellAllConfigSaveFail")));
e.printStackTrace();
return false;
}
@@ -1391,7 +1391,7 @@ public boolean setDelay(int delay){
*
* Return True if success, False if error or nothing changed or Player not meeting requirements.
*
- * Default usage of this method: sellAllSell(p, false, false, true, false, false, true);
+ * Default usage of this method: sellAllSell(p, false, false, true, true, false, true);
*
* @param p - Player.
* @param isUsingSign - boolean.
@@ -1406,21 +1406,21 @@ public boolean setDelay(int delay){
public boolean sellAllSell(Player p, boolean isUsingSign, boolean completelySilent, boolean notifyPlayerEarned, boolean notifyPlayerDelay, boolean notifyPlayerEarningDelay, boolean playSoundOnSellAll){
if (!isUsingSign && isSellAllSignEnabled && isSellAllBySignOnlyEnabled && !p.hasPermission(permissionBypassSign)){
if (!completelySilent) {
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.SellAllSignOnly"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_sell_sign_only));
}
return false;
}
if (isSellAllDelayEnabled && isPlayerWaitingSellAllDelay(p)){
if (notifyPlayerDelay && !completelySilent) {
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.SellAllWaitDelay"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_delay_wait));
}
return false;
}
if (sellAllBlocks.isEmpty()){
if (!completelySilent){
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.SellAllEmpty"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_sell_empty));
}
return false;
}
@@ -1450,7 +1450,7 @@ public boolean sellAllSell(Player p, boolean isUsingSign, boolean completelySile
addDelayedEarningAutoSellNotification(p, money);
}
} else if (notifyPlayerEarned){
- Output.get().sendInfo(sPlayer, messages.getString("Message.SellAllYouGotMoney") + money);
+ Output.get().sendInfo(sPlayer, messages.getString(MessagesConfig.StringID.spigot_message_sellall_money_earned) + money);
}
}
return true;
@@ -1459,7 +1459,7 @@ public boolean sellAllSell(Player p, boolean isUsingSign, boolean completelySile
if (isSellAllSoundEnabled && playSoundOnSellAll) {
p.playSound(p.getLocation(), sellAllSoundFail, 3, 1);
}
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.SellAllNothingToSell"));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_sell_nothing_sellable));
}
return false;
}
@@ -1499,21 +1499,21 @@ public boolean sellAllSell(Player p, boolean isUsingSign, boolean completelySile
public ArrayList sellAllSell(Player p, ArrayList itemStacks, boolean isUsingSign, boolean completelySilent, boolean notifyPlayerEarned, boolean notifyPlayerDelay, boolean notifyPlayerEarningDelay, boolean playSoundOnSellAll, boolean sellInputArrayListOnly){
if (!isUsingSign && isSellAllSignEnabled && isSellAllBySignOnlyEnabled && !p.hasPermission(permissionBypassSign)){
if (!completelySilent) {
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.SellAllSignOnly"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_sell_sign_only));
}
return itemStacks;
}
if (isSellAllDelayEnabled && isPlayerWaitingSellAllDelay(p)){
if (notifyPlayerDelay && !completelySilent) {
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.SellAllWaitDelay"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_delay_wait));
}
return itemStacks;
}
if (sellAllBlocks.isEmpty()){
if (!completelySilent){
- Output.get().sendWarn(new SpigotPlayer(p), messages.getString("Message.SellAllEmpty"));
+ Output.get().sendWarn(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_sell_empty));
}
return itemStacks;
}
@@ -1557,7 +1557,7 @@ public ArrayList sellAllSell(Player p, ArrayList itemStack
addDelayedEarningAutoSellNotification(p, money);
}
} else if (notifyPlayerEarned){
- Output.get().sendInfo(sPlayer, messages.getString("Message.SellAllYouGotMoney") + money);
+ Output.get().sendInfo(sPlayer, messages.getString(MessagesConfig.StringID.spigot_message_sellall_money_earned) + money);
}
}
} else {
@@ -1565,7 +1565,7 @@ public ArrayList sellAllSell(Player p, ArrayList itemStack
if (isSellAllSoundEnabled && playSoundOnSellAll) {
p.playSound(p.getLocation(), sellAllSoundFail, 3, 1);
}
- Output.get().sendInfo(new SpigotPlayer(p), messages.getString("Message.SellAllNothingToSell"));
+ Output.get().sendInfo(new SpigotPlayer(p), messages.getString(MessagesConfig.StringID.spigot_message_sellall_sell_nothing_sellable));
}
}
return itemStacks;
From 3885593a999ab5e8801572b2ed6ae27dd1d71a49 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Sat, 11 Sep 2021 17:32:36 -0400
Subject: [PATCH 056/283] Hook up the auto features notification to use the new
actionBar interface. This "should" prevent duplicate messages from being sent
to the player while the same message is displayed in the actionbar.
---
.../autofeatures/AutoManagerFeatures.java | 48 ++++++++++---------
.../prison/spigot/game/SpigotPlayer.java | 8 +++-
2 files changed, 32 insertions(+), 24 deletions(-)
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java
index aa97437bc..6990766ed 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java
@@ -7,13 +7,11 @@
import java.util.Random;
import java.util.Set;
import java.util.TreeMap;
-import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
-import org.bukkit.configuration.Configuration;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EntityType;
@@ -23,10 +21,9 @@
import com.cryptomorin.xseries.XMaterial;
-import net.md_5.bungee.api.ChatMessageType;
-import net.md_5.bungee.api.chat.TextComponent;
import tech.mcprison.prison.Prison;
import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig.AutoFeatures;
+import tech.mcprison.prison.autofeatures.PlayerMessaging.MessageType;
import tech.mcprison.prison.internal.block.PrisonBlock;
import tech.mcprison.prison.mines.data.Mine;
import tech.mcprison.prison.mines.features.MineBlockEvent.BlockEventType;
@@ -41,7 +38,7 @@
import tech.mcprison.prison.spigot.compat.SpigotCompatibility;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.sellall.SellAllUtil;
-import tech.mcprison.prison.spigot.spiget.BluesSpigetSemVerComparator;
+import tech.mcprison.prison.spigot.utils.tasks.PlayerMessagingTask;
import tech.mcprison.prison.util.BlockType;
import tech.mcprison.prison.util.Text;
@@ -805,10 +802,10 @@ private void dropExtra( HashMap extra, Player player )
}
}
- private boolean isBoolean( Configuration sellAllConfig, String config ) {
- String configValue = sellAllConfig.getString( config );
- return configValue != null && configValue.equalsIgnoreCase( "true" );
- }
+// private boolean isBoolean( Configuration sellAllConfig, String config ) {
+// String configValue = sellAllConfig.getString( config );
+// return configValue != null && configValue.equalsIgnoreCase( "true" );
+// }
private void dropAtBlock( SpigotItemStack itemStack, SpigotBlock block ) {
@@ -848,23 +845,30 @@ private void notifyPlayerWithSound( Player player, AutoFeatures messageId ) {
player.playSound(player.getLocation(), sound, 10F, 1F);
}
+ (new SpigotPlayer( player )).setActionBar( message );
+
// holographic display for showing full inventory does not work well.
// if ( isBoolean( AutoFeatures.hologramIfInventoryIsFull ) ) {
// displayMessageHologram( block, message , player);
// }
// else {
- actionBarVersion(player, message);
+// actionBarVersion(player, message);
// }
}
- private void actionBarVersion(Player player, String message) {
- if (new BluesSpigetSemVerComparator().compareMCVersionTo("1.9.0") < 0) {
- displayActionBarMessage(player, message);
- }
- else {
- player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(SpigotPrison.format(message)));
- }
- }
+// private void actionBarVersion(Player player, String message) {
+//
+// PlayerMessagingTask.submitTask( player, MessageType.actionBar, message );
+//
+//// SpigotCompatibility.getInstance().sendActionBar( player, message );
+//
+//// if (new BluesSpigetSemVerComparator().compareMCVersionTo("1.9.0") < 0) {
+//// displayActionBarMessage(player, message);
+//// }
+//// else {
+//// player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(SpigotPrison.format(message)));
+//// }
+// }
/**
* This is not usable since it not only prevents the player from mining when it is
@@ -888,10 +892,10 @@ private void displayMessageHologram(Block block, String message, Player p){
Bukkit.getScheduler().scheduleSyncDelayedTask(SpigotPrison.getInstance(), as::remove, (7L * 20L));
}
- private void displayActionBarMessage(Player player, String message) {
- SpigotPlayer prisonPlayer = new SpigotPlayer(player);
- Prison.get().getPlatform().showActionBar(prisonPlayer, message, 80);
- }
+// private void displayActionBarMessage(Player player, String message) {
+// SpigotPlayer prisonPlayer = new SpigotPlayer(player);
+// Prison.get().getPlatform().showActionBar(prisonPlayer, message, 80);
+// }
/**
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotPlayer.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotPlayer.java
index c46d9bbbb..b19c4a3cc 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotPlayer.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotPlayer.java
@@ -29,6 +29,7 @@
import org.bukkit.entity.ExperienceOrb;
import org.bukkit.event.player.PlayerTeleportEvent;
+import tech.mcprison.prison.autofeatures.PlayerMessaging.MessageType;
import tech.mcprison.prison.internal.ItemStack;
import tech.mcprison.prison.internal.Player;
import tech.mcprison.prison.internal.inventory.Inventory;
@@ -40,6 +41,7 @@
import tech.mcprison.prison.spigot.compat.SpigotNMSPlayer;
import tech.mcprison.prison.spigot.inventory.SpigotPlayerInventory;
import tech.mcprison.prison.spigot.scoreboard.SpigotScoreboard;
+import tech.mcprison.prison.spigot.utils.tasks.PlayerMessagingTask;
import tech.mcprison.prison.util.Gamemode;
import tech.mcprison.prison.util.Location;
@@ -613,8 +615,10 @@ public void setTitle( String title, String subtitle, int fadeIn, int stay, int f
@Override
public void setActionBar( String actionBar ) {
if ( getWrapper() != null) {
- SpigotCompatibility.getInstance()
- .sendActionBar( getWrapper(), actionBar );
+ PlayerMessagingTask.submitTask( getWrapper(), MessageType.actionBar, actionBar );
+
+// SpigotCompatibility.getInstance()
+// .sendActionBar( getWrapper(), actionBar );
}
}
}
From 76941165bf9d1c9c741427746dde7f6fc81c996a Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Sun, 12 Sep 2021 11:43:47 -0400
Subject: [PATCH 057/283] For the actionBar and title, translate the color
codes so they work properly.
---
docs/changelog_v3.3.x.md | 9 ++++++++-
.../mcprison/prison/spigot/compat/Spigot18Player.java | 8 +++++++-
.../mcprison/prison/spigot/compat/Spigot19Player.java | 10 +++++++---
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index 28fcd442c..25b866f4b 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -13,7 +13,14 @@ These build logs represent the work that has been going on within prison.
*Will continue as v3.3.0-alpha.7 2021-06-?? in the near future.*
-# 3.2.11-alpha.1 2021-09-08
+# 3.2.11-alpha.1 2021-09-12
+
+
+* **For the actionBar and title, translate the color codes so they work properly.**
+
+
+* **Hook up the auto features notification to use the new actionBar interface.**
+This "should" prevent duplicate messages from being sent to the player while the same message is displayed in the actionbar.
* **Fixed an error about backpacks and lore transition:** A single lore was being used for the backpacks utility, if a server
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot18Player.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot18Player.java
index 4862f8e3d..32de7241f 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot18Player.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot18Player.java
@@ -5,6 +5,8 @@
import com.cryptomorin.xseries.messages.ActionBar;
import com.cryptomorin.xseries.messages.Titles;
+import tech.mcprison.prison.util.Text;
+
public abstract class Spigot18Player
extends CompatibilityCache
implements CompatibilityPlayer
@@ -43,6 +45,9 @@ public void setMaxHealth( Player player, double maxHealth ) {
public void sendTitle( Player player, String title, String subtitle, int fadeIn, int stay, int fadeOut ) {
//player.sendTitle( title, subtitle );
+ title = title == null ? null : Text.translateAmpColorCodes( title );
+ subtitle = subtitle == null ? null : Text.translateAmpColorCodes( subtitle );
+
Titles.sendTitle( player, fadeIn, stay, fadeOut, title, subtitle );
}
@@ -58,7 +63,8 @@ public void sendTitle( Player player, String title, String subtitle, int fadeIn,
@Override
public void sendActionBar( Player player, String actionBar ) {
- ActionBar.sendActionBar( player, actionBar );
+ String message = Text.translateAmpColorCodes( actionBar );
+ ActionBar.sendActionBar( player, message );
// Was using the following until it was replaced with XSeries' ActionBar:
// player.sendTitle( "", actionBar );
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot19Player.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot19Player.java
index 71a0cdb67..370aa8045 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot19Player.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot19Player.java
@@ -7,6 +7,8 @@
import com.cryptomorin.xseries.messages.ActionBar;
import com.cryptomorin.xseries.messages.Titles;
+import tech.mcprison.prison.util.Text;
+
public abstract class Spigot19Player
extends Spigot18Blocks
{
@@ -38,8 +40,9 @@ public double getMaxHealth( Player player ) {
//@SuppressWarnings( "deprecation" )
public void sendTitle( Player player, String title, String subtitle, int fadeIn, int stay, int fadeOut ) {
- //player.sendTitle( title, subtitle );
-
+ title = title == null ? null : Text.translateAmpColorCodes( title );
+ subtitle = subtitle == null ? null : Text.translateAmpColorCodes( subtitle );
+
Titles.sendTitle( player, fadeIn, stay, fadeOut, title, subtitle );
}
@@ -47,7 +50,8 @@ public void sendTitle( Player player, String title, String subtitle, int fadeIn,
@Override
public void sendActionBar( Player player, String actionBar ) {
- ActionBar.sendActionBar( player, actionBar );
+ String message = Text.translateAmpColorCodes( actionBar );
+ ActionBar.sendActionBar( player, message );
// Was using the following until it was replaced with XSeries' ActionBar:
// player.spigot().sendMessage( ChatMessageType.ACTION_BAR,
From 3e22fdad7645b969a4491c97b7c5ddaa40b1ac70 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Sun, 12 Sep 2021 11:46:46 -0400
Subject: [PATCH 058/283] Add placeholders {actionBar} and {title} to the
blockEvent listing of placeholders that can be used. They are shortcuts for
the new prison utils commands.
---
docs/changelog_v3.3.x.md | 4 ++++
.../java/tech/mcprison/prison/tasks/PrisonCommandTask.java | 2 ++
.../tech/mcprison/prison/mines/commands/MinesCommands.java | 2 +-
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index 25b866f4b..de5e964ec 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -16,6 +16,10 @@ These build logs represent the work that has been going on within prison.
# 3.2.11-alpha.1 2021-09-12
+* **Add placeholders {actionBar} and {title} to the blockEvent listing of placeholders that can be used.**
+They are shortcuts for the new prison utils commands.
+
+
* **For the actionBar and title, translate the color codes so they work properly.**
diff --git a/prison-core/src/main/java/tech/mcprison/prison/tasks/PrisonCommandTask.java b/prison-core/src/main/java/tech/mcprison/prison/tasks/PrisonCommandTask.java
index f0895ec1a..4644767d5 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/tasks/PrisonCommandTask.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/tasks/PrisonCommandTask.java
@@ -258,6 +258,8 @@ private String translateCommand( Player player, String command ) {
if ( player != null ) {
formatted = formatted
.replace( "{msg}", "prison utils msg {player} " )
+ .replace( "{actionBar}", "prison utils titles actionBar {player} " )
+ .replace( "{title}", "prison utils titles title {player} " )
.replace( "{player}", player.getName())
.replace( "{player_uid}", player.getUUID().toString())
.replace( "{utilsDecay}", "prison utils decay" );
diff --git a/prison-mines/src/main/java/tech/mcprison/prison/mines/commands/MinesCommands.java b/prison-mines/src/main/java/tech/mcprison/prison/mines/commands/MinesCommands.java
index e869ea795..112fe0ae8 100644
--- a/prison-mines/src/main/java/tech/mcprison/prison/mines/commands/MinesCommands.java
+++ b/prison-mines/src/main/java/tech/mcprison/prison/mines/commands/MinesCommands.java
@@ -3227,7 +3227,7 @@ public void blockEventRemove(CommandSender sender,
@Command(identifier = "mines blockEvent add", description = "Adds a BlockBreak command to a mine. " +
"For each block that is broke there will be a chance to run one of these commands. \n" +
- "To send messages use {msg} or {broadcast} followed by the formatted message. " +
+ "To send messages use {msg}, {broadcast}, {actionBar}, or {title} followed by the formatted message. " +
"Can use placeholders {player} and {player_uid}. Use ; between multiple commands. \n" +
"Example: &7\\Q'token give {player} 1;{msg} &7You got &31 &7token!;tpa a'\\E&3 \n" +
"This command defaults to no permission and 'sync' task mode; " +
From e31cdbedd1cee620fa25295143e986e19fb4526a Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Sun, 12 Sep 2021 13:45:23 -0400
Subject: [PATCH 059/283] Some initial work to setup the mine bombs configs.
---
docs/changelog_v3.3.x.md | 3 +
.../tech/mcprison/prison/file/FileIO.java | 22 ++++++-
.../tech/mcprison/prison/file/JsonFileIO.java | 5 ++
.../prison/spigot/bombs/MineBombData.java | 50 +++++++++++++-
.../prison/spigot/bombs/MineBombs.java | 66 +++++++++++++++++++
.../spigot/bombs/MineBombsConfigData.java | 25 +++++++
.../spigot/utils/PrisonUtilsMineBombs.java | 2 +-
7 files changed, 167 insertions(+), 6 deletions(-)
create mode 100644 prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombsConfigData.java
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index de5e964ec..2e62c933a 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -16,6 +16,9 @@ These build logs represent the work that has been going on within prison.
# 3.2.11-alpha.1 2021-09-12
+* **Some initial work to setup the mine bombs configs.**
+
+
* **Add placeholders {actionBar} and {title} to the blockEvent listing of placeholders that can be used.**
They are shortcuts for the new prison utils commands.
diff --git a/prison-core/src/main/java/tech/mcprison/prison/file/FileIO.java b/prison-core/src/main/java/tech/mcprison/prison/file/FileIO.java
index 75071c04f..67e0c98a6 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/file/FileIO.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/file/FileIO.java
@@ -9,6 +9,7 @@
import java.util.Date;
import java.util.List;
+import tech.mcprison.prison.Prison;
import tech.mcprison.prison.error.Error;
import tech.mcprison.prison.error.ErrorManager;
import tech.mcprison.prison.modules.ModuleStatus;
@@ -28,6 +29,11 @@ public FileIO()
this(null, null);
}
+ /**
+ *
+ * @param errorManager Optional; set to null if used outside of a module.
+ * @param status Optional; set to null if used outside of a module.
+ */
public FileIO(ErrorManager errorManager, ModuleStatus status)
{
super();
@@ -39,12 +45,24 @@ public FileIO(ErrorManager errorManager, ModuleStatus status)
}
+ public File getProjectRootDiretory() {
+ return Prison.get().getDataFolder();
+ }
+
+ public File getTempFile( File file ) {
+ String tempFileName = file.getName() + "." + getTimestampFormat() + ".tmp";
+ File tempFile = new File(file.getParentFile(), tempFileName);
+
+ return tempFile;
+ }
+
protected void saveFile( File file, String data )
{
if ( file != null && data != null )
{
- String tempFileName = file.getName() + "." + getTimestampFormat() + ".tmp";
- File tempFile = new File(file.getParentFile(), tempFileName);
+ File tempFile = getTempFile( file );
+// String tempFileName = file.getName() + "." + getTimestampFormat() + ".tmp";
+// File tempFile = new File(file.getParentFile(), tempFileName);
try
{
diff --git a/prison-core/src/main/java/tech/mcprison/prison/file/JsonFileIO.java b/prison-core/src/main/java/tech/mcprison/prison/file/JsonFileIO.java
index 04482a331..bc872b0e8 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/file/JsonFileIO.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/file/JsonFileIO.java
@@ -14,6 +14,11 @@ public class JsonFileIO
{
private final Gson gson;
+ /**
+ *
+ * @param errorManager Optional; set to null if used outside of a module.
+ * @param status Optional; set to null if used outside of a module.
+ */
public JsonFileIO(ErrorManager errorManager, ModuleStatus status)
{
super(errorManager, status);
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombData.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombData.java
index 93950d8a7..276e48cbf 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombData.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombData.java
@@ -37,12 +37,56 @@ public class MineBombData {
* a chance if it is to be included, or excluded.
*
*/
- private double chance;
+ // private double chance;
private String explosionShape;
-
-
+ public MineBombData() {
+ super();
+
+ }
+
+ public String getName() {
+ return name;
+ }
+ public void setName( String name ) {
+ this.name = name;
+ }
+
+ public String getItemType() {
+ return itemType;
+ }
+ public void setItemType( String itemType ) {
+ this.itemType = itemType;
+ }
+
+ public XMaterial getItem() {
+ return item;
+ }
+ public void setItem( XMaterial item ) {
+ this.item = item;
+ }
+
+ public List getLore() {
+ return lore;
+ }
+ public void setLore( List lore ) {
+ this.lore = lore;
+ }
+
+ public int getRadius() {
+ return radius;
+ }
+ public void setRadius( int radius ) {
+ this.radius = radius;
+ }
+
+ public String getExplosionShape() {
+ return explosionShape;
+ }
+ public void setExplosionShape( String explosionShape ) {
+ this.explosionShape = explosionShape;
+ }
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombs.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombs.java
index c41d94dd0..50b101b30 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombs.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombs.java
@@ -1,12 +1,22 @@
package tech.mcprison.prison.spigot.bombs;
+import java.io.File;
import java.util.ArrayList;
import java.util.List;
+import tech.mcprison.prison.file.JsonFileIO;
import tech.mcprison.prison.util.Location;
public class MineBombs
{
+ public static final String MINE_BOMBS_FILE_NAME = "mineBombsConifg.json";
+ public static final String MINE_BOMBS_PATH_NAME = "module_conf/mines";
+
+ private static MineBombs instance;
+
+ private MineBombsConfigData configData;
+
+
public enum ExplosionShape {
sphere,
@@ -14,7 +24,55 @@ public enum ExplosionShape {
;
}
+
+ private MineBombs() {
+ super();
+
+ loadConfigJson();
+ }
+ public static MineBombs getInstance() {
+ if ( instance == null ) {
+ synchronized ( MineBombs.class ) {
+ if ( instance == null ) {
+
+ instance = new MineBombs();
+ }
+ }
+ }
+ return instance;
+ }
+
+ public void saveConfigJson() {
+
+ JsonFileIO fio = new JsonFileIO( null, null );
+
+ File configFile = getConfigFile( fio );
+
+ fio.saveJsonFile( configFile, getConfigData() );
+
+ }
+
+ public File getConfigFile( JsonFileIO jsonFileIO ) {
+
+ File path = new File( jsonFileIO.getProjectRootDiretory(), MINE_BOMBS_PATH_NAME );
+ path.mkdirs();
+ File configFile = new File( path, MINE_BOMBS_FILE_NAME );
+
+ return configFile;
+ }
+
+ public void loadConfigJson() {
+ JsonFileIO fio = new JsonFileIO( null, null );
+
+ File configFile = getConfigFile( fio );
+
+ MineBombsConfigData configs =
+ (MineBombsConfigData) fio.readJsonFile( configFile, getConfigData() );
+
+ setConfigData( configs );
+ }
+
public List calculateSphere( Location loc, int radius, boolean hollow ) {
List results = new ArrayList<>();
@@ -48,4 +106,12 @@ public List calculateSphere( Location loc, int radius, boolean hollow
}
return results;
}
+
+ public MineBombsConfigData getConfigData() {
+ return configData;
+ }
+ public void setConfigData( MineBombsConfigData configData ) {
+ this.configData = configData;
+ }
+
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombsConfigData.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombsConfigData.java
new file mode 100644
index 000000000..22b5cecc7
--- /dev/null
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombsConfigData.java
@@ -0,0 +1,25 @@
+package tech.mcprison.prison.spigot.bombs;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import tech.mcprison.prison.file.FileIOData;
+
+public class MineBombsConfigData
+ implements FileIOData
+{
+ private Map bombs;
+
+ public MineBombsConfigData() {
+ super();
+
+ this.bombs = new TreeMap<>();
+ }
+
+ public Map getBombs() {
+ return bombs;
+ }
+ public void setBombs( Map bombs ) {
+ this.bombs = bombs;
+ }
+}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsMineBombs.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsMineBombs.java
index 8404aa488..4bb131728 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsMineBombs.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsMineBombs.java
@@ -100,7 +100,7 @@ public void utilsMineBombs( CommandSender sender,
radius = Integer.parseInt( radiusSize );
- MineBombs mBombs = new MineBombs();
+ MineBombs mBombs = MineBombs.getInstance();
SpigotWorld world = (SpigotWorld) location.getWorld();
From 7ca3d5889b14bbaf394c9f691cd00908f418b427 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Tue, 14 Sep 2021 11:35:47 -0400
Subject: [PATCH 060/283] Significant progress on Prison's Mine Bombs: Moved
the mine bombs primary classes to the prison core so it's accessible from all
packages. Setup 4 default mine bombs if the commands are used and there are
none defined. Setup a new /prison utils bomb commands to list all bombs and
to give players bombs. These are not complete and fully tested yet.
---
docs/changelog_v3.3.x.md | 8 +-
.../mcprison/prison}/bombs/MineBombData.java | 45 ++++++-
.../mcprison/prison}/bombs/MineBombs.java | 64 +++++++++-
.../prison}/bombs/MineBombsConfigData.java | 2 +-
.../spigot/utils/PrisonUtilsMineBombs.java | 116 +++++++++++++++++-
5 files changed, 222 insertions(+), 13 deletions(-)
rename {prison-spigot/src/main/java/tech/mcprison/prison/spigot => prison-core/src/main/java/tech/mcprison/prison}/bombs/MineBombData.java (65%)
rename {prison-spigot/src/main/java/tech/mcprison/prison/spigot => prison-core/src/main/java/tech/mcprison/prison}/bombs/MineBombs.java (53%)
rename {prison-spigot/src/main/java/tech/mcprison/prison/spigot => prison-core/src/main/java/tech/mcprison/prison}/bombs/MineBombsConfigData.java (90%)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index 2e62c933a..0d86e464c 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -13,7 +13,13 @@ These build logs represent the work that has been going on within prison.
*Will continue as v3.3.0-alpha.7 2021-06-?? in the near future.*
-# 3.2.11-alpha.1 2021-09-12
+# 3.2.11-alpha.1 2021-09-14
+
+
+* **Significant progress on Prison's Mine Bombs:**
+Moved the mine bombs primary classes to the prison core so it's accessible from all packages.
+Setup 4 default mine bombs if the commands are used and there are none defined.
+Setup a new /prison utils bomb commands to list all bombs and to give players bombs. These are not complete and fully tested yet.
* **Some initial work to setup the mine bombs configs.**
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombData.java b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombData.java
similarity index 65%
rename from prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombData.java
rename to prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombData.java
index 276e48cbf..3edc31be7 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombData.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombData.java
@@ -1,8 +1,9 @@
-package tech.mcprison.prison.spigot.bombs;
+package tech.mcprison.prison.bombs;
+import java.util.ArrayList;
import java.util.List;
-import com.cryptomorin.xseries.XMaterial;
+import tech.mcprison.prison.internal.block.PrisonBlock;
public class MineBombData {
@@ -20,7 +21,7 @@ public class MineBombData {
* for the bomb. This is converted from the String itemType.
*
*/
- private transient XMaterial item;
+ private transient PrisonBlock item;
private List lore;
@@ -42,10 +43,37 @@ public class MineBombData {
private String explosionShape;
+
+ private String description;
+
+
public MineBombData() {
super();
}
+
+
+ public MineBombData( String name, String itemType, String explosionShape,
+ int radius, String... lores ) {
+ this();
+
+ this.name = name;
+ this.itemType = itemType;
+
+ this.explosionShape = explosionShape;
+ this.radius = radius;
+
+ this.lore = new ArrayList<>();
+
+ if ( lores != null ) {
+ for ( String l : lores ) {
+ this.lore.add( l );
+ }
+ }
+
+ }
+
+
public String getName() {
return name;
@@ -61,10 +89,10 @@ public void setItemType( String itemType ) {
this.itemType = itemType;
}
- public XMaterial getItem() {
+ public PrisonBlock getItem() {
return item;
}
- public void setItem( XMaterial item ) {
+ public void setItem( PrisonBlock item ) {
this.item = item;
}
@@ -88,5 +116,12 @@ public String getExplosionShape() {
public void setExplosionShape( String explosionShape ) {
this.explosionShape = explosionShape;
}
+
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription( String description ) {
+ this.description = description;
+ }
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombs.java b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java
similarity index 53%
rename from prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombs.java
rename to prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java
index 50b101b30..68918bc5a 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombs.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java
@@ -1,15 +1,16 @@
-package tech.mcprison.prison.spigot.bombs;
+package tech.mcprison.prison.bombs;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import tech.mcprison.prison.file.JsonFileIO;
+import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.util.Location;
public class MineBombs
{
- public static final String MINE_BOMBS_FILE_NAME = "mineBombsConifg.json";
+ public static final String MINE_BOMBS_FILE_NAME = "mineBombsConfig.json";
public static final String MINE_BOMBS_PATH_NAME = "module_conf/mines";
private static MineBombs instance;
@@ -28,6 +29,8 @@ public enum ExplosionShape {
private MineBombs() {
super();
+ this.configData = new MineBombsConfigData();
+
loadConfigJson();
}
@@ -67,10 +70,21 @@ public void loadConfigJson() {
File configFile = getConfigFile( fio );
- MineBombsConfigData configs =
- (MineBombsConfigData) fio.readJsonFile( configFile, getConfigData() );
+ if ( !configFile.exists() ) {
+ setupDefaultMineBombData();
+ }
- setConfigData( configs );
+ else {
+
+ MineBombsConfigData configs =
+ (MineBombsConfigData) fio.readJsonFile( configFile, getConfigData() );
+
+ if ( configs != null && configs.getBombs().size() > 0 ) {
+
+ getConfigData().getBombs().putAll( configs.getBombs() );
+
+ }
+ }
}
public List calculateSphere( Location loc, int radius, boolean hollow ) {
@@ -106,6 +120,46 @@ public List calculateSphere( Location loc, int radius, boolean hollow
}
return results;
}
+
+ public void setupDefaultMineBombData()
+ {
+ if ( getConfigData().getBombs().size() == 0 ) {
+
+ MineBombData mbDataSmall = new MineBombData(
+ "SmallBomb", "brewing_stand", "sphere", 2, "Small Mine Bomb" );
+ mbDataSmall.setDescription("A small mine bomb made with some chemicals and a brewing stand.");
+
+ MineBombData mbDataMedium = new MineBombData(
+ "MediumBomb", "fireworks", "sphere", 5, "Medium Mine Bomb" );
+ mbDataMedium.setDescription("A medium mine bomb made from leftover fireworks, " +
+ "but supercharged with a strange green glowing liquid.");
+
+ MineBombData mbDataLarge = new MineBombData(
+ "LargeBomb", "tnt", "sphereHollow", 12, "Large Mine Bomb" );
+ mbDataLarge.setDescription("A large mine bomb made from TNT with some strange parts " +
+ "that maybe be " +
+ "described as alien technology.");
+
+ MineBombData mbDataOof = new MineBombData(
+ "OofBomb", "tnt_minecard", "sphereHollow", 19, "Oof Mine Bomb" );
+ mbDataOof.setDescription("An oof-ably large mine bomb made with a minecart heaping with TNT. " +
+ "Unlike the large mine bomb, this one obviously is built with alien technology.");
+
+
+ getConfigData().getBombs().put( mbDataSmall.getName(), mbDataSmall );
+ getConfigData().getBombs().put( mbDataMedium.getName(), mbDataMedium );
+ getConfigData().getBombs().put( mbDataLarge.getName(), mbDataLarge );
+ getConfigData().getBombs().put( mbDataOof.getName(), mbDataOof );
+
+ saveConfigJson();
+
+ Output.get().logInfo( "Mine bombs: setup default values." );
+ }
+ else {
+ Output.get().logInfo( "Could not generate a mine bombs save file since at least one already exists." );
+ }
+
+ }
public MineBombsConfigData getConfigData() {
return configData;
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombsConfigData.java b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombsConfigData.java
similarity index 90%
rename from prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombsConfigData.java
rename to prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombsConfigData.java
index 22b5cecc7..07c4fea5b 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bombs/MineBombsConfigData.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombsConfigData.java
@@ -1,4 +1,4 @@
-package tech.mcprison.prison.spigot.bombs;
+package tech.mcprison.prison.bombs;
import java.util.Map;
import java.util.TreeMap;
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsMineBombs.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsMineBombs.java
index 4bb131728..218bf375f 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsMineBombs.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsMineBombs.java
@@ -2,16 +2,18 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import org.bukkit.Bukkit;
+import tech.mcprison.prison.bombs.MineBombData;
+import tech.mcprison.prison.bombs.MineBombs;
import tech.mcprison.prison.commands.Arg;
import tech.mcprison.prison.commands.Command;
import tech.mcprison.prison.internal.CommandSender;
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.api.ExplosiveBlockBreakEvent;
import tech.mcprison.prison.spigot.block.SpigotBlock;
-import tech.mcprison.prison.spigot.bombs.MineBombs;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.game.SpigotWorld;
import tech.mcprison.prison.util.Location;
@@ -128,6 +130,118 @@ public void utilsMineBombs( CommandSender sender,
}
}
+
+
+ @Command(identifier = "prison utils bomb list",
+ description = "A list of all available bombs.",
+ onlyPlayers = false,
+ permissions = "prison.utils.bombs" )
+ public void utilsMineBombsList( CommandSender sender
+
+ ) {
+
+ if ( !isEnableMineBombs() ) {
+
+ Output.get().logInfo( "Prison's utils command mine bombs is disabled in modules.yml." );
+ }
+ else {
+
+ MineBombs mBombs = MineBombs.getInstance();
+
+ Set keys = mBombs.getConfigData().getBombs().keySet();
+ for ( String key : keys ) {
+
+ MineBombData bomb = mBombs.getConfigData().getBombs().get( key );
+
+ String message = String.format(
+ "%-12s %-7s Radius= %s (%s)\n %s",
+ bomb.getName(), bomb.getExplosionShape(), Integer.toString(bomb.getRadius()),
+ bomb.getItemType(), bomb.getDescription() );
+
+ sender.sendMessage( message );
+ }
+
+ }
+ }
+
+
+ @Command(identifier = "prison utils bomb give",
+ description = "Gives the player a mine bomb. Can also provide a list of " +
+ "all available bombs.",
+ onlyPlayers = false,
+ permissions = "prison.utils.bombs",
+ altPermissions = "prison.utils.bombs.others")
+ public void utilsMineBombsGive( CommandSender sender,
+ @Arg(name = "playerName", description = "Player name") String playerName,
+
+ @Arg(name = "bombName", description = "The bomb name, or 'list' to show all available " +
+ "bombs. [round]",
+ def = "list") String bombName,
+ @Arg(name = "quantity", description = "Quantity of bombs to give. [1 > +]",
+ def = "1" )
+ String quantity
+
+ ) {
+
+ if ( !isEnableMineBombs() ) {
+
+ Output.get().logInfo( "Prison's utils command mine bombs is disabled in modules.yml." );
+ }
+ else {
+
+
+ if ( "list".equalsIgnoreCase( bombName ) ) {
+
+ utilsMineBombsList( sender );
+ return;
+ }
+
+ SpigotPlayer player = checkPlayerPerms( sender, playerName,
+ "prison.utils.bomb", "prison.utils.bomb.others" );
+
+ if ( player != null ) {
+
+ if ( playerName != null && !playerName.equalsIgnoreCase( player.getName() ) ) {
+ // Need to shift the player's name over to the message:
+
+ }
+
+
+ if ( bombName == null ) {
+ Output.get().logInfo( "Prison utils giveBomb: You need to specify a bomb name, or " +
+ "use 'list' to show all available bombs. " );
+ return;
+ }
+
+ int count = 1;
+
+ count = Integer.parseInt( quantity );
+
+ MineBombs mBombs = MineBombs.getInstance();
+
+
+// if ( "list".equalsIgnoreCase( bombName ) ) {
+//
+// Set keys = mBombs.getConfigData().getBombs().keySet();
+// for ( String key : keys ) {
+//
+// MineBombData bomb = mBombs.getConfigData().getBombs().get( key );
+//
+// String message = String.format(
+// "%-12s %-7s Radius= %s (%s)\n %s",
+// bomb.getName(), bomb.getExplosionShape(), Integer.toString(bomb.getRadius()),
+// bomb.getItemType(), bomb.getDescription() );
+//
+// sender.sendMessage( message );
+// }
+// }
+
+
+ }
+ }
+ }
+
+
public boolean isEnableMineBombs() {
return enableMineBombs;
}
From 2690945898a347a13597facc2243ecb5ba22cf3b Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Thu, 23 Sep 2021 23:00:01 -0400
Subject: [PATCH 061/283] Able to give players bombs, based upon the item type
as defined for the bomb.
---
docs/changelog_v3.3.x.md | 5 +-
.../tech/mcprison/prison/bombs/MineBombs.java | 15 +--
.../spigot/utils/PrisonUtilsMineBombs.java | 91 ++++++++++++++++++-
3 files changed, 100 insertions(+), 11 deletions(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index 0d86e464c..c66fbd3de 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -13,7 +13,10 @@ These build logs represent the work that has been going on within prison.
*Will continue as v3.3.0-alpha.7 2021-06-?? in the near future.*
-# 3.2.11-alpha.1 2021-09-14
+# 3.2.11-alpha.1 2021-09-23
+
+
+* **Able to give players bombs, based upon the item type as defined for the bomb.**
* **Significant progress on Prison's Mine Bombs:**
diff --git a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java
index 68918bc5a..8cb245cfd 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java
@@ -130,7 +130,7 @@ public void setupDefaultMineBombData()
mbDataSmall.setDescription("A small mine bomb made with some chemicals and a brewing stand.");
MineBombData mbDataMedium = new MineBombData(
- "MediumBomb", "fireworks", "sphere", 5, "Medium Mine Bomb" );
+ "MediumBomb", "firework_rocket", "sphere", 5, "Medium Mine Bomb" );
mbDataMedium.setDescription("A medium mine bomb made from leftover fireworks, " +
"but supercharged with a strange green glowing liquid.");
@@ -141,22 +141,23 @@ public void setupDefaultMineBombData()
"described as alien technology.");
MineBombData mbDataOof = new MineBombData(
- "OofBomb", "tnt_minecard", "sphereHollow", 19, "Oof Mine Bomb" );
+ "OofBomb", "tnt_minecart", "sphereHollow", 19, "Oof Mine Bomb" );
mbDataOof.setDescription("An oof-ably large mine bomb made with a minecart heaping with TNT. " +
"Unlike the large mine bomb, this one obviously is built with alien technology.");
- getConfigData().getBombs().put( mbDataSmall.getName(), mbDataSmall );
- getConfigData().getBombs().put( mbDataMedium.getName(), mbDataMedium );
- getConfigData().getBombs().put( mbDataLarge.getName(), mbDataLarge );
- getConfigData().getBombs().put( mbDataOof.getName(), mbDataOof );
+ getConfigData().getBombs().put( mbDataSmall.getName().toLowerCase(), mbDataSmall );
+ getConfigData().getBombs().put( mbDataMedium.getName().toLowerCase(), mbDataMedium );
+ getConfigData().getBombs().put( mbDataLarge.getName().toLowerCase(), mbDataLarge );
+ getConfigData().getBombs().put( mbDataOof.getName().toLowerCase(), mbDataOof );
saveConfigJson();
Output.get().logInfo( "Mine bombs: setup default values." );
}
else {
- Output.get().logInfo( "Could not generate a mine bombs save file since at least one already exists." );
+ Output.get().logInfo( "Could not generate a mine bombs save file since at least one " +
+ "mine bomb already exists." );
}
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsMineBombs.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsMineBombs.java
index 218bf375f..ffd0fe244 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsMineBombs.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsMineBombs.java
@@ -6,14 +6,18 @@
import org.bukkit.Bukkit;
+import com.cryptomorin.xseries.XMaterial;
+
import tech.mcprison.prison.bombs.MineBombData;
import tech.mcprison.prison.bombs.MineBombs;
import tech.mcprison.prison.commands.Arg;
import tech.mcprison.prison.commands.Command;
import tech.mcprison.prison.internal.CommandSender;
+import tech.mcprison.prison.output.LogLevel;
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.api.ExplosiveBlockBreakEvent;
import tech.mcprison.prison.spigot.block.SpigotBlock;
+import tech.mcprison.prison.spigot.block.SpigotItemStack;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.game.SpigotWorld;
import tech.mcprison.prison.util.Location;
@@ -154,11 +158,13 @@ public void utilsMineBombsList( CommandSender sender
MineBombData bomb = mBombs.getConfigData().getBombs().get( key );
String message = String.format(
- "%-12s %-7s Radius= %s (%s)\n %s",
+ "%-12s %-7s Radius= %s (%s)\n %s",
bomb.getName(), bomb.getExplosionShape(), Integer.toString(bomb.getRadius()),
bomb.getItemType(), bomb.getDescription() );
- sender.sendMessage( message );
+// sender.sendMessage( message );
+
+ Output.get().log( message, LogLevel.PLAIN );
}
}
@@ -175,7 +181,7 @@ public void utilsMineBombsGive( CommandSender sender,
@Arg(name = "playerName", description = "Player name") String playerName,
@Arg(name = "bombName", description = "The bomb name, or 'list' to show all available " +
- "bombs. [round]",
+ "bombs. [list]",
def = "list") String bombName,
@Arg(name = "quantity", description = "Quantity of bombs to give. [1 > +]",
def = "1" )
@@ -213,12 +219,91 @@ public void utilsMineBombsGive( CommandSender sender,
return;
}
+
int count = 1;
count = Integer.parseInt( quantity );
MineBombs mBombs = MineBombs.getInstance();
+ MineBombData bomb = mBombs.getConfigData().getBombs().get( bombName );
+
+ if ( bomb != null ) {
+
+ XMaterial xBomb = XMaterial.matchXMaterial( bomb.getItemType() ).orElse( null );
+
+ if ( xBomb != null ) {
+
+ SpigotItemStack bombs = new SpigotItemStack( xBomb.parseItem() );
+ if ( bombs != null ) {
+
+ bombs.setDisplayName( bomb.getName() );
+ bombs.setAmount( count );
+
+
+ List lore = bombs.getLore();
+
+ lore.add( "&4Prison Mine Bomb:" );
+ lore.add( " &7" + bomb.getName() );
+ lore.add( " " );
+
+ lore.add( "Size, Diameter: " + ( 1 + 2 * bomb.getRadius()) );
+ lore.add( "Shape: " + bomb.getExplosionShape() );
+
+ String[] desc = bomb.getDescription().split( " " );
+ StringBuilder sb = new StringBuilder();
+
+ for ( String d : desc ) {
+
+ sb.append( d ).append( " " );
+
+ if ( sb.length() > 30 ) {
+ sb.insert( 0, " " );
+
+ lore.add( sb.toString() );
+ sb.setLength( 0 );
+ }
+ }
+ if ( sb.length() > 0 ) {
+ sb.insert( 0, " " );
+
+ lore.add( sb.toString() );
+ }
+// lore.add( " " + bomb.getDescription() );
+
+ lore.add( " " );
+
+ bombs.setLore( lore );
+
+
+ player.getInventory().addItem( bombs );
+ }
+
+// else {
+//
+// String message = "A mine bomb with the name of %s, is unable to generate an ItemStack. ";
+//
+// sender.sendMessage( String.format( message, bombName) );
+// }
+
+ }
+
+ else {
+
+ String message = "A mine bomb with the name of %s, has an invalid itemType value. " +
+ "'%s' does not exist in the XMaterial types. Contact Prison support for help " +
+ "in finding the correct values to use. Google: 'XSeries XMaterial'";
+
+ sender.sendMessage( String.format( message, bombName, bomb.getItemType() ) );
+ }
+
+ }
+
+ else {
+ String message = "A mine bomb with the name of %s does not exist.";
+
+ sender.sendMessage( String.format( message, bombName ) );
+ }
// if ( "list".equalsIgnoreCase( bombName ) ) {
//
From cfb0ad16e4346ebeeb4f16aebc31a826826882a8 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Sat, 25 Sep 2021 01:12:48 -0400
Subject: [PATCH 062/283] Add a new feature to the PrisonSpigotAPI to allow for
the creation of a new mine through the API. This could be used to generate
player mines in a plot world.
---
docs/changelog_v3.3.x.md | 7 +-
.../prison/spigot/api/PrisonSpigotAPI.java | 72 ++++++++++++++++++-
2 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index c66fbd3de..8426f751e 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -13,7 +13,12 @@ These build logs represent the work that has been going on within prison.
*Will continue as v3.3.0-alpha.7 2021-06-?? in the near future.*
-# 3.2.11-alpha.1 2021-09-23
+# 3.2.11-alpha.1 2021-09-25
+
+
+* **Add a new feature to the PrisonSpigotAPI to allow for the creation of a new mine through the API.**
+This could be used to generate player mines in a plot world.
+
* **Able to give players bombs, based upon the item type as defined for the bomb.**
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/api/PrisonSpigotAPI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/api/PrisonSpigotAPI.java
index 2d2091b7a..9347363d9 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/api/PrisonSpigotAPI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/api/PrisonSpigotAPI.java
@@ -6,6 +6,7 @@
import java.util.TreeMap;
import org.bukkit.Material;
+import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
@@ -18,17 +19,21 @@
import tech.mcprison.prison.mines.managers.MineManager;
import tech.mcprison.prison.mines.managers.MineManager.MineSortOrder;
import tech.mcprison.prison.modules.Module;
+import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.ranks.PrisonRanks;
import tech.mcprison.prison.ranks.data.Rank;
import tech.mcprison.prison.ranks.data.RankPlayer;
import tech.mcprison.prison.ranks.managers.PlayerManager;
import tech.mcprison.prison.ranks.managers.RankManager;
+import tech.mcprison.prison.selection.Selection;
import tech.mcprison.prison.spigot.SpigotPrison;
import tech.mcprison.prison.spigot.backpacks.BackpacksUtil;
import tech.mcprison.prison.spigot.block.SpigotBlock;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
+import tech.mcprison.prison.spigot.game.SpigotWorld;
import tech.mcprison.prison.spigot.sellall.SellAllUtil;
import tech.mcprison.prison.util.BlockType;
+import tech.mcprison.prison.util.Location;
import tech.mcprison.prison.util.MaterialType;
/**
@@ -163,7 +168,7 @@ public String getPrisonBlockName( String blockName ) {
}
/**
- * Provides a list of all mines that contains the specfied block.
+ *
Provides a list of all mines that contains the specified block.
*
*
* @param prisonBlockName - The prison block name
@@ -309,6 +314,71 @@ public Mine getPrisonMine( Player player, Block block, boolean isCanceledEvent)
return results;
}
+ /**
+ * This creates a prison Location. It must include a valid world, and
+ * then the x, y, z coordinates.
+ *
+ *
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
+ public Location createLocation( World world, int x, int y, int z ) {
+ Location results = null;
+
+ if ( world != null ) {
+
+ results = new Location( new SpigotWorld(world), x, y, z );
+ }
+ return results;
+ }
+
+ /**
+ * This creates a mine at the given two coordinates. The provided tag
+ * value is optional. Minimal checks are performed. This checks to ensure the
+ * mines module is active, and a mine by the same name does not exist.
+ *
+ *
+ * @param mineName
+ * @param tag
+ * @param location1
+ * @param location2
+ * @return
+ */
+ public boolean createMine( String mineName, String tag,
+ Location location1, Location location2 ) {
+ boolean results = false;
+
+ if ( mineName != null && tag != null && location1 != null && location2 != null ) {
+ PrisonMines mm = getPrisonMineManager();
+ if ( mm != null ) {
+
+ if ( mm.getMine(mineName) != null) {
+
+ String message = String.format( "Cannot create requested mine. " +
+ "Mine already exists by the name of '%s'.",
+ mineName);
+ Output.get().logError( message );
+
+ }
+ else {
+ Selection selection = new Selection( location1, location2 );
+
+ Mine mine = new Mine(mineName, selection);
+
+ if ( tag != null ) {
+ mine.setTag( tag );
+ }
+
+ mm.getMineManager().add(mine);
+ }
+ }
+ }
+
+ return results;
+ }
private TreeMap getPlayerCache() {
return getPrisonMineManager().getPlayerCache();
From f8151d0328b7c4c831cc6292f0a00324aebe5850 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Sun, 26 Sep 2021 12:02:32 -0400
Subject: [PATCH 063/283] Added a listener for PlayerInteractEvent.
---
docs/changelog_v3.3.x.md | 5 ++++-
.../java/tech/mcprison/prison/PrisonCommand.java | 7 ++++++-
.../prison/internal/platform/Platform.java | 2 ++
.../java/tech/mcprison/prison/TestPlatform.java | 5 +++++
.../mcprison/prison/spigot/SpigotPlatform.java | 15 +++++++++++++++
5 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index 8426f751e..46e751281 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -13,7 +13,10 @@ These build logs represent the work that has been going on within prison.
*Will continue as v3.3.0-alpha.7 2021-06-?? in the near future.*
-# 3.2.11-alpha.1 2021-09-25
+# 3.2.11-alpha.1 2021-09-26
+
+
+* **Added a listener for PlayerInteractEvent.**
* **Add a new feature to the PrisonSpigotAPI to allow for the creation of a new mine through the API.**
diff --git a/prison-core/src/main/java/tech/mcprison/prison/PrisonCommand.java b/prison-core/src/main/java/tech/mcprison/prison/PrisonCommand.java
index e28d7cf16..9cf417f3f 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/PrisonCommand.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/PrisonCommand.java
@@ -1473,7 +1473,7 @@ public void supportListenersDump(CommandSender sender,
description = "Provides a detailed list of all registered event listeners for" +
"the various event types. BlockBreak listeners will include all " +
"listeners that are being monitored within auto features. " +
- "[blockBreak, traceBlockBreak, chat]"
+ "[blockBreak, traceBlockBreak, chat, playerInteract]"
) String listener
) {
@@ -1502,6 +1502,11 @@ public void supportListenersDump(CommandSender sender,
return;
}
+ if ( "playerInteract".equalsIgnoreCase( listener ) ) {
+
+ results = Prison.get().getPlatform().dumpEventListenersPlayerInteractEvents();
+ }
+
if ( results != null ) {
for ( String line : results.split( "\n" ) ) {
diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/platform/Platform.java b/prison-core/src/main/java/tech/mcprison/prison/internal/platform/Platform.java
index ba68215d0..5b47f64b2 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/internal/platform/Platform.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/internal/platform/Platform.java
@@ -370,6 +370,8 @@ public void autoCreateMineLinerAssignment( List rankMineNames,
public void traceEventListenersBlockBreakEvents( CommandSender sender );
+ public String dumpEventListenersPlayerInteractEvents();
+
public void testPlayerUtil( UUID uuid );
diff --git a/prison-core/src/test/java/tech/mcprison/prison/TestPlatform.java b/prison-core/src/test/java/tech/mcprison/prison/TestPlatform.java
index a0b2b64fe..789021ced 100644
--- a/prison-core/src/test/java/tech/mcprison/prison/TestPlatform.java
+++ b/prison-core/src/test/java/tech/mcprison/prison/TestPlatform.java
@@ -361,6 +361,11 @@ public void traceEventListenersBlockBreakEvents( CommandSender sender ) {
}
+ @Override
+ public String dumpEventListenersPlayerInteractEvents() {
+ return "";
+ }
+
@Override
public void testPlayerUtil( UUID uuid ) {
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPlatform.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPlatform.java
index e33f11467..3238d249d 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPlatform.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPlatform.java
@@ -42,6 +42,7 @@
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerChatEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredListener;
@@ -2138,6 +2139,20 @@ public String dumpEventListenersPlayerChatEvents() {
return sb.toString();
}
+ @Override
+ public String dumpEventListenersPlayerInteractEvents() {
+ StringBuilder sb = new StringBuilder();
+
+ ChatDisplay eventDisplay = dumpEventListenersChatDisplay(
+ "PlayerInteractEvent",
+ new SpigotHandlerList( PlayerInteractEvent.getHandlerList()) );
+ if ( eventDisplay != null ) {
+ sb.append( eventDisplay.toStringBuilder() );
+ }
+
+ return sb.toString();
+ }
+
/**
* Some information on events...
*
From a7d8653e9df6909e70b8cd004c6cf8e7c5c4a242 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Sun, 26 Sep 2021 12:10:41 -0400
Subject: [PATCH 064/283] Mine Bombs: Initial setup of placing bombs to
activate them. Not yet functional.
---
.../mcprison/prison/bombs/MineBombData.java | 18 +
.../tech/mcprison/prison/bombs/MineBombs.java | 26 +-
.../spigot/api/ExplosiveBlockBreakEvent.java | 10 +
.../spigot/utils/PrisonBombListener.java | 100 +++++
.../spigot/utils/PrisonUtilsMineBombs.java | 358 +++++++++++++++---
.../spigot/utils/PrisonUtilsModule.java | 6 +
6 files changed, 460 insertions(+), 58 deletions(-)
create mode 100644 prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java
diff --git a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombData.java b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombData.java
index 3edc31be7..c3cfc1bef 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombData.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombData.java
@@ -47,6 +47,9 @@ public class MineBombData {
private String description;
+ private boolean activated = false;
+
+
public MineBombData() {
super();
@@ -74,6 +77,14 @@ public MineBombData( String name, String itemType, String explosionShape,
}
+ public MineBombData clone() {
+ MineBombData cloned = new MineBombData( getName(), getItemType(), getExplosionShape(),
+ getRadius() );
+ for ( String l : lore ) {
+ cloned.getLore().add( l );
+ }
+ return cloned;
+ }
public String getName() {
return name;
@@ -123,5 +134,12 @@ public String getDescription() {
public void setDescription( String description ) {
this.description = description;
}
+
+ public boolean isActivated() {
+ return activated;
+ }
+ public void setActivated( boolean activated ) {
+ this.activated = activated;
+ }
}
diff --git a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java
index 8cb245cfd..df38267a9 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java
@@ -15,7 +15,7 @@ public class MineBombs
private static MineBombs instance;
- private MineBombsConfigData configData;
+ private final MineBombsConfigData configData;
@@ -46,6 +46,27 @@ public static MineBombs getInstance() {
return instance;
}
+ /**
+ * This finds a bomb with the given name, and returns a clone. The clone is
+ * important since individual instances will set the isActivated() variable to
+ * true if the bomb is active. If it's activated, then that indicates the
+ * bomb will be used and the bomb was removed from the player's inventory.
+ *
+ *
+ * @param bombName
+ * @return
+ */
+ public MineBombData findBomb( String bombName ) {
+ MineBombData bombOriginal = null;
+
+ if ( bombName != null ) {
+
+ bombOriginal = getConfigData().getBombs().get( bombName.toLowerCase() );
+ }
+
+ return bombOriginal.clone();
+ }
+
public void saveConfigJson() {
JsonFileIO fio = new JsonFileIO( null, null );
@@ -165,8 +186,5 @@ public void setupDefaultMineBombData()
public MineBombsConfigData getConfigData() {
return configData;
}
- public void setConfigData( MineBombsConfigData configData ) {
- this.configData = configData;
- }
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/api/ExplosiveBlockBreakEvent.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/api/ExplosiveBlockBreakEvent.java
index b2543ff78..8301952c2 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/api/ExplosiveBlockBreakEvent.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/api/ExplosiveBlockBreakEvent.java
@@ -9,6 +9,8 @@
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.BlockBreakEvent;
+import tech.mcprison.prison.bombs.MineBombData;
+
/**
* This is an example of an explosive event that should be used for
* enchantments that will break more than one block at a time.
@@ -50,6 +52,7 @@ public class ExplosiveBlockBreakEvent
private String triggeredBy;
+ private MineBombData mineBomb;
public ExplosiveBlockBreakEvent( Block theBlock, Player player,
List explodedBlocks, String triggeredBy ) {
@@ -104,6 +107,13 @@ public void setTriggeredBy( String triggeredBy ) {
this.triggeredBy = triggeredBy;
}
+ public MineBombData getMineBomb() {
+ return mineBomb;
+ }
+ public void setMineBomb( MineBombData mineBomb ) {
+ this.mineBomb = mineBomb;
+ }
+
@Override
public HandlerList getHandlers(){
return handlers;
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java
new file mode 100644
index 000000000..e40c5c899
--- /dev/null
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java
@@ -0,0 +1,100 @@
+package tech.mcprison.prison.spigot.utils;
+
+import java.text.DecimalFormat;
+
+import org.bukkit.entity.Item;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.Action;
+import org.bukkit.event.player.PlayerInteractEvent;
+
+import tech.mcprison.prison.bombs.MineBombData;
+import tech.mcprison.prison.spigot.block.SpigotBlock;
+import tech.mcprison.prison.spigot.block.SpigotItemStack;
+import tech.mcprison.prison.spigot.game.SpigotPlayer;
+
+/**
+ * This listener class handles the player's interaction with using a bomb.
+ *
+ *
+ *
+ * Some of the inspiration for the handling of player's bomb was found in the
+ * following open source project:
+ * https://github.com/hpfxd/bombs/blob/master/src/main/java/xyz/tooger/bombs/BombListener.java
+ *
+ *
+ */
+public class PrisonBombListener
+ implements Listener
+{
+
+ @EventHandler( priority = EventPriority.LOW )
+ public void onInteract(PlayerInteractEvent event) {
+ if ( !event.getPlayer().hasPermission("prison.minebombs.use") ) {
+ return;
+ }
+
+ if ( event.getAction().equals(Action.RIGHT_CLICK_BLOCK) || event.getAction().equals(Action.RIGHT_CLICK_AIR) ) {
+
+ // If the player is holding a mine bomb, then get the bomb and decrease the
+ // ItemStack in the player's hand by 1:
+ MineBombData bomb = PrisonUtilsMineBombs.getBombInHand( event.getPlayer() );
+
+ if ( bomb != null ) {
+
+ Player player = event.getPlayer();
+
+ SpigotPlayer sPlayer = new SpigotPlayer( player );
+
+ // if the bomb is not activated, then that indicates that the players is
+ // under a cooldown and the bomb cannot be used, nor has it been removed from their
+ // inventory.
+ if ( bomb.isActivated() ) {
+
+
+ SpigotItemStack bombs = PrisonUtilsMineBombs.getItemStackBomb( bomb );
+
+ if ( bombs != null ) {
+
+ SpigotBlock sBlock = new SpigotBlock( event.getClickedBlock() );
+
+
+ int throwSpeed = 2;
+
+ final Item dropped = player.getWorld().dropItem(player.getLocation(), bombs.getBukkitStack() );
+ dropped.setVelocity(player.getLocation().getDirection().multiply( throwSpeed ).normalize() );
+ dropped.setPickupDelay( 50000 );
+
+
+ PrisonUtilsMineBombs.setoffBombDelayed( sPlayer, bomb, dropped, sBlock, throwSpeed );
+
+ }
+ }
+ else {
+
+ String playerUUID = player.getUniqueId().toString();
+ int cooldownTicks = PrisonUtilsMineBombs.checkPlayerCooldown( playerUUID );
+ float cooldownSeconds = cooldownTicks / 2.0f;
+ DecimalFormat dFmt = new DecimalFormat( "0.0" );
+
+ String message =
+ String.format( "You cannot use another Prison Mine Bomb for %s seconds.",
+ dFmt.format( cooldownSeconds ) );
+ sPlayer.sendMessage( message );
+ }
+
+ }
+
+ else {
+
+ // Do nothing since this means the event is not Prison Mine Bomb related.
+ }
+
+
+
+
+ }
+ }
+}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsMineBombs.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsMineBombs.java
index ffd0fe244..a195b6abc 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsMineBombs.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsMineBombs.java
@@ -2,9 +2,14 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
import org.bukkit.Bukkit;
+import org.bukkit.entity.Item;
+import org.bukkit.entity.Player;
+import org.bukkit.scheduler.BukkitRunnable;
import com.cryptomorin.xseries.XMaterial;
@@ -15,9 +20,11 @@
import tech.mcprison.prison.internal.CommandSender;
import tech.mcprison.prison.output.LogLevel;
import tech.mcprison.prison.output.Output;
+import tech.mcprison.prison.spigot.SpigotPrison;
import tech.mcprison.prison.spigot.api.ExplosiveBlockBreakEvent;
import tech.mcprison.prison.spigot.block.SpigotBlock;
import tech.mcprison.prison.spigot.block.SpigotItemStack;
+import tech.mcprison.prison.spigot.compat.SpigotCompatibility;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.game.SpigotWorld;
import tech.mcprison.prison.util.Location;
@@ -25,8 +32,14 @@
public class PrisonUtilsMineBombs
extends PrisonUtils
{
+ public static final String MINE_BOMBS_LORE_1 = "&4Prison Mine Bomb:";
+ public static final String MINE_BOMBS_LORE_2_PREFIX = " &7";
+ public static final int MINE_BOMBS_COOLDOWN_TICKS = 15 * 20; // 15 seconds
+
private boolean enableMineBombs = false;
+ public static final Map playerCooldowns = new TreeMap<>();
+
public PrisonUtilsMineBombs() {
super();
@@ -230,64 +243,14 @@ public void utilsMineBombsGive( CommandSender sender,
if ( bomb != null ) {
- XMaterial xBomb = XMaterial.matchXMaterial( bomb.getItemType() ).orElse( null );
+ SpigotItemStack bombs = getItemStackBomb( bomb );
- if ( xBomb != null ) {
-
- SpigotItemStack bombs = new SpigotItemStack( xBomb.parseItem() );
- if ( bombs != null ) {
-
- bombs.setDisplayName( bomb.getName() );
- bombs.setAmount( count );
-
-
- List lore = bombs.getLore();
-
- lore.add( "&4Prison Mine Bomb:" );
- lore.add( " &7" + bomb.getName() );
- lore.add( " " );
-
- lore.add( "Size, Diameter: " + ( 1 + 2 * bomb.getRadius()) );
- lore.add( "Shape: " + bomb.getExplosionShape() );
-
- String[] desc = bomb.getDescription().split( " " );
- StringBuilder sb = new StringBuilder();
-
- for ( String d : desc ) {
-
- sb.append( d ).append( " " );
-
- if ( sb.length() > 30 ) {
- sb.insert( 0, " " );
-
- lore.add( sb.toString() );
- sb.setLength( 0 );
- }
- }
- if ( sb.length() > 0 ) {
- sb.insert( 0, " " );
-
- lore.add( sb.toString() );
- }
-// lore.add( " " + bomb.getDescription() );
-
- lore.add( " " );
-
- bombs.setLore( lore );
-
-
- player.getInventory().addItem( bombs );
- }
+ if ( bombs != null ) {
-// else {
-//
-// String message = "A mine bomb with the name of %s, is unable to generate an ItemStack. ";
-//
-// sender.sendMessage( String.format( message, bombName) );
-// }
+ bombs.setAmount( count );
+ player.getInventory().addItem( bombs );
}
-
else {
String message = "A mine bomb with the name of %s, has an invalid itemType value. " +
@@ -297,6 +260,73 @@ public void utilsMineBombsGive( CommandSender sender,
sender.sendMessage( String.format( message, bombName, bomb.getItemType() ) );
}
+// XMaterial xBomb = XMaterial.matchXMaterial( bomb.getItemType() ).orElse( null );
+//
+// if ( xBomb != null ) {
+//
+// SpigotItemStack bombs = new SpigotItemStack( xBomb.parseItem() );
+// if ( bombs != null ) {
+//
+// bombs.setDisplayName( bomb.getName() );
+// bombs.setAmount( count );
+//
+//
+// List lore = bombs.getLore();
+//
+// lore.add( MINE_BOMBS_LORE_1 );
+// lore.add( MINE_BOMBS_LORE_2_PREFIX + bomb.getName() );
+// lore.add( " " );
+//
+// lore.add( "Size, Diameter: " + ( 1 + 2 * bomb.getRadius()) );
+// lore.add( "Shape: " + bomb.getExplosionShape() );
+//
+// String[] desc = bomb.getDescription().split( " " );
+// StringBuilder sb = new StringBuilder();
+//
+// for ( String d : desc ) {
+//
+// sb.append( d ).append( " " );
+//
+// if ( sb.length() > 30 ) {
+// sb.insert( 0, " " );
+//
+// lore.add( sb.toString() );
+// sb.setLength( 0 );
+// }
+// }
+// if ( sb.length() > 0 ) {
+// sb.insert( 0, " " );
+//
+// lore.add( sb.toString() );
+// }
+//// lore.add( " " + bomb.getDescription() );
+//
+// lore.add( " " );
+//
+// bombs.setLore( lore );
+//
+//
+// player.getInventory().addItem( bombs );
+// }
+//
+//// else {
+////
+//// String message = "A mine bomb with the name of %s, is unable to generate an ItemStack. ";
+////
+//// sender.sendMessage( String.format( message, bombName) );
+//// }
+//
+// }
+
+// else {
+//
+// String message = "A mine bomb with the name of %s, has an invalid itemType value. " +
+// "'%s' does not exist in the XMaterial types. Contact Prison support for help " +
+// "in finding the correct values to use. Google: 'XSeries XMaterial'";
+//
+// sender.sendMessage( String.format( message, bombName, bomb.getItemType() ) );
+// }
+
}
else {
@@ -326,7 +356,227 @@ public void utilsMineBombsGive( CommandSender sender,
}
}
+
+ public static SpigotItemStack getItemStackBomb( MineBombData bomb ) {
+ SpigotItemStack bombs = null;
+
+ XMaterial xBomb = XMaterial.matchXMaterial( bomb.getItemType() ).orElse( null );
+
+ if ( xBomb != null ) {
+
+ bombs = new SpigotItemStack( xBomb.parseItem() );
+ if ( bombs != null ) {
+
+ bombs.setDisplayName( bomb.getName() );
+ //bombs.setAmount( count );
+
+
+ List lore = bombs.getLore();
+
+ lore.add( MINE_BOMBS_LORE_1 );
+ lore.add( MINE_BOMBS_LORE_2_PREFIX + bomb.getName() );
+ lore.add( " " );
+
+ lore.add( "Size, Diameter: " + ( 1 + 2 * bomb.getRadius()) );
+ lore.add( "Shape: " + bomb.getExplosionShape() );
+
+ String[] desc = bomb.getDescription().split( " " );
+ StringBuilder sb = new StringBuilder();
+
+ for ( String d : desc ) {
+
+ sb.append( d ).append( " " );
+
+ if ( sb.length() > 30 ) {
+ sb.insert( 0, " " );
+
+ lore.add( sb.toString() );
+ sb.setLength( 0 );
+ }
+ }
+ if ( sb.length() > 0 ) {
+ sb.insert( 0, " " );
+
+ lore.add( sb.toString() );
+ }
+// lore.add( " " + bomb.getDescription() );
+
+ lore.add( " " );
+
+ bombs.setLore( lore );
+
+ }
+
+ }
+
+ return bombs;
+ }
+
+
+ /**
+ * This takes a player and checks their main hand to see if it contains a bomb.
+ * If it does, then it return the selected bomb, and it reduces the quantity by
+ * one.
+ *
+ *
+ * @param player
+ * @return
+ */
+ public static MineBombData getBombInHand( Player player ) {
+ MineBombData results = null;
+
+ SpigotItemStack itemInHand = SpigotCompatibility.getInstance().getPrisonItemInMainHand( player );
+
+ if ( itemInHand != null ) {
+ List lore = itemInHand.getLore();
+
+ if ( lore.size() > 1 &&
+ lore.get( 0 ).equalsIgnoreCase( MINE_BOMBS_LORE_1 ) &&
+ lore.get( 1 ).startsWith( MINE_BOMBS_LORE_2_PREFIX )) {
+
+ String bombName = lore.get( 1 ).replace( MINE_BOMBS_LORE_2_PREFIX, "" );
+
+ MineBombs mBombs = MineBombs.getInstance();
+
+ results = mBombs.findBomb( bombName );
+
+ String playerUUID = player.getUniqueId().toString();
+
+ if ( results != null &&
+ checkPlayerCooldown( playerUUID ) == 0 ) {
+
+ // Setting activated to true indicates the bomb is live and it has
+ // been removed from the player's inventory:
+ results.setActivated( true );
+ itemInHand.setAmount( itemInHand.getAmount() - 1 );
+
+ // Remove from inventory:
+ SpigotCompatibility.getInstance().setItemInMainHand( player, itemInHand.getBukkitStack() );
+
+ // Set cooldown:
+ PrisonUtilsMineBombs.addPlayerCooldown( playerUUID );
+ }
+ }
+ }
+
+ return results;
+ }
+
+ public static boolean addPlayerCooldown( String playerUUID ) {
+ return addPlayerCooldown( playerUUID, MINE_BOMBS_COOLDOWN_TICKS );
+ }
+
+ /**
+ * If a cooldown is not setup for the player, this will try to add one and
+ * will return a value of true to indicate the a cooldown was set. If a cooldown
+ * already exists, then this will return a value of false.
+ *
+ *
+ * @param playerUUID
+ * @param ticks
+ * @return
+ */
+ public static boolean addPlayerCooldown( String playerUUID, int ticks ) {
+ boolean results = false;
+
+ if ( !playerCooldowns.containsKey( playerUUID ) ||
+ playerCooldowns.get( playerUUID ) <= 0 ) {
+
+ playerCooldowns.put( playerUUID, ticks );
+
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+
+ int ticksRemaining = playerCooldowns.get( playerUUID ) - 10;
+
+ if ( ticksRemaining <= 0 ) {
+ playerCooldowns.remove( playerUUID );
+ this.cancel();
+ }
+ else {
+ playerCooldowns.put( playerUUID, ticksRemaining );
+ }
+
+ }
+ }.runTaskTimer( SpigotPrison.getInstance(), 10, 10);
+
+ results = true;
+ }
+
+ return results;
+ }
+
+ public static int checkPlayerCooldown( String playerUUID ) {
+ int results = 0;
+
+ if ( playerCooldowns.containsKey( playerUUID ) ) {
+ results = playerCooldowns.get( playerUUID );
+ }
+
+ return results;
+ }
+ public static boolean setoffBombDelayed( SpigotPlayer sPlayer, MineBombData bomb, Item droppedBomb,
+ SpigotBlock sBlock, int delayTicks ) {
+ boolean results = false;
+
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+
+ // Remove the item that the player threw:
+ droppedBomb.remove();
+
+ Location location = sBlock.getLocation();
+ SpigotWorld world = (SpigotWorld) location.getWorld();
+
+ MineBombs mBombs = MineBombs.getInstance();
+
+ // Calculate all the locations that are included in the explosion:
+ List blockLocations = mBombs.calculateSphere( location,
+ bomb.getRadius(), false );
+
+
+ // Convert to spigot blocks:
+ List blocks = new ArrayList<>();
+ for ( Location bLocation : blockLocations ) {
+ SpigotBlock sBlock = (SpigotBlock) world.getBlockAt( bLocation );
+ if ( !sBlock.isEmpty() ) {
+
+ blocks.add( sBlock.getWrapper() );
+ }
+ }
+
+
+ SpigotBlock targetBlock = (SpigotBlock) world.getBlockAt( location );
+
+
+ ExplosiveBlockBreakEvent explodeEvent = new ExplosiveBlockBreakEvent(
+ targetBlock.getWrapper(), sPlayer.getWrapper(), blocks );
+ explodeEvent.setTriggeredBy( bomb.getName() );
+ explodeEvent.setMineBomb( bomb );
+
+ Bukkit.getServer().getPluginManager().callEvent( explodeEvent );
+
+
+
+ }
+ }.runTaskLater( SpigotPrison.getInstance(), delayTicks );
+
+ //.runTaskTimer( SpigotPrison.getInstance(), 10, 10);
+
+ return results;
+ }
+
+ public static double getPlayerCoolDownRemaining()
+ {
+
+ return 0;
+ }
+
public boolean isEnableMineBombs() {
return enableMineBombs;
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsModule.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsModule.java
index 1d4c78f7c..7cb23f1da 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsModule.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsModule.java
@@ -1,9 +1,11 @@
package tech.mcprison.prison.spigot.utils;
+import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import tech.mcprison.prison.Prison;
import tech.mcprison.prison.modules.Module;
+import tech.mcprison.prison.spigot.SpigotPrison;
public class PrisonUtilsModule
extends Module
@@ -130,6 +132,10 @@ public void enable() {
Prison.get().getCommandHandler().registerCommands( utils );
+ // Only Register the Bomb Listener if bombs are active:
+ Bukkit.getPluginManager().registerEvents(
+ new PrisonBombListener(), SpigotPrison.getInstance());
+
}
}
From 85fd9d86a367c2d6aacb559ed422efc0115c8fa5 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Sun, 26 Sep 2021 12:13:29 -0400
Subject: [PATCH 065/283] Fortune on a tool was appearing as a negative value:
-1000. Not sure how it became negative, but this will better deal with
negative values.
---
docs/changelog_v3.3.x.md | 4 ++++
.../prison/spigot/autofeatures/AutoManagerFeatures.java | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index 46e751281..a61c82078 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -16,6 +16,10 @@ These build logs represent the work that has been going on within prison.
# 3.2.11-alpha.1 2021-09-26
+* **Fortune on a tool was appearing as a negative value: -1000.**
+Not sure how it became negative, but this will better deal with negative values.
+
+
* **Added a listener for PlayerInteractEvent.**
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java
index 6990766ed..6c0ad34d7 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java
@@ -143,7 +143,7 @@ protected short getFortune(SpigotItemStack itemInHand){
}
int maxFortuneLevel = getInteger( AutoFeatures.fortuneMultiplierMax );
- if ( maxFortuneLevel != 0 && results > maxFortuneLevel ) {
+ if ( maxFortuneLevel > 0 && results > maxFortuneLevel ) {
results = (short) maxFortuneLevel;
}
From aeb4983da7ec3f4e9d93efdbdde8453e4393f5c2 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Sun, 26 Sep 2021 12:14:20 -0400
Subject: [PATCH 066/283] Upgrade XSeries to v8.4.0 to help prepare for spigot
v1.18.x.
---
prison-spigot/build.gradle | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/prison-spigot/build.gradle b/prison-spigot/build.gradle
index 388480ab2..322701478 100644
--- a/prison-spigot/build.gradle
+++ b/prison-spigot/build.gradle
@@ -105,7 +105,7 @@ dependencies {
// implementation 'com.github.cryptomorin:xseries:b95d195482'
// https://mvnrepository.com/artifact/com.github.cryptomorin/XSeries
- implementation 'com.github.cryptomorin:XSeries:8.3.0'
+ implementation 'com.github.cryptomorin:XSeries:8.4.0'
@@ -187,7 +187,7 @@ shadowJar {
include(dependency('me.clip:placeholderapi:2.10.9'))
- include(dependency('com.github.cryptomorin:XSeries:8.3.0'))
+ include(dependency('com.github.cryptomorin:XSeries:8.4.0'))
//include(dependency('org.inventivetalent.spiget-update:bukkit:1.4.2-SNAPSHOT'))
//include(dependency('me.badbones69:crazyenchantments-plugin:1.8-Dev-Build-v8'))
From e3f1e57f5e82c530222d98987d208d93d564501b Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Sun, 26 Sep 2021 12:51:17 -0400
Subject: [PATCH 067/283] New auto features settings: Able to prevent event
canceling and also control if the drops are cleared. This has not been tested
too much, but it may help make prison more compatible with other plugins that
are needing to handle the block break events.
---
docs/changelog_v3.3.x.md | 4 ++++
.../autofeatures/AutoFeaturesFileConfig.java | 18 +++++++++++-------
.../mcprison/prison/spigot/SpigotUtil.java | 6 ++++++
.../autofeatures/AutoManagerFeatures.java | 18 +++++++++++++++---
.../spigot/block/OnBlockBreakEventCore.java | 10 +++++-----
.../prison/spigot/block/SpigotBlock.java | 14 +++++++++++++-
6 files changed, 54 insertions(+), 16 deletions(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index a61c82078..d918a2d11 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -16,6 +16,10 @@ These build logs represent the work that has been going on within prison.
# 3.2.11-alpha.1 2021-09-26
+* **New auto features settings: Able to prevent event canceling and also control if the drops are cleared.**
+This has not been tested too much, but it may help make prison more compatible with other plugins that are needing to handle the block break events.
+
+
* **Fortune on a tool was appearing as a negative value: -1000.**
Not sure how it became negative, but this will better deal with negative values.
diff --git a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java
index e236f8faa..9ee1a04df 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java
@@ -49,7 +49,11 @@ public enum AutoFeatures {
blockBreakEvents(options),
- blockBreakEventPriority(blockBreakEvents, "LOW"),
+ cancelAllBlockBreakEvents(blockBreakEvents, true),
+ cancelAllBlockEventBlockDrops(blockBreakEvents, true),
+
+
+ blockBreakEventPriority(blockBreakEvents, "LOW"),
isProcessTokensEnchantExplosiveEvents(blockBreakEvents, false),
TokenEnchantBlockExplodeEventPriority(blockBreakEvents, "DISABLED"),
@@ -232,12 +236,12 @@ public enum AutoFeatures {
- debug(options),
- isDebugSupressOnBlockBreakEventCancels(debug, false),
- isDebugSupressOnTEExplodeEventCancels(debug, false),
- isDebugSupressOnCEBlastUseEventCancels(debug, false),
- isDebugSupressOnPEExplosiveEventCancels(debug, false),
- isDebugSupressOnPrisonMinesBlockBreakEventCancels(debug, false)
+// debug(options),
+// isDebugSupressOnBlockBreakEventCancels(debug, false),
+// isDebugSupressOnTEExplodeEventCancels(debug, false),
+// isDebugSupressOnCEBlastUseEventCancels(debug, false),
+// isDebugSupressOnPEExplosiveEventCancels(debug, false),
+// isDebugSupressOnPrisonMinesBlockBreakEventCancels(debug, false)
;
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotUtil.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotUtil.java
index c93b150fe..4f1822830 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotUtil.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotUtil.java
@@ -1017,6 +1017,12 @@ public static List getDrops(SpigotBlock block, SpigotItemStack
return ret;
}
+
+// public static void clearDrops(SpigotBlock block) {
+//
+// block.getWrapper().getDrops().clear();;
+// }
+
/*
* InventoryType
*/
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java
index 6c0ad34d7..c52c9e03d 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java
@@ -23,7 +23,6 @@
import tech.mcprison.prison.Prison;
import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig.AutoFeatures;
-import tech.mcprison.prison.autofeatures.PlayerMessaging.MessageType;
import tech.mcprison.prison.internal.block.PrisonBlock;
import tech.mcprison.prison.mines.data.Mine;
import tech.mcprison.prison.mines.features.MineBlockEvent.BlockEventType;
@@ -38,7 +37,6 @@
import tech.mcprison.prison.spigot.compat.SpigotCompatibility;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.sellall.SellAllUtil;
-import tech.mcprison.prison.spigot.utils.tasks.PlayerMessagingTask;
import tech.mcprison.prison.util.BlockType;
import tech.mcprison.prison.util.Text;
@@ -426,6 +424,13 @@ protected int autoPickup( Player player,
List drops = new ArrayList<>( SpigotUtil.getDrops(block, itemInHand) );
+ // This clears the drops for the given block, so if the event is not canceled, it will
+ // not result in duplicate drops.
+ if ( isBoolean( AutoFeatures.cancelAllBlockEventBlockDrops ) ) {
+ block.clearDrops();
+ }
+
+
if (drops != null && drops.size() > 0 ) {
// Need better drop calculation that is not using the getDrops function.
@@ -499,7 +504,14 @@ public int calculateNormalDrop( SpigotItemStack itemInHand, SpigotBlock block )
// plus there are some extra items, such as flint, that will never be dropped.
List drops = new ArrayList<>( SpigotUtil.getDrops(block, itemInHand) );
-
+
+ // This clears the drops for the given block, so if the event is not canceled, it will
+ // not result in duplicate drops.
+ if ( isBoolean( AutoFeatures.cancelAllBlockEventBlockDrops ) ) {
+ block.clearDrops();
+ }
+
+
if (drops != null && drops.size() > 0 ) {
// Need better drop calculation that is not using the getDrops function.
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java
index 4f0b6d14f..ff79959b7 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java
@@ -423,7 +423,7 @@ else if ( pmEvent.getMine() != null || pmEvent.getMine() == null &&
// doAction returns a boolean that indicates if the event should be canceled or not:
if ( doAction( sBlock, pmEvent.getMine(), pmEvent.getPlayer(), debugInfo ) ) {
- if ( !isBoolean( AutoFeatures.isDebugSupressOnBlockBreakEventCancels ) ) {
+ if ( !isBoolean( AutoFeatures.cancelAllBlockBreakEvents ) ) {
e.setCancelled( true );
}
else {
@@ -910,7 +910,7 @@ else if ( isTEExplosiveEnabled &&
if ( doAction( pmEvent.getMine(), pmEvent.getPlayer(),
pmEvent.getExplodedBlocks(), BlockEventType.TEXplosion, triggered, debugInfo ) ) {
- if ( !isBoolean( AutoFeatures.isDebugSupressOnTEExplodeEventCancels ) ) {
+ if ( !isBoolean( AutoFeatures.cancelAllBlockBreakEvents ) ) {
e.setCancelled( true );
}
@@ -1288,7 +1288,7 @@ else if ( isCEBlockExplodeEnabled &&
if ( doAction( pmEvent.getMine(), e.getPlayer(), pmEvent.getExplodedBlocks(),
BlockEventType.CEXplosion, triggered, debugInfo ) ) {
- if ( !isBoolean( AutoFeatures.isDebugSupressOnCEBlastUseEventCancels ) ) {
+ if ( !isBoolean( AutoFeatures.cancelAllBlockBreakEvents ) ) {
e.setCancelled( true );
}
@@ -1413,7 +1413,7 @@ else if ( isPEExplosiveEnabled &&
if ( doAction( pmEvent.getMine(), e.getPlayer(), pmEvent.getExplodedBlocks(),
BlockEventType.PEExplosive, triggered, debugInfo ) ) {
- if ( !isBoolean( AutoFeatures.isDebugSupressOnPEExplosiveEventCancels ) ) {
+ if ( !isBoolean( AutoFeatures.cancelAllBlockBreakEvents ) ) {
e.setCancelled( true );
}
@@ -1511,7 +1511,7 @@ else if ( isPPrisonExplosiveBlockBreakEnabled &&
if ( doAction( pmEvent.getMine(), e.getPlayer(), pmEvent.getExplodedBlocks(),
BlockEventType.PrisonExplosion, triggered, debugInfo ) ) {
- if ( !isBoolean( AutoFeatures.isDebugSupressOnPrisonMinesBlockBreakEventCancels ) ) {
+ if ( !isBoolean( AutoFeatures.cancelAllBlockBreakEvents ) ) {
e.setCancelled( true );
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/SpigotBlock.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/SpigotBlock.java
index de8aa83f2..c78e6383d 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/SpigotBlock.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/SpigotBlock.java
@@ -296,7 +296,8 @@ public void setType(BlockType blockType) {
return results;
}
- @Override public List getDrops() {
+ @Override
+ public List getDrops() {
List ret = new ArrayList<>();
if ( getWrapper() != null ) {
@@ -322,6 +323,17 @@ public List getDrops(ItemStack tool) {
return ret;
}
+ /**
+ * This clears the drops for the given block, so if the event is not canceled, it will
+ * not result in duplicate drops.
+ *
+ */
+ public void clearDrops() {
+
+ getWrapper().getDrops().clear();
+ }
+
+
// public List getDrops(SpigotItemStack tool) {
// List ret = new ArrayList<>();
//
From b20cbe65f8b9420a58134dbde8f8d9c068c869f6 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Sun, 26 Sep 2021 12:53:04 -0400
Subject: [PATCH 068/283] Removal of some auto feature commented out old code.
---
docs/changelog_v3.3.x.md | 3 +
.../spigot/block/OnBlockBreakEventCore.java | 402 +-----------------
2 files changed, 4 insertions(+), 401 deletions(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index d918a2d11..8160c2906 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -16,6 +16,9 @@ These build logs represent the work that has been going on within prison.
# 3.2.11-alpha.1 2021-09-26
+* **Removal of some auto feature commented out old code.**
+
+
* **New auto features settings: Able to prevent event canceling and also control if the drops are cleared.**
This has not been tested too much, but it may help make prison more compatible with other plugins that are needing to handle the block break events.
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java
index ff79959b7..a7e63263a 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java
@@ -328,71 +328,6 @@ protected void genericBlockEvent( BlockBreakEvent e, boolean monitor, boolean bl
}
}
-// boolean isAir = e.getBlock().getType() == null || e.getBlock().getType() == Material.AIR;
-
-
-// Long playerUUIDLSB = Long.valueOf( pmEvent.getPlayer().getUniqueId().getLeastSignificantBits() );
-//
-// // Get the cached mine, if it exists:
-// Mine mine = getPlayerCache().get( playerUUIDLSB );
-//
-// if ( mine == null || !mine.isInMineExact( pmEvent.getSpigotBlock().getLocation() ) ) {
-// // Look for the correct mine to use.
-// // Set mine to null so if cannot find the right one it will return a null:
-// mine = findMineLocation( pmEvent.getSpigotBlock() );
-//
-// // Store the mine in the player cache if not null:
-// if ( mine != null ) {
-// getPlayerCache().put( playerUUIDLSB, mine );
-// }
-// }
-// pmEvent.setMine( mine );
-//
-// debugInfo.append( "mine=" + (mine == null ? "none" : mine.getName()) + " " );
-//
-//
-// if ( isToolDisabled( e.getPlayer() ) ) {
-//
-// PrisonUtilsTitles uTitles = new PrisonUtilsTitles();
-// uTitles.utilsTitlesActionBar( pmEvent.getSpigotPlayer(), "",
-// "&cYour tool is worn-out and cannot be used." );
-//
-// e.setCancelled( true );
-// debugInfo.append( "UNUSABLE_TOOL__WORN_OUT (event canceled) " );
-// }
-// else if ( mine != null && BlockUtils.getInstance().isUnbreakable( sBlock ) ) {
-// // The block is unbreakable because a utility has it locked:
-//
-// e.setCancelled( true );
-// debugInfo.append( "UNBREAKABLE_BLOCK_UTILS (event canceled) " );
-// }
-// else if ( mine != null && (mine.isMineAccessByRank() || mine.isAccessPermissionEnabled()) &&
-// !mine.hasMiningAccess( pmEvent.getSpigotPlayer() ) ) {
-// // The player does not have permission to access this mine, so do not process
-// //
-//
-// e.setCancelled( true );
-// debugInfo.append( "ACCESS_DENIED (event canceled) " );
-// }
-// else if ( blockEventsOnly ) {
-//
-// String triggered = null;
-//
-// doActionBlockEventOnly( sBlock, mine, e.getPlayer(), BlockEventType.blockBreak, triggered );
-//
-// debugInfo.append( "(actionBlockEventOnly) " );
-// }
-// else if ( monitor && mine == null ) {
-// // bypass all processing since the block break is outside any mine:
-//
-// debugInfo.append( "(bypassed monitor no mine) " );
-// }
-// else if ( monitor && mine != null ) {
-//
-// doActionMonitor( sBlock, mine );
-//
-// debugInfo.append( "(monitor) " );
-// }
// This is where the processing actually happens:
else if ( pmEvent.getMine() != null || pmEvent.getMine() == null &&
@@ -705,157 +640,6 @@ private void genericBlockExplodeEvent( TEBlockExplodeEvent e, boolean monitor, b
}
}
-
-// List explodedBlocks = new ArrayList<>();
-
-// // Need to wrap in a Prison block so it can be used with the mines:
-// SpigotBlock block = new SpigotBlock(e.getBlock());
-//
-// // long startNano = System.nanoTime();
-// Long playerUUIDLSB = Long.valueOf( e.getPlayer().getUniqueId().getLeastSignificantBits() );
-//
-// // Get the cached mine, if it exists:
-// Mine mine = getPlayerCache().get( playerUUIDLSB );
-//
-// if ( mine == null || !mine.isInMineExact( block.getLocation() ) ) {
-//
-//
-// // Look for the correct mine to use.
-// // Set mine to null so if cannot find the right one it will return a null:
-// mine = findMineLocation( block );
-//
-// // Store the mine in the player cache if not null:
-// if ( mine != null ) {
-// getPlayerCache().put( playerUUIDLSB, mine );
-//
-// // we found the mine!
-// }
-//
-// }
-//
-// debugInfo.append( "mine=" + (mine == null ? "none" : mine.getName()) + " " );
-
-
-// if ( isToolDisabled( e.getPlayer() ) ) {
-//
-// PrisonUtilsTitles uTitles = new PrisonUtilsTitles();
-// uTitles.utilsTitlesActionBar( new SpigotPlayer( e.getPlayer() ), "",
-// "&cYour tool is worn-out and cannot be used." );
-//
-// e.setCancelled( true );
-// debugInfo.append( "UNUSABLE_TOOL__WORN_OUT (event canceled) " );
-// }
-// else if ( mine != null && BlockUtils.getInstance().isUnbreakable( block ) ) {
-// // The block is unbreakable because a utility has it locked:
-//
-// e.setCancelled( true );
-// debugInfo.append( "UNBREAKABLE_BLOCK_UTILS (event canceled) " );
-// }
-// else if ( mine != null && (mine.isMineAccessByRank() || mine.isAccessPermissionEnabled()) &&
-// !mine.hasMiningAccess( new SpigotPlayer( e.getPlayer() ) ) ) {
-// // The player does not have permission to access this mine, so do not process
-// //
-//
-// e.setCancelled( true );
-// debugInfo.append( "ACCESS_DENIED (event canceled) " );
-// }
-// else if ( blockEventsOnly ) {
-// int unbreakable = 0;
-// int outsideOfMine = 0;
-//
-// if ( mine != null ) {
-//
-// String triggered = null;
-//
-// // This was already checked to ensure it's breakable:
-// doActionBlockEventOnly( block, mine, e.getPlayer(), BlockEventType.blockBreak, triggered );
-//
-// // All other blocks in the explosion:
-// for ( Block blk : e.blockList() ) {
-//
-// // Need to wrap in a Prison block so it can be used with the mines.
-// // Since this is a monitor, there is no need to check to see if the
-// // block is in a mine since the getTargetPrisonBlock function will
-// // perform that check indirectly.
-// SpigotBlock sBlock = new SpigotBlock(blk);
-//
-// if ( BlockUtils.getInstance().isUnbreakable( sBlock ) ) {
-//
-// unbreakable++;
-// }
-// else if ( mine.isInMineExact( sBlock.getLocation() ) ) {
-//
-// doActionBlockEventOnly( sBlock, mine, e.getPlayer(), BlockEventType.blockBreak, triggered );
-// }
-// else {
-// outsideOfMine++;
-// }
-//
-// }
-//
-// }
-//
-// if ( unbreakable > 0 ) {
-//
-// // e.setCancelled( true );
-// debugInfo.append( "UNBREAKABLE_BLOCK_UTILS (" + unbreakable +
-// " blocks, event not canceled) " );
-// }
-// if ( outsideOfMine > 0 ) {
-//
-// debugInfo.append( "BLOCKS_OUTSIDE_OF_MINE (" + outsideOfMine +
-// " blocks, event not canceled) " );
-// }
-//
-// debugInfo.append( "(actionBlockEventOnly) " );
-// }
-// else if ( monitor && mine == null ) {
-// // bypass all processing since the block break is outside any mine:
-//
-// debugInfo.append( "(bypassed monitor no mine) " );
-// }
-// else if ( monitor && mine != null ) {
-// int unbreakable = 0;
-// int outsideOfMine = 0;
-//
-// // Initial block that was hit:
-// doActionMonitor( block, mine );
-//
-// // All other blocks in the explosion:
-// for ( Block blk : e.blockList() ) {
-//
-// // Need to wrap in a Prison block so it can be used with the mines.
-// // Since this is a monitor, there is no need to check to see if the
-// // block is in a mine since the getTargetPrisonBlock function will
-// // perform that check indirectly.
-// SpigotBlock sBlock = new SpigotBlock(blk);
-//
-// if ( BlockUtils.getInstance().isUnbreakable( new SpigotBlock( blk ) ) ) {
-//
-// unbreakable++;
-// }
-// else if ( mine.isInMineExact( sBlock.getLocation() ) ) {
-//
-// doActionMonitor( sBlock, mine );
-// }
-// else {
-// outsideOfMine++;
-// }
-// }
-//
-// if ( unbreakable > 0 ) {
-//
-// // e.setCancelled( true );
-// debugInfo.append( "UNBREAKABLE_BLOCK_UTILS (" + unbreakable +
-// " blocks, event not canceled) " );
-// }
-// if ( outsideOfMine > 0 ) {
-//
-// debugInfo.append( "BLOCKS_OUTSIDE_OF_MINE (" + outsideOfMine +
-// " blocks, event not canceled) " );
-// }
-// debugInfo.append( "(monitor) " );
-// }
// now process all blocks (non-monitor):
@@ -1051,191 +835,7 @@ protected void genericBlastUseEvent( BlastUseEvent e, boolean monitor, boolean b
}
-//
-// List explodedBlocks = new ArrayList<>();
-//
-//
-// // long startNano = System.nanoTime();
-// Long playerUUIDLSB = Long.valueOf( e.getPlayer().getUniqueId().getLeastSignificantBits() );
-//
-// // Get the cached mine, if it exists:
-// Mine mine = getPlayerCache().get( playerUUIDLSB );
-//
-// if ( mine == null ) {
-//
-//
-// // NOTE: The crazy enchantment's blast use event does not identify the block that
-// // was hit, so will have to check them all.
-//
-// // have to go through all blocks since some blocks may be outside the mine.
-// // but terminate search upon first find:
-// for ( Block blk : e.getBlockList() ) {
-// // Need to wrap in a Prison block so it can be used with the mines:
-// SpigotBlock block = new SpigotBlock(blk);
-//
-// // Look for the correct mine to use.
-// // Set mine to null so if cannot find the right one it will return a null:
-// mine = findMineLocation( block );
-//
-// // Store the mine in the player cache if not null:
-// if ( mine != null ) {
-// getPlayerCache().put( playerUUIDLSB, mine );
-//
-// // we found the mine!
-// break;
-// }
-// }
-// }
-// else {
-//
-// // NOTE: Just because the mine is not null, does not mean that the block was tested to be
-// // within the mine. The mine from the player cache could be a different mine
-// // altogether. The block must be tested.
-//
-// // have to go through all blocks since some blocks may be outside the mine.
-// // but terminate search upon first find:
-// for ( Block blk : e.getBlockList() ) {
-// // Need to wrap in a Prison block so it can be used with the mines:
-// SpigotBlock block = new SpigotBlock(blk);
-//
-// // Look for the correct mine to use.
-// // Set mine to null so if cannot find the right one it will return a null:
-// mine = findMineLocation( block );
-//
-// // Store the mine in the player cache if not null:
-// if ( mine != null ) {
-// getPlayerCache().put( playerUUIDLSB, mine );
-//
-// // we found the mine!
-// break;
-// }
-// }
-//
-// }
-//
-// debugInfo.append( "mine=" + (mine == null ? "none" : mine.getName()) + " " );
-//
-// boolean isCEBlockExplodeEnabled = isBoolean( AutoFeatures.isProcessCrazyEnchantsBlockExplodeEvents );
-//
-// if ( isToolDisabled( e.getPlayer() ) ) {
-//
-// PrisonUtilsTitles uTitles = new PrisonUtilsTitles();
-// uTitles.utilsTitlesActionBar( new SpigotPlayer( e.getPlayer() ), "",
-// "&cYour tool is worn-out and cannot be used." );
-//
-// e.setCancelled( true );
-// debugInfo.append( "UNUSABLE_TOOL__WORN_OUT (event canceled) " );
-// }
-//// else if ( mine != null && BlockUtils.getInstance().isUnbreakable( block ) ) {
-//// // The block is unbreakable because a utility has it locked:
-////
-//// e.setCancelled( true );
-//// debugInfo += "UNBREAKABLE_BLOCK_UTILS (event canceled) ";
-//// }
-// else if ( mine != null && (mine.isMineAccessByRank() || mine.isAccessPermissionEnabled()) &&
-// !mine.hasMiningAccess( new SpigotPlayer( e.getPlayer() ) ) ) {
-// // The player does not have permission to access this mine, so do not process
-// //
-//
-// e.setCancelled( true );
-// debugInfo.append( "ACCESS_DENIED (event canceled) " );
-// }
-// else if ( blockEventsOnly ) {
-// int unbreakable = 0;
-// int outsideOfMine = 0;
-//
-// if ( mine != null ) {
-//
-// String triggered = null;
-//
-// // All other blocks in the explosion:
-// for ( Block blk : e.getBlockList() ) {
-//
-//
-// // Need to wrap in a Prison block so it can be used with the mines.
-// // Since this is a monitor, there is no need to check to see if the
-// // block is in a mine since the getTargetPrisonBlock function will
-// // perform that check indirectly.
-// SpigotBlock sBlock = new SpigotBlock(blk);
-//
-// if ( BlockUtils.getInstance().isUnbreakable( new SpigotBlock( blk ) ) ) {
-//
-// unbreakable++;
-// }
-// else if ( mine.isInMineExact( sBlock.getLocation() ) ) {
-//
-// doActionBlockEventOnly( sBlock, mine, e.getPlayer(), BlockEventType.CEXplosion, triggered );
-// }
-// else {
-// outsideOfMine++;
-// }
-//
-// }
-// }
-//
-// if ( unbreakable > 0 ) {
-//
-// // e.setCancelled( true );
-// debugInfo.append( "UNBREAKABLE_BLOCK_UTILS (" + unbreakable +
-// " blocks, event not canceled) " );
-// }
-// if ( outsideOfMine > 0 ) {
-//
-// debugInfo.append( "BLOCKS_OUTSIDE_OF_MINE (" + outsideOfMine +
-// " blocks, event not canceled) " );
-// }
-//
-// debugInfo.append( "(actionBlockEventOnly) " );
-// }
-// else if ( monitor && mine == null ) {
-// // bypass all processing since the block break is outside any mine:
-//
-// debugInfo.append( "(bypassed monitor no mine) " );
-// }
-// else if ( monitor && mine != null ) {
-// int unbreakable = 0;
-// int outsideOfMine = 0;
-//
-// // Initial block that was hit: CrazyE does not have the main block:
-// // doActionMonitor( block, mine );
-//
-// // All other blocks in the explosion:
-// for ( Block blk : e.getBlockList() ) {
-//
-// // Need to wrap in a Prison block so it can be used with the mines.
-// // Since this is a monitor, there is no need to check to see if the
-// // block is in a mine since the getTargetPrisonBlock function will
-// // perform that check indirectly.
-// SpigotBlock sBlock = new SpigotBlock(blk);
-//
-// if ( BlockUtils.getInstance().isUnbreakable( new SpigotBlock( blk ) ) ) {
-//
-// unbreakable++;
-// }
-// else if ( mine.isInMineExact( sBlock.getLocation() ) ) {
-//
-// doActionMonitor( sBlock, mine );
-// }
-// else {
-// outsideOfMine++;
-// }
-//
-// }
-//
-// if ( unbreakable > 0 ) {
-//
-// // e.setCancelled( true );
-// debugInfo.append( "UNBREAKABLE_BLOCK_UTILS (" + unbreakable +
-// " blocks, event not canceled) " );
-// }
-// if ( outsideOfMine > 0 ) {
-//
-// debugInfo.append( "BLOCKS_OUTSIDE_OF_MINE (" + outsideOfMine +
-// " blocks, event not canceled) " );
-// }
-//
-// debugInfo.append( "(monitor) " );
-// }
+
// now process all blocks (non-monitor):
else if ( isCEBlockExplodeEnabled &&
From 32ec731c5fd030c42b7d1e2f9bae97a27c571317 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Sun, 26 Sep 2021 13:13:19 -0400
Subject: [PATCH 069/283] Adjustments to the new auto features for cancel block
break events and block drops.
---
docs/changelog_v3.3.x.md | 3 +++
.../prison/autofeatures/AutoFeaturesFileConfig.java | 6 +++++-
.../prison/spigot/block/OnBlockBreakEventCore.java | 10 +++++-----
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index 8160c2906..5f1ceb8cf 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -16,6 +16,9 @@ These build logs represent the work that has been going on within prison.
# 3.2.11-alpha.1 2021-09-26
+* **Adjustments to the new auto features for cancel block break events and block drops.**
+
+
* **Removal of some auto feature commented out old code.**
diff --git a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java
index 9ee1a04df..a711d2cd7 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java
@@ -49,8 +49,12 @@ public enum AutoFeatures {
blockBreakEvents(options),
+ // Setting this to true will cancel the block break events (normal prison behavior):
cancelAllBlockBreakEvents(blockBreakEvents, true),
- cancelAllBlockEventBlockDrops(blockBreakEvents, true),
+ // Setting this to false will not zero out the block drops (normal prison behavior).
+ // When set to true, it will zero it out so if the block break event is not cancleed,
+ // then it will prevent double drops:
+ cancelAllBlockEventBlockDrops(blockBreakEvents, false),
blockBreakEventPriority(blockBreakEvents, "LOW"),
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java
index a7e63263a..fa4e59cba 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java
@@ -358,7 +358,7 @@ else if ( pmEvent.getMine() != null || pmEvent.getMine() == null &&
// doAction returns a boolean that indicates if the event should be canceled or not:
if ( doAction( sBlock, pmEvent.getMine(), pmEvent.getPlayer(), debugInfo ) ) {
- if ( !isBoolean( AutoFeatures.cancelAllBlockBreakEvents ) ) {
+ if ( isBoolean( AutoFeatures.cancelAllBlockBreakEvents ) ) {
e.setCancelled( true );
}
else {
@@ -694,7 +694,7 @@ else if ( isTEExplosiveEnabled &&
if ( doAction( pmEvent.getMine(), pmEvent.getPlayer(),
pmEvent.getExplodedBlocks(), BlockEventType.TEXplosion, triggered, debugInfo ) ) {
- if ( !isBoolean( AutoFeatures.cancelAllBlockBreakEvents ) ) {
+ if ( isBoolean( AutoFeatures.cancelAllBlockBreakEvents ) ) {
e.setCancelled( true );
}
@@ -888,7 +888,7 @@ else if ( isCEBlockExplodeEnabled &&
if ( doAction( pmEvent.getMine(), e.getPlayer(), pmEvent.getExplodedBlocks(),
BlockEventType.CEXplosion, triggered, debugInfo ) ) {
- if ( !isBoolean( AutoFeatures.cancelAllBlockBreakEvents ) ) {
+ if ( isBoolean( AutoFeatures.cancelAllBlockBreakEvents ) ) {
e.setCancelled( true );
}
@@ -1013,7 +1013,7 @@ else if ( isPEExplosiveEnabled &&
if ( doAction( pmEvent.getMine(), e.getPlayer(), pmEvent.getExplodedBlocks(),
BlockEventType.PEExplosive, triggered, debugInfo ) ) {
- if ( !isBoolean( AutoFeatures.cancelAllBlockBreakEvents ) ) {
+ if ( isBoolean( AutoFeatures.cancelAllBlockBreakEvents ) ) {
e.setCancelled( true );
}
@@ -1111,7 +1111,7 @@ else if ( isPPrisonExplosiveBlockBreakEnabled &&
if ( doAction( pmEvent.getMine(), e.getPlayer(), pmEvent.getExplodedBlocks(),
BlockEventType.PrisonExplosion, triggered, debugInfo ) ) {
- if ( !isBoolean( AutoFeatures.cancelAllBlockBreakEvents ) ) {
+ if ( isBoolean( AutoFeatures.cancelAllBlockBreakEvents ) ) {
e.setCancelled( true );
}
From 0c630f51029f17034f732eaa4e604c21961c565a Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Sun, 26 Sep 2021 22:27:16 -0400
Subject: [PATCH 070/283] Added an example of possible backpack object to the
PlayerCachePlayerData object.
---
docs/changelog_v3.3.x.md | 3 +++
.../prison/cache/PlayerCachePlayerData.java | 13 +++++++++++++
2 files changed, 16 insertions(+)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index 5f1ceb8cf..bb2e793f5 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -16,6 +16,9 @@ These build logs represent the work that has been going on within prison.
# 3.2.11-alpha.1 2021-09-26
+* **Added an example of possible backpack object to the PlayerCachePlayerData object.**
+
+
* **Adjustments to the new auto features for cancel block break events and block drops.**
diff --git a/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCachePlayerData.java b/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCachePlayerData.java
index 315a1a0fd..8297da749 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCachePlayerData.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/cache/PlayerCachePlayerData.java
@@ -2,12 +2,15 @@
import java.io.File;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
import java.util.TreeMap;
import tech.mcprison.prison.autofeatures.PlayerMessaging;
import tech.mcprison.prison.internal.Player;
import tech.mcprison.prison.internal.block.PrisonBlock;
+import tech.mcprison.prison.internal.inventory.Inventory;
import tech.mcprison.prison.placeholders.PlaceholdersUtil;
/**
@@ -87,6 +90,7 @@ public class PlayerCachePlayerData {
private transient PlayerMessaging playerMessaging;
+ private List backpacks;
private transient boolean dirty = false;
@@ -119,6 +123,8 @@ public PlayerCachePlayerData() {
this.playerMessaging = new PlayerMessaging();
+ this.backpacks = new ArrayList<>();
+
}
public PlayerCachePlayerData( Player player, File playerFile ) {
@@ -539,6 +545,13 @@ public void setPlayerMessaging( PlayerMessaging playerMessaging ) {
this.playerMessaging = playerMessaging;
}
+ public List getBackpacks() {
+ return backpacks;
+ }
+ public void setBackpacks( List backpacks ) {
+ this.backpacks = backpacks;
+ }
+
public boolean isDirty() {
return dirty;
}
From 848acd09e8e8fca6ec2e092b8493d170fb553443 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Tue, 28 Sep 2021 13:32:18 -0400
Subject: [PATCH 071/283] Bug fix: Logic was corrected to handle the double
negative correctly. The was an issue with the /mines set area command when
the mine's area was larger than 25,000 blocks. They have to enter either
"confirm" or "yes". The bug would require them to enter both to create the
mine.
---
docs/changelog_v3.3.x.md | 6 +++++-
.../tech/mcprison/prison/mines/commands/MinesCommands.java | 4 ++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index bb2e793f5..a29019efa 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -13,7 +13,11 @@ These build logs represent the work that has been going on within prison.
*Will continue as v3.3.0-alpha.7 2021-06-?? in the near future.*
-# 3.2.11-alpha.1 2021-09-26
+# 3.2.11-alpha.1 2021-09-28
+
+
+* **Bug fix: Logic was corrected to handle the double negative correctly.**
+The was an issue with the /mines set area command when the mine's area was larger than 25,000 blocks. They have to enter either "confirm" or "yes". The bug would require them to enter both to create the mine.
* **Added an example of possible backpack object to the PlayerCachePlayerData object.**
diff --git a/prison-mines/src/main/java/tech/mcprison/prison/mines/commands/MinesCommands.java b/prison-mines/src/main/java/tech/mcprison/prison/mines/commands/MinesCommands.java
index 112fe0ae8..9bd8e7adb 100644
--- a/prison-mines/src/main/java/tech/mcprison/prison/mines/commands/MinesCommands.java
+++ b/prison-mines/src/main/java/tech/mcprison/prison/mines/commands/MinesCommands.java
@@ -2252,8 +2252,8 @@ else if ( source == null || "wand".equalsIgnoreCase( source ) ) {
Bounds selectedBounds = selection.asBounds();
if ( selectedBounds.getTotalBlockCount() > 25000 &&
- (options == null || !options.toLowerCase().contains( "confirm" ) ||
- !options.toLowerCase().contains( "yes" ))) {
+ (options == null || !options.toLowerCase().contains( "confirm" ) &&
+ !options.toLowerCase().contains( "yes" )) ) {
String message = String.format( "&7Warning: This mine has a size of %s. If this is " +
"intentional, then please re-submit this command with adding the " +
"keyword of either 'confirm' or 'yes' to the end of the command. ",
From 26d81903cf5a5f74fe9aab64979bdf898848f893 Mon Sep 17 00:00:00 2001
From: AnonymousGCA
Date: Fri, 1 Oct 2021 22:36:09 +0200
Subject: [PATCH 072/283] Changelogs: - Absolutely not ready NewBackPacksUtil,
not tested and not even final class name, everything is work-in-progress and
there may be a ton of optimizations possible.
---
.../spigot/backpacks/BackpacksListeners.java | 4 +-
.../spigot/backpacks/NewBackpacksUtil.java | 437 ++++++++++++++++++
2 files changed, 439 insertions(+), 2 deletions(-)
create mode 100644 prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/NewBackpacksUtil.java
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/BackpacksListeners.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/BackpacksListeners.java
index 38ead4741..d380712b0 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/BackpacksListeners.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/BackpacksListeners.java
@@ -32,7 +32,7 @@ public void onBackpackCloseEvent(InventoryCloseEvent e){
@EventHandler
public void onDeadBackpack(PlayerDeathEvent e){
- onDeadBackpackAction(e);
+ onDeathBackpackAction(e);
}
@@ -50,7 +50,7 @@ public void onPlayerClickBackpackItem(PlayerInteractEvent e){
backpackItemClickAction(e);
}
- private void onDeadBackpackAction(PlayerDeathEvent e) {
+ private void onDeathBackpackAction(PlayerDeathEvent e) {
if (getBoolean(BackpacksUtil.get().getBackpacksConfig().getString("Options.BackPack_Lose_Items_On_Death"))) {
BackpacksUtil.get().resetBackpack(e.getEntity());
if (getBoolean(BackpacksUtil.get().getBackpacksConfig().getString("Options.Multiple-BackPacks-For-Player-Enabled"))) {
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/NewBackpacksUtil.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/NewBackpacksUtil.java
new file mode 100644
index 000000000..4a52f8795
--- /dev/null
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/NewBackpacksUtil.java
@@ -0,0 +1,437 @@
+package tech.mcprison.prison.spigot.backpacks;
+
+import com.cryptomorin.xseries.XMaterial;
+import com.cryptomorin.xseries.XSound;
+import org.bukkit.Bukkit;
+import org.bukkit.configuration.Configuration;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+import tech.mcprison.prison.cache.PlayerCache;
+import tech.mcprison.prison.cache.PlayerCachePlayerData;
+import tech.mcprison.prison.output.Output;
+import tech.mcprison.prison.spigot.SpigotPrison;
+import tech.mcprison.prison.spigot.configs.MessagesConfig;
+import tech.mcprison.prison.spigot.game.SpigotPlayer;
+import tech.mcprison.prison.spigot.inventory.SpigotInventory;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author AnonymousGCA (GABRYCA)
+ */
+public class NewBackpacksUtil {
+
+ private static NewBackpacksUtil instance;
+ private MessagesConfig messages;
+ private Configuration backpacksConfig;
+ private Configuration backpacksData;
+ private boolean isFoundDeprecatedData;
+ private boolean isBackpackUsePermissionEnabled;
+ private boolean isBackpackAutopickupEnabled;
+ private boolean isBackpackOpenItemEnabled;
+ private boolean isBackpackOpenItemGivenOnJoin;
+ private boolean isBackpackEnabledIfLimitZero;
+ private boolean isBackpackLostOnDeath;
+ private boolean isBackpackOpenSoundEnabled;
+ private boolean isBackpackCloseSoundEnabled;
+ private boolean isMultipleBackpacksEnabled;
+ private String backpackUsePermission;
+ private String backpackOpenItemTitle;
+ private XSound backpackOpenSound = XSound.BLOCK_CHEST_OPEN;
+ private XSound backpackCloseSound = XSound.BLOCK_CHEST_CLOSE;
+ private int defaultBackpackSize;
+ private int defaultBackpackLimitForPlayer;
+ private XMaterial backpackOpenItem = XMaterial.CHEST;
+
+
+ /**
+ * Get an instance of Backpacks to get full access to the API.
+ *
+ * If Backpacks are disabled, this will return null.
+ *
+ * @return BackpacksUtil
+ */
+ public NewBackpacksUtil get() {
+
+ if (!getBoolean(SpigotPrison.getInstance().getConfig().getString("backpacks"))) {
+ return null;
+ }
+
+ if (instance == null) {
+ instance = new NewBackpacksUtil();
+ instance.initCachedData();
+ }
+
+ return instance;
+ }
+
+ /**
+ * Return boolean value from String.
+ *
+ * @param string - Boolean string.
+ * @return boolean.
+ */
+ public static boolean getBoolean(String string) {
+ return string != null && string.equalsIgnoreCase("true");
+ }
+
+ /**
+ * Init options that will be cached.
+ */
+ private void initCachedData() {
+ messages = SpigotPrison.getInstance().getMessagesConfig();
+ backpacksConfig = SpigotPrison.getInstance().getBackpacksConfig();
+ if (new File(SpigotPrison.getInstance().getDataFolder() + "/backpacks/backpacksData.yml").exists()) {
+ backpacksData = YamlConfiguration.loadConfiguration(new File(SpigotPrison.getInstance().getDataFolder() + "/backpacks/backpacksData.yml"));
+ isFoundDeprecatedData = true;
+ } else {
+ isFoundDeprecatedData = false;
+ }
+ isBackpackUsePermissionEnabled = getBoolean(backpacksConfig.getString("Options.BackPack_Use_Permission_Enabled"));
+ isBackpackAutopickupEnabled = getBoolean(backpacksConfig.getString("Options.BackPack_AutoPickup_Usable"));
+ isBackpackOpenItemEnabled = getBoolean(backpacksConfig.getString("Options.Back_Pack_GUI_Opener_Item"));
+ isBackpackOpenItemGivenOnJoin = getBoolean(backpacksConfig.getString("Options.BackPack_Item_OnJoin"));
+ isBackpackEnabledIfLimitZero = getBoolean(backpacksConfig.getString("Options.BackPack_Access_And_Item_If_Limit_Is_0"));
+ isBackpackLostOnDeath = getBoolean(backpacksConfig.getString("Options.BackPack_Lose_Items_On_Death"));
+ isBackpackOpenSoundEnabled = getBoolean(backpacksConfig.getString("Options.BackPack_Open_Sound_Enabled"));
+ isBackpackCloseSoundEnabled = getBoolean(backpacksConfig.getString("Options.BackPack_Close_Sound_Enabled"));
+ isMultipleBackpacksEnabled = getBoolean(backpacksConfig.getString("Options.Multiple-BackPacks-For-Player-Enabled"));
+ if (XSound.matchXSound(backpacksConfig.getString("Options.BackPack_Open_Sound")).isPresent()) {
+ backpackOpenSound = XSound.matchXSound(backpacksConfig.getString("Options.BackPack_Open_Sound")).get();
+ }
+ if (XSound.matchXSound(backpacksConfig.getString("Options.BackPack_Close_Sound")).isPresent()) {
+ backpackCloseSound = XSound.matchXSound(backpacksConfig.getString("Options.BackPack_Close_Sound")).get();
+ }
+ if (XMaterial.matchXMaterial(backpacksConfig.getString("Options.BackPack_Item")).isPresent()) {
+ backpackOpenItem = XMaterial.matchXMaterial(backpacksConfig.getString("Options.BackPack_Item")).get();
+ }
+ backpackUsePermission = backpacksConfig.getString("Options.BackPack_Use_Permission");
+ backpackOpenItemTitle = backpacksConfig.getString("Options.BackPack_Item_Title");
+ defaultBackpackSize = Integer.parseInt(backpacksConfig.getString("Options.BackPack_Default_Size"));
+ defaultBackpackLimitForPlayer = Integer.parseInt(backpacksConfig.getString("Options.Multiple-BackPacks-For-Player"));
+ }
+
+ /**
+ * Save a Player's Backpack.
+ *
+ * @param p - Player.
+ * @param inv - Backpack.
+ */
+ public void setBackpack(Player p, Inventory inv, int id) {
+
+ //TODO
+ // Add conditions here to check if Player can own backpacks.
+ // This may also be a method with a boolean return value.
+
+ PlayerCachePlayerData pData = PlayerCache.getInstance().getOnlinePlayer(new SpigotPlayer(p));
+
+ if (pData == null) {
+ Output.get().sendInfo(new SpigotPlayer(p), "Sorry, unable to find cached data on you, this may be a bug! Please report it.");
+ return;
+ }
+
+ List inventories = prisonInventoryToNormalConverter(pData.getBackpacks());
+
+ if (inventories.get(id) != null){
+ // No need to check more conditions here, Player already owns a backpack here.
+ inventories.set(id, inv);
+
+ pData.setBackpacks(normalInventoryToPrisonConverter(inventories));
+ } else {
+
+ //TODO
+ // Add conditions to check if player can own a new backpack, maybe he reached the limit.
+ // This may be also a method with a boolean return value.
+
+ inventories.add(inv);
+
+ pData.setBackpacks(normalInventoryToPrisonConverter(inventories));
+ }
+ }
+
+ /**
+ * Get a Player's Backpack, there may be multiple ones.
+ *
+ * @param p - Player.
+ * @param id - int.
+ * @return Inventory - Backpack.
+ */
+ public Inventory getBackpack(Player p, int id) {
+
+ PlayerCachePlayerData pData = PlayerCache.getInstance().getOnlinePlayer(new SpigotPlayer(p));
+
+ if (pData == null) {
+ return null;
+ }
+
+ oldBackpacksConverter(p);
+
+ if (pData.getBackpacks() == null || pData.getBackpacks().get(id) == null) {
+ return null;
+ }
+ SpigotInventory sInv = (SpigotInventory) pData.getBackpacks().get(id);
+
+ return sInv.getWrapper();
+ }
+
+ /**
+ * Get Backpacks of a Player in a List of Inventories.
+ *
+ * @param p - Player.
+ *
+ * @return Inventory - List.
+ */
+ public List getBackpacks(Player p) {
+
+ PlayerCachePlayerData pData = PlayerCache.getInstance().getOnlinePlayer(new SpigotPlayer(p));
+
+ if (pData == null) {
+ return null;
+ }
+
+ oldBackpacksConverter(p);
+
+ if (pData.getBackpacks() == null) {
+ return null;
+ }
+
+ return prisonInventoryToNormalConverter(pData.getBackpacks());
+ }
+
+ /**
+ * Converts a Prison's Inventory List to the spigot standard one.
+ *
+ * @param pInv - PrisonInventory List.
+ *
+ * @return List - Inventory.
+ * */
+ private List prisonInventoryToNormalConverter(List pInv) {
+ List inventories = new ArrayList<>();
+ for (tech.mcprison.prison.internal.inventory.Inventory pInvRead : pInv) {
+ SpigotInventory sInv = (SpigotInventory) pInvRead;
+ inventories.add(sInv.getWrapper());
+ }
+
+ return inventories;
+ }
+
+ /**
+ * Converts a Spigot's normal Inventory List to the Prison one.
+ *
+ * @param inventories - Inventories.
+ *
+ * @return List - Prison Inventories.
+ * */
+ private List normalInventoryToPrisonConverter(List inventories) {
+ List pInv = new ArrayList<>();
+ for (Inventory readInv : inventories){
+ pInv.add(SpigotInventory.fromWrapper(readInv));
+ }
+ return pInv;
+ }
+
+ /**
+ * Converts old Backpacks storage to the new one, deleting the deprecated one for this player.
+ *
+ * @param p - Player.
+ */
+ private void oldBackpacksConverter(Player p) {
+ if (isFoundDeprecatedData) {
+ if (backpacksData.getString("Inventories." + p.getUniqueId() + ".PlayerName") != null) {
+
+ PlayerCachePlayerData pData = PlayerCache.getInstance().getOnlinePlayer(new SpigotPlayer(p));
+
+ List prisonBackpacks = pData.getBackpacks();
+ List readBackpacks = new ArrayList<>();
+
+ Output.get().sendWarn(new SpigotPlayer(p), "The Backpack data got updated, conversion started...");
+ File backpacksFile = new File(SpigotPrison.getInstance().getDataFolder() + "/backpacks/backpacksData.yml");
+ FileConfiguration backpacksFileData = YamlConfiguration.loadConfiguration(backpacksFile);
+
+ // Check if multiple backpacks is enabled and get the backpacks.
+ if (isMultipleBackpacksEnabled) {
+ for (String backpackIds : getBackpacksIDsList(p)) {
+ readBackpacks.add(getOldBackpackOwn(p, backpackIds));
+ }
+ } else {
+ readBackpacks.add(getOldBackpackOwn(p));
+ }
+
+ // Set to null this data and save it in the old config.
+ backpacksFileData.set("Inventories." + p.getUniqueId(), null);
+ try {
+ backpacksFileData.save(backpacksFile);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ int numberConverted = 0;
+ for (Inventory inv : readBackpacks) {
+ numberConverted++;
+ prisonBackpacks.add(SpigotInventory.fromWrapper(inv));
+ }
+
+ pData.setBackpacks(prisonBackpacks);
+ pData.isDirty();
+ Output.get().sendInfo(new SpigotPlayer(p), numberConverted + " Backpacks converted with success, will open soon...");
+ }
+ }
+ }
+
+ /**
+ * This method exists only for the conversion of the old deprecated one.
+ */
+ @Deprecated
+ private Inventory getOldBackpackOwn(Player p) {
+
+ int size = getOldSize(p);
+ Inventory inv = Bukkit.createInventory(p, size, SpigotPrison.format("&3" + p.getName() + " -> Backpack"));
+
+ // Get the Items config section.
+ Set slots;
+ try {
+ slots = backpacksData.getConfigurationSection("Inventories." + p.getUniqueId() + ".Items").getKeys(false);
+ } catch (NullPointerException ex) {
+ return inv;
+ }
+ if (slots.size() != 0) {
+ for (String slot : slots) {
+ ItemStack finalItem = backpacksData.getItemStack("Inventories." + p.getUniqueId() + ".Items." + slot + ".ITEMSTACK");
+ if (finalItem != null) {
+ int slotNumber = Integer.parseInt(slot);
+ if (size > slotNumber) {
+ inv.setItem(slotNumber, finalItem);
+ }
+ }
+ }
+ }
+
+ return inv;
+ }
+
+ /**
+ * This method exists only for the conversion of the old deprecated one.
+ */
+ @Deprecated
+ private Inventory getOldBackpackOwn(Player p, String id) {
+
+ int size = getOldSize(p, id);
+ Inventory inv = Bukkit.createInventory(p, size, SpigotPrison.format("&3" + p.getName() + " -> Backpack-" + id));
+
+ // Get the Items config section
+ Set slots;
+ try {
+ slots = backpacksData.getConfigurationSection("Inventories." + p.getUniqueId() + ".Items-" + id).getKeys(false);
+ } catch (NullPointerException ex) {
+ return inv;
+ }
+ if (slots.size() != 0) {
+ for (String slot : slots) {
+ ItemStack finalItem = backpacksData.getItemStack("Inventories." + p.getUniqueId() + ".Items-" + id + "." + slot + ".ITEMSTACK");
+ if (finalItem != null) {
+ int slotNumber = Integer.parseInt(slot);
+ if (size > slotNumber) {
+ inv.setItem(slotNumber, finalItem);
+ }
+ }
+ }
+ }
+
+ return inv;
+ }
+
+ /**
+ * Don't use this method.
+ */
+ @Deprecated
+ private int getOldSize(Player p) {
+
+ int backPackSize = defaultBackpackSize;
+
+ try {
+ backPackSize = Integer.parseInt(backpacksData.getString("Inventories." + p.getUniqueId() + ".Items.Size"));
+ } catch (NumberFormatException ignored) {
+ }
+
+ if (backPackSize % 9 != 0) {
+ backPackSize = (int) Math.ceil((float) backPackSize / 9) * 9;
+ }
+
+ if (backPackSize == 0) backPackSize = 9;
+
+ return getBackpackPermSize(p, backPackSize);
+ }
+
+ /**
+ * Don't use this method.
+ */
+ @Deprecated
+ private int getOldSize(Player p, String id) {
+ int backPackSize = defaultBackpackSize;
+
+ try {
+ backPackSize = Integer.parseInt(backpacksData.getString("Inventories." + p.getUniqueId() + ".Items-" + id + ".Size"));
+ } catch (NumberFormatException ignored) {
+ }
+
+ if (backPackSize % 9 != 0) {
+ backPackSize = (int) Math.ceil((float) backPackSize / 9) * 9;
+ }
+
+ if (backPackSize == 0) backPackSize = 9;
+
+ return getBackpackPermSize(p, backPackSize);
+ }
+
+ /**
+ * Get backpack size of a Player Backpack with the permission for a custom one.
+ */
+ private int getBackpackPermSize(Player p, int backPackSize) {
+ SpigotPlayer sPlayer = new SpigotPlayer(p);
+ List perms = sPlayer.getPermissions("prison.backpack.size.");
+ int value = 0;
+ for (String permNumber : perms) {
+ int newValue = Integer.parseInt(permNumber.substring(21));
+ if (newValue > value) {
+ value = (int) Math.ceil((float) newValue / 9) * 9;
+ }
+ }
+
+ if (value != 0) {
+ return value;
+ }
+ return backPackSize;
+ }
+
+ /**
+ * This method exists only for the conversion of the old deprecated one.
+ */
+ @Deprecated
+ private List getBackpacksIDsList(Player p) {
+ List backpacksIDs = new ArrayList<>();
+
+ // Items can be -> Items- or just Items in the config, the default and old backpacks will have Items only, newer will be like
+ // Items-1 or anyway an ID, I'm just getting the ID with this which's what I need.
+ try {
+ for (String key : backpacksData.getConfigurationSection("Inventories." + p.getUniqueId()).getKeys(false)) {
+ if (!key.equalsIgnoreCase("Items") && !key.equalsIgnoreCase("Limit") && !key.equalsIgnoreCase("PlayerName") && !key.equalsIgnoreCase("UniqueID")) {
+ backpacksIDs.add(key.substring(6));
+ } else {
+ if (!backpacksIDs.contains(null) && !key.equalsIgnoreCase("PlayerName") && !key.equalsIgnoreCase("UniqueID") && !key.equalsIgnoreCase("Limit")) {
+ backpacksIDs.add(null);
+ }
+ }
+ }
+ } catch (NullPointerException ignored) {
+ }
+
+ return backpacksIDs;
+ }
+}
From 31763dc1a35e96ba801cdb460aed167233fd6dbe Mon Sep 17 00:00:00 2001
From: AnonymousGCA
Date: Fri, 1 Oct 2021 23:04:08 +0200
Subject: [PATCH 073/283] Changelogs: - Absolutely not ready NewBackPacksUtil,
not tested and not even final class name, everything is work-in-progress and
there may be a ton of optimizations possible.
---
.../spigot/backpacks/NewBackpacksUtil.java | 166 ++++++++++++++----
1 file changed, 134 insertions(+), 32 deletions(-)
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/NewBackpacksUtil.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/NewBackpacksUtil.java
index 4a52f8795..e9b72c6ef 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/NewBackpacksUtil.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/NewBackpacksUtil.java
@@ -120,21 +120,26 @@ private void initCachedData() {
/**
* Save a Player's Backpack.
+ * This method will return true if ran with success, false if Player is missing permission (if enabled)
+ * or some conditions aren't met, or even errors.
+ * Essentially, return true if success, false if fail.
*
* @param p - Player.
* @param inv - Backpack.
+ *
+ * @return boolean.
*/
- public void setBackpack(Player p, Inventory inv, int id) {
+ public boolean setBackpack(Player p, Inventory inv, int id) {
- //TODO
- // Add conditions here to check if Player can own backpacks.
- // This may also be a method with a boolean return value.
+ if (!canOwnBackpacks(p)){
+ return false;
+ }
PlayerCachePlayerData pData = PlayerCache.getInstance().getOnlinePlayer(new SpigotPlayer(p));
if (pData == null) {
- Output.get().sendInfo(new SpigotPlayer(p), "Sorry, unable to find cached data on you, this may be a bug! Please report it.");
- return;
+ Output.get().sendInfo(new SpigotPlayer(p), "Sorry, unable to find cached data about you, this may be a bug! Please report it.");
+ return false;
}
List inventories = prisonInventoryToNormalConverter(pData.getBackpacks());
@@ -146,21 +151,99 @@ public void setBackpack(Player p, Inventory inv, int id) {
pData.setBackpacks(normalInventoryToPrisonConverter(inventories));
} else {
- //TODO
- // Add conditions to check if player can own a new backpack, maybe he reached the limit.
- // This may be also a method with a boolean return value.
+ return addBackpack(p, inv);
+ }
+ return true;
+ }
- inventories.add(inv);
+ /**
+ * Add a Backpack to a Player.
+ *
+ * Return true if success, false if fail.
+ *
+ * @param p - Player.
+ * @param inv - Inventory.
+ *
+ * @return boolean.
+ * */
+ public boolean addBackpack(Player p, Inventory inv){
- pData.setBackpacks(normalInventoryToPrisonConverter(inventories));
+ if (!canOwnBackpacks(p)){
+ return false;
}
+
+ if (inv.getSize() <= getBackpackPermSize(p)){
+ Output.get().sendWarn(new SpigotPlayer(p), "Sorry but you can't own a Backpack of this size.");
+ return false;
+ }
+
+ PlayerCachePlayerData pData = PlayerCache.getInstance().getOnlinePlayer(new SpigotPlayer(p));
+
+ if (pData == null) {
+ Output.get().sendInfo(new SpigotPlayer(p), "Sorry, unable to find cached data on you, this may be a bug! Please report it.");
+ return false;
+ }
+
+ List inventories = prisonInventoryToNormalConverter(pData.getBackpacks());
+
+ if (reachedBackpacksLimit(p)){
+ Output.get().sendWarn(new SpigotPlayer(p), "Sorry, you can't own more Backpacks!");
+ return false;
+ }
+
+ inventories.add(inv);
+ pData.setBackpacks(normalInventoryToPrisonConverter(inventories));
+ return true;
+ }
+
+ /**
+ * Check if player reached limit of own backpacks.
+ *
+ * @return boolean - True if reached, false if not.
+ * */
+ public boolean reachedBackpacksLimit(Player p){
+ return isMultipleBackpacksEnabled && (getBackpacksLimit(p) <= getNumberOwnedBackpacks(p));
+ }
+
+ /**
+ * Get number of Backpacks own by Player.
+ *
+ * @param p - Player.
+ * */
+ public int getNumberOwnedBackpacks(Player p){
+ PlayerCachePlayerData pData = PlayerCache.getInstance().getOnlinePlayer(new SpigotPlayer(p));
+
+ if (pData == null){
+ return 0;
+ }
+
+ return pData.getBackpacks().size();
+ }
+
+ // TODO
+ // Not sure if this data is cached yet.
+ private int getBackpacksLimit(Player p) {
+ return defaultBackpackLimitForPlayer;
+ }
+
+ /**
+ * Check if Player can own Backpacks.
+ * Return true if can, False otherwise.
+ *
+ * @param p - Player.
+ *
+ * @return boolean.
+ * */
+ public boolean canOwnBackpacks(Player p){
+ return !isBackpackUsePermissionEnabled || p.hasPermission(backpackUsePermission);
}
/**
* Get a Player's Backpack, there may be multiple ones.
*
- * @param p - Player.
+ * @param p - Player.
* @param id - int.
+ *
* @return Inventory - Backpack.
*/
public Inventory getBackpack(Player p, int id) {
@@ -285,6 +368,45 @@ private void oldBackpacksConverter(Player p) {
}
}
+ /**
+ * Get backpack size of a Player Backpack with the permission for a custom one.
+ */
+ private int getBackpackPermSize(Player p, int backPackSize) {
+ SpigotPlayer sPlayer = new SpigotPlayer(p);
+ List perms = sPlayer.getPermissions("prison.backpack.size.");
+ int value = 0;
+ for (String permNumber : perms) {
+ int newValue = Integer.parseInt(permNumber.substring(21));
+ if (newValue > value) {
+ value = (int) Math.ceil((float) newValue / 9) * 9;
+ }
+ }
+
+ if (value != 0) {
+ return value;
+ }
+ return backPackSize;
+ }
+
+ /**
+ * Get backpack size from permissions of a Player and/or defaults.
+ *
+ * @param p - Player.
+ *
+ * @return int - size.
+ * */
+ public int getBackpackPermSize(Player p){
+ int backPackSize = defaultBackpackSize;
+
+ if (backPackSize % 9 != 0) {
+ backPackSize = (int) Math.ceil((float) backPackSize / 9) * 9;
+ }
+
+ if (backPackSize == 0) backPackSize = 9;
+
+ return getBackpackPermSize(p, backPackSize);
+ }
+
/**
* This method exists only for the conversion of the old deprecated one.
*/
@@ -390,26 +512,6 @@ private int getOldSize(Player p, String id) {
return getBackpackPermSize(p, backPackSize);
}
- /**
- * Get backpack size of a Player Backpack with the permission for a custom one.
- */
- private int getBackpackPermSize(Player p, int backPackSize) {
- SpigotPlayer sPlayer = new SpigotPlayer(p);
- List perms = sPlayer.getPermissions("prison.backpack.size.");
- int value = 0;
- for (String permNumber : perms) {
- int newValue = Integer.parseInt(permNumber.substring(21));
- if (newValue > value) {
- value = (int) Math.ceil((float) newValue / 9) * 9;
- }
- }
-
- if (value != 0) {
- return value;
- }
- return backPackSize;
- }
-
/**
* This method exists only for the conversion of the old deprecated one.
*/
From 9451ffb18e5929dfbdd549f6c291b82d94a4cfcb Mon Sep 17 00:00:00 2001
From: AnonymousGCA
Date: Sun, 3 Oct 2021 15:40:34 +0200
Subject: [PATCH 074/283] Changelogs: - Absolutely not ready NewBackPacksUtil,
not tested and not even final class name, everything is work-in-progress and
there may be a ton of optimizations possible.
---
.../spigot/backpacks/NewBackpacksUtil.java | 179 ++++++++++++++----
1 file changed, 146 insertions(+), 33 deletions(-)
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/NewBackpacksUtil.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/NewBackpacksUtil.java
index e9b72c6ef..e1332baf3 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/NewBackpacksUtil.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/NewBackpacksUtil.java
@@ -3,18 +3,21 @@
import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XSound;
import org.bukkit.Bukkit;
+import org.bukkit.Sound;
import org.bukkit.configuration.Configuration;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
import tech.mcprison.prison.cache.PlayerCache;
import tech.mcprison.prison.cache.PlayerCachePlayerData;
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.SpigotPrison;
import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
+import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.inventory.SpigotInventory;
import java.io.File;
@@ -34,7 +37,7 @@ public class NewBackpacksUtil {
private Configuration backpacksData;
private boolean isFoundDeprecatedData;
private boolean isBackpackUsePermissionEnabled;
- private boolean isBackpackAutopickupEnabled;
+ private boolean isBackpackAutoPickupEnabled;
private boolean isBackpackOpenItemEnabled;
private boolean isBackpackOpenItemGivenOnJoin;
private boolean isBackpackEnabledIfLimitZero;
@@ -72,6 +75,124 @@ public NewBackpacksUtil get() {
return instance;
}
+ /**
+ * Check if Backpack AutoPickup is enabled.
+ *
+ * @return boolean.
+ */
+ public boolean isBackpackAutoPickupEnabled() {
+ return this.isBackpackAutoPickupEnabled;
+ }
+
+ /**
+ * Check if the Backpack Open Item is enabled.
+ *
+ * @return boolean.
+ */
+ public boolean isBackpackOpenItemEnabled() {
+ return this.isBackpackOpenItemEnabled;
+ }
+
+ /**
+ * Check if the Backpack Open Item is given on join.
+ *
+ * @return boolean.
+ */
+ public boolean isBackpackOpenItemGivenOnJoin() {
+ return this.isBackpackOpenItemGivenOnJoin;
+ }
+
+ /**
+ * Check if Backpack can be used and Backpack item too
+ * if the Player's limit is set to 0.
+ *
+ * @return boolean.
+ */
+ public boolean isBackpackEnabledIfLimitZero() {
+ return this.isBackpackEnabledIfLimitZero;
+ }
+
+ /**
+ * Check if Backpack is deleted/reset on death.
+ *
+ * @return boolean.
+ */
+ public boolean isBackpackLostOnDeath() {
+ return this.isBackpackLostOnDeath;
+ }
+
+ /**
+ * Check if Backpack open sound is enabled.
+ *
+ * @return boolean.
+ * */
+ public boolean isBackpackOpenSoundEnabled(){
+ return this.isBackpackOpenSoundEnabled;
+ }
+
+ /**
+ * Check if Backpack close sound is enabled.
+ *
+ * @return boolean.
+ * */
+ public boolean isBackpackCloseSoundEnabled(){
+ return this.isBackpackCloseSoundEnabled;
+ }
+
+ /**
+ * Get Backpack Open Item Title.
+ *
+ * @return String.
+ * */
+ public String getBackpackOpenItemTitle(){
+ return this.backpackOpenItemTitle;
+ }
+
+ /**
+ * Get Backpack Open Permission.
+ *
+ * @return String.
+ * */
+ public String getBackpackUsePermission(){
+ return this.backpackUsePermission;
+ }
+
+ /**
+ * Get Backpack Open Sound.
+ *
+ * @return Sound.
+ * */
+ public Sound getBackpackOpenSound(){
+ return this.backpackOpenSound.parseSound();
+ }
+
+ /**
+ * Get Backpack Close Sound.
+ *
+ * @return Sound.
+ * */
+ public Sound getBackpackCloseSound(){
+ return this.backpackCloseSound.parseSound();
+ }
+
+ /**
+ * Get Backpack Open Item.
+ *
+ * @return ItemStack.
+ * */
+ public ItemStack getBackpackOpenItem(){
+
+ ItemStack backPackOpenItemStack = new ItemStack(backpackOpenItem.parseMaterial(), 1);
+ ItemMeta meta = backPackOpenItemStack.getItemMeta();
+ meta.setDisplayName(SpigotPrison.format(SpigotPrison.format(backpackOpenItemTitle)));
+ ButtonLore lore = new ButtonLore();
+ lore.setLoreAction("Click to open Backpack!");
+ meta.setLore(lore.getLore());
+ backPackOpenItemStack.setItemMeta(meta);
+
+ return backPackOpenItemStack;
+ }
+
/**
* Return boolean value from String.
*
@@ -95,7 +216,7 @@ private void initCachedData() {
isFoundDeprecatedData = false;
}
isBackpackUsePermissionEnabled = getBoolean(backpacksConfig.getString("Options.BackPack_Use_Permission_Enabled"));
- isBackpackAutopickupEnabled = getBoolean(backpacksConfig.getString("Options.BackPack_AutoPickup_Usable"));
+ isBackpackAutoPickupEnabled = getBoolean(backpacksConfig.getString("Options.BackPack_AutoPickup_Usable"));
isBackpackOpenItemEnabled = getBoolean(backpacksConfig.getString("Options.Back_Pack_GUI_Opener_Item"));
isBackpackOpenItemGivenOnJoin = getBoolean(backpacksConfig.getString("Options.BackPack_Item_OnJoin"));
isBackpackEnabledIfLimitZero = getBoolean(backpacksConfig.getString("Options.BackPack_Access_And_Item_If_Limit_Is_0"));
@@ -124,14 +245,13 @@ private void initCachedData() {
* or some conditions aren't met, or even errors.
* Essentially, return true if success, false if fail.
*
- * @param p - Player.
+ * @param p - Player.
* @param inv - Backpack.
- *
* @return boolean.
*/
public boolean setBackpack(Player p, Inventory inv, int id) {
- if (!canOwnBackpacks(p)){
+ if (!canOwnBackpacks(p)) {
return false;
}
@@ -144,7 +264,7 @@ public boolean setBackpack(Player p, Inventory inv, int id) {
List inventories = prisonInventoryToNormalConverter(pData.getBackpacks());
- if (inventories.get(id) != null){
+ if (inventories.get(id) != null) {
// No need to check more conditions here, Player already owns a backpack here.
inventories.set(id, inv);
@@ -158,21 +278,20 @@ public boolean setBackpack(Player p, Inventory inv, int id) {
/**
* Add a Backpack to a Player.
- *
+ *
* Return true if success, false if fail.
*
- * @param p - Player.
+ * @param p - Player.
* @param inv - Inventory.
- *
* @return boolean.
- * */
- public boolean addBackpack(Player p, Inventory inv){
+ */
+ public boolean addBackpack(Player p, Inventory inv) {
- if (!canOwnBackpacks(p)){
+ if (!canOwnBackpacks(p)) {
return false;
}
- if (inv.getSize() <= getBackpackPermSize(p)){
+ if (inv.getSize() <= getBackpackPermSize(p)) {
Output.get().sendWarn(new SpigotPlayer(p), "Sorry but you can't own a Backpack of this size.");
return false;
}
@@ -186,7 +305,7 @@ public boolean addBackpack(Player p, Inventory inv){
List inventories = prisonInventoryToNormalConverter(pData.getBackpacks());
- if (reachedBackpacksLimit(p)){
+ if (reachedBackpacksLimit(p)) {
Output.get().sendWarn(new SpigotPlayer(p), "Sorry, you can't own more Backpacks!");
return false;
}
@@ -200,8 +319,8 @@ public boolean addBackpack(Player p, Inventory inv){
* Check if player reached limit of own backpacks.
*
* @return boolean - True if reached, false if not.
- * */
- public boolean reachedBackpacksLimit(Player p){
+ */
+ public boolean reachedBackpacksLimit(Player p) {
return isMultipleBackpacksEnabled && (getBackpacksLimit(p) <= getNumberOwnedBackpacks(p));
}
@@ -209,11 +328,11 @@ public boolean reachedBackpacksLimit(Player p){
* Get number of Backpacks own by Player.
*
* @param p - Player.
- * */
- public int getNumberOwnedBackpacks(Player p){
+ */
+ public int getNumberOwnedBackpacks(Player p) {
PlayerCachePlayerData pData = PlayerCache.getInstance().getOnlinePlayer(new SpigotPlayer(p));
- if (pData == null){
+ if (pData == null) {
return 0;
}
@@ -231,19 +350,17 @@ private int getBackpacksLimit(Player p) {
* Return true if can, False otherwise.
*
* @param p - Player.
- *
* @return boolean.
- * */
- public boolean canOwnBackpacks(Player p){
+ */
+ public boolean canOwnBackpacks(Player p) {
return !isBackpackUsePermissionEnabled || p.hasPermission(backpackUsePermission);
}
/**
* Get a Player's Backpack, there may be multiple ones.
*
- * @param p - Player.
+ * @param p - Player.
* @param id - int.
- *
* @return Inventory - Backpack.
*/
public Inventory getBackpack(Player p, int id) {
@@ -268,7 +385,6 @@ public Inventory getBackpack(Player p, int id) {
* Get Backpacks of a Player in a List of Inventories.
*
* @param p - Player.
- *
* @return Inventory - List.
*/
public List getBackpacks(Player p) {
@@ -292,9 +408,8 @@ public List getBackpacks(Player p) {
* Converts a Prison's Inventory List to the spigot standard one.
*
* @param pInv - PrisonInventory List.
- *
* @return List - Inventory.
- * */
+ */
private List prisonInventoryToNormalConverter(List pInv) {
List inventories = new ArrayList<>();
for (tech.mcprison.prison.internal.inventory.Inventory pInvRead : pInv) {
@@ -309,12 +424,11 @@ private List prisonInventoryToNormalConverter(List normalInventoryToPrisonConverter(List inventories) {
List pInv = new ArrayList<>();
- for (Inventory readInv : inventories){
+ for (Inventory readInv : inventories) {
pInv.add(SpigotInventory.fromWrapper(readInv));
}
return pInv;
@@ -392,10 +506,9 @@ private int getBackpackPermSize(Player p, int backPackSize) {
* Get backpack size from permissions of a Player and/or defaults.
*
* @param p - Player.
- *
* @return int - size.
- * */
- public int getBackpackPermSize(Player p){
+ */
+ public int getBackpackPermSize(Player p) {
int backPackSize = defaultBackpackSize;
if (backPackSize % 9 != 0) {
From 9b801c5c0f29be16bf44395f457c121d6dc592f9 Mon Sep 17 00:00:00 2001
From: AnonymousGCA
Date: Sun, 3 Oct 2021 23:19:38 +0200
Subject: [PATCH 075/283] Changelogs: - Absolutely not ready NewBackPacksUtil,
not tested and not even final class name, everything is work-in-progress and
there may be a ton of optimizations possible.
---
.../spigot/backpacks/NewBackpacksUtil.java | 31 ++++++++++-
.../gui/backpacks/BackpacksPlayerGUI.java | 54 +++++++++++++++++++
2 files changed, 83 insertions(+), 2 deletions(-)
create mode 100644 prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksPlayerGUI.java
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/NewBackpacksUtil.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/NewBackpacksUtil.java
index e1332baf3..cd9617ba9 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/NewBackpacksUtil.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/backpacks/NewBackpacksUtil.java
@@ -17,6 +17,7 @@
import tech.mcprison.prison.spigot.SpigotPrison;
import tech.mcprison.prison.spigot.configs.MessagesConfig;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
+import tech.mcprison.prison.spigot.gui.backpacks.BackpacksPlayerGUI;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.inventory.SpigotInventory;
@@ -56,12 +57,12 @@ public class NewBackpacksUtil {
/**
* Get an instance of Backpacks to get full access to the API.
- *
+ *
* If Backpacks are disabled, this will return null.
*
* @return BackpacksUtil
*/
- public NewBackpacksUtil get() {
+ public static NewBackpacksUtil get() {
if (!getBoolean(SpigotPrison.getInstance().getConfig().getString("backpacks"))) {
return null;
@@ -269,6 +270,7 @@ public boolean setBackpack(Player p, Inventory inv, int id) {
inventories.set(id, inv);
pData.setBackpacks(normalInventoryToPrisonConverter(inventories));
+ pData.isDirty();
} else {
return addBackpack(p, inv);
@@ -312,6 +314,7 @@ public boolean addBackpack(Player p, Inventory inv) {
inventories.add(inv);
pData.setBackpacks(normalInventoryToPrisonConverter(inventories));
+ pData.isDirty();
return true;
}
@@ -404,6 +407,30 @@ public List getBackpacks(Player p) {
return prisonInventoryToNormalConverter(pData.getBackpacks());
}
+ /**
+ * Open Player's Backpack.
+ *
+ * Return true if open with success, false if fail or error.
+ *
+ * @param p - Player.
+ * @param id - Int.
+ *
+ * return boolean.
+ * */
+ public boolean openBackpack(Player p, int id){
+
+ // Check if Player owns a Backpack with this ID.
+ if (getBackpack(p, id) == null){
+
+ Output.get().sendWarn(new SpigotPlayer(p), "Backpack not found!");
+ return false;
+ }
+
+ BackpacksPlayerGUI gui = new BackpacksPlayerGUI(p, id);
+ gui.open();
+ return true;
+ }
+
/**
* Converts a Prison's Inventory List to the spigot standard one.
*
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksPlayerGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksPlayerGUI.java
new file mode 100644
index 000000000..843100d1f
--- /dev/null
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/backpacks/BackpacksPlayerGUI.java
@@ -0,0 +1,54 @@
+package tech.mcprison.prison.spigot.gui.backpacks;
+
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.Inventory;
+import tech.mcprison.prison.output.Output;
+import tech.mcprison.prison.spigot.backpacks.NewBackpacksUtil;
+import tech.mcprison.prison.spigot.game.SpigotPlayer;
+import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
+import tech.mcprison.prison.spigot.gui.guiutility.SpigotGUIComponents;
+
+public class BackpacksPlayerGUI extends SpigotGUIComponents {
+
+ private final Player p;
+ private final int id;
+
+ /**
+ * Load Backpack of a Player if exists.
+ *
+ * @param p - Player.
+ * @param id - Backpack id.
+ * */
+ public BackpacksPlayerGUI(Player p, int id){
+ this.p = p;
+ this.id = id;
+ }
+
+ public void open(){
+
+ NewBackpacksUtil backpacksUtil = NewBackpacksUtil.get();
+
+ if (backpacksUtil == null){
+ return;
+ }
+
+ SpigotPlayer sPlayer = new SpigotPlayer(p);
+
+ Inventory inv = backpacksUtil.getBackpack(p, id);
+
+ if (inv != null){
+ PrisonGUI gui = new PrisonGUI(p, inv.getSize(), "&3" + p.getName() + " -> Backpack-" + id);
+
+ Output.get().sendInfo(sPlayer, "Backpack" + id + " open with success!");
+
+ if (backpacksUtil.isBackpackOpenSoundEnabled()){
+ p.playSound(p.getLocation(), backpacksUtil.getBackpackOpenSound(),3,1);
+ }
+
+ gui.open();
+ }
+
+ Output.get().sendWarn(sPlayer, "Backpack ID -> " + id + " not found");
+ }
+
+}
From fbb0c6904311f3a1007dbc7246f9365a55e40353 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Sun, 3 Oct 2021 23:59:00 -0400
Subject: [PATCH 076/283] Changed the message about worn out tool to use the
SpigotPlayer's setActionBar() function to prevent overloading console
messages.
---
docs/changelog_v3.3.x.md | 5 ++++-
.../prison/spigot/block/OnBlockBreakEventCore.java | 10 ++++++----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index a29019efa..fd7ec372a 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -13,7 +13,10 @@ These build logs represent the work that has been going on within prison.
*Will continue as v3.3.0-alpha.7 2021-06-?? in the near future.*
-# 3.2.11-alpha.1 2021-09-28
+# 3.2.11-alpha.1 2021-10-03
+
+
+* **Changed the message about worn out tool to use the SpigotPlayer's setActionBar() function to prevent overloading console messages.**
* **Bug fix: Logic was corrected to handle the double negative correctly.**
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java
index fa4e59cba..7d0fe44b3 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java
@@ -41,7 +41,6 @@
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.integrations.IntegrationCrazyEnchantmentsPickaxes;
import tech.mcprison.prison.spigot.utils.BlockUtils;
-import tech.mcprison.prison.spigot.utils.PrisonUtilsTitles;
import tech.mcprison.prison.util.Text;
public class OnBlockBreakEventCore
@@ -498,9 +497,12 @@ else if ( mine.isInMineExact( sBlock.getLocation() ) ) {
if ( isToolDisabled( pmEvent.getPlayer() ) ) {
- PrisonUtilsTitles uTitles = new PrisonUtilsTitles();
- uTitles.utilsTitlesActionBar( pmEvent.getSpigotPlayer(), "",
- "&cYour tool is worn-out and cannot be used." );
+ // This will prevent sending too many messages since it is using PlayerMessagingTask:
+ pmEvent.getSpigotPlayer().setActionBar( "&cYour tool is worn-out and cannot be used." );
+
+// PrisonUtilsTitles uTitles = new PrisonUtilsTitles();
+// uTitles.utilsTitlesActionBarForce( pmEvent.getSpigotPlayer(), null,
+// "&cYour tool is worn-out and cannot be used." );
pmEvent.setCancelOriginalEvent( true );
debugInfo.append( "UNUSABLE_TOOL__WORN_OUT (event canceled) " );
From e83224819f351562e3628bb3a8959577fb88bbf3 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Thu, 7 Oct 2021 18:22:54 -0400
Subject: [PATCH 077/283] Fixed a compatibility issue with older versions of
spigot. Should have possibly use the compatibility classes, but if a method
does not exist, then this will fall back on a string matching pattern.
---
docs/changelog_v3.3.x.md | 5 ++-
.../prison/spigot/game/SpigotPlayerUtil.java | 33 ++++++++++++++++---
2 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index fd7ec372a..439e929c4 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -13,7 +13,10 @@ These build logs represent the work that has been going on within prison.
*Will continue as v3.3.0-alpha.7 2021-06-?? in the near future.*
-# 3.2.11-alpha.1 2021-10-03
+# 3.2.11-alpha.1 2021-10-07
+
+
+* **Fixed a compatibility issue with older versions of spigot.** Should have possibly use the compatibility classes, but if a method does not exist, then this will fall back on a string matching pattern.
* **Changed the message about worn out tool to use the SpigotPlayer's setActionBar() function to prevent overloading console messages.**
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotPlayerUtil.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotPlayerUtil.java
index 8bdd8cf68..4ac67b8c3 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotPlayerUtil.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotPlayerUtil.java
@@ -1,7 +1,9 @@
package tech.mcprison.prison.spigot.game;
+import java.lang.reflect.Method;
import java.util.UUID;
+import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment;
import tech.mcprison.prison.Prison;
@@ -333,12 +335,35 @@ private int getEnchantment( String enchant ) {
Enchantment enchantment = null;
- for ( Enchantment e : Enchantment.values() ) {
- if ( e.getKey().getKey().equalsIgnoreCase( enchant ) ) {
- enchantment = e;
- break;
+ try
+ {
+ @SuppressWarnings( "unused" )
+ Method methodGetKey = Enchantment.LUCK.getClass().getMethod( "getKey" );
+
+ for ( Enchantment e : Enchantment.values() ) {
+ if (e.getKey().getKey().equalsIgnoreCase( enchant ) ) {
+ enchantment = e;
+ break;
+ }
}
}
+ catch ( NoSuchMethodException | SecurityException e1 ) {
+ // Ignore the fact that the method does not exist, which just means this is
+ // spigot 1.8 or so.
+
+ for ( Enchantment e : Enchantment.values() ) {
+ if ( e.toString().toLowerCase().contains( enchant.toLowerCase() ) ) {
+ enchantment = e;
+ }
+ }
+ }
+
+// for ( Enchantment e : Enchantment.values() ) {
+// if (e.getKey().getKey().equalsIgnoreCase( enchant ) ) {
+// enchantment = e;
+// break;
+// }
+// }
if ( enchantment != null ) {
From 6c848b14d986745ec91fbad97077baf240aa0ae5 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Thu, 7 Oct 2021 18:25:24 -0400
Subject: [PATCH 078/283] For a couple of rankup messages, using the rank tag
now instead of the rank name.
---
docs/changelog_v3.3.x.md | 3 +++
.../mcprison/prison/ranks/commands/RankUpCommandMessages.java | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index 439e929c4..fdf592f1f 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -16,6 +16,9 @@ These build logs represent the work that has been going on within prison.
# 3.2.11-alpha.1 2021-10-07
+* **For a couple of rankup messages, using the rank tag now instead of the rank name.**
+
+
* **Fixed a compatibility issue with older versions of spigot.** Should have possibly use the compatibility classes, but if a method does not exist, then this will fall back on a string matching pattern.
diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RankUpCommandMessages.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RankUpCommandMessages.java
index b756c595c..895a1f578 100644
--- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RankUpCommandMessages.java
+++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RankUpCommandMessages.java
@@ -180,7 +180,7 @@ protected void ranksRankupSuccessMsg( CommandSender sender, String playerName,
.withReplacements(
(playerName == null ? messagNoPlayerName : playerName),
- (tRank == null ? "" : tRank.getName()),
+ (tRank == null ? "" : tRank.getTag() ),
(results.getMessage() != null ? results.getMessage() : "")
);
@@ -202,7 +202,7 @@ protected void ranksRankupSuccessMsg( CommandSender sender, String playerName,
.withReplacements(
(playerName == null ? messagNoPlayerNameBroadcast : playerName),
- (tRank == null ? "" : tRank.getName()),
+ (tRank == null ? "" : tRank.getTag() ),
(results.getMessage() != null ? results.getMessage() : "")
)
.broadcast();
From b913d6395a534137838acdf4f64f9a63e9151325 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Thu, 7 Oct 2021 18:35:52 -0400
Subject: [PATCH 079/283] Add the abilty to glow the prison bombs when they are
dropped/set.
---
docs/changelog_v3.3.x.md | 3 +++
.../java/tech/mcprison/prison/bombs/MineBombData.java | 9 +++++++++
.../mcprison/prison/spigot/utils/PrisonBombListener.java | 8 +++++++-
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index fdf592f1f..ebaba599b 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -16,6 +16,9 @@ These build logs represent the work that has been going on within prison.
# 3.2.11-alpha.1 2021-10-07
+* **Add the ability to glow the prison bombs when they are dropped/set.**
+
+
* **For a couple of rankup messages, using the rank tag now instead of the rank name.**
diff --git a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombData.java b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombData.java
index c3cfc1bef..034c0cb1f 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombData.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombData.java
@@ -47,6 +47,8 @@ public class MineBombData {
private String description;
+ private boolean glowing = false;
+
private boolean activated = false;
@@ -135,6 +137,13 @@ public void setDescription( String description ) {
this.description = description;
}
+ public boolean isGlowing() {
+ return glowing;
+ }
+ public void setGlowing( boolean glowing ) {
+ this.glowing = glowing;
+ }
+
public boolean isActivated() {
return activated;
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java
index e40c5c899..d8e5fcd98 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java
@@ -31,7 +31,7 @@ public class PrisonBombListener
{
@EventHandler( priority = EventPriority.LOW )
- public void onInteract(PlayerInteractEvent event) {
+ public void onInteract( PlayerInteractEvent event ) {
if ( !event.getPlayer().hasPermission("prison.minebombs.use") ) {
return;
}
@@ -67,6 +67,12 @@ public void onInteract(PlayerInteractEvent event) {
dropped.setVelocity(player.getLocation().getDirection().multiply( throwSpeed ).normalize() );
dropped.setPickupDelay( 50000 );
+ dropped.setGlowing( bomb.isGlowing() );
+ dropped.setCustomName( bomb.getName() );
+
+ dropped.setMetadata( "prisonMineBomb", new FixedMetadataValue( SpigotPrison.getInstance(), true ) );
+ //dropped.setMetadata( "prisonMineName", new FixedMetadataValue( SpigotPrison.getInstance(), "mineName" ) );
+
PrisonUtilsMineBombs.setoffBombDelayed( sPlayer, bomb, dropped, sBlock, throwSpeed );
From f1178a7cb5d9153875ad8dedeaab73d7d2e7159d Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Fri, 8 Oct 2021 06:28:56 -0400
Subject: [PATCH 080/283] Add the abilty to glow the prison bombs when they are
dropped/set.
---
.../tech/mcprison/prison/spigot/utils/PrisonBombListener.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java
index d8e5fcd98..3fbdafbf2 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java
@@ -9,6 +9,7 @@
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.metadata.FixedMetadataValue;
import tech.mcprison.prison.bombs.MineBombData;
import tech.mcprison.prison.spigot.block.SpigotBlock;
From a0b5db6302ae62f337edc18fe0f9571281996120 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Fri, 8 Oct 2021 06:32:10 -0400
Subject: [PATCH 081/283] Add the abilty to glow the prison bombs when they are
dropped/set.
---
.../tech/mcprison/prison/spigot/utils/PrisonBombListener.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java
index 3fbdafbf2..923a9799e 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java
@@ -12,6 +12,7 @@
import org.bukkit.metadata.FixedMetadataValue;
import tech.mcprison.prison.bombs.MineBombData;
+import tech.mcprison.prison.spigot.SpigotPrison;
import tech.mcprison.prison.spigot.block.SpigotBlock;
import tech.mcprison.prison.spigot.block.SpigotItemStack;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
From 41fce1f049d1259d0288f6e4b6cd65bcd814e284 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Tue, 12 Oct 2021 22:21:52 -0400
Subject: [PATCH 082/283] A few updates to mine bombs. They have been disabled
so they cannot be used.
---
docs/changelog_v3.3.x.md | 5 +-
.../prison/spigot/game/SpigotPlayerUtil.java | 1 -
.../spigot/utils/PrisonBombListener.java | 141 ++++++++++++++++--
3 files changed, 129 insertions(+), 18 deletions(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index ebaba599b..8dfea901b 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -13,7 +13,10 @@ These build logs represent the work that has been going on within prison.
*Will continue as v3.3.0-alpha.7 2021-06-?? in the near future.*
-# 3.2.11-alpha.1 2021-10-07
+# 3.2.11-alpha.1 2021-10-12
+
+
+* **A few updates to mine bombs. They have been disabled so they cannot be used.**
* **Add the ability to glow the prison bombs when they are dropped/set.**
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotPlayerUtil.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotPlayerUtil.java
index 4ac67b8c3..df736630f 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotPlayerUtil.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotPlayerUtil.java
@@ -3,7 +3,6 @@
import java.lang.reflect.Method;
import java.util.UUID;
-import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment;
import tech.mcprison.prison.Prison;
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java
index 923a9799e..e98316b7a 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonBombListener.java
@@ -2,16 +2,25 @@
import java.text.DecimalFormat;
+import org.bukkit.attribute.Attribute;
+import org.bukkit.attribute.AttributeModifier;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
+import org.bukkit.event.block.BlockPlaceEvent;
+import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.metadata.FixedMetadataValue;
+import com.google.common.collect.Multimap;
+
import tech.mcprison.prison.bombs.MineBombData;
+import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.SpigotPrison;
import tech.mcprison.prison.spigot.block.SpigotBlock;
import tech.mcprison.prison.spigot.block.SpigotItemStack;
@@ -31,12 +40,15 @@
public class PrisonBombListener
implements Listener
{
+
- @EventHandler( priority = EventPriority.LOW )
+// @EventHandler( priority = EventPriority.LOW )
public void onInteract( PlayerInteractEvent event ) {
- if ( !event.getPlayer().hasPermission("prison.minebombs.use") ) {
- return;
- }
+// if ( !event.getPlayer().hasPermission("prison.minebombs.use") ) {
+// return;
+// }
+
+ Output.get().logInfo( "### PrisonBombListener: PlayerInteractEvent 01 " );
if ( event.getAction().equals(Action.RIGHT_CLICK_BLOCK) || event.getAction().equals(Action.RIGHT_CLICK_AIR) ) {
@@ -44,8 +56,12 @@ public void onInteract( PlayerInteractEvent event ) {
// ItemStack in the player's hand by 1:
MineBombData bomb = PrisonUtilsMineBombs.getBombInHand( event.getPlayer() );
+ Output.get().logInfo( "### PrisonBombListener: PlayerInteractEvent 02 is bomb null " + (bomb == null) );
+
if ( bomb != null ) {
+ Output.get().logInfo( "### PrisonBombListener: PlayerInteractEvent 03 " );
+
Player player = event.getPlayer();
SpigotPlayer sPlayer = new SpigotPlayer( player );
@@ -55,28 +71,32 @@ public void onInteract( PlayerInteractEvent event ) {
// inventory.
if ( bomb.isActivated() ) {
+// Output.get().logInfo( "### PrisonBombListener: PlayerInteractEvent 04 " );
SpigotItemStack bombs = PrisonUtilsMineBombs.getItemStackBomb( bomb );
if ( bombs != null ) {
+
+ Output.get().logInfo( "### PrisonBombListener: PlayerInteractEvent 05 " );
SpigotBlock sBlock = new SpigotBlock( event.getClickedBlock() );
+ Output.get().logInfo( "### PrisonBombListener: PlayerInteractEvent dropping block " );
int throwSpeed = 2;
- final Item dropped = player.getWorld().dropItem(player.getLocation(), bombs.getBukkitStack() );
- dropped.setVelocity(player.getLocation().getDirection().multiply( throwSpeed ).normalize() );
- dropped.setPickupDelay( 50000 );
-
- dropped.setGlowing( bomb.isGlowing() );
- dropped.setCustomName( bomb.getName() );
-
- dropped.setMetadata( "prisonMineBomb", new FixedMetadataValue( SpigotPrison.getInstance(), true ) );
- //dropped.setMetadata( "prisonMineName", new FixedMetadataValue( SpigotPrison.getInstance(), "mineName" ) );
-
-
- PrisonUtilsMineBombs.setoffBombDelayed( sPlayer, bomb, dropped, sBlock, throwSpeed );
+// final Item dropped = player.getWorld().dropItem(player.getLocation(), bombs.getBukkitStack() );
+// dropped.setVelocity(player.getLocation().getDirection().multiply( throwSpeed ).normalize() );
+// dropped.setPickupDelay( 50000 );
+//
+// dropped.setGlowing( bomb.isGlowing() );
+// dropped.setCustomName( bomb.getName() );
+//
+// dropped.setMetadata( "prisonMineBomb", new FixedMetadataValue( SpigotPrison.getInstance(), true ) );
+// //dropped.setMetadata( "prisonMineName", new FixedMetadataValue( SpigotPrison.getInstance(), "mineName" ) );
+//
+//
+// PrisonUtilsMineBombs.setoffBombDelayed( sPlayer, bomb, dropped, sBlock, throwSpeed );
}
}
@@ -105,4 +125,93 @@ public void onInteract( PlayerInteractEvent event ) {
}
}
+
+
+// @EventHandler( priority = EventPriority.HIGHEST, ignoreCancelled = false )
+ public void onBlockPlace( PlayerDropItemEvent event ) {
+
+ Output.get().logInfo( "### PrisonBombListener: PlayerDropItemEvent " );
+
+ if ( event.isCancelled() && event.getItemDrop().hasMetadata( "prisonMineBomb" ) ) {
+
+// event.getItemDrop().getMetadata( "prisonMineBomb" );
+
+// event.getItemDrop().
+
+ event.setCancelled( false );
+ }
+
+ }
+
+// @EventHandler( priority = EventPriority.HIGHEST, ignoreCancelled = false )
+// public void onBlockPlace2( PlayerInteractEvent event ) {
+//
+// Output.get().logInfo( "### PrisonBombListener: PlayerInteractEvent - oof" );
+// }
+
+// @EventHandler( priority = EventPriority.HIGHEST, ignoreCancelled = false )
+ public void onBlockPlace3( BlockPlaceEvent event ) {
+
+ Output.get().logInfo( "### PrisonBombListener: BlockPlaceEvent HIGHEST isCanceled= " + event.isCancelled() );
+
+// event.getBlockPlaced();
+
+
+ event.setBuild( true );
+ event.setCancelled( false );
+
+ ItemStack item = event.getItemInHand();
+
+
+ if ( item.hasItemMeta() && item.getItemMeta().hasDisplayName() ) {
+ ItemMeta meta = item.getItemMeta();
+
+ Output.get().logInfo( "### PrisonBombListener: BlockPlaceEvent " + meta.getDisplayName() );
+
+// meta.getCustomTagContainer().hasCustomTag( null, null )
+
+// meta.
+//
+// Multimap attributes = meta.getAttributeModifiers();
+//
+//
+// for ( String attri : attributes. ) {
+//
+// }
+
+ }
+
+
+ }
+
+// @EventHandler( priority = EventPriority.HIGHEST, ignoreCancelled = false )
+ public void onBlockPlace3( PlayerInteractEvent event ) {
+
+ Output.get().logInfo( "### PrisonBombListener: PlayerInteractEvent " );
+
+
+ }
+
+// @EventHandler( priority = EventPriority.HIGHEST, ignoreCancelled = false )
+// public void onBlockPlace3( BlockDropItemEvent event ) {
+//
+// Output.get().logInfo( "### PrisonBombListener: PlayerInteractEvent " );
+//
+//
+// }
+
+// @EventHandler( priority = EventPriority.HIGHEST )
+// public void onBlockPlace2( Player event ) {
+//
+//
+// if ( event.isCancelled() && event.getItemDrop().hasMetadata( "prisonMineBomb" ) ) {
+//
+//// event.getItemDrop().getMetadata( "prisonMineBomb" );
+//
+//// event.getItemDrop().
+//
+// event.setCancelled( false );
+// }
+//
+// }
}
From cb46c660736db7f3c1fd2c231d69c534dee6b084 Mon Sep 17 00:00:00 2001
From: AnonymousGCA
Date: Wed, 13 Oct 2021 18:50:53 +0200
Subject: [PATCH 083/283] Changelogs: - Fixes to /sellall auto toggle command
not being handled correctly in the internal SellAll util.
---
.../spigot/commands/PrisonSpigotSellAllCommands.java | 2 +-
.../tech/mcprison/prison/spigot/sellall/SellAllUtil.java | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotSellAllCommands.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotSellAllCommands.java
index d635719b4..c8be38d4f 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotSellAllCommands.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotSellAllCommands.java
@@ -368,7 +368,7 @@ public void sellAllSellWithDelayCommand(CommandSender sender){
}
- @Command(identifier = "sellall auto toggle", description = "Let the user enable or disable sellall auto", onlyPlayers = true)
+ @Command(identifier = "sellall auto toggle", description = "Let the user enable or disable sellall auto", altPermissions = "prison.sellall.toggle", onlyPlayers = true)
private void sellAllAutoEnableUser(CommandSender sender){
if (!isEnabled()) return;
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/sellall/SellAllUtil.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/sellall/SellAllUtil.java
index d0f4d740e..9a90cb4b3 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/sellall/SellAllUtil.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/sellall/SellAllUtil.java
@@ -419,6 +419,11 @@ private HashMap getHashMapOfPlayerInventories(Player p) {
* @return boolean.
* */
public boolean isPlayerAutoSellEnabled(Player p){
+
+ if (isAutoSellPerUserToggleablePermEnabled && !p.hasPermission(permissionAutoSellPerUserToggleable)){
+ return false;
+ }
+
if (sellAllConfig.getString("Users." + p.getUniqueId() + ".isEnabled") == null){
return true;
}
@@ -1271,6 +1276,8 @@ public boolean setAutoSellPlayer(Player p, boolean enable){
e.printStackTrace();
return false;
}
+
+ updateConfig();
return true;
}
From 8a1675f2c5b7015876da6676f3f4542a2e1dfe1d Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Fri, 15 Oct 2021 01:04:10 -0400
Subject: [PATCH 084/283] Release the v3.2.11-alpha.2 of prison.
---
docs/changelog_v3.3.x.md | 6 +++++-
gradle.properties | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index 8dfea901b..94cfa7732 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -13,7 +13,11 @@ These build logs represent the work that has been going on within prison.
*Will continue as v3.3.0-alpha.7 2021-06-?? in the near future.*
-# 3.2.11-alpha.1 2021-10-12
+# 3.2.11-alpha.2 2021-10-14
+
+
+
+**3.2.11-alpha.2 2021-10-14**
* **A few updates to mine bombs. They have been disabled so they cannot be used.**
diff --git a/gradle.properties b/gradle.properties
index 6937acf6b..bbda2e2a3 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -3,7 +3,7 @@
## # This is actually the "correct" place to define the version for the project.
## # Used within build.gradle with ${project.version}.
## # Can be overridden on the command line: gradle -Pversion=3.2.1-alpha.3
-version=3.2.11-alpha.1
+version=3.2.11-alpha.2
#version=3.2.8.2
#version=3.3.0-alpha.6
From b6e42fecb80382fc1a90e9f7af44428e8f4e192e Mon Sep 17 00:00:00 2001
From: AnonymousGCA
Date: Sat, 16 Oct 2021 00:13:27 +0200
Subject: [PATCH 085/283] Changelogs: - Prestiges GUI fix.
---
.../prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java
index de6ad766c..a7e2ac9d7 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java
@@ -169,10 +169,11 @@ public void open() {
}
}
- Button itemrank = new Button(null, playerHasThisRank ? materialHas : materialHasNot, amount++, ranksLore, rank.getTag());
if (playerRank != null && playerRank.equals( rank )){
playerHasThisRank = false;
}
+
+ Button itemrank = new Button(null, playerHasThisRank ? materialHas : materialHasNot, amount++, ranksLore, rank.getTag());
if (!(playerHasThisRank)){
if (hackyCounterEnchant <= 0) {
hackyCounterEnchant++;
From dcd08f20d0173d1e024dc2a7c872fa816f3d1ef3 Mon Sep 17 00:00:00 2001
From: AnonymousGCA
Date: Sat, 16 Oct 2021 00:19:59 +0200
Subject: [PATCH 086/283] Changelogs: - Prestiges GUI fix.
---
.../gui/rank/SpigotPlayerPrestigesGUI.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java
index a7e2ac9d7..c2b7e9cb0 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java
@@ -132,14 +132,22 @@ public void open() {
}
Rank rank = ladder.getLowestRank().get();
-
PlayerRank prestigePlayerRank = getRankPlayer().getRank("prestiges");
-
Rank playerRank = prestigePlayerRank == null ? null : prestigePlayerRank.getRank();
+ XMaterial materialHas;
+ XMaterial materialHasNot;
// Not sure how you want to represent this:
- XMaterial materialHas = XMaterial.valueOf(guiConfig.getString("Options.Ranks.Item_gotten_rank"));
- XMaterial materialHasNot = XMaterial.valueOf(guiConfig.getString("Options.Ranks.Item_not_gotten_rank"));
+ try {
+ materialHas = XMaterial.valueOf(guiConfig.getString("Options.Ranks.Item_gotten_rank"));
+ } catch (IllegalArgumentException ignored){
+ materialHas = XMaterial.TRIPWIRE_HOOK;
+ }
+ try {
+ materialHasNot = XMaterial.valueOf(guiConfig.getString("Options.Ranks.Item_not_gotten_rank"));
+ } catch (IllegalArgumentException ignored){
+ materialHasNot = XMaterial.REDSTONE_BLOCK;
+ }
// Variables.
boolean playerHasThisRank = true;
From 92a7741de9edf9754ad96642a73a0050aa39b49f Mon Sep 17 00:00:00 2001
From: AnonymousGCA
Date: Sat, 16 Oct 2021 00:22:22 +0200
Subject: [PATCH 087/283] Changelogs: - Prestiges GUI fix.
---
.../prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java
index c2b7e9cb0..7efb64069 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerPrestigesGUI.java
@@ -193,6 +193,9 @@ public void open() {
gui.addButton(itemrank);
rank = rank.getRankNext();
+ if (amount > 45){
+ break;
+ }
}
ButtonLore rankupLore = new ButtonLore(messages.getString(MessagesConfig.StringID.spigot_gui_lore_click_to_rankup), messages.getString(MessagesConfig.StringID.spigot_gui_lore_rankup_if_enough_money));
From 88d16be53dab20e6c59181b6aa66291ed59d3f7a Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Mon, 18 Oct 2021 21:01:06 -0400
Subject: [PATCH 088/283] Add millisecond reporting for the time it takes to
handle a block break event.
---
docs/changelog_v3.3.x.md | 6 ++++-
.../spigot/block/OnBlockBreakEventCore.java | 25 +++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index 94cfa7732..d53cb7faf 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -13,7 +13,11 @@ These build logs represent the work that has been going on within prison.
*Will continue as v3.3.0-alpha.7 2021-06-?? in the near future.*
-# 3.2.11-alpha.2 2021-10-14
+# 3.2.11-alpha.2 2021-10-18
+
+
+
+* **Add millisecond reporting for the time it takes to handle a block break event.**
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java
index 7d0fe44b3..7837e53cf 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventCore.java
@@ -291,6 +291,8 @@ protected void genericBlockEvent( BlockBreakEvent e, boolean monitor, boolean bl
return;
}
+ long start = System.currentTimeMillis();
+
// Register all external events such as mcMMO and EZBlocks:
OnBlockBreakExternalEvents.getInstance().registerAllExternalEvents();
@@ -383,6 +385,9 @@ else if ( pmEvent.getMine() != null || pmEvent.getMine() == null &&
}
+ long stop = System.currentTimeMillis();
+ debugInfo.append( " [" ).append( stop - start ).append( " ms]" );
+
Output.get().logDebug( DebugTarget.blockBreak, debugInfo.toString() );
}
@@ -602,6 +607,8 @@ else if ( pmEvent.isMonitor() && mine != null ) {
private void genericBlockExplodeEvent( TEBlockExplodeEvent e, boolean monitor, boolean blockEventsOnly,
boolean autoManager ) {
+ long start = System.currentTimeMillis();
+
// Register all external events such as mcMMO and EZBlocks:
OnBlockBreakExternalEvents.getInstance().registerAllExternalEvents();
@@ -736,6 +743,9 @@ else if ( isTEExplosiveEnabled &&
}
+ long stop = System.currentTimeMillis();
+ debugInfo.append( " [" ).append( stop - start ).append( " ms]" );
+
Output.get().logDebug( DebugTarget.blockBreak, debugInfo.toString() );
}
@@ -788,6 +798,8 @@ private String checkCEExplosionTriggered( TEBlockExplodeEvent e )
protected void genericBlastUseEvent( BlastUseEvent e, boolean monitor, boolean blockEventsOnly,
boolean autoManager ) {
+ long start = System.currentTimeMillis();
+
// Register all external events such as mcMMO and EZBlocks:
OnBlockBreakExternalEvents.getInstance().registerAllExternalEvents();
@@ -929,6 +941,9 @@ else if ( isCEBlockExplodeEnabled &&
}
+ long stop = System.currentTimeMillis();
+ debugInfo.append( " [" ).append( stop - start ).append( " ms]" );
+
Output.get().logDebug( DebugTarget.blockBreak, debugInfo.toString() );
}
@@ -950,6 +965,8 @@ else if ( isCEBlockExplodeEnabled &&
protected void genericExplosiveEvent( PEExplosionEvent e, boolean monitor, boolean blockEventsOnly,
boolean autoManager ) {
+ long start = System.currentTimeMillis();
+
// Register all external events such as mcMMO and EZBlocks:
OnBlockBreakExternalEvents.getInstance().registerAllExternalEvents();
@@ -1043,6 +1060,9 @@ else if ( isPEExplosiveEnabled &&
}
+ long stop = System.currentTimeMillis();
+ debugInfo.append( " [" ).append( stop - start ).append( " ms]" );
+
Output.get().logDebug( DebugTarget.blockBreak, debugInfo.toString() );
}
@@ -1050,6 +1070,8 @@ else if ( isPEExplosiveEnabled &&
protected void genericExplosiveEvent( ExplosiveBlockBreakEvent e, boolean monitor, boolean blockEventsOnly,
boolean autoManager ) {
+ long start = System.currentTimeMillis();
+
// Register all external events such as mcMMO and EZBlocks:
OnBlockBreakExternalEvents.getInstance().registerAllExternalEvents();
@@ -1141,6 +1163,9 @@ else if ( isPPrisonExplosiveBlockBreakEnabled &&
}
+ long stop = System.currentTimeMillis();
+ debugInfo.append( " [" ).append( stop - start ).append( " ms]" );
+
Output.get().logDebug( DebugTarget.blockBreak, debugInfo.toString() );
}
From 9da566b6d252495a8385969846f10e885aabeca6 Mon Sep 17 00:00:00 2001
From: RoyalBlueRanger <665978+rbluer@users.noreply.github.com>
Date: Mon, 18 Oct 2021 21:59:08 -0400
Subject: [PATCH 089/283] Simplified the configuration of the handling of the
block break events. Instead of having a separate setting that is a boolean
value that indicates it's either enabled or disabled, these are now using the
priority value of DISABLED.
---
docs/changelog_v3.3.x.md | 3 +++
.../tech/mcprison/prison/PrisonCommand.java | 17 ++++---------
.../autofeatures/AutoFeaturesFileConfig.java | 7 +-----
.../prison/spigot/SpigotPlatform.java | 24 +++++++++++++++----
.../events/AutoManagerCrazyEnchants.java | 9 ++++---
.../events/AutoManagerPrisonEnchants.java | 13 ++++++----
...nagerPrisonsExplosiveBlockBreakEvents.java | 11 +++++----
.../events/AutoManagerTokenEnchant.java | 11 +++++----
.../events/AutoManagerZenchantments.java | 9 ++++---
.../spigot/block/OnBlockBreakEventCore.java | 22 +++++++++++------
10 files changed, 76 insertions(+), 50 deletions(-)
diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md
index d53cb7faf..2d5cd3dba 100644
--- a/docs/changelog_v3.3.x.md
+++ b/docs/changelog_v3.3.x.md
@@ -16,6 +16,9 @@ These build logs represent the work that has been going on within prison.
# 3.2.11-alpha.2 2021-10-18
+* **Simplified the configuration of the handling of the block break events.**
+Instead of having a separate setting that is a boolean value that indicates it's either enabled or disabled, these are now using the priority value of DISABLED.
+
* **Add millisecond reporting for the time it takes to handle a block break event.**
diff --git a/prison-core/src/main/java/tech/mcprison/prison/PrisonCommand.java b/prison-core/src/main/java/tech/mcprison/prison/PrisonCommand.java
index 9cf417f3f..2946fd814 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/PrisonCommand.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/PrisonCommand.java
@@ -885,26 +885,21 @@ public void autoFeaturesInformation(CommandSender sender) {
display.addText( "&b " );
- display.addText( "&b options.blockBreakEvents.isProcessTokensEnchantExplosiveEvents: %s",
- afw.isBoolean( AutoFeatures.isProcessTokensEnchantExplosiveEvents ) );
display.addText( "&b options.blockBreakEvents.TokenEnchantBlockExplodeEventPriority: %s",
- afw.getMessage( AutoFeatures.isProcessTokensEnchantExplosiveEvents ) );
+ afw.getMessage( AutoFeatures.TokenEnchantBlockExplodeEventPriority ) );
- display.addText( "&b options.blockBreakEvents.isProcessCrazyEnchantsBlockExplodeEvents: %s",
- afw.isBoolean( AutoFeatures.isProcessCrazyEnchantsBlockExplodeEvents ) );
display.addText( "&b options.blockBreakEvents.CrazyEnchantsBlastUseEventPriority: %s",
afw.getMessage( AutoFeatures.CrazyEnchantsBlastUseEventPriority ) );
- display.addText( "&b options.blockBreakEvents.isProcessZenchantsBlockExplodeEvents: %s",
- afw.isBoolean( AutoFeatures.isProcessZenchantsBlockExplodeEvents ) );
display.addText( "&b options.blockBreakEvents.ZenchantmentsBlockShredEventPriority: %s",
afw.getMessage( AutoFeatures.ZenchantmentsBlockShredEventPriority ) );
- display.addText( "&b options.blockBreakEvents.isProcessPrisonEnchantsExplosiveEvents: %s",
- afw.isBoolean( AutoFeatures.isProcessPrisonEnchantsExplosiveEvents ) );
display.addText( "&b options.blockBreakEvents.PrisonEnchantsExplosiveEventPriority: %s",
afw.getMessage( AutoFeatures.PrisonEnchantsExplosiveEventPriority ) );
+ display.addText( "&b options.blockBreakEvents.ProcessPrisons_ExplosiveBlockBreakEventsPriority: %s",
+ afw.getMessage( AutoFeatures.ProcessPrisons_ExplosiveBlockBreakEventsPriority ) );
+
display.addText( "&b " );
display.addText( "&b Normal Drops (if auto pickup is off):" );
@@ -944,10 +939,6 @@ public void autoFeaturesInformation(CommandSender sender) {
afw.getMessage( AutoFeatures.fortuneMultiplierMax ));
display.addText( "&b " );
- display.addText( "&b options.isProcessTokensEnchantExplosiveEvents %s",
- afw.isBoolean( AutoFeatures.isProcessTokensEnchantExplosiveEvents ));
- display.addText( "&b options.isProcessCrazyEnchantsBlockExplodeEvents %s",
- afw.isBoolean( AutoFeatures.isProcessCrazyEnchantsBlockExplodeEvents ));
display.addText( "&b options.isProcessMcMMOBlockBreakEvents %s",
afw.isBoolean( AutoFeatures.isProcessMcMMOBlockBreakEvents ));
display.addText( "&b " );
diff --git a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java
index a711d2cd7..4fc6ea770 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java
@@ -52,26 +52,21 @@ public enum AutoFeatures {
// Setting this to true will cancel the block break events (normal prison behavior):
cancelAllBlockBreakEvents(blockBreakEvents, true),
// Setting this to false will not zero out the block drops (normal prison behavior).
- // When set to true, it will zero it out so if the block break event is not cancleed,
+ // When set to true, it will zero it out so if the block break event is not canceled,
// then it will prevent double drops:
cancelAllBlockEventBlockDrops(blockBreakEvents, false),
blockBreakEventPriority(blockBreakEvents, "LOW"),
- isProcessTokensEnchantExplosiveEvents(blockBreakEvents, false),
TokenEnchantBlockExplodeEventPriority(blockBreakEvents, "DISABLED"),
- isProcessCrazyEnchantsBlockExplodeEvents(blockBreakEvents, false),
CrazyEnchantsBlastUseEventPriority(blockBreakEvents, "DISABLED"),
- isProcessZenchantsBlockExplodeEvents(blockBreakEvents, false),
ZenchantmentsBlockShredEventPriority(blockBreakEvents, "DISABLED"),
- isProcessPrisonEnchantsExplosiveEvents(blockBreakEvents, false),
PrisonEnchantsExplosiveEventPriority(blockBreakEvents, "DISABLED"),
- isProcessPrisons_ExplosiveBlockBreakEvents(blockBreakEvents, false),
ProcessPrisons_ExplosiveBlockBreakEventsPriority(blockBreakEvents, "DISABLED"),
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPlatform.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPlatform.java
index 3238d249d..f4003f495 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPlatform.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPlatform.java
@@ -1870,13 +1870,27 @@ public List getActiveFeatures() {
if ( isAutoManagerEnabled ) {
+
+
+ boolean bbeCabbe = afw.isBoolean( AutoFeatures.cancelAllBlockBreakEvents );
+ results.add( String.format(". Cancel all Block Break Events:&b %s",
+ Boolean.toString( bbeCabbe ) ) );
+
+
+ boolean bbeCabebd = afw.isBoolean( AutoFeatures.cancelAllBlockEventBlockDrops );
+ results.add( String.format(". Cancel All Block Break Events Block Drops:&b %s",
+ Boolean.toString( bbeCabebd ) ) );
+
+
+
+
String bbePriority = afw.getMessage( AutoFeatures.blockBreakEventPriority );
BlockBreakPriority blockBreakPriority = BlockBreakPriority.fromString( bbePriority );
results.add( String.format(". '&7org.bukkit.BlockBreakEvent&3' Priority:&b %s",
blockBreakPriority.name() ) );
String pebbePriority = afw.getMessage( AutoFeatures.ProcessPrisons_ExplosiveBlockBreakEventsPriority );
- boolean isPebbeEnabled = afw.isBoolean( AutoFeatures.isProcessPrisons_ExplosiveBlockBreakEvents );
+ boolean isPebbeEnabled = pebbePriority != null && !"DISABLED".equalsIgnoreCase( pebbePriority );
BlockBreakPriority pebbeEventPriority = BlockBreakPriority.fromString( pebbePriority );
results.add( String.format("%s. Prison's own '&7ExplosiveBlockBreakEvent&3' Priority:&b %s %s",
(isPebbeEnabled ? "" : "+" ),
@@ -1885,7 +1899,7 @@ public List getActiveFeatures() {
) );
String peeePriority = afw.getMessage( AutoFeatures.PrisonEnchantsExplosiveEventPriority );
- boolean isPeeeEnabled = afw.isBoolean( AutoFeatures.isProcessPrisonEnchantsExplosiveEvents );
+ boolean isPeeeEnabled = peeePriority != null && !"DISABLED".equalsIgnoreCase( peeePriority );
BlockBreakPriority peeeEventPriority = BlockBreakPriority.fromString( peeePriority );
results.add( String.format("%s. Pulsi_'s PrisonEnchants '&7PEExplosiveEvent&3' Priority:&b %s %s",
(isPeeeEnabled ? "" : "+" ),
@@ -1894,7 +1908,7 @@ public List getActiveFeatures() {
) );
String tebePriority = afw.getMessage( AutoFeatures.TokenEnchantBlockExplodeEventPriority );
- boolean isTebeEnabled = afw.isBoolean( AutoFeatures.isProcessTokensEnchantExplosiveEvents );
+ boolean isTebeEnabled = tebePriority != null && !"DISABLED".equalsIgnoreCase( tebePriority );
BlockBreakPriority tebEventPriority = BlockBreakPriority.fromString( tebePriority );
results.add( String.format("%s. TokenEnchant '&7BlockExplodeEvent&3' Priority:&b %s %s",
(isTebeEnabled ? "" : "+" ),
@@ -1903,7 +1917,7 @@ public List