The itemName is the displayname that is used for the items.
+ * This can be customized without impacting the bomb's name, the bomb's nameTag,
+ * etc...
+ *
+ *
+ * This function will process older config data versions and apply updates to the
+ * various fields to bring it up to date. For example, if a new field is added, the
+ * default value would be null, so this is a way to ensure there is a non-null default
+ * value added. Keep in mind that if the field is null, then it will not be saved in
+ * the json file which means that when the file is edited the person won't know there
+ * is a new field added.
+ *
+ *
+ * @param configs
+ */
+ private void mineBombApplyVersionUpdates( MineBombsConfigData configs ) {
+
+ // If dataFormatVersion is 0, then need to fix the new itemName field so it
+ // is set to the new default value, otherwise it will remain null.
+ if ( configs.getDataFormatVersion() == 0 ) {
+
+ Set keys = configs.getBombs().keySet();
+ for (String key : keys) {
+ MineBombData bombData = configs.getBombs().get( key );
+
+ // Just getting the itemName will set nulls to the default value:
+ bombData.getItemName();
+ }
+
+ }
+
+ }
+
+
/**
* This will apply simple validation to the mine bombs that were just loaded.
@@ -433,6 +465,52 @@ public List calculateCube( Location loc, int radius ) {
return results;
}
+
+ public List calculateCube( Location loc1, Location loc2 ) {
+ List results = new ArrayList<>();
+
+ // get all x, y, & z:
+ int xLoc1 = loc1.getBlockX();
+ int xLoc2 = loc2.getBlockX();
+ int yLoc1 = loc1.getBlockY();
+ int yLoc2 = loc2.getBlockY();
+ int zLoc1 = loc1.getBlockZ();
+ int zLoc2 = loc2.getBlockZ();
+
+ // loc1 must be less than loc2... it does not matter if x, y, or z gets
+ // switched around:
+ if ( xLoc1 > xLoc2 ) {
+ int x = xLoc1;
+ xLoc1 = xLoc2;
+ xLoc2 = x;
+ }
+ if ( yLoc1 > yLoc2 ) {
+ int y = yLoc1;
+ yLoc1 = yLoc2;
+ yLoc2 = y;
+ }
+ if ( zLoc1 > zLoc2 ) {
+ int z = zLoc1;
+ zLoc1 = zLoc2;
+ zLoc2 = z;
+ }
+
+ for ( int x = xLoc1 ; x <= xLoc2 ; x++ ) {
+ for ( int y = yLoc1 ; y <= yLoc2; y++ ) {
+ for ( int z = zLoc1 ; z <= zLoc2 ; z++ ) {
+
+ Location l = new Location( loc1.getWorld(), x, y, z );
+ results.add( l );
+
+ }
+ }
+ }
+
+ return results;
+ }
+
+
+
//
// @SuppressWarnings( "unused" )
// public void setupDefaultMineBombData()
diff --git a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombsConfigData.java b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombsConfigData.java
index 573002a0f..fd45845b1 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombsConfigData.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombsConfigData.java
@@ -18,7 +18,7 @@ public class MineBombsConfigData
*/
public static final int MINE_BOMB_DATA_FORMAT_VERSION = 1;
- private int dataFormatVersion = 0;
+ private int dataFormatVersion = 1;
private Map bombs;
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 9b1ca5727..67b1d3664 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
@@ -412,7 +412,7 @@ public void addPlayerBlocks( Player player, String mine, PrisonBlockStatusData b
// public void addPlayerBlocks( Player player, String mine, PrisonBlock block, int quantity ) {
// addPlayerBlocks( player, mine, block.getBlockName(), quantity );
// }
- public void addPlayerBlocks( Player player, String mine, String blockName, int quantity ) {
+ private void addPlayerBlocks( Player player, String mine, String blockName, int quantity ) {
PlayerCachePlayerData playerData = getPlayer( player );
// Output.get().logInfo( "### addPlayerBlock: mine= " + (mine == null ? "null" : mine) +
@@ -424,6 +424,11 @@ public void addPlayerBlocks( Player player, String mine, String blockName, int q
// }
playerData.addBlock( mine, blockName, quantity );
+
+ if ( player.isMinecraftStatisticsEnabled() ) {
+
+ player.incrementMinecraftStatsMineBlock( player, blockName, quantity );
+ }
}
/**
diff --git a/prison-core/src/main/java/tech/mcprison/prison/cache/TopNRanksComparator.java b/prison-core/src/main/java/tech/mcprison/prison/cache/TopNRanksComparator.java
index b54b83967..a918dbbb7 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/cache/TopNRanksComparator.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/cache/TopNRanksComparator.java
@@ -2,6 +2,17 @@
import java.util.Comparator;
+/**
+ * This is a comparator for the basic TopNStatsData.
+ * It first compares the Prestiges ladder ranks, if both are the
+ * same then it will compare the Default ladder ranks.
+ * If both of those are the same, then it will compare the
+ * balances.
+ *
+ *
+ * @author Blue
+ *
+ */
public class TopNRanksComparator
implements Comparator
{
@@ -11,42 +22,54 @@ public int compare( TopNStatsData o1, TopNStatsData o2 ) {
int results = 0;
if ( o1.getTopRankPrestiges() == null && o2.getTopRankPrestiges() == null ) {
+
+ // Both prestiges are null, so set results to 0 and then we need to check the default ranks
results = 0;
}
- if ( o1.getTopRankPrestiges() == null ) {
- return 1;
- }
- if ( o2.getTopRankPrestiges() == null ) {
- return -1;
- }
-
- if ( o1.getTopRankDefault() == null && o2.getTopRankDefault() == null ) {
- return Double.compare( o1.getCurrentBalance(), o2.getCurrentBalance() );
+ else if ( o1.getTopRankPrestiges() == null ) {
+ // One is not null, so set to 1 and exit:
+ results = 1;
}
- if ( o1.getTopRankDefault() == null ) {
- return 1;
+ else if ( o2.getTopRankPrestiges() == null ) {
+ // One is not null, so set to -1 and exit:
+ results = -1;
}
- if ( o2.getTopRankDefault() == null ) {
- return -1;
+ else {
+ // Must now evaluate the prestige ranks since both are not null:
+ int o1Pos = o1.getTopRankPrestiges().getPosition();
+ int o2Pos = o2.getTopRankPrestiges().getPosition();
+
+ results = Integer.compare(o1Pos, o2Pos);
}
- results = Integer.compare(
- o1.getTopRankPrestiges().getPosition(),
- o2.getTopRankPrestiges().getPosition() );
-
if ( results == 0 ) {
- results = Integer.compare(
- o1.getTopRankDefault().getPosition(),
- o2.getTopRankDefault().getPosition() );
+ if ( o1.getTopRankDefault() == null && o2.getTopRankDefault() == null ) {
+ results = 0;
+ }
+ else if ( o1.getTopRankDefault() == null ) {
+ results = 1;
+ }
+ else if ( o2.getTopRankDefault() == null ) {
+ results = -1;
+ }
+ else {
+
+ // Must now evaluate the default ranks since both are not null:
+ int o1Pos = o1.getTopRankDefault().getPosition();
+ int o2Pos = o2.getTopRankDefault().getPosition();
+
+ results = Integer.compare(o1Pos, o2Pos);
+ }
if ( results == 0 ) {
-
+ // Next compare the balances:
results = Double.compare( o1.getCurrentBalance(), o2.getCurrentBalance() );
+
}
-
}
+
- return 0;
+ return results;
}
}
diff --git a/prison-core/src/main/java/tech/mcprison/prison/cache/TopNStatsData.java b/prison-core/src/main/java/tech/mcprison/prison/cache/TopNStatsData.java
index c4c08029a..e3165a0a0 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/cache/TopNStatsData.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/cache/TopNStatsData.java
@@ -1,7 +1,26 @@
package tech.mcprison.prison.cache;
+import tech.mcprison.prison.Prison;
import tech.mcprison.prison.ranks.data.Rank;
+import tech.mcprison.prison.ranks.data.RankLadder;
+/**
+ * This class contains the user data that is used for TopN stats.
+ * It keeps track of the player's stats for totalBlocks, tokens, balance,
+ * and their Prestiges and Default rank position.
+ * This data prevents the need to access the player's cache object.
+ *
+ *
+ * For the user of the prestiges Rank object, and the default Rank object,
+ * upon first access, it will try to look up those values and will store the
+ * Rank object in a local variable for faster access later. Those stored
+ * objects will not be persisted and hence why there is string field for their
+ * names.
+ *
+ *
+ * @author Blue
+ *
+ */
public class TopNStatsData
{
@@ -16,10 +35,12 @@ public class TopNStatsData
private String topRankPrestigesName;
- private String topRankDefaultName;
-
private transient Rank topRankPrestiges;
+ private transient boolean presetigeRankCheck = false;
+
+ private String topRankDefaultName;
private transient Rank topRankDefault;
+ private transient boolean defaultRankCheck = false;
private long lastSeenDate;
@@ -82,6 +103,10 @@ public void setTopRankDefaultName( String topRankDefaultName ) {
}
public Rank getTopRankPrestiges() {
+ if ( !presetigeRankCheck && topRankPrestiges == null ) {
+ presetigeRankCheck = true;
+ topRankPrestiges = lookupRank( RankLadder.PRESTIGES, getTopRankPrestigesName() );
+ }
return topRankPrestiges;
}
public void setTopRankPrestiges( Rank topRankPrestiges ) {
@@ -89,6 +114,10 @@ public void setTopRankPrestiges( Rank topRankPrestiges ) {
}
public Rank getTopRankDefault() {
+ if ( !defaultRankCheck && topRankDefault == null ) {
+ defaultRankCheck = true;
+ topRankDefault = lookupRank( RankLadder.DEFAULT, getTopRankDefaultName() );
+ }
return topRankDefault;
}
public void setTopRankDefault( Rank topRankDefault ) {
@@ -109,4 +138,15 @@ public void setLastUpdateDate( long lastUpdateDate ) {
this.lastUpdateDate = lastUpdateDate;
}
+ private Rank lookupRank( String ladder, String rank ) {
+ Rank results = null;
+
+ if ( rank != null ) {
+ RankLadder rLadder = Prison.get().getPlatform().getRankLadder( ladder );
+
+ results = rLadder.getRank( rank );
+ }
+
+ return results;
+ }
}
diff --git a/prison-core/src/main/java/tech/mcprison/prison/cache/TopNStats.java b/prison-core/src/main/java/tech/mcprison/prison/cache/TopNStatsSingleton.java
similarity index 76%
rename from prison-core/src/main/java/tech/mcprison/prison/cache/TopNStats.java
rename to prison-core/src/main/java/tech/mcprison/prison/cache/TopNStatsSingleton.java
index 9b8f1ce92..3ffe63f41 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/cache/TopNStats.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/cache/TopNStatsSingleton.java
@@ -4,10 +4,10 @@
import java.util.Collections;
import java.util.List;
-public class TopNStats
+public class TopNStatsSingleton
{
- private static TopNStats instance;
+ private static TopNStatsSingleton instance;
List mainList;
@@ -19,19 +19,19 @@ public class TopNStats
- private TopNStats() {
+ private TopNStatsSingleton() {
super();
this.mainList = new ArrayList<>();
}
- public static TopNStats getInstance() {
+ public static TopNStatsSingleton getInstance() {
if ( instance == null ) {
- synchronized ( TopNStats.class )
+ synchronized ( TopNStatsSingleton.class )
{
if ( instance == null ) {
- instance = new TopNStats();
+ instance = new TopNStatsSingleton();
}
}
}
diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/Player.java b/prison-core/src/main/java/tech/mcprison/prison/internal/Player.java
index 80dd797a0..c9b44fced 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/internal/Player.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/internal/Player.java
@@ -170,4 +170,11 @@ public interface Player
public boolean isSneaking();
+
+ public boolean isMinecraftStatisticsEnabled();
+
+ public void incrementMinecraftStatsMineBlock( Player player, String blockName, int quantity );
+
+ public void incrementMinecraftStatsDropCount( Player player, String blockName, int quantity);
+
}
diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/block/Block.java b/prison-core/src/main/java/tech/mcprison/prison/internal/block/Block.java
index 7f129ae6a..5e166a0cf 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/internal/block/Block.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/internal/block/Block.java
@@ -115,4 +115,10 @@ default boolean isEmpty() {
*/
public List getDrops(ItemStack tool);
+
+ public String getBlockName();
+
+ public void setBlockName( String blockName );
+
+
}
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 b2508c19d..479f4be6d 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
@@ -454,5 +454,10 @@ public void autoCreateMineLinerAssignment( List rankMineNames,
public List getPlayerOldBackpacks( Player player );
+
+
+ public int getMinY();
+
+ public int getMaxY();
}
diff --git a/prison-core/src/main/java/tech/mcprison/prison/modules/ModuleManager.java b/prison-core/src/main/java/tech/mcprison/prison/modules/ModuleManager.java
index a56e5b6e9..73b8c6d15 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/modules/ModuleManager.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/modules/ModuleManager.java
@@ -21,7 +21,6 @@
import java.io.File;
import java.util.ArrayList;
import java.util.List;
-import java.util.Optional;
import tech.mcprison.prison.Prison;
import tech.mcprison.prison.PrisonAPI;
@@ -62,11 +61,12 @@ public static File getModuleRootDefault() {
* Register a new module.
*/
public void registerModule(Module module) {
- if (getModule(module.getName()).isPresent()) {
- return; // Already added
+ if ( getModule(module.getName()) == null ) {
+ // Module does not exist, so add it:
+ modules.add(module);
+ enableModule(module);
+// return; // Already added
}
- modules.add(module);
- enableModule(module);
}
private void validateVersion(Module module) {
@@ -114,8 +114,11 @@ public boolean enableModule(Module module) {
* @param module The {@link Module} to enable.
*/
public void unregisterModule(Module module) {
+
disableModule(module);
- getModule(module.getName()).ifPresent(modules::remove);
+
+ getModules().remove(module);
+// getModule(module.getName()).ifPresent(modules::remove);
}
/**
@@ -144,17 +147,39 @@ public void unregisterAll() {
/**
* Returns the {@link Module} with the specified name.
*/
- public Optional getModule(String name) {
- return modules.stream().filter(module -> module.getName().equalsIgnoreCase(name))
- .findFirst();
+ public Module getModule(String name) {
+ Module results = null;
+
+ for (Module module : getModules() ) {
+
+ if ( module.getName().equalsIgnoreCase(name) ) {
+ results = module;
+ break;
+ }
+ }
+ return results;
+
+// return modules.stream().filter(module -> module.getName().equalsIgnoreCase(name))
+// .findFirst();
}
/**
* Returns the {@link Module} with the specified package name.
*/
- public Optional getModuleByPackageName(String name) {
- return modules.stream().filter(module -> module.getPackageName().equalsIgnoreCase(name))
- .findFirst();
+ public Module getModuleByPackageName(String name) {
+ Module results = null;
+
+ for (Module module : getModules() ) {
+
+ if ( module.getPackageName().equalsIgnoreCase(name) ) {
+ results = module;
+ break;
+ }
+ }
+ return results;
+
+// return modules.stream().filter(module -> module.getPackageName().equalsIgnoreCase(name))
+// .findFirst();
}
/**
@@ -172,47 +197,47 @@ public File getModuleRoot() {
return moduleRoot;
}
- /**
- * Returns the status of a module (enabled or error message), in the form of a color-coded string.
- * This is meant to show to users.
- *
- * @deprecated Use {@link Module#getStatus()} instead.
- */
- @Deprecated public String getStatus(String moduleName) {
- Optional moduleOptional = getModule(moduleName);
- return moduleOptional.map(module -> module.getStatus().getMessage()).orElse(null);
- }
-
- /**
- * Set the status of a module.
- *
- * @param moduleName The name of the module.
- * @param newStatus The module's status. May include color codes, amp-prefixed.
- * @deprecated Use {@link Module#getStatus()} instead.
- */
- @Deprecated public void setStatus(String moduleName, String newStatus) {
- Optional moduleOptional = getModule(moduleName);
- if (!moduleOptional.isPresent()) {
- return;
- }
- Module module = moduleOptional.get();
-
- if (newStatus.toLowerCase().contains("enabled")) {
- module.getStatus().toEnabled();
- } else if (newStatus.toLowerCase().contains("disabled")) {
- module.getStatus().toDisabled();
- } else {
- module.getStatus().toFailed(newStatus);
- }
-
- }
+// /**
+// * Returns the status of a module (enabled or error message), in the form of a color-coded string.
+// * This is meant to show to users.
+// *
+// * @deprecated Use {@link Module#getStatus()} instead.
+// */
+// @Deprecated public String getStatus(String moduleName) {
+// Optional moduleOptional = getModule(moduleName);
+// return moduleOptional.map(module -> module.getStatus().getMessage()).orElse(null);
+// }
+
+// /**
+// * Set the status of a module.
+// *
+// * @param moduleName The name of the module.
+// * @param newStatus The module's status. May include color codes, amp-prefixed.
+// * @deprecated Use {@link Module#getStatus()} instead.
+// */
+// @Deprecated public void setStatus(String moduleName, String newStatus) {
+// Optional moduleOptional = getModule(moduleName);
+// if (!moduleOptional.isPresent()) {
+// return;
+// }
+// Module module = moduleOptional.get();
+//
+// if (newStatus.toLowerCase().contains("enabled")) {
+// module.getStatus().toEnabled();
+// } else if (newStatus.toLowerCase().contains("disabled")) {
+// module.getStatus().toDisabled();
+// } else {
+// module.getStatus().toFailed(newStatus);
+// }
+//
+// }
public boolean isModuleActive(String moduleName) {
boolean results = false;
if ( moduleName != null ) {
- Module module = getModule(moduleName).orElse(null);
+ Module module = getModule(moduleName);
if ( module != null ) {
results = module.getStatus().getStatus() == Status.ENABLED;
}
diff --git a/prison-core/src/main/java/tech/mcprison/prison/modules/ModuleStatus.java b/prison-core/src/main/java/tech/mcprison/prison/modules/ModuleStatus.java
index d7f7a4de8..9033e5b1d 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/modules/ModuleStatus.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/modules/ModuleStatus.java
@@ -30,6 +30,10 @@ public class ModuleStatus {
* Enums
*/
+ public enum Status {
+ ENABLED, DISABLED, FAILED
+ }
+
private Status status;
/*
@@ -113,8 +117,5 @@ public void addMessage(String message) {
}
}
- public enum Status {
- ENABLED, DISABLED, FAILED
- }
}
diff --git a/prison-core/src/main/java/tech/mcprison/prison/ranks/data/RankLadder.java b/prison-core/src/main/java/tech/mcprison/prison/ranks/data/RankLadder.java
index 7bb160ba1..d35788ce7 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/ranks/data/RankLadder.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/ranks/data/RankLadder.java
@@ -272,6 +272,27 @@ public int compareTo( RankLadder rl )
return results;
}
+ /**
+ * This function finds a rank with the given name. The rank name
+ * must be an exact match, but it's case insensitive.
+ *
+ *
+ * @param rank
+ * @return
+ */
+ public Rank getRank( String rank ) {
+ Rank results = null;
+
+ for ( Rank r : ranks ) {
+ if ( r.getName().equalsIgnoreCase( rank ) ) {
+ results = r;
+ break;
+ }
+ }
+
+ return results;
+ }
+
/**
* Add a rank to this ladder.
*
diff --git a/prison-core/src/main/java/tech/mcprison/prison/ranks/data/RankPlayer.java b/prison-core/src/main/java/tech/mcprison/prison/ranks/data/RankPlayer.java
index 26c6508d9..6021ed64e 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/ranks/data/RankPlayer.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/ranks/data/RankPlayer.java
@@ -66,6 +66,11 @@ public class RankPlayer
private UUID uid;
+ // This is used to track if a RankPlayer was saved, or needs to be saved.
+ private transient boolean enableDirty = false;
+ private transient boolean dirty = false;
+
+
private TreeMap ladderRanks;
// ranks is the storage structure used to save the player's ladder & ranks:
@@ -255,7 +260,21 @@ public UUID getUUID() {
return uid;
}
- /**
+ public boolean isEnableDirty() {
+ return enableDirty;
+ }
+ public void setEnableDirty(boolean enableDirty) {
+ this.enableDirty = enableDirty;
+ }
+
+ public boolean isDirty() {
+ return dirty;
+ }
+ public void setDirty(boolean dirty) {
+ this.dirty = dirty;
+ }
+
+ /**
* If the player has any names in the getNames() collection, of which they may not,
* then getDisaplyName() will return the last one set, otherwise it will return
* a null.
@@ -1429,6 +1448,21 @@ public boolean isSneaking() {
return false;
}
+ @Override
+ public boolean isMinecraftStatisticsEnabled() {
+ return false;
+ }
+
+
+ @Override
+ public void incrementMinecraftStatsMineBlock( Player player, String blockName, int quantity) {
+
+ }
+
+ @Override
+ public void incrementMinecraftStatsDropCount( Player player, String blockName, int quantity) {
+
+ }
/**
* This function will return the next rank that they player will have upon
@@ -1671,8 +1705,8 @@ public String printRankScoreLine1( int rankPostion ) {
String sPenaltyStr = PlaceholdersUtil.formattedKmbtSISize( getRankScorePenalty(), dFmt, " " );
String message = String.format(
- " %-3d %-18s %-7s %-7s %9s %9s %9s",
- (rankPostion > 0 ? rankPostion : ""),
+ " %-3s %-18s %-7s %-7s %9s %9s %9s",
+ (rankPostion > 0 ? Integer.toString(rankPostion) : ""),
getName(),
prestRankTagNc,
defRankTagNc,
@@ -1718,8 +1752,8 @@ public String printRankScoreLine2( int rankPostion ) {
String ranks = prestRankTagNc + defRankTagNc;
String message = String.format(
- " %-3d %-9s %6s %-17s %9s",
- (rankPostion > 0 ? rankPostion : ""),
+ " %-3s %-9s %6s %-17s %9s",
+ (rankPostion > 0 ? Integer.toString(rankPostion) : ""),
ranks,
dFmt.format( getRankScore() ),
getName(),
diff --git a/prison-core/src/main/java/tech/mcprison/prison/util/Bounds.java b/prison-core/src/main/java/tech/mcprison/prison/util/Bounds.java
index 74294ab16..0bcb4dba5 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/util/Bounds.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/util/Bounds.java
@@ -18,6 +18,7 @@
package tech.mcprison.prison.util;
+import tech.mcprison.prison.Prison;
import tech.mcprison.prison.internal.World;
/**
@@ -165,6 +166,9 @@ public Bounds( Bounds bounds, Edges edge, int amount ) {
int zMin = bounds.getzBlockMin();
int zMax = bounds.getzBlockMax();
+ int worldMinY = Prison.get().getPlatform().getMinY();
+ int worldMaxY = Prison.get().getPlatform().getMaxY();
+
switch ( edge )
{
case top:
@@ -172,8 +176,8 @@ public Bounds( Bounds bounds, Edges edge, int amount ) {
if ( yMax < yMin ) {
yMax = yMin;
}
- if ( yMax > 255 ) {
- yMax = 255;
+ if ( yMax > worldMaxY ) {
+ yMax = worldMaxY;
}
break;
@@ -182,8 +186,8 @@ public Bounds( Bounds bounds, Edges edge, int amount ) {
if ( yMin > yMax ) {
yMin = yMax;
}
- if ( yMin < 0 ) {
- yMin = 0;
+ if ( yMin < worldMinY ) {
+ yMin = worldMinY;
}
break;
diff --git a/prison-core/src/main/java/tech/mcprison/prison/util/ExampleJavaDoubleVsBigDecimal.java b/prison-core/src/main/java/tech/mcprison/prison/util/ExampleJavaDoubleVsBigDecimal.java
new file mode 100644
index 000000000..a856abc35
--- /dev/null
+++ b/prison-core/src/main/java/tech/mcprison/prison/util/ExampleJavaDoubleVsBigDecimal.java
@@ -0,0 +1,63 @@
+package tech.mcprison.prison.util;
+
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+
+import tech.mcprison.prison.Prison;
+
+public class ExampleJavaDoubleVsBigDecimal {
+
+ public static void main( String[] args ) {
+
+ ExampleJavaDoubleVsBigDecimal app = new ExampleJavaDoubleVsBigDecimal();
+
+ ArrayList out = app.runSample();
+
+ String header = String.format(
+ "%s %30s %35s %16s %s",
+ "Int Digits ",
+ " double ",
+ " BigDecimal ",
+ "Delta ",
+ "Row" );
+
+ System.out.println( header );
+
+ for (String line : out) {
+ System.out.println( line );
+ }
+ }
+
+
+ private ArrayList runSample() {
+ ArrayList out = new ArrayList<>();
+
+ StringBuilder sb = new StringBuilder();
+ sb.append( ".111111" );
+
+ DecimalFormat dFmt = Prison.get().getDecimalFormat( "#,##0.00000" );
+
+ for ( int i = 1; i < 25; i++ ) {
+ sb.insert( 0, "1" );
+
+ double dub = Double.parseDouble( sb.toString() );
+ BigDecimal bigD = new BigDecimal( sb.toString() );
+
+ BigDecimal delta = bigD.subtract( BigDecimal.valueOf(dub) );
+
+ String rpt = String.format(
+ "%2d %40s %35s %16s %2d",
+ i,
+ dFmt.format( dub ),
+ bigD.toString(), delta.toString(),
+ i
+ );
+
+ out.add( rpt );
+
+ }
+
+ return out;
+ }
+}
diff --git a/prison-core/src/main/java/tech/mcprison/prison/util/PrisonJarReporter.java b/prison-core/src/main/java/tech/mcprison/prison/util/PrisonJarReporter.java
index c59fc3c9c..b9cb8f58d 100644
--- a/prison-core/src/main/java/tech/mcprison/prison/util/PrisonJarReporter.java
+++ b/prison-core/src/main/java/tech/mcprison/prison/util/PrisonJarReporter.java
@@ -55,7 +55,12 @@ public enum JavaVersion {
JavaSE_15("3b"),
JavaSE_16("3c"),
JavaSE_17("3d"),
- JavaSE_18("3e")
+ JavaSE_18("3e"),
+ JavaSE_19("3f"),
+ JavaSE_20("40"),
+ JavaSE_21("41"),
+
+ JavaSE_UnknownVersion("UnknownJavaVersion")
;
private final String hex;
@@ -67,7 +72,7 @@ public String getHex() {
}
public static JavaVersion fromString( String hexString ) {
- JavaVersion results = null;
+ JavaVersion results = JavaSE_UnknownVersion;
if ( hexString != null && hexString.length() >= 2 ) {
diff --git a/prison-core/src/main/resources/lang/core/fr_FR.properties b/prison-core/src/main/resources/lang/core/fr_FR.properties
new file mode 100644
index 000000000..d33f66512
--- /dev/null
+++ b/prison-core/src/main/resources/lang/core/fr_FR.properties
@@ -0,0 +1,185 @@
+#
+# Prison is a Minecraft plugin for the prison game mode.
+# Copyright (C) 2021 The Prison Team
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+
+##
+## Prison Supports Unicode (UTF-8) encoding in these properties files. BUt you must
+## follow these instructions to ensure everything works properly.
+##
+## 1. You should only edit these files using a UTF-8 editor. On windows use NotePad, not WordPad.
+## WordPad will save as plain text. To confirm the save was successful: save, close the editor,
+## then reopen to confirm the encoding was preserved.
+##
+## 2. When running on Windows, you must enable utf-8 encoding in minecraft's console. Windows
+## defaults to a characterpage 1252. To enable window's use of utf-8, you need to change the
+## encoding prior to launching spigot/paper:
+## chcp 65001
+##
+## Full example of a windows script, which hooks for java debugging:
+## rem Note: chcp 65001 enables utf-8 in windows, when normally windows uses characterpage 1252
+## chcp 65001
+## java -Dfile.encoding="UTF-8" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -Xms1g -Xmx4g -jar spigot-1.8.8.jar nogui --log-strip-color
+## pause
+##
+## 3. When viewing the logs/latest.log files you must use an editor such as NotePad instead of WordPad.
+##
+## 4. Unicode is properly displayed in game, in console, in the logs, and with paste.helpch.at when using
+## /prison support submit.
+##
+
+
+# NOTE: A messages__version is an arbitrary integer that will be manually incremented within Prison
+# when there are changes to these messages. This value represents when message content is
+# changed, fixed, or added to. This value may not be increased if the change is very small and
+# insignificant, such as a space or a couple of letters.
+#
+# messages__auto_refresh=true indicates that this file will automatically be replaced if
+# Prison detects a messages__version difference. The old file will be deleted (renamed) and
+# a new copy will be placed in the directory to be used. If this value is set to false, then
+# Prison will not refresh this file and there could be issues with the display of other messages.
+# If auto refresh is set to false, we are not held responsible for possible issues that can
+# arise from inaccurate messages. If set to false, then you are responsible for maintaining
+# the messages on your own.
+#
+# If you make changes to this file, and you have messages__auto_refresh=false, then those
+# changes will be replaced when this file is updated. Since the old file is renamed, and
+# not deleted, you can manually merge your changes back in to the new update. The old
+# renamed files will never be deleted by prison; you can remove them when you feel like it
+# is safe to do so.
+#
+# Please consider helping Prison, and everyone else who may use Prison, by contributing all
+# translations to other languages. They should be faithful translations, and not something
+# for the sake of humor or changes just for cosmetic styling. If you have something you would
+# like to share, please contact a staff member on our Discord server.
+#Thanks for your contributions!
+#
+messages__version=9
+messages__auto_refresh=true
+
+
+core_output__prefix_template=| %1 | &7
+core_output__prefix_template_prison=Prison
+core_output__prefix_template_info=Info
+core_output__prefix_template_warning=Avertissement
+core_output__prefix_template_error=Erreur
+core_output__prefix_template_debug=Debug
+
+core_output__color_code_info=&3
+core_output__color_code_warning=&c
+core_output__color_code_error=&c
+core_output__color_code_debug=&9
+
+core_output__error_startup_failure=Prison: (Envoi à System.err en raison de l'échec du log d'Output.log):
+core_output__error_incorrect_number_of_parameters=Échec du log (%1): Nombre de paramètres incorrect: [%2] Message brut original: [%3] Arguments: %4
+
+
+core_text__prefix=&3
+core_text__just_now=à l'instant même
+core_text__ago=il y a
+core_text__from_now=Ã partir de maintenant
+core_text__and=et
+core_text__time_units_prefix_spacer=
+core_text__time_units_singular=année,mois,semaine,jour,heure,minute,seconde
+core_text__time_units_plural=années,mois,semaines,days,heures,minutes,secondes
+core_text__time_units_short=a,m,s,j,h,m,s
+
+
+core_tokens__name_required=Prison Tokens=Le pseudo d'un joueur est requis quand utilisé dans la console.
+core_tokens__cannot_view_others_balances=Prison Tokens: Tu n'as pas la permission de voir le solde des autres joueurs.
+core_tokens__view_balance=&3%1 a %2 tokens.
+core_tokens__add_invalid_amount=Prison Tokens: Montant invalide: '%1'. Il doit être supérieur à zéro.
+core_tokens__added_amount=&3%1 a maintenant &7%2 &3tokens après en avoir ajouté &7%3&3.
+core_tokens__removed_amount=&3%1 a maintenant &7%2 &3tokens après en avoir retiré &7%3&3.
+core_tokens__set_amount=&3%1 a maintenant &7%2 &3tokens.
+
+
+core_runCmd__name_required=Un pseudo valide est requis.
+core_runCmd__command_required=Une commande est requise.
+
+
+core_prison_utf8_test=Привет! Давай поÑмотрим, работает ли? Test 01
+
+
+# The following are the original messages and they will eventually be replaced.
+
+includeError=[%1] a une valeur invalide.
+excludeError=[%1] a une valeur invalide.
+cantAsConsole=Tu ne peux pas faire dans dans la console.
+missingArgument=L'argument [%1] n'est pas défini (il n'a pas de valeur par défaut).
+missingFlagArgument=L'indicateur -%1 n'a pas les paramètres requis.
+undefinedFlagArgument=L'argument [%1] de l'indicateur -%2 n'est pas défini.
+internalErrorOccurred=Une erreur interne s'est produite lors de la tentative d'exécution de cette commande.
+noPermission=Vous n'avez pas les permissions nécessaires pour exécuter cette commande.
+blockParseError=Le paramètre [%1] n'est pas un block valide.
+numberParseError=Le paramètre [%1] n'est pas un nombre.
+numberTooLow=Le paramètre [%1] doit être supérieur ou égal à %2.
+numberTooHigh=Le paramètre [%1] doit être inférieur ou égal à %2.
+numberRangeError=Le paramètre [%1] doit être supérieur ou égal à %2 et doit être inférieur ou égal à %3.
+tooFewCharacters=Le paramètre [%1] doit être supérieur ou égal à %2 caractères.
+tooManyCharacters=Le paramètre [%1] doit être inférieur ou égal à %2 caractères.
+playerNotOnline=Le joueur %1 n'est pas en ligne.
+worldNotFound=Le monde %1 n'a pas été trouvé.
+
+
+
+
+
+core_gui__click_to_decrease=&3Clique pour diminuer.
+core_gui__click_to_increase=&3Clique pour augmenter.
+
+
+core_gui__click_to_cancel=&3Clique pour annuler.
+core_gui__click_to_close=&3Clique pour fermer.
+core_gui__click_to_confirm=&3Clique pour confirmer.
+core_gui__click_to_delete=&3Clique pour supprimer.
+core_gui__click_to_disable=&3Clique pour désactiver.
+core_gui__click_to_edit=&3Clique pour editer.
+core_gui__click_to_enable=&3Clique pour activer.
+core_gui__click_to_open=&3Clique pour ouvrir.
+
+
+core_gui__left_click_to_confirm=&3Clique-gauche pour confirmer.
+core_gui__left_click_to_reset=&3Clique-gauche pour réinitialiser.
+core_gui__left_click_to_open=&3Clique-gauche pour ouvrir.
+core_gui__left_click_to_edit=&3Clique-gauche pour editer.
+
+
+core_gui__right_click_to_cancel=&3Clique-droit pour annuler.
+core_gui__right_click_to_delete=&3Clique-droit pour supprimer.
+core_gui__right_click_to_disable=&3Clique-droit pour désactiver.
+core_gui__right_click_to_enable=&3Clique-droit pour activer.
+core_gui__right_click_to_toggle=&3Clique-droit pour basculer.
+
+
+core_gui__right_click_and_shift_to_delete=&3Clique-droit et maj pour supprimer.
+core_gui__right_click_and_shift_to_disable=&3Clique-droit et maj pour désactiver.
+core_gui__right_click_and_shift_to_toggle=&3Clique-droit et maj pour basculer.
+
+
+core_gui__page_next=&3Page suivante.
+core_gui__page_prior=&3Page précedente.
+
+
+core_gui__money_earned=&3Vous avez gagné &a$%1
+core_gui__price=&3Prix: %1
+core_gui__confirm=&3Confirmer: %1 %2
+core_gui__delay=&3Délai: %1 secondes
+core_gui__multiplier=&3Multiplicateur: x %1
+core_gui__value=&3Valeur: %1
+core_gui__permission=&3Permission: &7%1
+core_gui__prestige_name=&3Nom de prestige: %1
+
diff --git a/prison-core/src/main/resources/lang/mines/fr_FR.properties b/prison-core/src/main/resources/lang/mines/fr_FR.properties
new file mode 100644
index 000000000..4928b82e5
--- /dev/null
+++ b/prison-core/src/main/resources/lang/mines/fr_FR.properties
@@ -0,0 +1,99 @@
+# NOTE: A messages__version is an arbitrary integer that will be manually incremented within Prison
+# when there are changes to these messages. This value represents when message content is
+# changed, fixed, or added to. This value may not be increased if the change is very small and
+# insignificant, such as a space or a couple of letters.
+#
+# messages__auto_refresh=true indicates that this file will automatically be replaced if
+# Prison detects a messages__version difference. The old file will be deleted (renamed) and
+# a new copy will be placed in the directory to be used. If this value is set to false, then
+# Prison will not refresh this file and there could be issues with the display of other messages.
+# If auto refresh is set to false, we are not held responsible for possible issues that can
+# arise from inaccurate messages. If set to false, then you are responsible for maintaining
+# the messages on your own.
+#
+# If you make changes to this file, and you have messages__auto_refresh=false, then those
+# changes will be replaced when this file is updated. Since the old file is renamed, and
+# not deleted, you can manually merge your changes back in to the new update. The old
+# renamed files will never be deleted by prison; you can remove them when you feel like it
+# is safe to do so.
+#
+# Please consider helping Prison, and everyone else who may use Prison, by contributing all
+# translations to other languages. They should be faithful translations, and not something
+# for the sake of humor or changes just for cosmetic styling. If you have something you would
+# like to share, please contact a staff member on our Discord server.
+#Thanks for your contributions!
+#
+
+##
+## Prison Supports Unicode (UTF-8) encoding in these properties files. BUt you must
+## follow these instructions to ensure everything works properly.
+##
+## 1. You should only edit these files using a UTF-8 editor. On windows use NotePad, not WordPad.
+## WordPad will save as plain text. To confirm the save was successful: save, close the editor,
+## then reopen to confirm the encoding was preserved.
+##
+## 2. When running on Windows, you must enable utf-8 encoding in minecraft's console. Windows
+## defaults to a characterpage 1252. To enable window's use of utf-8, you need to change the
+## encoding prior to launching spigot/paper:
+## chcp 65001
+##
+## Full example of a windows script, which hooks for java debugging:
+## rem Note: chcp 65001 enables utf-8 in windows, when normally windows uses characterpage 1252
+## chcp 65001
+## java -Dfile.encoding="UTF-8" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -Xms1g -Xmx4g -jar spigot-1.8.8.jar nogui --log-strip-color
+## pause
+##
+## 3. When viewing the logs/latest.log files you must use an editor such as NotePad instead of WordPad.
+##
+## 4. Unicode is properly displayed in game, in console, in the logs, and with paste.helpch.at when using
+## /prison support submit.
+##
+
+
+
+messages__version=4
+messages__auto_refresh=true
+
+
+
+# The following are the original messages and they will eventually be replaced.
+
+reset_warning=&7La mine %1 va se réinitialiser dans &3%2&7.
+reset_message=&7La mine %1 a été réinitialisée.
+not_allowed=&7Tu n'es pas autorisé à miner ici.
+autosmelt_enable=&bL'Autosmelt &7a été &aactivé&7.
+autosmelt_disable=&bL'Autosmelt &7a été &cdésactivé&7.
+autoblock_enable=&bL'Autoblock &7a été &aactivé&7.
+autoblock_disable=&bL'Autoblock &7a été &cdésactivé&7.
+autopickup_enable=&bL'Autopickup &7a été &aactivé&7.
+autopickup_disable=&bL'Autopickup &7a été &cdésactivé&7.
+teleported=&7Tu as été téléporté à la mine &3%1&7.
+mine_reset=&7La mine &3%1&7 a été réinitialisée.
+mine_reset_fail=&7La mine &3%1&7 n'a pas pu être réinitialisée. &8Consultez la console pour plus de détails.
+mine_created=&7La mine a été créée avec succès.
+mine_deleted=&7La mine a été supprimée avec succès.
+select_bounds=&7Vous devez d'abord sélectionner les limites de la mine. &8Faites /mines wand pour le faire.
+world_diff=&7Vous ne pouvez pas créer des mines dans deux mondes différents.
+mine_exists=&7A mine by that name already exists.
+mine_does_not_exist=&7Une mine du même nom existe déjà .
+spawn_set=&7Le point de spawn de la mine a été défini.
+spawn_removed=&7Le point de spawn de la mine a été supprimé.
+spawnpoint_same_world=&7Le &cpoint de spawn &7doit être dans le même &cmonde &7que la mine.
+not_a_block=&c%1 &7n'est pas un bloc.
+block_already_added=&7Ce bloc a déjà été ajouté dans la mine.
+mine_full=&cCette mine sera trop remplie. &7Essaye de réduire le percentage de ce block ou d'un autre dans la mine pour faire de la place.
+block_added=&7Le bloc &3%1 &7a été ajoutée à la mine &3%2&7.
+block_set=&7Changement du bloc &3%1 &7dans la mine &3%2&7.
+block_not_removed=&7Ce bloc n'est pas dans cette mine.
+block_deleted=&7Le bloc &3%1 &7 a été supprimée de la mine &3%2&7.
+mine_redefined=&7La mine a bien été &3redéfinie&7.
+missing_world=&7Le monde dans lequel la mine a été créée est introuvable.
+block_search_blank=&7Saisissez une valeur pour rechercher un bloc.
+
+mines_mtp__unable_to_teleport=Désolé. Tu ne peux pas te téléporter là -bas.
+mines_mtp__unable_to_teleport_others=&3Tu ne peux pas téléporter d'autres joueurs dans une mine. Paramètre ignoré.
+mines_mtp__no_target_mine_found=Aucune mine trouvée. &3Soumet à nouveau la demande de téléportation avec un nom de mine.
+mines_mtp__player_must_be_in_game=Tu ne peux téléporter que les joueurs qui sont en ligne.
+mines_mtp__player_must_be_in_game=&3Le joueur spécifié n'est pas en lignhe et ne peut donc pas être téléporté.
+mines_mtp__cannot_use_virtual_mines=&cOption invalide. Cette mine est une mine virtuelle&7. Utilise &a/mines set area &7pour activer la mine.
+mines_mtp__teleport_failed=&3La téléportation a échoué. Es-tu sûr d'être un joueur ?
diff --git a/prison-core/src/main/resources/lang/ranks/en_US.properties b/prison-core/src/main/resources/lang/ranks/en_US.properties
index c75503fd7..ff6e18da4 100644
--- a/prison-core/src/main/resources/lang/ranks/en_US.properties
+++ b/prison-core/src/main/resources/lang/ranks/en_US.properties
@@ -1,4 +1,4 @@
-# NOTE: A messages__version is an arbitrary integer that will be manually incremented within Prison
+ # NOTE: A messages__version is an arbitrary integer that will be manually incremented within Prison
# when there are changes to these messages. This value represents when message content is
# changed, fixed, or added to. This value may not be increased if the change is very small and
# insignificant, such as a space or a couple of letters.
@@ -50,7 +50,7 @@
##
-messages__version=27
+messages__version=28
messages__auto_refresh=true
ranks_rankup__rankup_no_player_name=You have
@@ -342,3 +342,8 @@ ranks_rankCommands__player_no_ranks_found=&3No ranks found for &c%1
ranks_rankCommands__players_invalid_ladder=The ladder '%1' doesn't exist, or was not 'ALL'.
ranks_rankCommands__players_invalid_action=The action '%1' is invalid. [players, all, full]
+
+ranks_rankCommands__topn_forced_reload_successful=topN forced reload was successful.
+ranks_rankCommands__topn_forced_reload_failure=topN forced reload failed.
+ranks_rankCommands__topn_debug_saved_success=topN debug mode: all topN data saved to Prison/data_storage/prisonTopN.json and reloaded for performance stats.
+
diff --git a/prison-core/src/main/resources/lang/ranks/fr_FR.properties b/prison-core/src/main/resources/lang/ranks/fr_FR.properties
new file mode 100644
index 000000000..90af5af69
--- /dev/null
+++ b/prison-core/src/main/resources/lang/ranks/fr_FR.properties
@@ -0,0 +1,348 @@
+# NOTE: A messages__version is an arbitrary integer that will be manually incremented within Prison
+# when there are changes to these messages. This value represents when message content is
+# changed, fixed, or added to. This value may not be increased if the change is very small and
+# insignificant, such as a space or a couple of letters.
+#
+# messages__auto_refresh=true indicates that this file will automatically be replaced if
+# Prison detects a messages__version difference. The old file will be deleted (renamed) and
+# a new copy will be placed in the directory to be used. If this value is set to false, then
+# Prison will not refresh this file and there could be issues with the display of other messages.
+# If auto refresh is set to false, we are not held responsible for possible issues that can
+# arise from inaccurate messages. If set to false, then you are responsible for maintaining
+# the messages on your own.
+#
+# If you make changes to this file, and you have messages__auto_refresh=false, then those
+# changes will be replaced when this file is updated. Since the old file is renamed, and
+# not deleted, you can manually merge your changes back in to the new update. The old
+# renamed files will never be deleted by prison; you can remove them when you feel like it
+# is safe to do so.
+#
+# Please consider helping Prison, and everyone else who may use Prison, by contributing all
+# translations to other languages. They should be faithful translations, and not something
+# for the sake of humor or changes just for cosmetic styling. If you have something you would
+# like to share, please contact a staff member on our Discord server.
+#Thanks for your contributions!
+#
+
+##
+## Prison Supports Unicode (UTF-8) encoding in these properties files. BUt you must
+## follow these instructions to ensure everything works properly.
+##
+## 1. You should only edit these files using a UTF-8 editor. On windows use NotePad, not WordPad.
+## WordPad will save as plain text. To confirm the save was successful: save, close the editor,
+## then reopen to confirm the encoding was preserved.
+##
+## 2. When running on Windows, you must enable utf-8 encoding in minecraft's console. Windows
+## defaults to a characterpage 1252. To enable window's use of utf-8, you need to change the
+## encoding prior to launching spigot/paper:
+## chcp 65001
+##
+## Full example of a windows script, which hooks for java debugging:
+## rem Note: chcp 65001 enables utf-8 in windows, when normally windows uses characterpage 1252
+## chcp 65001
+## java -Dfile.encoding="UTF-8" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -Xms1g -Xmx4g -jar spigot-1.8.8.jar nogui --log-strip-color
+## pause
+##
+## 3. When viewing the logs/latest.log files you must use an editor such as NotePad instead of WordPad.
+##
+## 4. Unicode is properly displayed in game, in console, in the logs, and with paste.helpch.at when using
+## /prison support submit.
+##
+
+
+messages__version=28
+messages__auto_refresh=true
+
+ranks_rankup__rankup_no_player_name=Tu as
+ranks_rankup__rankup_no_player_name_broadcast=Quelqu'un
+ranks_rankup__rankup_you_are=Tu es
+ranks_rankup__rankup_success=Félicitations ! %1 est monté au rang '%2'. %3
+ranks_rankup__demote_success=Malheureusement, %1 a été rétrogradé au rang '%2'. %3
+ranks_rankup__log_rank_change=%1 a initié le changement de rang: %2
+ranks_rankup__rankup_cant_afford=Tu n'as pas assez d'argent pour monter en rang ! Le rang suivant coûte %1%2.
+ranks_rankup__rankup_lowest=%1 est déjà au rang le plus bas !
+ranks_rankup__rankup_highest=%1 est déjà au rang le plus haut !
+ranks_rankup__rankup_failure=Échec générique de la montée en rang. Examine les détails pour en déterminer la raison.
+ranks_rankup__rankup_failed_to_load_player=Impossible de charger le joueur.
+ranks_rankup__rankup_failed_to_load_ladder=Impossible de charger le classement.
+ranks_rankup__rankup_failed_to_assign_rank=Impossible d'assigner un rang. Examine les détails pour en déterminer la raison.
+ranks_rankup__rankup_failed_to_assign_rank_with_refund=Impossible d'assigner un rang. Examine les détails pour en déterminer la raison. Un remboursement a été fait.
+ranks_rankup__rankup_failed_to_save_player_file=Échec de la récupération ou de l'écriture des données. Les fichiers sont peut-être corrompus. Alertez un administrateur du serveur.
+ranks_rankup__rankup_no_ranks=Il n'y a pas de rangs dans ce classement.
+ranks_rankup__rankup_rank_does_not_exist=Le rang %1 n'existe pas dans ce serveur.
+ranks_rankup__rankup_rank_is_not_in_ladder=Le rang %1 n'existe pas dans le classement %2.
+ranks_rankup__rankup_currency_is_not_supported=La monnaie, %1, n'est pas supporté par aucun plugin d'économie chargé.
+ranks_rankup__rankup_ladder_removed=Le classement %1 a été supprimé.
+ranks_rankup__rankup_failure_removing_ladder=La montée en rang a échoué comme le joueur n'a pas pu être supprimé du classement. (Les joueurs ne peuvent pas être supprimés du classement 'default').
+ranks_rankup__rankup_in_progress_failure=La montée en rang n'a pas réussi à se terminer correctement. Aucun statut n'a été défini.
+
+ranks_rankup__rankup_failure_to_get_rankplayer=Tu n'existes pas ! Il n'y a aucune trace de toi sur le serveur. Essaye de rejoindre à nouveau ou contacte un administrateur du serveur.
+ranks_rankup__rankup_failure_invalid_ladder=Le classement '%1' n'existe pas.
+ranks_rankup__rankup_failure_must_be_online_player=&3Tu dois être un joueur en ligne pour utiliser cette commande.
+ranks_rankup__no_permission=Tu as besoin de la permission '%1' pour monter en rang dans ce classement.
+ranks_rankup__cannot_run_from_console=&7Tu ne peux pas executer de montée de rang à partir de la console. Fait &3/rankup help&7.
+ranks_rankup__invalid_player_name=&7Nom de joueur invalide. '%1'
+ranks_rankup__internal_failure=&7Mode de montée en rang invalide. Erreur interne. Reporte cette erreur.
+ranks_rankup__error_no_default_ladder=&c[ERREUR] Il n'y a pas de classement par défaut ! Reporte cette erreur à un administrateur !
+ranks_rankup__error_no_lower_rank=&c[ERREUR] Impossible d'obtenir le rang le plus bas ! Reporte cette erreur à un administrateur !
+
+ranks_rankup__error_no_ladder=&c[ERREUR] Le classement %1 n'existe pas ! Reporte cette erreur à un administrateur !
+ranks_rankup__error_no_lower_rank_on_ladder=&c[ERREUR] Le classement %1 n'a pas de rang ! Reporte cette erreur à un administrateur !
+
+ranks_rankup__error_player_not_on_default_ladder=&c[ERREUR] Le joueur n'est pas dans le classement par défaut. Joueur: %1
+ranks_rankup__not_at_last_rank=&cTu n'es pas au dernier rang !
+ranks_rankup__at_last_rank=&cTu es au dernier rang !
+ranks_rankup__not_able_to_prestige=&7[&3Désolé&7] &3Tu ne peux pas prestique &6Prestige !
+ranks_rankup__not_able_to_reset_rank=&7Impossible de réinitialiser ton rang au classement par défaut.
+
+ranks_rankup__balance_set_to_zero=&7Ton solde a été remis à zéro.
+ranks_rankup__prestige_successful=&7[&3Félicitations&7] &3Tu as &6Prestige&3 vers %1&c!
+ranks_rankup__prestige_failure=&7[&3Désolé&7] &3Tu n'as pas pu &6Prestige&3 vers %1&c!
+ranks_rankup__confirm_prestige_line_1=&3Confirmation Prestige: %1
+ranks_rankup__confirm_prestige_line_2=&3 Prix: &7%1
+ranks_rankup__confirm_prestige_line_3=&3 Solde: &7%1%2
+ranks_rankup__confirm_prestige_line_4=&3 Le rang par défaut sera réinitialisé.
+ranks_rankup__confirm_prestige_line_5=&3 Le solde sera réinitialisé.
+ranks_rankup__confirm_prestige_line_6=&3Confirme avec la commande: '&7/prestige %1confirm&3'
+ranks_rankup__confirm_prestige_line_7=&3Confirme en cliquant sur le bloc vert
+
+ranks_rankup__invalid_charge_value=&3Valeur invalide pour chargePlayer. Les valeurs valides sont: %1 %2
+ranks_rankup__invalid_refund_value=&3Valeur invalide pour refundPlayer. Les valeurs valides sont: %1 %2
+
+
+ranks_rankutil__failure_internal=Erreur dans l'exécution de rankupPlayerInternal, voir les logs serveur pour check server logs pour la stack trace: %1
+ranks_rankutil__failure_saving_player_data=Une erreur s'est produite lors de l'enregistrement des fichiers du joueur.
+
+
+ranks_firstJoinHandler__no_ranks_on_server=Il n'y a pas de rang sur le serveur ! Les nouveaux joueurs n'ont pas de rang.
+ranks_firstJoinHandler__could_not_save_player=Impossible de sauvegarder les fichiers sauvegarde des joueurs.
+ranks_firstJoinHandler__success=Bienvenue ! %1 vient de rejoindre le serveur et a été attribué des rangs par défaut.
+
+
+ranks_prisonRanks__failure_no_economy_status=&cPas de plugins d'économie
+ranks_prisonRanks__failure_no_economy=PrisonRanks.enable() - Erreur - Pas de plugin d'économie actif - %1
+ranks_prisonRanks__failure_loading_ranks_status=&cImpossible de charger les fichiers de rang: %1
+ranks_prisonRanks__failure_loading_ranks=Un fichier de rang n'a pas pu être chargé. %1
+ranks_prisonRanks__failure_loading_ladders_status=&cImpossible de charger les fichiers de classement: %1
+ranks_prisonRanks__failure_loading_ladders=Un fichier de classement n'a pas pu être chargé. %1
+ranks_prisonRanks__failure_loading_players_status=&cImpossible de charger les fichiers de joueur: %1
+ranks_prisonRanks__failure_loading_players=Un fichier de joueur n'a pas pu être chargé. %1
+ranks_prisonRanks__failed_loading_players=&cImpossible de charger les fichiers de joueur: %1
+ranks_prisonRanks__failed_to_load_player_file=Un fichier de joueur n'a pas pu être chargé. %1
+
+ranks_prisonRanks__status_loaded_ranks=Chargement de %1 rangs. Rangs par défaut: %2 Rangs de prestige: %3 Autres rangs: %4
+ranks_prisonRanks__status_loaded_ladders=Chargement de %1 classements.
+ranks_prisonRanks__status_loaded_players=Chargement de %1 joueurs.
+
+ranks_prisonRanks__failure_with_ladder=&cImpossible de %1 un nouveau classement %2, un classement preexistant n'a pas pu être trouvé.
+ranks_prisonRanks__failure_with_ladder_create=créer
+ranks_prisonRanks__failure_with_ladder_save=sauvegarder
+ranks_prisonRanks__failure_with_ladder_default=défaut
+ranks_prisonRanks__failure_with_ladder_prestiges=prestiges
+
+ranks_prisonRanks__added_new_player=&7Prison: &cUn nouveau joueur a été ajouté &7au Prison: &3%1 &7a été trouvé sur le serveur.
+ranks_prisonRanks__added_and_fixed_players=Chargement de rang Prison: Ajout de %1 joueurs au prison. Correction de %2 joueurs qui n'avaient pas de rang sur l'échelle par défaut.
+
+
+ranks_rank__failure_loading_ranks=&aÉchec: Chargement des rangs ! &7Exception parsing rank documents. Rang id= %1 nom= %2 [%3]
+
+ranks_rankManager__failure_loading_rankManager=&aÉchec: chargement des classements %1 (classement id: %2): &7Impossible de charger le RankManager, donc impossible d'accéder aux rangs.
+ranks_rankManager__failure_duplicate_rank=&aÉchec: échec de chargement du RankLadder: Rang '%1' était déjà lié au classement '%2', mais on a tenté de l'ajouter au classement '%3'. Ce rang ne sera pas lié au classement '%4'
+
+
+ranks_rankManager__remove_rank_warning=Avertissement de suppression de rang: Il n'existe pas de rang subsidiaire, les joueurs ayant le rang qui sera supprimé n'auront aucun rang sur ce classement.
+ranks_rankManager__cannot_save_player_file=RemoveRank: Impossible d'enregistrer le fichier du joueur.
+ranks_rankManager__player_is_now=Joueur %1 est maintenant %2
+ranks_rankManager__cannot_save_ladder_file=RemoveRank: Impossible de sauvegarder le classement %1.
+ranks_rankManager__failure_no_economy=Échec d'économie: &7La monnaie &a%1&7 a été enregistrée avec le rang &a%2&7, mais n'est plus supportée par aucun plugin d'économie disponible.
+ranks_rankManager__ranks_by_ladders=&7Rangs par classement:
+
+
+ranks_ladderManager__cannot_save_ladder_file=&cLadderManager.saveLadder: Échec de la sauvegarde du classement. &7%1 &3Erreur= [&7%2&3]"
+
+
+ranks_playerManager__cannot_save_player_file=Une erreur s'est produite lors de la sauvegarde des fichiers joueur: %1
+ranks_playerManager__cannot_add_new_player=PlayerManager.getPlayer(): Échec de l'ajout du nouveau pseudo du joueur: %1. %2
+ranks_playerManager__cannot_save_new_player_file=Échec dans la création des données du nouveau joueur %1 nom de fichier cible: %2
+ranks_playerManager__no_player_name_available=
+ranks_playerManager__cannot_load_player_file=Impossible de charger le joueur: %1
+ranks_playerManager__failed_to_load_economy_currency=Échec du chargement de l'économie pour récupérer le solde du joueur %1 avec la monnaie %2.
+ranks_playerManager__failed_to_load_economy=Échec du chargement de l'économie pour récupérer le solde du joueur %1.
+ranks_playerManager__last_rank_message_for__prison_rankup_rank_tag_default=
+
+
+
+ranks_commandCommands__command_add_cannot_use_percent_symbols=&7Il n'est pas possible d'utiliser le symbole pourcentage comme placeholder; il faut utiliser { } Ã la place.
+ranks_commandCommands__command_add_placeholders=&7Les placeholders customs pour les commandes de rangs sont: &3%1
+ranks_commandCommands__rank_does_not_exist=Le rang '%1' n'existe pas.
+ranks_commandCommands__command_add_duplicate=La commande dupliquée '%1' n'a pas été ajoutée au rang '%2'.
+ranks_commandCommands__command_add_success=Commande '%1' ajoutée au rang '%2'.
+
+ranks_commandCommands__command_remove_sucess=Commande '%1' supprimée du rang '%2'.
+ranks_commandCommands__command_remove_failed=Le rang ne contient pas cette commande. Rien n'a été changé.
+
+ranks_commandCommands__command_list_contains_none=Le rang '%1' ne contient aucune commande.
+ranks_commandCommands__command_list_cmd_header=RankUpCommands pour le rang %1
+ranks_commandCommands__command_list_click_cmd_to_remove=&8Blique sur une commande pour la supprimer.
+ranks_commandCommands__command_list_click_to_remove=Clique pour supprimer.
+ranks_commandCommands__command_list_add_button=&7[&a+&7] Ajouter une nouvelle commande
+ranks_commandCommands__command_list_add_new_command_tool_tip=&7Ajouter une nouvelle commande.
+ranks_commandCommands__command_row_number_must_be_greater_than_zero=&7Veuillez fournir un numéro de ligne supérieur à zéro. La ligne était=[&b%1&7]
+ranks_commandCommands__command_row_number_too_high=&7Veuillez fournir un numéro de ligne inférieur ou égal à &b%1&7. La ligne était=[&b%2&7]
+
+
+
+ranks_commandCommands__ladder_command_add_placeholders=&7Les placeholders customs pour les commandes de classement sont: &3%1
+ranks_commandCommands__ladder_ladder_does_not_exist=Le classement '%1' n'existe pas.
+ranks_commandCommands__ladder_command_add_duplicate=La commande dupliquée '%1' n'a pas été ajoutée au classement '%2'.
+ranks_commandCommands__ladder_command_add_success=Commande '%1' ajoutée au classement '%2'.
+
+ranks_commandCommands__ladder_command_remove_sucess=Commande '%1' supprimée du classement '%2'..
+ranks_commandCommands__ladder_command_remove_failed=Le classement ne contient pas cette commande. Rien n'a été changé.
+
+ranks_commandCommands__ladder_command_list_contains_none=Le classement '%1' ne contient aucune commande.
+ranks_commandCommands__ladder_command_list_cmd_header=RankUpCommands pour le classement %1
+
+
+
+ranks_LadderCommands__ladder_already_exists=Un classement avec le nom '%1' existe déjà .
+ranks_LadderCommands__ladder_creation_error=Une erreur s'est produite lors de la création du classement '%1'. &8Consulte la console pour plus de détails.
+ranks_LadderCommands__ladder_created=Le classement '%1' a été créé.
+ranks_LadderCommands__ladder_could_not_save=Impossible de sauvegarder le classement.
+ranks_LadderCommands__ladder_does_not_exist=Le classement '%1' n'existe pas.
+ranks_LadderCommands__rank_does_not_exist=Le rang '%1' n'existe pas.
+ranks_LadderCommands__ladder_already_has_rank=Le classement '%1' contient déjà le rang '%2'.
+ranks_LadderCommands__ladder_added_rank=Le rang '%1' a été aujouté au classement '%2' dans la position %3.
+ranks_LadderCommands__ladder_deleted=Le classement '%1' a été supprimé.
+ranks_LadderCommands__ladder_cannot_delete_default=Tu ne peux pas supprimer le classement par défaut. Il est nécessaire.
+ranks_LadderCommands__ladder_cannot_delete_prestiges=Tu ne peux pas supprimer le classement de prestiges. Il est nécessaire.
+ranks_LadderCommands__ladder_cannot_delete_with_ranks=Impossible de supprimer un classement s'il a encore des rangs liés. Supprime tous les rangs et réessaye.
+ranks_LadderCommands__ladder_error=Une erreur s'est produite lros de la suppression du classement. &8Consulte la console pour plus de détails.
+ranks_LadderCommands__ladder_error_adding=Une erreur s'est produite lors de l'ajout du rang au classement. &8Consulte la console pour plus de détails.
+ranks_LadderCommands__ladder_error_removing=Une erreur s'est produite lros de la suppression du rang au classement. &8Consulte la console pour plus de détails.
+ranks_LadderCommands__ladder_error_saving=Erreur lors de la sauvegarde du classement.
+ranks_LadderCommands__move_rank_notice=Tentative de suppression du rang spécifié de son classement original, puis il sera ajouté à nouveau au classement cible à l'emplacement spécifié. Le rang ne sera pas perdu.
+ranks_LadderCommands__ladder_removed_rank_from_ladder=Rang '%1' supprimé du classement '%2'.
+
+
+ranks_LadderCommands__ladder_has_ranks=&7Ce classement contient les rangs suivants:
+ranks_LadderCommands__ladder_default_rank=&b(&9Rang par défaut&b) &7-
+ranks_LadderCommands__ladder_see_ranks_list=&3Voir &f/ranks list &b[ladderName] &3pour plus de détails sur les rangs.
+ranks_LadderCommands__ladder_has_no_perms=&3Le classement '&7%1&3' ne contient aucune permission ou aucun groupe de permissions.
+ranks_LadderCommands__ladder_set_rank_cost_multiplier=&3Le classement '&7%1&3' a été sauvegardé. Le multiplicateur du coût de rang est maintenant [%2]; il était de [%3].
+ranks_LadderCommands__ladder_rank_cost_multiplier_no_change=&3Le classement '&7%1&3' n'a pas été mis à jour. Le multiplicateur du coût de rang fourni n'a pas été changé. [%2]
+ranks_LadderCommands__ladder_rank_cost_multiplier_out_of_range=&3Le multiplicateur du coût du rang est hors de portée. Il doit être compris entre -100% et 100%. [%1]
+ranks_LadderCommands__ladder_apply_rank_cost_multiplier_no_change=&3Le classement '&7%1&3' n'a pas été mis à jour. The applied rank cost multiplier to this ladder did not change. [%2]
+ranks_LadderCommands__ladder_apply_rank_cost_multiplier_saved=&3Le classement '&7%1&3' a été sauvegardé. L'application du multiplicateur du coût du rang de ce classement est désormais la suivante [%2]; il était de [%3].
+
+
+ranks_rankCommands__rank_already_exists=&3Le rang nommé &7%1 &3existe déjà . Essaye de mettre un nom différent.
+ranks_rankCommands__rank_name_required=&3Un nom de rang est requis et ne peut pas contenir des codes de mise en forme.
+ranks_rankCommands__ladder_does_not_exist=&3Un classement du nom '&7%1&3' n'existe pas.
+ranks_rankCommands__ladder_has_no_ranks=&3Le classement '&7%1&3' ne contient aucun rang.
+ranks_rankCommands__ladder_has_no_ranks_text=&3--- Ce classement n'a aucun rang ---
+ranks_rankCommands__rank_does_not_exist=&3Le rang '&7%1&3' n'existe pas.
+ranks_rankCommands__rank_cannot_be_created=&3Le rang n'a pas pu être créé.
+ranks_rankCommands__rank_created_successfully=&3Le nouveau rang, '&7%1&3', a été créé dans le classement '&7%2&3', utilisant la tag value '&7%3&3'
+ranks_rankCommands__error_saving_ladder=&3Le classement '&7%1&3' n'a pas pu être sauvegardé sur le disque. Consulte la console pour plus de détails.
+ranks_rankCommands__error_writting_ladder=&3Le classement '&7%1&3' n'a pas pu être sauvegardé sur le disque. Consulte la console pour plus de détails.
+
+
+ranks_rankCommands__auto_config_preexisting_warning=&3Tu essayes d'exécuter la commande &7/ranks autoConfigure&3 avec des mines et des rangs déjà configurés. Nombre de rangs = &7%1&3. Nombre de mines = &7%2&3. Exécute cette commande avec le mot-clé &7help&3 pour plus d'informations et d'autres options de customisation: &7/ranks autoConfigure help&3. C'est mieux d'exécuter cette commande depuis la &7console&3 en raison de la quantité de données générées. Ajoute l'option '&7force&3' pour forcer l'exécution du processus. S'il y a un conflit avec un rang ou une mine qui existe déjà , ce processus va alors essayer de faire de son mieux pour fusionner les deux, néanmoins il y a un risque que ça ne se passe pas correctement. Lors de la fusion, tous les blocs seront replacés mais, dans la console, la liste des blocs originaux seront affichés si jamais tu souhaites les recréer. Pense à sauvegarder le répertoire &7plugins/Prison/&3 avant d'exécuter la commande pour plus de sécurité.
+ranks_rankCommands__auto_config_force_warning=&aAttention ! &3Exécution de l'autoConfigure avec l'option &7forcé&3 activée. Nous ne sommes pas responsables si les mines ou les rangs rentrent en collision.
+ranks_rankCommands__auto_config_invalid_options=&3Options invaldes. Utilise %1&3. C'était: &3%2
+ranks_rankCommands__auto_config_skip_rank_warning=&aAttention ! &3Le rang &7%1 &3existe déjà et ignorée en même temps que la génération de la mine si elle est activée, ainsi que toutes les autres fonctionnalités.
+
+ranks_rankCommands__auto_config_no_ranks_created=Ranks autoConfigure: Aucun rang n'a été créé.
+ranks_rankCommands__auto_config_ranks_created=Ranks autoConfigure: %1 rangs ont été créés.
+ranks_rankCommands__auto_config_no_rank_cmds_created=Ranks autoConfigure: Aucune commande de rang n'a été créée.
+ranks_rankCommands__auto_config_ladder_rank_cost_multiplier_info=Le classement 'prestiges' a été activé pour appliquer un multiplicateur de base du coût du rang de %1 qui sera appliqué pour tous les coûts de rangs. Ce multiplicateur sera augmenté par chaque rang sur le classement.
+ranks_rankCommands__auto_config_ladder_rank_cost_multiplier_command_example=Le multiplicateur de base du coût du rang peut être ajusté, ou désactiver, avec la commande: '/ranks ladder rankCostMultiplier
+ranks_rankCommands__auto_config_rank_cmds_created=Ranks autoConfigure: %1 commandes de rang ont été créées.
+
+ranks_rankCommands__auto_config_no_mines_created=Ranks autoConfigure: Aucune mine n'a été créée.
+ranks_rankCommands__auto_config_mines_created=Ranks autoConfigure: %1 mines ont été créées.
+
+ranks_rankCommands__auto_config_no_linkage=Ranks autoConfigure: Aucune mine et aucun rang n'ont été liés.
+ranks_rankCommands__auto_config_linkage_count=Ranks autoConfigure: %1 rangs et mines ont été liés.
+
+
+ranks_rankCommands__rank_cannot_remove=Tu ne peux pas supprimer ce rang car c'est le seul dans le classement par défaut.
+ranks_rankCommands__rank_was_removed=Le rang '%1' a bien été supprimé.
+ranks_rankCommands__rank_delete_error=Le rang '%1' n'a pas pu être supprimé suite à une erreur.
+
+
+ranks_rankCommands__ranks_list_header=&3Rangs dans le classement &7%1
+ranks_rankCommands__ranks_list_ladder_cost_multplier=&3 Multiplicateur du coût du rang du classement par rang : &7%1
+ranks_rankCommands__ranks_list_ladder_apply_ranks_cost_multplier=&3 Appliquer un multiplicateur global du coût du rang à ce rang ? &7%1
+ranks_rankCommands__ranks_list_ladder_edit_cost_multplier=Modifiez le multiplicateur du coût du rang de ce classement.
+
+ranks_rankCommands__ranks_list_click_to_edit=&7Clique sur le nom d'un rang pour voir plus d'informations.
+ranks_rankCommands__ranks_list_command_count= &cCmds: &3%1
+ranks_rankCommands__ranks_list_currency= &3Monnaie: &2%1
+ranks_rankCommands__ranks_list_click_to_view=&7Clique pour voir les informations.
+ranks_rankCommands__ranks_list_click_to_view2=&7Clique pour voir.
+ranks_rankCommands__ranks_list_create_new_rank=&7Créer un nouveau rang.
+ranks_rankCommands__ranks_list_you_may_try=&8Tu peux également essayer
+
+
+
+ranks_rankCommands__ranks_info_header=Rang %1
+ranks_rankCommands__ranks_info_name=&3Nom de Rang: &7%1
+ranks_rankCommands__ranks_info_tag=&3Tag de rang: &7%1 &3Raw: &7\Q%2\E
+ranks_rankCommands__ranks_info_ladder=&3LClassement: &7%1
+ranks_rankCommands__ranks_info_not_linked_to_mines=&3Ce rang n'a été lié à aucune mine.
+ranks_rankCommands__ranks_info_linked_mines=&3Mines liées à ce rang: %1
+ranks_rankCommands__ranks_info_cost=&3Coût: &7$%1
+ranks_rankCommands__ranks_info_currency=&3Monnaie: &7<&a%1&7>
+ranks_rankCommands__ranks_info_players_with_rank=&7Joueurs avec ce rang: %1
+ranks_rankCommands__ranks_info_rank_id=&6ID de rang: &7%1
+ranks_rankCommands__ranks_info_rank_delete_message=&7[&c-&7] Supprimer
+ranks_rankCommands__ranks_info_rank_delete_tool_tip=&7Clique pour supprimer ce rang.\n&cCette action ne peut être annulée.
+
+
+ranks_rankCommands__rank_set_cost_success=Le coût du rang '%1' a bien été fixé à %2
+
+
+ranks_rankCommands__set_currency_not_specified=Un nom de monnaie doit être spécifié, ou doit être 'none'. '%1' est invalide.
+ranks_rankCommands__set_currency_no_currency_to_clear=Le rang '%1' n'a pas de monnaie, elle ne peut donc pas être retirée.
+ranks_rankCommands__set_currency_cleared=La monnaie du rang '%1' a bien été retirée. Ce rang n'a plus de monnaie custom.
+ranks_rankCommands__set_currency_no_active_support=Aucune économie active ne supporte la monnaie nommée '%1'.
+ranks_rankCommands__set_currency_successful=La monnaie du rang '%1' a bien été définie avec succès à %2
+
+
+ranks_rankCommands__set_tag_invalid=&cLe nom de tag doit être une valeur valide. Pour supprimer, utilise la valeur &anone&c.
+ranks_rankCommands__set_tag_no_change=&cLe nouveau nom de tag est le même que celui actuel. Aucun changement n'a été fait.
+ranks_rankCommands__set_tag_cleared=&cLe nom de tag a été retiré pour le rang %1.
+ranks_rankCommands__set_tag_success=&cLe nom de tag a été changé à %1 pour le rang %2.
+
+
+ranks_rankCommands__player_must_be_online=&3Tu dois être un joueur en jeu pour exécuter cette commande, et/ou le joueur doit être en ligne.
+ranks_rankCommands__player_ladder_info=&7Classement: &b%1 &7Rang actuel: &b%2
+ranks_rankCommands__player_ladder_highest_rank= C'est le rang le plus élevé !
+ranks_rankCommands__player_ladder_next_rank=&7 Prochain rang: &b%1&7 &c$&b%2
+ranks_rankCommands__player_ladder_next_rank_currency=&7 Monnaie: &2%1
+ranks_rankCommands__player_balance_default=&7Le solde actuel de &b%1 &7est de &b%2
+ranks_rankCommands__player_balance_others=&7Le solde actuel de &b%1 &7est de &b%2 &2%3
+ranks_rankCommands__player_perms_offline=&7 REmarque: &3Le joueur est hors-ligne, les permissions ne sont donc pas disponibles ni exactes.
+ranks_rankCommands__player_sellall_multiplier=&7 Multiplicateur Sellall: &b%1 %2
+ranks_rankCommands__player_not_accurate=&5(&2Imprécis&5)
+ranks_rankCommands__player_admin_only=&8[Admin Uniquement]
+ranks_rankCommands__player_past_names=&7Pseudos précédents du joueur et date de changement:
+ranks_rankCommands__player_perms=&7Perms joueur:
+ranks_rankCommands__player_op=&cOP
+ranks_rankCommands__player_player=&3Joueur
+ranks_rankCommands__player_online=&3En ligne
+ranks_rankCommands__player_offline=&3Hors-ligne
+ranks_rankCommands__player_prison_offline_player=&3PrisonOfflinePlayer
+ranks_rankCommands__player_prison_player=&3PrisonPlayer
+ranks_rankCommands__player_no_ranks_found=&3Aucun rang trouvé pour &c%1
+
+
+ranks_rankCommands__players_invalid_ladder=Le classement '%1' n'existe pas, ou n'est pas 'ALL'.
+ranks_rankCommands__players_invalid_action=L'action '%1' est invalide. [players, all, full]
+
+
+ranks_rankCommands__topn_forced_reload_successful=topN forced reload was successful.
+ranks_rankCommands__topn_forced_reload_failure=topN forced reload failed.
+ranks_rankCommands__topn_debug_saved_success=topN debug mode: all topN data saved to Prison/data_storage/prisonTopN.json and reloaded for performance stats.
diff --git a/prison-core/src/main/resources/lang/ranks/pt_PT.properties b/prison-core/src/main/resources/lang/ranks/pt_PT.properties
index baa641ee2..9210d41b4 100644
--- a/prison-core/src/main/resources/lang/ranks/pt_PT.properties
+++ b/prison-core/src/main/resources/lang/ranks/pt_PT.properties
@@ -50,7 +50,7 @@
##
-messages__version=5
+messages__version=6
messages__auto_refresh=true
ranks_rankup__rankup_no_player_name=Tu têns
@@ -339,3 +339,8 @@ ranks_rankCommands__player_no_ranks_found=&3Nenhun rank encontrado para &c%1
ranks_rankCommands__players_invalid_ladder=The ladder '%1' doesn't exist, or was not 'ALL'.
ranks_rankCommands__players_invalid_action=The action '%1' is invalid. [players, all, full]
+
+ranks_rankCommands__topn_forced_reload_successful=topN forced reload was successful.
+ranks_rankCommands__topn_forced_reload_failure=topN forced reload failed.
+ranks_rankCommands__topn_debug_saved_success=topN debug mode: all topN data saved to Prison/data_storage/prisonTopN.json and reloaded for performance stats.
+
diff --git a/prison-core/src/main/resources/lang/ranks/zh-CN.properties b/prison-core/src/main/resources/lang/ranks/zh-CN.properties
index ee73dd57d..0bdc603b6 100644
--- a/prison-core/src/main/resources/lang/ranks/zh-CN.properties
+++ b/prison-core/src/main/resources/lang/ranks/zh-CN.properties
@@ -50,7 +50,7 @@
##
-messages__version=24
+messages__version=25
messages__auto_refresh=true
ranks_rankup__rankup_no_player_name=ä½ å·²ç»
@@ -329,3 +329,8 @@ ranks_rankCommands__player_no_ranks_found=&3未找到&c%1的阶级
ranks_rankCommands__players_invalid_ladder=阶级“%1â€ä¸å˜åœ¨ï¼Œæˆ–ä¸æ˜¯â€œå…¨éƒ¨â€
ranks_rankCommands__players_invalid_action=æ“作“%1â€æ— 效,[玩家,全部,全部]
+
+ranks_rankCommands__topn_forced_reload_successful=topN forced reload was successful.
+ranks_rankCommands__topn_forced_reload_failure=topN forced reload failed.
+ranks_rankCommands__topn_debug_saved_success=topN debug mode: all topN data saved to Prison/data_storage/prisonTopN.json and reloaded for performance stats.
+
diff --git a/prison-core/src/main/resources/lang/ranks/zh_TW.properties b/prison-core/src/main/resources/lang/ranks/zh_TW.properties
index 9e76d8333..a503b64b9 100644
--- a/prison-core/src/main/resources/lang/ranks/zh_TW.properties
+++ b/prison-core/src/main/resources/lang/ranks/zh_TW.properties
@@ -50,7 +50,7 @@
##
-messages__version=8
+messages__version=9
messages__auto_refresh=true
ranks_rankup__rankup_no_player_name=您已經
@@ -342,3 +342,8 @@ ranks_rankCommands__player_no_ranks_found=&3沒有找到階級 &c%1
ranks_rankCommands__players_invalid_ladder=階 '%1' ä¸å˜åœ¨, 或ä¸æ˜¯ 'ALL'.
ranks_rankCommands__players_invalid_action=æ“作 '%1' 無效. [players, all, full]
+
+ranks_rankCommands__topn_forced_reload_successful=topN forced reload was successful.
+ranks_rankCommands__topn_forced_reload_failure=topN forced reload failed.
+ranks_rankCommands__topn_debug_saved_success=topN debug mode: all topN data saved to Prison/data_storage/prisonTopN.json and reloaded for performance stats.
+
diff --git a/prison-core/src/main/resources/lang/sellall/en_US.properties b/prison-core/src/main/resources/lang/sellall/en_US.properties
index bf07f4ee0..916f8cfb4 100644
--- a/prison-core/src/main/resources/lang/sellall/en_US.properties
+++ b/prison-core/src/main/resources/lang/sellall/en_US.properties
@@ -49,7 +49,7 @@
## /prison support submit.
##
-messages__version=1
+messages__version=2
messages__auto_refresh=true
@@ -64,4 +64,5 @@ sellall_spigot_utils__shop_is_empty=&3Sorry, this sellall shop is empty.
sellall_spigot_utils__you_have_nothing_to_sell=&3Sorry, you have nothing to sell.
sellall_spigot_utils__sellall_is_disabled=&3Sorry, sellall is disabled..
+sellall_spigot_utils__sellall_gui_is_disabled=&3Sorry, the sellall GUI is disabled..
diff --git a/prison-core/src/main/resources/lang/sellall/fi_FI.properties b/prison-core/src/main/resources/lang/sellall/fi_FI.properties
index 059de9f6b..bc3352c73 100644
--- a/prison-core/src/main/resources/lang/sellall/fi_FI.properties
+++ b/prison-core/src/main/resources/lang/sellall/fi_FI.properties
@@ -49,7 +49,7 @@
## /prison support submit.
##
-messages__version=1
+messages__version=2
messages__auto_refresh=true
@@ -64,4 +64,5 @@ sellall_spigot_utils__shop_is_empty=&3Anteeksi, t
sellall_spigot_utils__you_have_nothing_to_sell=&3Anteeksi, sinulla ei ole myytävää.
sellall_spigot_utils__sellall_is_disabled=&3Anteeksi, sellall on disabloitu
+sellall_spigot_utils__sellall_gui_is_disabled=&3Sorry, the sellall GUI is disabled..
diff --git a/prison-core/src/main/resources/lang/sellall/fr_FR.properties b/prison-core/src/main/resources/lang/sellall/fr_FR.properties
new file mode 100644
index 000000000..10d609a7a
--- /dev/null
+++ b/prison-core/src/main/resources/lang/sellall/fr_FR.properties
@@ -0,0 +1,68 @@
+# NOTE: A messages__version is an arbitrary integer that will be manually incremented within Prison
+# when there are changes to these messages. This value represents when message content is
+# changed, fixed, or added to. This value may not be increased if the change is very small and
+# insignificant, such as a space or a couple of letters.
+#
+# messages__auto_refresh=true indicates that this file will automatically be replaced if
+# Prison detects a messages__version difference. The old file will be deleted (renamed) and
+# a new copy will be placed in the directory to be used. If this value is set to false, then
+# Prison will not refresh this file and there could be issues with the display of other messages.
+# If auto refresh is set to false, we are not held responsible for possible issues that can
+# arise from inaccurate messages. If set to false, then you are responsible for maintaining
+# the messages on your own.
+#
+# If you make changes to this file, and you have messages__auto_refresh=false, then those
+# changes will be replaced when this file is updated. Since the old file is renamed, and
+# not deleted, you can manually merge your changes back in to the new update. The old
+# renamed files will never be deleted by prison; you can remove them when you feel like it
+# is safe to do so.
+#
+# Please consider helping Prison, and everyone else who may use Prison, by contributing all
+# translations to other languages. They should be faithful translations, and not something
+# for the sake of humor or changes just for cosmetic styling. If you have something you would
+# like to share, please contact a staff member on our Discord server.
+#Thanks for your contributions!
+#
+
+##
+## Prison Supports Unicode (UTF-8) encoding in these properties files. BUt you must
+## follow these instructions to ensure everything works properly.
+##
+## 1. You should only edit these files using a UTF-8 editor. On windows use NotePad, not WordPad.
+## WordPad will save as plain text. To confirm the save was successful: save, close the editor,
+## then reopen to confirm the encoding was preserved.
+##
+## 2. When running on Windows, you must enable utf-8 encoding in minecraft's console. Windows
+## defaults to a characterpage 1252. To enable window's use of utf-8, you need to change the
+## encoding prior to launching spigot/paper:
+## chcp 65001
+##
+## Full example of a windows script, which hooks for java debugging:
+## rem Note: chcp 65001 enables utf-8 in windows, when normally windows uses characterpage 1252
+## chcp 65001
+## java -Dfile.encoding="UTF-8" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -Xms1g -Xmx4g -jar spigot-1.8.8.jar nogui --log-strip-color
+## pause
+##
+## 3. When viewing the logs/latest.log files you must use an editor such as NotePad instead of WordPad.
+##
+## 4. Unicode is properly displayed in game, in console, in the logs, and with paste.helpch.at when using
+## /prison support submit.
+##
+
+messages__version=2
+messages__auto_refresh=true
+
+
+sellall_function__message=&dExemple de &7Message
+
+
+
+sellall_spigot_utils__money_earned=&3Tu as gagné &a$%1
+sellall_spigot_utils__only_sellall_signs_are_enabled=&3Tu ne peux vendre que par les panneaux. La commande est désactivée.
+sellall_spigot_utils__rate_limit_exceeded=&3Ralenti un peu, la limite du taux d'utilisation a été dépassée.
+sellall_spigot_utils__shop_is_empty=&3Désolé, ce shop sellall est vide.
+sellall_spigot_utils__you_have_nothing_to_sell=&3Désolé, tu n'as rien à vendre.
+
+sellall_spigot_utils__sellall_is_disabled=&3Désolé, le sellall est désactivé...
+sellall_spigot_utils__sellall_gui_is_disabled=&3Sorry, the sellall GUI is disabled..
+
diff --git a/prison-core/src/main/resources/lang/sellall/pt_PT.properties b/prison-core/src/main/resources/lang/sellall/pt_PT.properties
index 56d723001..5fa3d2a7e 100644
--- a/prison-core/src/main/resources/lang/sellall/pt_PT.properties
+++ b/prison-core/src/main/resources/lang/sellall/pt_PT.properties
@@ -49,7 +49,7 @@
## /prison support submit.
##
-messages__version=1
+messages__version=2
messages__auto_refresh=true
@@ -64,4 +64,5 @@ sellall_spigot_utils__shop_is_empty=&3Desculpa, esta loja de sellall está vazia
sellall_spigot_utils__you_have_nothing_to_sell=&3Desculpa, não tens nada para vender.
sellall_spigot_utils__sellall_is_disabled=&3Desculpa, sellall está desativado..
+sellall_spigot_utils__sellall_gui_is_disabled=&3Sorry, the sellall GUI is disabled..
diff --git a/prison-core/src/main/resources/lang/sellall/zh_CN.properties b/prison-core/src/main/resources/lang/sellall/zh_CN.properties
index 1034dec30..eb9e536b4 100644
--- a/prison-core/src/main/resources/lang/sellall/zh_CN.properties
+++ b/prison-core/src/main/resources/lang/sellall/zh_CN.properties
@@ -49,7 +49,7 @@
## /prison support submit.
##
-messages__version=1
+messages__version=2
messages__auto_refresh=true
@@ -64,4 +64,5 @@ sellall_spigot_utils__shop_is_empty=&3抱æ‰ï¼Œä½†è¿™ä¸ªå‡ºå”®å•†åº—是空的
sellall_spigot_utils__you_have_nothing_to_sell=&3ä½ æ²¡æœ‰ä»€ä¹ˆå¯å–çš„
sellall_spigot_utils__sellall_is_disabled=&3sellallå·²ç¦ç”¨
+sellall_spigot_utils__sellall_gui_is_disabled=&3Sorry, the sellall GUI is disabled..
diff --git a/prison-core/src/main/resources/lang/spigot/fr_FR.properties b/prison-core/src/main/resources/lang/spigot/fr_FR.properties
new file mode 100644
index 000000000..3386e0a61
--- /dev/null
+++ b/prison-core/src/main/resources/lang/spigot/fr_FR.properties
@@ -0,0 +1,321 @@
+# NOTE: A messages__version is an arbitrary integer that will be manually incremented within Prison
+# when there are changes to these messages. This value represents when message content is
+# changed, fixed, or added to. This value may not be increased if the change is very small and
+# insignificant, such as a space or a couple of letters.
+#
+# messages__auto_refresh=true indicates that this file will automatically be replaced if
+# Prison detects a messages__version difference. The old file will be deleted (renamed) and
+# a new copy will be placed in the directory to be used. If this value is set to false, then
+# Prison will not refresh this file and there could be issues with the display of other messages.
+# If auto refresh is set to false, we are not held responsible for possible issues that can
+# arise from inaccurate messages. If set to false, then you are responsible for maintaining
+# the messages on your own.
+#
+# If you make changes to this file, and you have messages__auto_refresh=false, then those
+# changes will be replaced when this file is updated. Since the old file is renamed, and
+# not deleted, you can manually merge your changes back in to the new update. The old
+# renamed files will never be deleted by prison; you can remove them when you feel like it
+# is safe to do so.
+#
+# Please consider helping Prison, and everyone else who may use Prison, by contributing all
+# translations to other languages. They should be faithful translations, and not something
+# for the sake of humor or changes just for cosmetic styling. If you have something you would
+# like to share, please contact a staff member on our Discord server.
+#Thanks for your contributions!
+#
+
+##
+## Prison Supports Unicode (UTF-8) encoding in these properties files. BUt you must
+## follow these instructions to ensure everything works properly.
+##
+## 1. You should only edit these files using a UTF-8 editor. On windows use NotePad, not WordPad.
+## WordPad will save as plain text. To confirm the save was successful: save, close the editor,
+## then reopen to confirm the encoding was preserved.
+##
+## 2. When running on Windows, you must enable utf-8 encoding in minecraft's console. Windows
+## defaults to a characterpage 1252. To enable window's use of utf-8, you need to change the
+## encoding prior to launching spigot/paper:
+## chcp 65001
+##
+## Full example of a windows script, which hooks for java debugging:
+## rem Note: chcp 65001 enables utf-8 in windows, when normally windows uses characterpage 1252
+## chcp 65001
+## java -Dfile.encoding="UTF-8" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -Xms1g -Xmx4g -jar spigot-1.8.8.jar nogui --log-strip-color
+## pause
+##
+## 3. When viewing the logs/latest.log files you must use an editor such as NotePad instead of WordPad.
+##
+## 4. Unicode is properly displayed in game, in console, in the logs, and with paste.helpch.at when using
+## /prison support submit.
+##
+
+messages__version=6
+messages__auto_refresh=true
+
+## Click to do something
+spigot_gui_lore_click_to_add=Clique pour ajouter.
+spigot_gui_lore_click_to_add_backpack=Clique pour ajouter au Sac-Ã -dos.
+#spigot_gui_lore_click_to_cancel=Click to cancel.
+#spigot_gui_lore_click_to_close=Click to close.
+#spigot_gui_lore_click_to_confirm=Click to confirm.
+#spigot_gui_lore_click_to_decrease=Click to decrease.
+#spigot_gui_lore_click_to_delete=Click to delete.
+#spigot_gui_lore_click_to_disable=Click to disable.
+#spigot_gui_lore_click_to_edit=Click to edit.
+#spigot_gui_lore_click_to_enable=Click to enable.
+#spigot_gui_lore_click_to_increase=Click to increase.
+spigot_gui_lore_click_to_manage_rank=Clique pour gérer les rangs.
+#spigot_gui_lore_click_to_open=Click to open.
+spigot_gui_lore_click_to_rankup=Clique pour monter de rang.
+spigot_gui_lore_click_to_rename=Clique pour renommer.
+spigot_gui_lore_click_to_select=Clique pour sélectionner.
+spigot_gui_lore_click_to_start_block_setup=Clique pour ajouter un bloc.
+spigot_gui_lore_click_to_teleport=Clique pour te téléporter.
+spigot_gui_lore_click_to_use=Clique pour utiliser.
+
+## Left-Click to do something.
+#spigot_gui_lore_click_left_to_confirm=Left-Click to confirm.
+#spigot_gui_lore_click_left_to_reset=Left-Click to reset.
+#spigot_gui_lore_click_left_to_open=Left-Click to open.
+#spigot_gui_lore_click_left_to_edit=Left-Click to edit.
+
+## Right-Click to do something.
+#spigot_gui_lore_click_right_to_cancel=Right-Click to cancel.
+#spigot_gui_lore_click_right_to_delete=Right-Click to delete.
+#spigot_gui_lore_click_right_to_disable=Right-Click to disable.
+#spigot_gui_lore_click_right_to_enable=Right-Click to enable.
+#spigot_gui_lore_click_right_to_toggle=Right-Click to toggle.
+
+## Shift and Right-Click to do something
+#spigot_gui_lore_click_right_and_shift_to_delete=Shift and Right-Click to delete.
+#spigot_gui_lore_click_right_and_shift_to_disable=Shift and Right-Click to disable.
+#spigot_gui_lore_click_right_and_shift_to_toggle=Shift and Right-Click to toggle.
+
+## Titles or data naming.
+spigot_gui_lore_backpack_id=ID du Sac-Ã -dos:
+spigot_gui_lore_blocks=Blocs:
+spigot_gui_lore_blocktype=Blocktype:
+spigot_gui_lore_chance=Chance:
+spigot_gui_lore_command=Commande:
+spigot_gui_lore_currency=Monnaie:
+#spigot_gui_lore_delay=Delay:
+spigot_gui_lore_id=ID:
+spigot_gui_lore_info=Info:
+spigot_gui_lore_minename=Nom de mine:
+#spigot_gui_lore_multiplier=Multiplier:
+spigot_gui_lore_name=Nom:
+spigot_gui_lore_owner=Propriétaire:
+spigot_gui_lore_percentage=Pourcentage:
+#spigot_gui_lore_permission=Permission:
+spigot_gui_lore_players_at_rank=Joueurs à ce rang:
+#spigot_gui_lore_prestige_name=Prestige name:
+#spigot_gui_lore_price=Price:
+spigot_gui_lore_radius=Rayon:
+spigot_gui_lore_rank_tag=Tag de rang:
+spigot_gui_lore_reset_time=Temps de réinitialisation:
+spigot_gui_lore_size=Taille:
+spigot_gui_lore_show_item=Afficher l'objet:
+spigot_gui_lore_spawnpoint=Point de spawn:
+spigot_gui_lore_volume=Volume:
+#spigot_gui_lore_value=Value:
+spigot_gui_lore_world=Monde:
+
+## Simple actions or status.
+spigot_gui_lore_disabled=Désactiver.
+spigot_gui_lore_enabled=Activer.
+spigot_gui_lore_locked=Verrouillé !
+#spigot_gui_lore_next_page=Next page.
+#spigot_gui_lore_prior_page=Prior page.
+spigot_gui_lore_rankup=Monter en rang.
+spigot_gui_lore_selected=Sélectionné.
+spigot_gui_lore_unlocked=Déverrouillé !
+
+## Descriptions.
+spigot_gui_lore_add_backpack_instruction_1=Merci d'ajouter au moins un objet
+spigot_gui_lore_add_backpack_instruction_2=Si tu ne le fais pas, le Sac-Ã -dos
+spigot_gui_lore_add_backpack_instruction_3=Ne seras pas sauvegardé
+spigot_gui_lore_prestige_warning_1=Prestige réinitialisera:
+spigot_gui_lore_prestige_warning_2=- Le rang.
+spigot_gui_lore_prestige_warning_3=- Le solde.
+spigot_gui_lore_ranks_setup_1=Il n'y a pas de rangs !
+spigot_gui_lore_ranks_setup_2=Si tu veux continuer la configuration.
+spigot_gui_lore_ranks_setup_3=Tous les rangs et mines de A Ã Z seront fait
+spigot_gui_lore_ranks_setup_4=Avec les &3valeurs par &adefault &3!
+spigot_gui_lore_ranks_setup_5=Tu peux aussi utiliser:
+spigot_gui_lore_ranks_setup_6=/ranks autoConfigure full !
+spigot_gui_lore_ranks_setup_7=Remplace le X par un prix de départ et un multiplicateur
+spigot_gui_lore_ranks_setup_8=Prix par défaut = 50000, multiplicateur = 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=Régler le délai de la mine
+spigot_gui_lore_set_mine_delay_instruction_2=avant sa réinitialisation
+spigot_gui_lore_set_mine_delay_instruction_3=lorsqu'elle atteint zéro bloc.
+spigot_gui_lore_show_item_description_1=Voici l'objet
+spigot_gui_lore_show_item_description_2=affiché dans le GUI du joueur
+spigot_gui_lore_show_item_description_3=ou dans /mines GUI.
+spigot_gui_lore_skip_reset_instruction_1=Ne pas réinitialiser si
+spigot_gui_lore_skip_reset_instruction_2=s'il n'y a pas assez
+spigot_gui_lore_skip_reset_instruction_3=de blocks minés.
+
+## Button names or single line descriptions.
+spigot_gui_lore_autofeatures_button_description=Gérer les AutoFeatures.
+spigot_gui_lore_backpacks_button_description=Gérer les sacs-à -dos.
+spigot_gui_lore_disable_notifications=Désactiver les notifications.
+spigot_gui_lore_enable_radius_mode=Activez le mode Rayon.
+spigot_gui_lore_enable_within_mode=Activer le mode Within.
+spigot_gui_lore_mines_button_description=Gérer les mines.
+spigot_gui_lore_no_multipliers=[!] Il n'y a pas de multiplicateurs !
+spigot_gui_lore_ranks_button_description=GUI de gestion des rangs.
+spigot_gui_lore_rankup_if_enough_money=Si tu as assez d'argent.
+spigot_gui_lore_sellall_button_description=Gérer le SellAll.
+spigot_gui_lore_sellall_edit_info=Modifier la monnaie du SellAll.
+spigot_gui_lore_tp_to_mine=Clique pour te téléporter à la mine.
+
+## Messages
+spigot_message_missing_permission=Désolé, tu n'as pas la permission d'utiliser ça !
+spigot_message_chat_event_time_end=Tu n'as plus de temps, l'événement est annulé !
+spigot_message_event_cancelled=L'événement est annulé.
+spigot_message_command_wrong_format=Désolé, mauvais format de commande.
+spigot_message_console_error=Désolé, tu dois être un joueur pour utiliser ça.
+
+## Ladder Messages
+spigot_message_ladder_default_empty=Désolé, le classement par défaut est vide.
+
+## Mine Messages
+spigot_message_mines_disabled=Désolé, les mines sont désactivées.
+spigot_message_mines_name_chat_1=Écrit la &6Nomdelamine &7que tu aimerais utiliser et &6soumet-le&7.
+spigot_message_mines_name_chat_2=Input &cclose &7to cancel or wait &c30 seconds&7.
+spigot_message_mines_name_chat_cancelled=Le renommage de la mine a été &cfermé&7, rien n'a été changé !
+spigot_message_mines_item_show_edit_success=L'item des mines a été édité avec succès.
+spigot_message_mines_or_gui_disabled=Désolé, les mines ou les GUI sont désactivés.
+
+## Backpack Messages
+spigot_message_backpack_cant_own=Désolé, tu ne peux pas posséder de sacs-à -dos.
+spigot_message_backpack_delete_error=Désolé, tu ne peux pas supprimer le sacs-à -dos.
+spigot_message_backpack_delete_success=Sac-à -dos supprimé avec succès.
+spigot_message_backpack_format_error=Désolé, le format de la commande n'est pas correct, il manque peut-être des arguments
+spigot_message_backpack_limit_decrement_fail=La limite du sac-à -dos ne peut pas être négative.
+spigot_message_backpack_limit_edit_success=La limite du sac-à -dos modifié avec succès.
+spigot_message_backpack_limit_not_number=Désolé, la limite du sac-à -dos n'est pas un nombre.
+spigot_message_backpack_limit_reached=Désolé, tu ne peux pas avoir plus de sacs-à -dos.
+spigot_message_backpack_missing_playername=Désolé, il faut mettre un pseudo de joueur.
+spigot_message_backpack_resize_success=Si le sac-à -dos existe, il a été redimensionné avec succès.
+spigot_message_backpack_size_must_be_multiple_of_9=La taille du sac-à -dos doit être un multiple de 9 et ne pas dépasser 64 !
+
+
+## Prestige Messages
+spigot_message_prestiges_disabled=Désolé, les Prestiges sont désactivés.
+spigot_message_prestiges_empty=Désolé, il n'y a pas de Prestiges.
+spigot_message_prestiges_or_gui_disabled=Désolé, les Prestiges ou les GUIs sont désactivés.
+spigot_message_prestiges_confirm=Confirme&7: Tape le mot &aconfirm&7 pour confirmer.
+spigot_message_prestiges_cancel=Annuler&7: Tape le mot &ccancel&7 pour annuler, &ctu as 30 secondes.
+spigot_message_prestiges_cancelled=Prestige annulé.
+spigot_message_prestiges_cancelled_wrong_keyword=Prestige &cannulé&7, tu n'as pas écrit: &aconfirm&7.
+
+## Ranks Messages
+spigot_message_ranks_disabled=Désolé, les rangs sont désactivés.
+spigot_message_ranks_or_gui_disabled=Désolé, les rangs ou les GUIs sont désactivés.
+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=Tapez &cclose &7pour annuler ou attendez &c30 secondes&7.
+spigot_message_ranks_tag_chat_cancelled=Le renommage du tag a été &cfermé&7, rien n'a changé !
+
+## SellAll Messages
+spigot_message_sellall_auto_already_enabled=L'AutoSell est déjà activé.
+spigot_message_sellall_auto_already_disabled=L'AutoSell est déjà désactivé.
+spigot_message_sellall_auto_disabled=L'AutoSell a été désactivé avec succès.
+spigot_message_sellall_auto_disabled_cant_use=Désolé, vous devez activer l'AutoSell pour l'utiliser.
+spigot_message_sellall_auto_enabled=L'AutoSell a été activé avec succès
+spigot_message_sellall_auto_perusertoggleable_enabled=perUserToggleable AutoSell activé avec succès.
+spigot_message_sellall_auto_perusertoggleable_disabled=perUserToggleable AutoSell désactivé avec succès.
+spigot_message_sellall_auto_perusertoggleable_already_enabled=perUserToggleable AutoSell est déjà activé.
+spigot_message_sellall_auto_perusertoggleable_already_disabled=perUserToggleable AutoSell est déjà désactivé.
+spigot_message_sellall_boolean_input_invalid=La valeur booléenne n'est pas valide (les valeurs valides sont True ou False).
+spigot_message_sellall_cant_find_item_config=Désolé, je ne trouve pas l'item dans la config.
+spigot_message_sellall_currency_chat_1=&3Started setup of new currency for SellAll!
+spigot_message_sellall_currency_chat_2=Tape &ccancel &7pour annuler.
+spigot_message_sellall_currency_chat_3=Tape &3default &7pour définir la monnaie par défaut.
+spigot_message_sellall_currency_chat_4=Tape le &anom de la monnaie &7pour définir la nouvelle monnaie.
+spigot_message_sellall_currency_edit_success=La monnaie du SellAll a été éditée avec succès.
+spigot_message_sellall_currency_not_found=Désolé, la monnaie n'a pas été trouvée.
+spigot_message_sellall_hand_disabled=SellAll Hand désactivé avec succès.
+spigot_message_sellall_hand_enabled=Sellall Hand activé avec succès.
+spigot_message_sellall_hand_is_disabled=SellAll Hand est désactivé.
+spigot_message_sellall_item_add_success=Item ajouté avec succès.
+spigot_message_sellall_item_already_added=Tu as déjà ajouté cet item, utilise la commande edit à la place.
+spigot_message_sellall_item_delete_success=Item a déjà supprimé avec succès.
+spigot_message_sellall_item_edit_success=L'item de SellAll a été modifié avec succès.
+spigot_message_sellall_item_id_not_found=Désolé, nom ou ID de l'item invalide.
+spigot_message_sellall_item_missing_name=Ajoute un nom ou un ID d'item.
+spigot_message_sellall_item_missing_price=Ajoute la valeur de l'item.
+spigot_message_sellall_item_not_found=L'item de SellAll n'a pas été trouvé dans la config.
+spigot_message_sellall_default_values_success=Les valeurs par défaut du SellAll ont été définies avec succès.
+spigot_message_sellall_delay_already_enabled=Le délai SellAll est déjà activé.
+spigot_message_sellall_delay_already_disabled=Le délai SellAll est déjà désactivé.
+spigot_message_sellall_delay_disabled=Le délai SellAll a été désactivé avec succès.
+spigot_message_sellall_delay_disabled_cant_use=Désolé, il faut activer le délai SellAll pour utiliser ça.
+spigot_message_sellall_delay_edit_success=Le délai SellAll a été modifié avec succès.
+spigot_message_sellall_delay_enabled=Le délai SellAll a été activé avec succès.
+spigot_message_sellall_delay_not_number=Le délai SellAll n'est pas un nombre valide.
+#spigot_message_sellall_delay_wait=Sellall delay is enabled, please slow down.
+spigot_message_sellall_gui_disabled=Le GUI SellAll est désactivé.
+#spigot_message_sellall_money_earned=You earned &a$
+spigot_message_sellall_multiplier_add_success=Désolé, le multiplicateur SellAll a été ajouté avec succès.
+spigot_message_sellall_multiplier_are_disabled=Désolé, le multiplicateur SellAll est désactivé.
+spigot_message_sellall_multiplier_cant_find=Désolé, impossible de trouver le multiplicateur SellAll.
+spigot_message_sellall_multiplier_delete_success=Désolé, le multiplicateur SellAll est désactivé..
+spigot_message_sellall_multiplier_disabled=Le multiplicateur SellAll a été désactivé avec succès.
+spigot_message_sellall_multiplier_edit_success=Le multiplicateur SellAll a été modifié avec succès.
+spigot_message_sellall_multiplier_enabled=Le multiplicateur SellAll a été activé avec succès.
+#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=Tu as vendu à travers un panneau avec succès.
+spigot_message_sellall_trigger_already_disabled=Le SellAll Trigger est déjà désactivé.
+spigot_message_sellall_trigger_already_enabled=Le SellAll Trigger est déjà activé.
+spigot_message_sellall_trigger_disabled=Le SellAll Trigger a été désactivé avec succès.
+spigot_message_sellall_trigger_enabled=Le SellAll Trigger a été activé avec succès.
+spigot_message_sellall_trigger_is_disabled=Désolé, le SellAll Trigger est désactivé.
+spigot_message_sellall_trigger_item_add_success=Le SellAll Item Trigger a été ajouté avec succès.
+spigot_message_sellall_trigger_item_cant_find=L'item SellAll Item Trigger n'a pas été trouvé dans la config.
+spigot_message_sellall_trigger_item_delete_success=Le SellAll Item Trigger a été supprimé avec succès.
+spigot_message_sellall_trigger_item_missing=Veuillez ajouter le nom/l'ID de l'item à la commande.
+
+## GUI Messages
+spigot_message_gui_backpack_disabled=Impossible d'ouvrir le GUI, les sacs-à -dos sont désactivés.
+spigot_message_gui_backpack_empty=Désolé, il n'y a pas de sac-à -dos à montrer.
+spigot_message_gui_backpack_too_many=Désolé, il y a trop de classements et le GUI ne peut pas les montrer. Sorry, there are too many Backpacks and the GUI can't show them.
+spigot_message_gui_close_success=Le GUI s'est fermé avec succès.
+spigot_message_gui_error=Impossible d'ouvrir le GUI, il est désactivé ou il y a une erreur.
+spigot_message_gui_error_empty=Impossible d'ouvrir le GUI, il est vide.
+spigot_message_gui_ladder_empty=Désolé, il n'y a pas de classement à montrer.[%1]
+spigot_message_gui_ladder_too_many=Désolé, il y a trop de classements et le GUI ne peut pas les montrer.
+spigot_message_gui_mines_empty=Désolé, il n'y a pas de mines à montrer.
+spigot_message_gui_mines_too_many=Désolé, il y a trop de mines et le GUI ne peut pas les montrer.
+spigot_message_gui_prestiges_empty=Désolé, il n'y a pas de Prestiges à montrer.
+spigot_message_gui_prestiges_too_many=Désolé, il y a trop de Prestiges et le GUI ne peut pas les montrer.
+spigot_message_gui_ranks_empty=Désolé, il n'y a pas de rangs dans ce classement à montrer.
+spigot_message_gui_ranks_rankup_commands_empty=Désolé, il n'y a pas de commandes de Rankup à montrer.
+spigot_message_gui_ranks_rankup_commands_too_many=Désolé, il y a trop de commandes de Rankup et le GUI ne peut pas les montrer.
+spigot_message_gui_ranks_too_many=Désolé, il y a trop de rangs et le GUI ne peut pas les afficher.
+spigot_message_gui_reload_success=Les GUI ont été rechargés avec succès !
+#spigot_message_gui_sellall_disabled=Sorry, SellAll is disabled.
+spigot_message_gui_sellall_empty=Désolé, il n'y a rien à voir.
+spigot_message_gui_too_high=Désolé, mais la valeur est trop haute (supérieure au maximum possible).
+spigot_message_gui_too_low_value=Désolé, mais la valeur est trop faible (inférieure au minimum possible).
+
+
+
+
+spigot_blockbreak_mines__mine_is_being_reset__please_wait=La mine %1 est en cours de réinitialisation... Attends un peu.
+
+spigot_blockbreak_core__validate_event__your_tool_is_worn_out=&cTon outil est usé et ne peut plus être utilisé.
+
+spigot_auto_manager__inventory_is_full=&cATTENTION ! Ton inventaire est rempli !
+spigot_auto_manager__is_full_dropping_item__ignore__not_useds=&cATTENTION ! Ton inventaire est rempli et tu drops des items !
+spigot_auto_manager__inventory_is_full_losing_items=&cATTENTION ! Ton inventaire est rempli et tu perds des items !
+
+
+
+spigot_minebombs__cooldown_delay=Tu ne peux pas réutiliser une autre Bombe Prison Mine pendant encore %1 secondes.
+
+
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 31b0a4b7b..6875c4201 100644
--- a/prison-core/src/test/java/tech/mcprison/prison/TestPlatform.java
+++ b/prison-core/src/test/java/tech/mcprison/prison/TestPlatform.java
@@ -523,4 +523,14 @@ public RankLadder getRankLadder(String ladderName) {
public List getPlayerOldBackpacks( Player player ) {
return null;
}
+
+ @Override
+ public int getMinY() {
+ return 0;
+ }
+
+ @Override
+ public int getMaxY() {
+ return 255;
+ }
}
diff --git a/prison-core/src/test/java/tech/mcprison/prison/TestPlayer.java b/prison-core/src/test/java/tech/mcprison/prison/TestPlayer.java
index 97a85d83f..7ef2a4d27 100644
--- a/prison-core/src/test/java/tech/mcprison/prison/TestPlayer.java
+++ b/prison-core/src/test/java/tech/mcprison/prison/TestPlayer.java
@@ -236,4 +236,20 @@ public boolean isSneaking() {
return false;
}
+ @Override
+ public boolean isMinecraftStatisticsEnabled() {
+ return false;
+ }
+
+
+ @Override
+ public void incrementMinecraftStatsMineBlock( Player player, String blockName, int quantity) {
+
+ }
+
+ @Override
+ public void incrementMinecraftStatsDropCount( Player player, String blockName, int quantity) {
+
+ }
+
}
diff --git a/prison-mines/src/main/java/tech/mcprison/prison/mines/data/Mine.java b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/Mine.java
index 9faf1bcda..316f3639f 100644
--- a/prison-mines/src/main/java/tech/mcprison/prison/mines/data/Mine.java
+++ b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/Mine.java
@@ -560,7 +560,19 @@ else if ( validateBlockNames.contains( prisonBlock.getBlockName() ) ) {
List mineBlockEvents = (List) document.get("mineBlockEvents");
if ( mineBlockEvents != null ) {
for ( String blockEvent : mineBlockEvents ) {
- getBlockEvents().add( MineBlockEvent.fromSaveString( blockEvent, this.getName() ) );
+ if ( blockEvent != null ) {
+
+ MineBlockEvent bEvent = MineBlockEvent.fromSaveString( blockEvent, this.getName() );
+
+ if ( bEvent != null ) {
+
+ getBlockEvents().add( bEvent );
+ }
+ else {
+ Output.get().logInfo( "Notice: Mine: " + getName() + ": Error trying to parse a blockEvent. "
+ + "BlockEvent is lost: raw BlockEvent= [" + blockEvent + "]" );
+ }
+ }
}
}
diff --git a/prison-mines/src/main/java/tech/mcprison/prison/mines/features/MineBlockEvent.java b/prison-mines/src/main/java/tech/mcprison/prison/mines/features/MineBlockEvent.java
index cf07a7670..7873665d8 100644
--- a/prison-mines/src/main/java/tech/mcprison/prison/mines/features/MineBlockEvent.java
+++ b/prison-mines/src/main/java/tech/mcprison/prison/mines/features/MineBlockEvent.java
@@ -15,6 +15,8 @@
import tech.mcprison.prison.tasks.PrisonCommandTaskData.TaskMode;
public class MineBlockEvent {
+
+ public static final String ENCODED_PIPE = "$pipe$";
private double chance;
private String permission;
@@ -160,10 +162,12 @@ public String toSaveString() {
// DecimalFormat dFmt = Prison.get().getDecimalFormat("0.00000");
+ String cmd = getCommand().replace( "|", ENCODED_PIPE );
+
return nFmt.format( getChance() ) + "|" +
(getPermission() == null || getPermission().trim().length() == 0 ?
"none" : getPermission()) + "|" +
- getCommand() + "|" + getTaskMode().name() + "|" + getEventType().name() + "|" +
+ cmd + "|" + getTaskMode().name() + "|" + getEventType().name() + "|" +
(getTriggered() == null ? "none" : getTriggered()) + "|" +
getPrisonBlockStrings( "," );
}
@@ -251,6 +255,9 @@ private static MineBlockEvent fromStringV1( String chancePermCommand, String min
}
String command = cpc.length >= 3 ? cpc[2] : "";
+ if ( command.contains( ENCODED_PIPE ) ) {
+ command = command.replace( ENCODED_PIPE, "|" );
+ }
String mode = cpc.length >= 4 ? cpc[3] : "inline";
TaskMode taskMode = TaskMode.fromString( mode ); // defaults to inline
diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/PrisonRanks.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/PrisonRanks.java
index 9b585574a..c42474100 100644
--- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/PrisonRanks.java
+++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/PrisonRanks.java
@@ -36,10 +36,12 @@
import tech.mcprison.prison.ranks.commands.LadderCommands;
import tech.mcprison.prison.ranks.commands.RankUpCommand;
import tech.mcprison.prison.ranks.commands.RanksCommands;
+import tech.mcprison.prison.ranks.data.PlayerRank;
import tech.mcprison.prison.ranks.data.Rank;
import tech.mcprison.prison.ranks.data.RankLadder;
import tech.mcprison.prison.ranks.data.RankPlayer;
import tech.mcprison.prison.ranks.data.RankPlayerFactory;
+import tech.mcprison.prison.ranks.data.TopNPlayers;
import tech.mcprison.prison.ranks.managers.LadderManager;
import tech.mcprison.prison.ranks.managers.PlayerManager;
import tech.mcprison.prison.ranks.managers.RankManager;
@@ -199,6 +201,7 @@ public void enable() {
// Hook up all players to the ranks:
+ // - parameter checkPlayerBalances is set to false
playerManager.connectPlayersToRanks( false );
Output.get().logInfo( "Ranks: Finished Connecting Players to Ranks." );
@@ -227,7 +230,7 @@ public void enable() {
- // Load up all else
+ // Load up everything else
new FirstJoinHandler();
new ChatHandler();
@@ -260,7 +263,9 @@ public void enable() {
// Start up the TopNPlayer's collections after all players have been loaded:
// NOTE: getting the instance of TopNPlayers must be done "after" player validation.
// So that thread needs to initiate it after done validating and fixing all players.
-// TopNPlayers.getInstance();
+ // NOTE: Issue: player validation may take a long time, or could be disabled. So
+ // load topNPlayers now, and then refresh after validation.
+ TopNPlayers.getInstance();
// Check all players to see if any need to join:
@@ -274,85 +279,104 @@ public void enable() {
public void checkAllPlayersForJoin()
{
- RankUpCommand rankupCommands = rankManager.getRankupCommands();
+ boolean addNewPlayers =
+ Prison.get().getPlatform().getConfigBooleanTrue(
+ "ranks.startup.add-new-players-on-startup" ) ||
+ Prison.get().getPlatform().getConfigBooleanFalse(
+ "prison-ranks.startup.add-new-players-on-startup" );
- // If there is a default rank on the default ladder, then
- // check to see if there are any players not in prison: add them:
- RankLadder defaultLadder = getLadderManager().getLadder( LadderManager.LADDER_DEFAULT );
- if ( defaultLadder != null && defaultLadder.getRanks().size() > 0 ) {
- int addedPlayers = 0;
- int fixedPlayers = 0;
-
- for ( Player player : Prison.get().getPlatform().getOfflinePlayers() ) {
-
- // getPlayer() will add a player who does not exist:
- RankPlayer rPlayer = playerManager.getPlayer( player );
- if ( rPlayer != null ) {
- if ( rPlayer.checkName( player.getName() ) ) {
- playerManager.savePlayer( rPlayer );
- addedPlayers++;
- }
- }
- }
-
-
- RankPlayerFactory rankPlayerFactory = new RankPlayerFactory();
-
- // If any player does not have a rank on the default ladder, then add the default
- // ladder and rank:
- Rank defaultRank = defaultLadder.getLowestRank().get();
-
- if ( defaultRank == null ) {
- Output.get().logInfo(
- "PrisonRanks.checkAllPlayersForJoin: Warning: No default rank exists, so bypassing " +
- "the player checks. There may be players online without a rank which could " +
- "cause problems. Create a default rank and then restart the server to validate and " +
- "repair all players.");
- return;
- }
-
-
- for ( RankPlayer rPlayer : playerManager.getPlayers() ) {
-
- @SuppressWarnings( "unused" )
- String rp = rPlayer.toString();
+ if ( addNewPlayers ) {
+
+ RankUpCommand rankupCommands = rankManager.getRankupCommands();
+
+ // If there is a default rank on the default ladder, then
+ // check to see if there are any players not in prison: add them:
+ RankLadder defaultLadder = getLadderManager().getLadderDefault();
+// RankLadder defaultLadder = getLadderManager().getLadder( LadderManager.LADDER_DEFAULT );
+
+ if ( defaultLadder != null && defaultLadder.getRanks().size() > 0 ) {
+ int addedPlayers = 0;
+ int fixedPlayers = 0;
+
+ for ( Player player : Prison.get().getPlatform().getOfflinePlayers() ) {
+
+ // getPlayer() will add a player who does not exist:
+ RankPlayer rPlayer = playerManager.getPlayer( player );
+ if ( rPlayer != null ) {
+ if ( rPlayer.checkName( player.getName() ) ) {
+ playerManager.savePlayer( rPlayer );
+ addedPlayers++;
+ }
+ }
+ }
+
- Rank rankOnDefault = null;
-
- if ( rankPlayerFactory.getRank( rPlayer, defaultLadder ) != null ) {
-
- rankOnDefault = rankPlayerFactory.getRank( rPlayer, defaultLadder ).getRank();
-
+ RankPlayerFactory rankPlayerFactory = new RankPlayerFactory();
+
+ // If any player does not have a rank on the default ladder, then add the default
+ // ladder and rank:
+ Rank defaultRank = defaultLadder.getLowestRank().get();
+
+ if ( defaultRank == null ) {
+ Output.get().logInfo(
+ "PrisonRanks.checkAllPlayersForJoin: Warning: No default rank exists, so bypassing " +
+ "the player checks. There may be players online without a rank which could " +
+ "cause problems. Create a default rank and then restart the server to validate and " +
+ "repair all players.");
+ return;
+ }
+
+
+ for ( RankPlayer rPlayer : playerManager.getPlayers() ) {
+
+// @SuppressWarnings( "unused" )
+// String rp = rPlayer.toString();
+
+ Rank rankOnDefault = null;
+
+ PlayerRank pRank = rankPlayerFactory.getRank( rPlayer, defaultLadder );
+
+ if ( pRank != null ) {
+
+ rankOnDefault = pRank.getRank();
+
// Output.get().logInfo( "#### %s ladder = %s isRankNull= %s rank= %s %s [%s]" ,
// rPlayer.getName(),
// defaultLadder.getName(),
// (rankOnDefault == null ? "true" : "false"), (rankOnDefault == null ? "null" : rankOnDefault.getName()),
// (rankOnDefaultStr == null ? "true" : "false"), (rankOnDefaultStr == null ? "null" : rankOnDefaultStr.getName()),
// rp );
-
- }
- if ( rankOnDefault == null ) {
-
- rankupCommands.setPlayerRank( rPlayer, defaultRank );
-
- if ( rankPlayerFactory.getRank( rPlayer, defaultLadder ) != null ) {
-
- String message = prisonRankAddedNewPlayer( rPlayer.getName() );
-
- Output.get().logInfo( message );
- }
-
- fixedPlayers++;
- }
-
+
+ }
+ if ( rankOnDefault == null ) {
+
+ rankupCommands.setPlayerRank( rPlayer, defaultRank );
+
+ if ( rankPlayerFactory.getRank( rPlayer, defaultLadder ) != null ) {
+
+ String message = prisonRankAddedNewPlayer( rPlayer.getName() );
+
+ Output.get().logInfo( message );
+ }
+
+ fixedPlayers++;
+ }
+
+ }
+ if ( addedPlayers > 0 || fixedPlayers > 0 ) {
+
+ Output.get().logInfo( prisonRankAddedAndFixedPlayers( addedPlayers, fixedPlayers ) );
+ }
}
- if ( addedPlayers > 0 || fixedPlayers > 0 ) {
-
- Output.get().logInfo( prisonRankAddedAndFixedPlayers( addedPlayers, fixedPlayers ) );
- }
- }
-
- Output.get().logInfo( "Ranks: Finished First Join Checks." );
+
+ Output.get().logInfo( "Ranks: Finished First Join Checks." );
+ }
+ else {
+
+ Output.get().logInfo( "Ranks: First Join Checks disabled. Enable in 'config.yml' by adding " +
+ "'ranks.startup.add-new-players-on-startup: true'.");
+ }
+
}
diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RankUpCommand.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RankUpCommand.java
index 415f7b93f..71abf642c 100644
--- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RankUpCommand.java
+++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RankUpCommand.java
@@ -64,10 +64,12 @@ public RankUpCommand() {
* /rankup command
*/
- @Command(identifier = "rankupMax",
+ @Command( identifier = "rankupMax",
description = "Ranks up to the max rank that the player can afford. If the player has the " +
"perm ranks.rankupmax.prestige it will try to rankup prestige once it maxes out " +
- "on the default ladder.",
+ "on the default ladder. " +
+ "By default, no player has access to this command. The following perms must be used."
+ ,
altPermissions = {"ranks.rankupmax.default", "ranks.rankupmax.prestige", "ranks.rankupmax.[ladderName]"},
onlyPlayers = false)
public void rankUpMax(CommandSender sender,
@@ -145,9 +147,14 @@ public void rankUpMax(CommandSender sender,
}
- @Command(identifier = "rankup", description = "Ranks up to the next rank. All players have access to " +
+ @Command(identifier = "rankup",
+ description = "Ranks up to the next rank. All players have access to " +
"the ability to rankup on the default ladder so no perms are required, but any other ladder " +
- "requires the correct perms.",
+ "requires the correct perms. " +
+ "All players much have at least the perm 'ranks.user' to use this command. To use this " +
+ "command with other ladders, the users must have the correct perms as listed with this " +
+ "command's help information. "
+ ,
permissions = "ranks.user",
altPermissions = {"ranks.rankup.default", "ranks.rankup.prestiges", "ranks.rankup.[ladderName]"},
onlyPlayers = false)
@@ -213,10 +220,15 @@ public void rankUp(CommandSender sender,
}
- @Command(identifier = "prestige", description = "This will prestige the player. Prestiging is generally when "
+ @Command(identifier = "prestige",
+ description = "This will prestige the player. Prestiging is generally when "
+ "the player's default rank is reset to the lowest rank, their money is rest to zero, and they "
+ "start the mining and the ranking up process all over again. As a trade off for their reset "
- + "of ranks, they get a new prestige rank with the costs of the default ranks being increased.",
+ + "of ranks, they get a new prestige rank with the costs of the default ranks being increased. "
+ + "All players must have the perms 'ranks.user' plus the optional perm 'ranks.rankup.prestiges' "
+ + "if the config.yml setting 'prestige.enable__ranks_rankup_prestiges__permission` is set to a "
+ + "value of 'true' (defaults to 'false'). "
+ + "Examples: '/prestige', '/presetige confirm', '/prestige confirm'.",
permissions = "ranks.user",
altPermissions = {"ranks.rankup.prestiges"},
onlyPlayers = false)
@@ -264,6 +276,9 @@ public void prestigeCmd(CommandSender sender,
String perms = "ranks.rankup.";
String permsLadder = perms + LadderManager.LADDER_PRESTIGES;
+ boolean hasPermsLadder = sender.hasPermission(permsLadder);
+ boolean usePerms = Prison.get().getPlatform().getConfigBooleanFalse( "enable__ranks_rankup_prestiges__permission" );
+ boolean hasAcessToPrestige = usePerms && hasPermsLadder || !usePerms;
boolean isPrestigesEnabled = Prison.get().getPlatform().getConfigBooleanFalse( "prestiges" ) ||
Prison.get().getPlatform().getConfigBooleanFalse( "prestige.enabled" );
@@ -326,13 +341,16 @@ public void prestigeCmd(CommandSender sender,
return;
}
- if ( isPrestigesEnabled &&
- sender.hasPermission( permsLadder)
- ) {
+ if ( isPrestigesEnabled && hasAcessToPrestige ) {
+
Output.get().logDebug( DebugTarget.rankup,
- "Rankup: cmd '/prestige %s%s' Passed perm check: %s",
+ "Rankup: cmd '/prestige %s%s' Has Access to '/prestiges': %b "
+ + "Has perms: %b Perms: %s",
(playerName.length() == 0 ? "" : " " + playerName ),
(confirm == null ? "" : " " + confirm ),
+
+ hasAcessToPrestige,
+ hasPermsLadder,
permsLadder );
@@ -707,8 +725,13 @@ private void prestigePlayer(CommandSender sender, RankPlayer rankPlayer,
}
- @Command(identifier = "ranks promote", description = "Promotes a player to the next rank.",
- permissions = "ranks.promote", onlyPlayers = false)
+ @Command(identifier = "ranks promote",
+ description = "Promotes a player to the next rank. This is an admin command. " +
+ "This command can be used from the console. There is an " +
+ "option to charge the player for the cost of the next rank, which if enabled, will " +
+ "then be same as if the player used the command '/rankup'.",
+ permissions = "ranks.promote",
+ onlyPlayers = false)
public void promotePlayer(CommandSender sender,
@Arg(name = "playerName", def = "", description = "Player name") String playerName,
@Arg(name = "ladder", description = "The ladder to promote on.", def = "default") String ladder,
@@ -765,7 +788,14 @@ public void promotePlayer(CommandSender sender,
}
- @Command(identifier = "ranks demote", description = "Demotes a player to the next lower rank.",
+ @Command(identifier = "ranks demote",
+ description = "Demotes a player to the next lower rank. " +
+ "This is an admin command. This command can be used from the console. " +
+ "There is an option to refund the rankup cost to the player, of which the " +
+ "player will get a refund and it will be as if they did not perform a " +
+ "'/rankup' command. Please be aware that if an admin uses '/ranks promote' on a " +
+ "player, then '/ranks demote refund_player' the player will still get " +
+ "the refund although they did not pay for the rank.",
permissions = "ranks.demote", onlyPlayers = false)
public void demotePlayer(CommandSender sender,
@Arg(name = "playerName", def = "", description = "Player name") String playerName,
diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RanksCommands.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RanksCommands.java
index 1185492f6..47b28ea24 100644
--- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RanksCommands.java
+++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RanksCommands.java
@@ -2067,18 +2067,38 @@ public void rankTopN(CommandSender sender,
@Wildcard(join=true)
@Arg(name = "options", def = ".",
description = "Options: 'alt' displays a shorter format. " +
- "'archived' shows all of the archvied players. " +
- "'forceReload' forces the reloading of all players; must be OPd or console. " +
- "[alt archived forceReload]") String options ){
+ "'archived' shows the archvied players. " +
+ "'forceReload' forces the reloading of all players " +
+ "(must be OPd or console). " +
+ "'stats' shows topN performance info. " +
+ "'debugSave' generates a json save file under ranks directory on server (OPd or console). " +
+ "Can use multiple options. " +
+ "[alt archived forceReload stats debugSave]") String options ){
int page = 1;
int pageSize = 10;
if ( contains( "forceReload", pageNumber, pageSizeNumber, options ) ) {
- TopNPlayers.getInstance().forceReloadAllPlayers();
+ if ( sender.isOp() ) {
+ TopNPlayers.getInstance().forceReloadAllPlayers();
+ ranksTopNPlayerForcedReloadSuccess( sender );
+ }
+ else {
+
+ ranksTopNPlayerForcedReloadFailure( sender );
+ }
+
}
+ if ( contains( "debugSave", pageNumber, pageSizeNumber, options ) ) {
+
+ if ( sender.isOp() ) {
+ TopNPlayers.getInstance().saveToJson();
+ TopNPlayers.getInstance().loadSaveFile();
+ ranksTopNPlayerDebugSaved( sender );
+ }
+ }
boolean alt = contains( "alt", pageNumber, pageSizeNumber, options );
// if ( pageNumber.toLowerCase().contains("alt") ||
@@ -2092,6 +2112,16 @@ public void rankTopN(CommandSender sender,
// boolean sort = contains( "sort", pageNumber, pageSizeNumber, options );
+ int topNSize = TopNPlayers.getInstance().getTopNSize();
+ int archivedSize = TopNPlayers.getInstance().getArchivedSize();
+
+
+ if ( contains( "stats", pageNumber, pageSizeNumber, options ) ) {
+
+ sender.sendMessage( TopNPlayers.getInstance().getTopNStats() );
+ }
+
+
try {
page = Integer.parseInt(pageNumber);
}
@@ -2114,8 +2144,8 @@ public void rankTopN(CommandSender sender,
int totalPlayers =
archived ?
- TopNPlayers.getInstance().getArchivedSize() :
- TopNPlayers.getInstance().getTopNSize();
+ archivedSize :
+ topNSize;
// int totalPlayers = PrisonRanks.getInstance().getPlayerManager().getPlayers().size();
int totalPages = (totalPlayers / pageSize) + (totalPlayers % pageSize == 0 ? 0 : 1);
diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RanksCommandsMessages.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RanksCommandsMessages.java
index 0b540619e..67fbf342f 100644
--- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RanksCommandsMessages.java
+++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/RanksCommandsMessages.java
@@ -661,4 +661,25 @@ protected void ranksPlayersInvalidActionMsg( CommandSender sender, String action
}
+ protected void ranksTopNPlayerForcedReloadSuccess( CommandSender sender ) {
+ PrisonRanks.getInstance().getRanksMessages()
+ .getLocalizable( "ranks_rankCommands__topn_forced_reload_successful" )
+ .sendTo( sender );
+
+ }
+
+ protected void ranksTopNPlayerForcedReloadFailure( CommandSender sender ) {
+ PrisonRanks.getInstance().getRanksMessages()
+ .getLocalizable( "ranks_rankCommands__topn_forced_reload_failure" )
+ .sendTo( sender );
+
+ }
+
+ protected void ranksTopNPlayerDebugSaved( CommandSender sender ) {
+ PrisonRanks.getInstance().getRanksMessages()
+ .getLocalizable( "ranks_rankCommands__topn_debug_saved_success" )
+ .sendTo( sender );
+
+ }
+
}
diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/RankPlayerFactory.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/RankPlayerFactory.java
index 96fb1163c..366cd4f06 100644
--- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/RankPlayerFactory.java
+++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/RankPlayerFactory.java
@@ -86,7 +86,7 @@ public RankPlayer createRankPlayer(Document document) {
return rankPlayer;
}
- public Document toDocument( RankPlayer rankPlayer ) {
+ public static Document toDocument( RankPlayer rankPlayer ) {
Document ret = new Document();
ret.put("uid", rankPlayer.getUUID());
ret.put("ranks", rankPlayer.getRanksRefs() );
@@ -128,6 +128,7 @@ public void firstJoin( RankPlayer rankPlayer) {
RankUpCommand rankupCommands = PrisonRanks.getInstance().getRankManager().getRankupCommands();
rankupCommands.setPlayerRankFirstJoin( rankPlayer, defaultRank );
+ rankPlayer.setDirty( true );
// rankPlayer.addRank( defaultRank );
diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/TopNPlayers.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/TopNPlayers.java
index 869cd16c0..be8763fd6 100644
--- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/TopNPlayers.java
+++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/TopNPlayers.java
@@ -1,6 +1,7 @@
package tech.mcprison.prison.ranks.data;
import java.io.File;
+import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -14,6 +15,18 @@
import tech.mcprison.prison.ranks.PrisonRanks;
import tech.mcprison.prison.ranks.tasks.TopNPlayerUpdateAsyncTask;
+/**
+ * This is singleton that manages the topNPlayers.
+ *
+ *
+ * NOTE: This no longer saves and loads the json file.
+ * Timing was an issue and not really sure if it was even
+ * worth trying to bypass a full reload.
+ *
+ *
+ * @author Blue
+ *
+ */
public class TopNPlayers
implements FileIOData {
@@ -43,6 +56,13 @@ public class TopNPlayers
private transient boolean dirty = false;
+ private transient TopNPlayerUpdateAsyncTask updaterTask;
+
+ private long statsBuildDataNanoSec = 0L;
+ private long statsRefreshDataNanoSec = 0L;
+ private long statsSaveDataNanoSec = 0L;
+ private long statsLoadDataNanoSec = 0L;
+
private TopNPlayers() {
super();
@@ -69,7 +89,7 @@ public static TopNPlayers getInstance() {
if ( instance == null ) {
instance = new TopNPlayers();
- instance.loadSaveFile();
+// instance.loadSaveFile();
instance.launchTopNPlayerUpdateAsyncTask();
}
@@ -124,6 +144,11 @@ private void launchTopNPlayerUpdateAsyncTask() {
}
/**
+ * NOTE: The saved file is no longer being loaded. It only is used for
+ * debugging stats testing to identify how long it would take if it was actually
+ * being used. But the loaded data is not saved and it is not being used.
+ *
+ *
* Upon server startup, in an asynch thread, this function should be called
* to load the saved data from the file system. If there is no saved data,
* then this function will access the PlayerManager and build an initial
@@ -144,10 +169,9 @@ private void launchTopNPlayerUpdateAsyncTask() {
public void loadSaveFile() {
// If Ranks module is not loaded, then do not try to load any save file:
- if ( PrisonRanks.getInstance().getPlayerManager() != null ) {
- // Ranks is not loaded, so reset to empties:
+ if ( PrisonRanks.getInstance().getPlayerManager() == null ) {
- // Load from file was successful!
+ // Ranks is not loaded, so reset to empties:
setTopNList( new ArrayList<>() );
setTopNMap( new TreeMap<>() );
setArchivedList( new ArrayList<>() );
@@ -156,44 +180,54 @@ public void loadSaveFile() {
return;
}
+ long start = System.nanoTime();
+
JsonFileIO jfio = new JsonFileIO();
TopNPlayers temp = (TopNPlayers) jfio.readJsonFile( getSaveFile(), this );
+ temp.sortTopN();
+
+ // The following is disabled because this is just a performance test.
+
+
+// if ( temp != null &&
+// (temp.getTopNList().size() > 0 ||
+// temp.getArchivedList().size() > 0 )) {
+//
+// // Load from file was successful!
+// setTopNList( temp.getTopNList() );
+// setTopNMap( temp.getTopNMap() );
+// setArchivedList( temp.getArchivedList() );
+// setArchivedMap( temp.getArchivedMap() );
+//
+// // Since loading from a file, some players may now need to be archived:
+// checkArchives();
+// }
+// else {
+// // load from file was not successful, probably because there is no file.
+// // So create a new collection of players from the PlayerManager:
+// List players = PrisonRanks.getInstance().getPlayerManager().getPlayers();
+//
+// for (RankPlayer rankPlayer : players) {
+//
+// addPlayerData( rankPlayer );
+// }
+//
+// // Do not need to check archives since the last seen date is processed
+// // when adding the player data.
+// }
+//
+// // Sort:
+// sortTopN();
- if ( temp != null &&
- (temp.getTopNList().size() > 0 ||
- temp.getArchivedList().size() > 0 )) {
-
- // Load from file was successful!
- setTopNList( temp.getTopNList() );
- setTopNMap( temp.getTopNMap() );
- setArchivedList( temp.getArchivedList() );
- setArchivedMap( temp.getArchivedMap() );
-
- // Since loading from a file, some players may now need to be archived:
- checkArchives();
- }
- else {
- // load from file was not successful, probably because there is no file.
- // So create a new collection of players from the PlayerManager:
- List players = PrisonRanks.getInstance().getPlayerManager().getPlayers();
-
- for (RankPlayer rankPlayer : players) {
-
- addPlayerData( rankPlayer );
- }
-
- // Do not need to check archives since the last seen date is processed
- // when adding the player data.
- }
-
- // Sort:
- sortTopN();
+ long end = System.nanoTime();
+ setStatsLoadDataNanoSec( end - start );
- if ( isDirty() ) {
- saveToJson();
- }
+ // NOTE: save is disabled since this is just for debugging purposes.
+// if ( isDirty() ) {
+// saveToJson();
+// }
}
/**
@@ -210,6 +244,8 @@ public void forceReloadAllPlayers() {
if ( PrisonRanks.getInstance().getPlayerManager() != null ) {
+ long start = System.nanoTime();
+
getTopNList().clear();
getTopNMap().clear();
@@ -230,8 +266,12 @@ public void forceReloadAllPlayers() {
// Sort:
sortTopN();
+
+ long end = System.nanoTime();
- saveToJson();
+ setStatsBuildDataNanoSec( end - start );
+
+// saveToJson();
}
@@ -240,9 +280,16 @@ public void forceReloadAllPlayers() {
public void saveToJson() {
JsonFileIO jfio = new JsonFileIO();
+ long start = System.nanoTime();
+
jfio.saveJsonFile( getSaveFile(), this );
+
+ long end = System.nanoTime();
+
+ setStatsSaveDataNanoSec( end - start );
}
+ @SuppressWarnings("unused")
private void checkArchives() {
ArrayList temp = new ArrayList<>();
@@ -337,6 +384,8 @@ public void refreshAndSort() {
return;
}
+ long start = System.nanoTime();
+
if ( !calculatedRankScores ) {
calculateAllRankScores( getTopNList() );
@@ -408,7 +457,10 @@ public void refreshAndSort() {
setDirty( true );
-
+
+ long end = System.nanoTime();
+
+ setStatsRefreshDataNanoSec( end - start );
}
ArrayList newTopNList = new ArrayList<>();
@@ -546,6 +598,38 @@ public void updatePlayerData( RankPlayer rPlayer ) {
}
}
+ public String getTopNStats() {
+
+ int topNSize = getTopNSize();
+ int archivedSize = getArchivedSize();
+
+
+ DecimalFormat dFmt = Prison.get().getDecimalFormat("#,##0.000");
+ DecimalFormat iFmt = Prison.get().getDecimalFormat("#,##0");
+
+ String statsBuildMs = dFmt.format(
+ getStatsBuildDataNanoSec() / 1_000_000 );
+ String statsRefreshMs = dFmt.format(
+ getStatsRefreshDataNanoSec() / 1_000_000 );
+ String statsSaveMs = dFmt.format(
+ getStatsSaveDataNanoSec() / 1_000_000 );
+ String statsLoadMs = dFmt.format(
+ getStatsLoadDataNanoSec() / 1_000_000 );
+
+ String msg = String.format(
+ "&7topNstats:&3 topNs: %s archives: %s buildMs: %s refreshMs: %s " +
+ "saveMs: %s loadMs: %s ",
+ iFmt.format(topNSize),
+ iFmt.format(archivedSize),
+ statsBuildMs,
+ statsRefreshMs,
+ statsSaveMs,
+ statsLoadMs
+ );
+
+ return msg;
+ }
+
public int getTopNSize() {
return getTopNList().size();
}
@@ -652,4 +736,41 @@ public boolean isDirty() {
public void setDirty(boolean dirty) {
this.dirty = dirty;
}
+
+ public TopNPlayerUpdateAsyncTask getUpdaterTask() {
+ return updaterTask;
+ }
+ public void setUpdaterTask(TopNPlayerUpdateAsyncTask asyncTask) {
+
+ this.updaterTask = asyncTask;
+ }
+
+ public long getStatsBuildDataNanoSec() {
+ return statsBuildDataNanoSec;
+ }
+ public void setStatsBuildDataNanoSec(long statsBuildDataNanoSec) {
+ this.statsBuildDataNanoSec = statsBuildDataNanoSec;
+ }
+
+ public long getStatsRefreshDataNanoSec() {
+ return statsRefreshDataNanoSec;
+ }
+ public void setStatsRefreshDataNanoSec(long statsRefreshDataNanoSec) {
+ this.statsRefreshDataNanoSec = statsRefreshDataNanoSec;
+ }
+
+ public long getStatsSaveDataNanoSec() {
+ return statsSaveDataNanoSec;
+ }
+ public void setStatsSaveDataNanoSec(long statsSaveDataNanoSec) {
+ this.statsSaveDataNanoSec = statsSaveDataNanoSec;
+ }
+
+ public long getStatsLoadDataNanoSec() {
+ return statsLoadDataNanoSec;
+ }
+ public void setStatsLoadDataNanoSec(long statsLoadDataNanoSec) {
+ this.statsLoadDataNanoSec = statsLoadDataNanoSec;
+ }
+
}
diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/managers/PlayerManager.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/managers/PlayerManager.java
index 1856f2336..c068b8955 100644
--- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/managers/PlayerManager.java
+++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/managers/PlayerManager.java
@@ -163,11 +163,17 @@ public void loadPlayers() throws IOException {
* @throws IOException If the file could not be created or written to.
* @see #savePlayer(RankPlayer) To save with the default conventional filename.
*/
- public void savePlayer(RankPlayer player, String playerFile) throws IOException {
+ private void savePlayer(RankPlayer player, String playerFile) throws IOException {
- RankPlayerFactory rankPlayerFactory = new RankPlayerFactory();
+ if ( !player.isEnableDirty() || player.isEnableDirty() && player.isDirty() ) {
+
+ collection.save(playerFile, RankPlayerFactory.toDocument( player ) );
+
+ player.setDirty( false );
+ }
+// RankPlayerFactory rankPlayerFactory = new RankPlayerFactory();
- collection.save(playerFile, rankPlayerFactory.toDocument( player ) );
+// collection.save(playerFile, RankPlayerFactory.toDocument( player ) );
// collection.insert(playerFile, player.toDocument());
}
@@ -277,7 +283,7 @@ public Set getPlayerErrors() {
public RankPlayer getPlayer(UUID uid, String playerName) {
RankPlayer results = null;
- boolean dirty = false;
+// boolean dirty = false;
playerName = playerName == null ? "" : playerName.trim();
@@ -297,7 +303,8 @@ public RankPlayer getPlayer(UUID uid, String playerName) {
// This checks to see if they have a new name, if so, then adds it to the history:
// But the UID must match:
if ( uid != null && rankPlayer.getUUID().equals(uid) ) {
- dirty = rankPlayer.checkName( playerName );
+ rankPlayer.setEnableDirty( true );
+ rankPlayer.setDirty( rankPlayer.checkName( playerName ) );
}
results = rankPlayer;
@@ -314,12 +321,19 @@ public RankPlayer getPlayer(UUID uid, String playerName) {
if ( results == null && playerName != null && !"console".equalsIgnoreCase( playerName ) ) {
results = addPlayer(uid, playerName);
- dirty = results != null;
+
+ if ( results != null ) {
+
+ results.setDirty( true );
+ }
+
+// dirty = results != null;
}
// Save if dirty (change or new):
- if ( dirty && results != null ) {
+ if ( results != null ) {
savePlayer( results );
+
}
return results;
@@ -379,6 +393,7 @@ protected RankPlayer addPlayerSyncTask( UUID uid, String playerName ) {
// We need to create a new player data file.
newPlayer = new RankPlayer( uid, playerName );
newPlayer.checkName( playerName );
+ newPlayer.setDirty( true );
rankPlayerFactory.firstJoin( newPlayer );
@@ -1455,24 +1470,41 @@ public String getTranslatePlayerPlaceHolder( PlaceholderIdentifier identifier )
Player player = identifier.getPlayer();
PlayerManager pm = PrisonRanks.getInstance().getPlayerManager();
- RankPlayer rankPlayer = pm.getPlayer( player );
-
- PlaceHolderKey placeHolderKey = identifier.getPlaceholderKey();
-
-
- PlaceholderAttributeBar attributeBar = identifier.getAttributeBar();
- PlaceholderAttributeNumberFormat attributeNFormat = identifier.getAttributeNFormat();
- PlaceholderAttributeText attributeText = identifier.getAttributeText();
+ RankPlayer rankPlayer = null;
-// int sequence = identifier.getSequence();
+ try {
+ rankPlayer = pm.getPlayer( player );
+ }
+ catch (Exception e) {
+
+ String msg = String.format(
+ "PlayerManager: failed to getPlayer(): %s [%s]",
+ player == null ? "-null-" : player.getName(),
+ e.getMessage()
+ );
+
+ Output.get().logError( msg );
+ }
String results = null;
- PrisonPlaceHolders placeHolder = placeHolderKey.getPlaceholder();
if ( rankPlayer != null ) {
+ PlaceHolderKey placeHolderKey = identifier.getPlaceholderKey();
+
+
+ PlaceholderAttributeBar attributeBar = identifier.getAttributeBar();
+ PlaceholderAttributeNumberFormat attributeNFormat = identifier.getAttributeNFormat();
+ PlaceholderAttributeText attributeText = identifier.getAttributeText();
+
+// int sequence = identifier.getSequence();
+
+
+
+ PrisonPlaceHolders placeHolder = placeHolderKey.getPlaceholder();
+
String ladderName = placeHolderKey.getData();
if ( rankPlayer != null ) {
diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/managers/RankManager.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/managers/RankManager.java
index b0d816a6e..f56f41209 100644
--- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/managers/RankManager.java
+++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/managers/RankManager.java
@@ -375,7 +375,11 @@ public boolean removeRank(Rank rank) {
rankPlayer.addRank(newRank);
}
+ rankPlayer.setDirty( true );
+
PrisonRanks.getInstance().getPlayerManager().savePlayer(rankPlayer);
+
+
// try {
// } catch (IOException e) {
// Localizable localManagerLog = PrisonRanks.getInstance().getRanksMessages()
@@ -726,10 +730,17 @@ public String getTranslateRanksPlaceHolder( PlaceholderIdentifier identifier ) {
boolean isStatsPlayers = placeHolder.hasFlag( PlaceholderFlags.STATSPLAYERS );
boolean isStatsRank = placeHolder.hasFlag( PlaceholderFlags.STATSRANKS );
- if ( !( isStatsPlayers ) &&
- rank != null &&
- ( rankPlayer != null ||
- rankPlayer == null && isStatsRank ) ) {
+
+ if ( isStatsPlayers ||
+ isStatsRank ||
+ rank != null && rankPlayer != null
+
+ ) {
+
+// if ( !( isStatsPlayers ) &&
+// rank != null &&
+// ( rankPlayer != null ||
+// rankPlayer == null && isStatsRank ) ) {
identifier.setFoundAMatch( true );
@@ -1269,6 +1280,18 @@ else if ( placeHolder == PrisonPlaceHolders.prison_top_player_penalty_raw_nnn_tp
}
}
+ else if ( Output.get().isDebug() ) {
+ String msg = String.format(
+ "RankManager.getTranslateRanksPlaceHolder(): Failed to process a placeholder " +
+ "isStatsPlayers: %b isStatsRank: %b [%s]",
+ isStatsPlayers,
+ isStatsRank,
+ placeHolder.toString()
+
+ );
+
+ Output.get().logDebug( msg );
+ }
if ( attributeText != null && results != null ) {
diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/tasks/RanksStartupPlayerValidationsAsyncTask.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/tasks/RanksStartupPlayerValidationsAsyncTask.java
index f0a7d8754..498c3c36b 100644
--- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/tasks/RanksStartupPlayerValidationsAsyncTask.java
+++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/tasks/RanksStartupPlayerValidationsAsyncTask.java
@@ -45,7 +45,11 @@ public void run() {
// NOTE: since TopN is based upon Ranks and the associated players, if Ranks module
// is disabled, TopN will not run. Make sure 100% that the PlayerManager has been
// setup before trying to call TopNPlayers.getInstance() or it will never work/start.
- TopNPlayers.getInstance();
+ if ( TopNPlayers.getInstance().getUpdaterTask() != null ) {
+
+ // NOTE: force the reloading of all topNPlayers on the next update
+ TopNPlayers.getInstance().getUpdaterTask().setForceReload( true );
+ }
// // The following can take awhile to run if there are a lot of players
diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/tasks/TopNPlayerUpdateAsyncTask.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/tasks/TopNPlayerUpdateAsyncTask.java
index f9be9af9a..ffdde60fd 100644
--- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/tasks/TopNPlayerUpdateAsyncTask.java
+++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/tasks/TopNPlayerUpdateAsyncTask.java
@@ -9,6 +9,8 @@ public class TopNPlayerUpdateAsyncTask
private TopNPlayers topNPlayers;
+ private boolean forceReload = true;
+
// private boolean startup = true;
public TopNPlayerUpdateAsyncTask( TopNPlayers topNPlayers ) {
@@ -23,6 +25,8 @@ public static void submitTaskTimerAsync( TopNPlayers topNPlayers,
TopNPlayerUpdateAsyncTask asyncTask =
new TopNPlayerUpdateAsyncTask( topNPlayers );
+ topNPlayers.setUpdaterTask( asyncTask );
+
PrisonTaskSubmitter.runTaskTimerAsync( asyncTask, delayTicks, intervalTicks );
}
@@ -35,8 +39,22 @@ public void run() {
// topNPlayers.loadSaveFile();
// }
- topNPlayers.refreshAndSort();
+ if ( forceReload ) {
+ topNPlayers.forceReloadAllPlayers();
+ forceReload = false;
+ }
+ else {
+
+ topNPlayers.refreshAndSort();
+ }
+ }
+
+ public boolean isForceReload() {
+ return forceReload;
+ }
+ public void setForceReload(boolean forceReload) {
+ this.forceReload = forceReload;
}
}
diff --git a/prison-sellall/src/main/java/tech/mcprison/prison/sellall/messages/SpigotVariousGuiMessages.java b/prison-sellall/src/main/java/tech/mcprison/prison/sellall/messages/SpigotVariousGuiMessages.java
index e17d5ce8a..479589162 100644
--- a/prison-sellall/src/main/java/tech/mcprison/prison/sellall/messages/SpigotVariousGuiMessages.java
+++ b/prison-sellall/src/main/java/tech/mcprison/prison/sellall/messages/SpigotVariousGuiMessages.java
@@ -92,5 +92,11 @@ public void sellallIsDisabledMsg( CommandSender sender ) {
.sendTo( sender );
}
+ public void sellallGUIIsDisabledMsg( CommandSender sender ) {
+ PrisonSellall.getInstance().getSellallMessages()
+ .getLocalizable( "sellall_spigot_utils__sellall_gui_is_disabled" )
+ .sendTo( sender );
+ }
+
}
diff --git a/prison-spigot/build.gradle b/prison-spigot/build.gradle
index 4be483662..3ab4ae5fe 100644
--- a/prison-spigot/build.gradle
+++ b/prison-spigot/build.gradle
@@ -67,7 +67,10 @@ repositories {
maven {
- url = 'https://mvnrepository.com/artifact/de.tr7zw/item-nbt-api-plugin'
+ name = "CodeMC"
+ url = uri("https://repo.codemc.io/repository/maven-public/")
+// url = 'https://repo.codemc.io/service/rest/repository/browse/maven-public/de/tr7zw/item-nbt-api-plugin'
+// url = 'https://mvnrepository.com/artifact/de.tr7zw/item-nbt-api-plugin'
content {
includeGroup 'de.tr7zw'
}
@@ -92,8 +95,10 @@ dependencies {
implementation project(':prison-sellall')
- implementation 'org.bstats:bstats-base:3.0.0'
- implementation 'org.bstats:bstats-bukkit:3.0.0'
+ // https://mvnrepository.com/artifact/org.bstats/bstats-base
+ // https://mvnrepository.com/artifact/org.bstats/bstats-bukkit
+ implementation 'org.bstats:bstats-base:3.0.2'
+ implementation 'org.bstats:bstats-bukkit:3.0.2'
// implementation 'org.bstats:bstats-base:2.2.1'
// implementation 'org.bstats:bstats-bukkit:2.2.1'
@@ -103,6 +108,7 @@ dependencies {
// Using jar instead: lib/Spiget_v1.4.2.prison-build.jar
+ // https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
implementation 'org.apache.commons:commons-lang3:3.12.0'
@@ -113,15 +119,15 @@ dependencies {
// But do not see v5.0
compileOnly 'net.luckperms:api:5.0'
- compileOnly 'me.lucko.luckperms:luckperms-api:4.2'
+ // https://mvnrepository.com/artifact/me.lucko.luckperms/luckperms-api
+ compileOnly 'me.lucko.luckperms:luckperms-api:4.4'
// jitpack.io:
// implementation 'com.github.cryptomorin:xseries:b95d195482'
// https://mvnrepository.com/artifact/com.github.cryptomorin/XSeries
- implementation 'com.github.cryptomorin:XSeries:9.2.0'
- //implementation 'com.github.cryptomorin:XSeries:9.0.0'
- //implementation 'com.github.cryptomorin:XSeries:8.8.0'
+ implementation 'com.github.cryptomorin:XSeries:9.4.0'
+ //implementation 'com.github.cryptomorin:XSeries:9.2.0'
@@ -142,7 +148,10 @@ dependencies {
// compileOnly 'at.pcgamingfreaks:Minepacks-API:2.3.22'
// compileOnly 'at.pcgamingfreaks:Minepacks-API:2.3.21.3'
- compileOnly 'net.milkbowl.vault:VaultAPI:1.7'
+
+ // https://mvnrepository.com/artifact/com.github.MilkBowl/VaultAPI
+ compileOnly 'com.github.MilkBowl:VaultAPI:1.7.1'
+ //compileOnly 'net.milkbowl.vault:VaultAPI:1.7.0'
// compileOnly('be.maximvdw:MVdWPlaceholderAPI:2.5.2-SNAPSHOT'){
// exclude group: 'org.spigotmc'
@@ -151,17 +160,24 @@ dependencies {
// compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.1'
+ // NOTE: mavenrepository.com is not the offical repo.
+ // NOTE: This item-nbt MUST use the API and not the plugini version!
+ // Good: https://repo.codemc.io/service/rest/repository/browse/maven-public/de/tr7zw/item-nbt-api/
+ // Bad?: https://repo.codemc.io/service/rest/repository/browse/maven-public/de/tr7zw/item-nbt-api-plugin/2.11.3/
// NOTE: This maven repo was failing to be accessable during online builds. So added to the /lib.
+ // https://github.com/tr7zw/Item-NBT-API/wiki/Using-Gradle
// https://www.spigotmc.org/resources/nbt-api.7939/
// https://mvnrepository.com/artifact/de.tr7zw/item-nbt-api-plugin
- implementation 'de.tr7zw:item-nbt-api-plugin:2.11.1'
+ implementation 'de.tr7zw:item-nbt-api:2.11.3'
+// implementation 'de.tr7zw:item-nbt-api-plugin:2.11.2'
// implementation 'de.tr7zw:item-nbt-api-plugin:2.10.0'
// implementation 'de.tr7zw:item-nbt-api-plugin:2.9.2'
// https://github.com/LoneDev6/API-ItemsAdder#-packages
// https://github.com/LoneDev6/API-ItemsAdder/tags
- compileOnly 'com.github.LoneDev6:API-ItemsAdder:3.2.5'
+ compileOnly 'com.github.LoneDev6:API-ItemsAdder:3.5.0b'
+// compileOnly 'com.github.LoneDev6:API-ItemsAdder:3.2.5'
@@ -211,21 +227,28 @@ processResources {
shadowJar {
dependencies {
include(dependency('org.apache.commons:commons-lang3:3.12.0'))
- include(dependency('com.google.code.gson:gson:2.8.6'))
-
- include(dependency('org.bstats:bstats-base:3.0.0'))
- include(dependency('org.bstats:bstats-bukkit:3.0.0'))
+
+ // https://mvnrepository.com/artifact/com.google.code.gson/gson
+ include(dependency('com.google.code.gson:gson:2.10.1'))
+ //include(dependency('com.google.code.gson:gson:2.8.6'))
+
+ include(dependency('org.bstats:bstats-base:3.0.2'))
+ include(dependency('org.bstats:bstats-bukkit:3.0.2'))
// include(dependency('org.bstats:bstats-base:2.2.1'))
// include(dependency('org.bstats:bstats-bukkit:2.2.1'))
include(dependency('me.clip:placeholderapi:2.11.2'))
//include(dependency('me.clip:placeholderapi:2.10.9'))
- include(dependency('com.github.cryptomorin:XSeries:9.2.0'))
+ // https://mvnrepository.com/artifact/com.github.cryptomorin/XSeries
+ include(dependency('com.github.cryptomorin:XSeries:9.4.0'))
+ //include(dependency('com.github.cryptomorin:XSeries:9.2.0'))
//include(dependency('com.github.cryptomorin:XSeries:9.0.0'))
//include(dependency('com.github.cryptomorin:XSeries:8.8.0'))
- include(dependency('de.tr7zw:item-nbt-api-plugin:2.11.1'))
+
+ // https://mvnrepository.com/artifact/de.tr7zw/item-nbt-api-plugin
+ include(dependency('de.tr7zw:item-nbt-api:'))
//include(dependency('de.tr7zw:item-nbt-api-plugin:2.10.0'))
//include(dependency('org.inventivetalent.spiget-update:bukkit:1.4.2-SNAPSHOT'))
@@ -242,7 +265,8 @@ shadowJar {
relocate 'org.inventivetalent.update.spiget', 'tech.mcprison.prison.spiget'
relocate 'com.cryptomorin', 'tech.mcprison.prison.cryptomorin'
- relocate 'de.tr7zw.nbtapi', 'tech.mcprison.prison.nbtapi'
+ relocate 'de.tr7zw.changeme.nbtapi', 'tech.mcprison.prison.nbtapi'
+// relocate 'de.tr7zw.nbtapi', 'tech.mcprison.prison.nbtapi'
//relocate 'me.badbones69.crazyenchantments.api.events.BlastUseEvent', 'tech.mcprison.prison.crazyenchantments.api'
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotCommand.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotCommand.java
new file mode 100644
index 000000000..c1be0120a
--- /dev/null
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotCommand.java
@@ -0,0 +1,50 @@
+package tech.mcprison.prison.spigot;
+
+import tech.mcprison.prison.Prison;
+import tech.mcprison.prison.commands.Command;
+import tech.mcprison.prison.internal.CommandSender;
+import tech.mcprison.prison.output.Output;
+import tech.mcprison.prison.spigot.customblock.PrisonItemsAdder;
+
+public class SpigotCommand {
+
+ public SpigotCommand() {
+ super();
+
+ // Register these commands:
+ Prison.get().getCommandHandler().registerCommands( this );
+ }
+
+ @Command(identifier = "prison support test itemsAdder",
+ description = "Initial test of accessing ItemsAdder.",
+ onlyPlayers = false, permissions = "prison.admin" )
+ public void testItemAdderCommand(CommandSender sender ) {
+
+
+ PrisonItemsAdder pia = new PrisonItemsAdder();
+
+
+ Output.get().logInfo( "Prison Support: Starting to access ItemsAdder:" );
+ Output.get().logInfo( " This is just a preliminary test just to identify if prison can access the "
+ + "ItemsAddr list of custom blocks. Once this can be verified, along with the format that "
+ + "they are using, then Prison can be setup to utilize those items as custom blocks within "
+ + "Prison. Please copy and past these results to the discord server to the attention "
+ + "of Blue." );
+ Output.get().logInfo( " Will list all custom blocks: ItemsAdder.getAllItems() with only isBlock():" );
+
+ pia.integrate();
+
+
+ if ( pia.hasIntegrated() ) {
+
+ pia.testCustomBlockRegistry();
+ }
+ else {
+ Output.get().logInfo( "Warning: Prison has not been able to establish a connection to "
+ + "ItemsAdder. Make sure it has been installed and is loading successfully." );
+ }
+
+
+ Output.get().logInfo( "Prison Support: Compleated tests with access to ItemsAdder:" );
+ }
+}
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 cc6d16eb1..c560ec3a9 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
@@ -103,6 +103,7 @@
import tech.mcprison.prison.ranks.data.RankLadder;
import tech.mcprison.prison.ranks.data.RankPlayer;
import tech.mcprison.prison.ranks.data.RankPlayerFactory;
+import tech.mcprison.prison.ranks.data.TopNPlayers;
import tech.mcprison.prison.ranks.managers.PlayerManager;
import tech.mcprison.prison.ranks.managers.RankManager;
import tech.mcprison.prison.spigot.autofeatures.events.AutoManagerBlockBreakEvents;
@@ -236,10 +237,10 @@ public Optional getWorld(String name) {
@Override
public void getWorldLoadErrors( ChatDisplay display ) {
- Optional prisonMinesOpt = Prison.get().getModuleManager().getModule( PrisonMines.MODULE_NAME );
+ Module prisonMinesModule = Prison.get().getModuleManager().getModule( PrisonMines.MODULE_NAME );
- if ( prisonMinesOpt.isPresent() ) {
- MineManager mineManager = ((PrisonMines) prisonMinesOpt.get()).getMineManager();
+ if ( prisonMinesModule != null ) {
+ MineManager mineManager = ((PrisonMines) prisonMinesModule).getMineManager();
// When finished loading the mines, then if there are any worlds that
// could not be loaded, dump the details:
@@ -2087,7 +2088,7 @@ public List getActiveFeatures( boolean showLaddersAndRanks ) {
}
- Module minesModule = Prison.get().getModuleManager().getModule( "Mines" ).orElseGet( null );
+ Module minesModule = Prison.get().getModuleManager().getModule( "Mines" ); //.orElseGet( null );
if ( minesModule != null &&
minesModule.getStatus().getStatus() == ModuleStatus.Status.ENABLED ) {
@@ -2273,6 +2274,8 @@ public List getActiveFeatures( boolean showLaddersAndRanks ) {
boolean isCalcFortune = afw.isBoolean( AutoFeatures.isCalculateFortuneEnabled );
results.add( String.format(". Calculate Fortune:&b %s", isCalcFortune) );
+ results.add( String.format("+. . Fortune Multiplier:&b %s",
+ afw.getInteger( AutoFeatures.fortuneMultiplierGlobal )) );
results.add( String.format("+. . Max Fortune Level:&b %s &3(0 = no max Level)",
afw.getInteger( AutoFeatures.fortuneMultiplierMax )) );
@@ -2448,6 +2451,11 @@ else if ( !isBasic ) {
}
+
+ display.addText("");
+ display.addText( TopNPlayers.getInstance().getTopNStats() );
+
+
display.addText("");
display.addText("&7Locale Settings:");
@@ -3097,4 +3105,14 @@ public List getPlayerOldBackpacks( Player player ) {
return backpacks;
}
+
+ @Override
+ public int getMinY() {
+ return SpigotCompatibility.getInstance().getMinY();
+ }
+
+ @Override
+ public int getMaxY() {
+ return SpigotCompatibility.getInstance().getMaxY();
+ }
}
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 53003fd97..4008430ef 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
@@ -92,6 +92,7 @@
import tech.mcprison.prison.spigot.spiget.BluesSpigetSemVerComparator;
import tech.mcprison.prison.spigot.tasks.PrisonInitialStartupTask;
import tech.mcprison.prison.spigot.tasks.SpigotPrisonDelayedStartupTask;
+import tech.mcprison.prison.spigot.utils.PrisonUtilsMineBombs;
import tech.mcprison.prison.spigot.utils.PrisonUtilsModule;
import tech.mcprison.prison.util.Text;
@@ -392,17 +393,28 @@ public void onEnableStartup() {
}
- // Startup bStats:
- prisonBStats.initMetricsOnEnable();
-
-
-
// Force a backup if prison version is new:
PrisonBackups backups = new PrisonBackups();
backups.serverStartupVersionCheck();
+ // Reload guiConfigs since ranks and mines have now been loaded:
+ guiConfig.initialize();
+
+
+
+ // Setup mine bombs:
+ PrisonUtilsMineBombs.getInstance().reloadPrisonMineBombs();
+
+
+ // Enable Temp spigot commands:
+ new SpigotCommand();
+ // Startup bStats:
+ prisonBStats.initMetricsOnEnable();
+
+
+
Output.get().logInfo( "Prison - Finished loading." );
@@ -1075,10 +1087,14 @@ private void initModulesAndCommands() {
// If sellall is enabled, then allow it to initialize.
- if (isSellAllEnabled){
+// if (isSellAllEnabled){
SellAllUtil.get();
- }
+// }
+ // Load sellAll if enabled
+// if (isSellAllEnabled){
+ Prison.get().getCommandHandler().registerCommands( new PrisonSpigotSellAllCommands() );
+// }
}
else {
@@ -1108,10 +1124,6 @@ private void initModulesAndCommands() {
Prison.get().getCommandHandler().registerCommands( new PrisonSpigotPrestigeCommands() );
}
- // Load sellAll if enabled
- if (isSellAllEnabled){
- Prison.get().getCommandHandler().registerCommands( new PrisonSpigotSellAllCommands() );
- }
}
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 e991cbefd..e8fe0f841 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
@@ -173,7 +173,7 @@ public static ItemStack getItemStack( XMaterial xMaterial, int amount ) {
return bukkitStack;
}
- public static SpigotItemStack getSpigotItemStack( XMaterial xMaterial, int amount ) {
+ public static SpigotItemStack getSpigotItemStackXMat( XMaterial xMaterial, int amount ) {
SpigotItemStack itemStack = null;
try {
@@ -186,6 +186,21 @@ public static SpigotItemStack getSpigotItemStack( XMaterial xMaterial, int amoun
return itemStack;
}
+ public static SpigotItemStack getSpigotItemStack( PrisonBlock material, int amount ) {
+
+ XMaterial xMat = SpigotCompatibility.getInstance().getXMaterial( material );
+
+ SpigotItemStack iStack = getSpigotItemStackXMat( xMat, amount );
+
+ return iStack;
+ }
+
+ public static void getSpigotBlock( ItemStack iStack ) {
+ XMaterial xmat = XMaterial.matchXMaterial( iStack );
+
+// SpigotCompatibility.getInstance().
+ }
+
/*public static HashMap addItemToPlayerInventory(
Player player, SpigotItemStack itemStack ) {
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/api/PrisonMinesBlockBreakEvent.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/api/PrisonMinesBlockBreakEvent.java
index f979ef8a5..f0e4535e2 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/api/PrisonMinesBlockBreakEvent.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/api/PrisonMinesBlockBreakEvent.java
@@ -16,6 +16,7 @@
import tech.mcprison.prison.spigot.block.BlockBreakPriority;
import tech.mcprison.prison.spigot.block.SpigotBlock;
import tech.mcprison.prison.spigot.block.SpigotItemStack;
+import tech.mcprison.prison.spigot.block.OnBlockBreakMines.MinesEventResults;
import tech.mcprison.prison.spigot.compat.SpigotCompatibility;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
@@ -131,28 +132,36 @@ public class PrisonMinesBlockBreakEvent
public PrisonMinesBlockBreakEvent(
- Block theBlock, Player player,
- Mine mine,
+ MinesEventResults eventResults,
+// Block theBlock, Player player,
+// Mine mine,
// SpigotBlock spigotBlock, SpigotPlayer spigotPlayer,
- BlockBreakPriority bbPriority,
+// BlockBreakPriority bbPriority,
// boolean monitor, boolean blockEventsOnly,
- BlockEventType blockEventType, String triggered,
+ BlockEventType blockEventType,
+ String triggered,
StringBuilder debugInfo ) {
- super( theBlock, player );
+ super( eventResults.getBlock(), eventResults.getSpigotPlayer().getWrapper() );
+// super( theBlock, player );
- this.mine = mine;
+ this.mine = eventResults.getMine();
+// this.mine = mine;
// Need to wrap in a Prison block so it can be used with the mines:
- SpigotBlock sBlock = SpigotBlock.getSpigotBlock( theBlock );
- SpigotPlayer sPlayer = new SpigotPlayer( player );
+// SpigotBlock sBlock = SpigotBlock.getSpigotBlock( theBlock );
+// SpigotPlayer sPlayer = new SpigotPlayer( player );
- this.spigotBlock = sBlock;
- this.spigotPlayer = sPlayer;
+ this.spigotBlock = eventResults.getSpigotBlock();
+ this.spigotPlayer = eventResults.getSpigotPlayer();
+// this.spigotBlock = sBlock;
+// this.spigotPlayer = sPlayer;
- this.itemInHand = SpigotCompatibility.getInstance().getPrisonItemInMainHand( player );
+ this.itemInHand = SpigotCompatibility.getInstance()
+ .getPrisonItemInMainHand( eventResults.getSpigotPlayer().getWrapper() );
- this.bbPriority = bbPriority;
+ this.bbPriority = eventResults.getBbPriority();
+// this.bbPriority = bbPriority;
// this.monitor = monitor;
// this.blockEventsOnly = blockEventsOnly;
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 a20dc07c9..f6a11d90a 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
@@ -2,7 +2,6 @@
import java.util.ArrayList;
import java.util.List;
-import java.util.Optional;
import java.util.TreeMap;
import java.util.UUID;
@@ -383,9 +382,11 @@ private TreeMap getPlayerCache() {
public PrisonMines getPrisonMineManager() {
if ( prisonMineManager == null && !isMineModuleDisabled() ) {
- Optional mmOptional = Prison.get().getModuleManager().getModule( PrisonMines.MODULE_NAME );
- if ( mmOptional.isPresent() && mmOptional.get().isEnabled() ) {
- PrisonMines prisonMines = (PrisonMines) mmOptional.get();
+
+ Module module = Prison.get().getModuleManager().getModule( PrisonMines.MODULE_NAME );
+
+ if (module != null && module.isEnabled() ) {
+ PrisonMines prisonMines = (PrisonMines) module;
this.prisonMineManager = prisonMines;
} else {
setMineModuleDisabled( true );
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 f74b5c5b3..841fbae06 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
@@ -8,7 +8,6 @@
import java.util.Map.Entry;
import java.util.Random;
import java.util.Set;
-import java.util.TreeMap;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@@ -106,10 +105,8 @@ protected boolean checkIfNoAccess( PrisonMinesBlockBreakEvent pmEvent, double st
boolean results = false;
// NOTE: Check for the ACCESS priority and if someone does not have access, then return
- // with a cancel on the event. Both ACCESSBLOCKEVENTS and ACCESSMONITOR will be
- // converted to just ACCESS at this point, and the other part will run under either
- // BLOCKEVENTS or MONITOR.
- if ( pmEvent.getBbPriority() == BlockBreakPriority.ACCESS && pmEvent.getMine() != null &&
+ // with a cancel on the event.
+ if ( pmEvent.getBbPriority().isAccess() && pmEvent.getMine() != null &&
!pmEvent.getMine().hasMiningAccess( pmEvent.getSpigotPlayer() )) {
String message = String.format( "(&cACCESS fail: player %s does not have access to "
@@ -278,10 +275,10 @@ protected EventListenerCancelBy processPMBBEvent(PrisonMinesBlockBreakEvent pmEv
if ( isBoolean( AutoFeatures.cancelAllBlockBreakEvents ) ) {
cancelBy = EventListenerCancelBy.event;
}
- else {
-
- pmEvent.getDebugInfo().append( "(event not canceled) " );
- }
+// else {
+//
+// pmEvent.getDebugInfo().append( "(event not canceled) " );
+// }
finalizeBreakTheBlocks( pmEvent );
@@ -362,15 +359,15 @@ protected boolean hasFortune(SpigotItemStack itemInHand){
return results;
}
- protected short getFortune(SpigotItemStack itemInHand){
- short results = (short) 0;
+ protected short getFortune(SpigotItemStack itemInHand, StringBuilder debugInfo ){
+ short fortLevel = (short) 0;
try {
if ( itemInHand != null &&
itemInHand.getBukkitStack() != null &&
itemInHand.getBukkitStack().containsEnchantment( Enchantment.LOOT_BONUS_BLOCKS ) &&
itemInHand.getBukkitStack().getEnchantments() != null ) {
- results = (short) itemInHand.getBukkitStack().getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS);
+ fortLevel = (short) itemInHand.getBukkitStack().getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS);
}
}
catch ( NullPointerException e ) {
@@ -378,11 +375,28 @@ protected short getFortune(SpigotItemStack itemInHand){
// It throws this exception: Caused by: java.lang.NullPointerException: null key in entry: null=5
}
+ short results = (short) fortLevel;
+// DecimalFormat dFmt = new DecimalFormat( "#,##0.0000" );
+ DecimalFormat iFmt = new DecimalFormat( "#,##0" );
+
int maxFortuneLevel = getInteger( AutoFeatures.fortuneMultiplierMax );
- if ( maxFortuneLevel > 0 && results > maxFortuneLevel ) {
+ String maxFort = "";
+ if ( maxFortuneLevel > 0 && fortLevel > maxFortuneLevel ) {
results = (short) maxFortuneLevel;
+ maxFort = String.format(" max=%s result=%s",
+ iFmt.format( maxFortuneLevel ),
+ iFmt.format( results ));
}
+// double fortuneMultiplierGlobal = getDouble( AutoFeatures.fortuneMultiplierGlobal );
+// results *= fortuneMultiplierGlobal;
+
+ String fortInfo = String.format( "(getToolFort: fort=%s%s) ",
+ iFmt.format( fortLevel ),
+ maxFort );
+
+ debugInfo.append( fortInfo );
+
return results;
}
@@ -504,7 +518,7 @@ private int applyAutoEventsDetails( PrisonMinesBlockBreakEvent pmEvent ) {
.append( lorePickup ? "lore " : "" )
.append( permPickup ? "perm " : "" )
.append( configPickup ? "config " : "" )
- .append( limit2minesPickup ? "limit2mines" : "noLimit" )
+ .append( limit2minesPickup ? "mines" : "noLimit" )
.append( "] ")
.append( " Smelt [")
@@ -512,7 +526,7 @@ private int applyAutoEventsDetails( PrisonMinesBlockBreakEvent pmEvent ) {
.append( loreSmelt ? "lore " : "" )
.append( permSmelt ? "perm " : "" )
.append( configSmelt ? "config " : "" )
- .append( limit2minesSmelt ? "limit2mines" : "noLimit" )
+ .append( limit2minesSmelt ? "mines" : "noLimit" )
.append( "] ")
.append( " Block [")
@@ -520,7 +534,7 @@ private int applyAutoEventsDetails( PrisonMinesBlockBreakEvent pmEvent ) {
.append( loreBlock ? "lore " : "" )
.append( permBlock ? "perm " : "" )
.append( configBlock ? "config " : "" )
- .append( limit2minesBlock ? "limit2mines" : "noLimit" )
+ .append( limit2minesBlock ? "mines" : "noLimit" )
.append( "] ");
}
@@ -702,6 +716,10 @@ protected int autoPickup( PrisonMinesBlockBreakEvent pmEvent,
Player player = pmEvent.getPlayer();
SpigotItemStack itemInHand = pmEvent.getItemInHand();
// SpigotBlock block = pmEvent.getSpigotBlock();
+
+ // Calculate silkTouch drops before processing drops:
+ calculateSilkTouch( pmEvent );
+
List drops = pmEvent.getBukkitDrops();
// The following may not be the correct drops for all versions of spigot,
@@ -718,26 +736,57 @@ protected int autoPickup( PrisonMinesBlockBreakEvent pmEvent,
if (drops != null && drops.size() > 0 ) {
- debugInfo.append( "[autoPickupDrops]" );
+ DecimalFormat drFmt = Prison.get().getDecimalFormat("#,##0.0000");
+ double bukkitDropsMultiplier =
+ isBoolean( AutoFeatures.isCalculateFortuneEnabled ) ?
+ getDouble( AutoFeatures.fortuneBukkitDropsMultiplier ) :
+ 1.0d;
+ StringBuilder sb = new StringBuilder();
+ for (SpigotItemStack sItemStack : drops) {
+ if ( sb.length() > 0 ) {
+ sb.append( "," );
+ }
+ int amtBukkit = sItemStack.getAmount();
+ int amt = (int) (amtBukkit * bukkitDropsMultiplier);
+ if ( amt < 1 ) {
+ amt = 1;
+ }
+ sb.append( sItemStack.getName() ).append( ":" )
+ .append( amt );
+ if ( amt != amtBukkit ) {
+ sItemStack.setAmount( amt );
+ sb.append( "(").append( amtBukkit ).append( ")" );
+ }
+ }
+ if ( bukkitDropsMultiplier != 1.0d ) {
+ sb.insert( 0, ": " );
+ sb.insert( 0, drFmt.format( bukkitDropsMultiplier) );
+ sb.insert( 0, "bukkitDropMult=" );
+ }
+
+ debugInfo.append( "[autoPickupDrops:: " ).append( sb ).append( "] ");
+
+
+
// Need better drop calculation that is not using the getDrops function.
- calculateSilkTouch( itemInHand, drops );
+// calculateSilkTouch( pmEvent, itemInHand, drops );
// Adds in additional drop items: Add Flint with gravel drops:
- calculateDropAdditions( itemInHand, drops );
+ calculateDropAdditions( itemInHand, drops, pmEvent.getDebugInfo() );
// Add fortune to the items in the inventory
if ( isBoolean( AutoFeatures.isCalculateFortuneEnabled ) ) {
- short fortuneLevel = getFortune(itemInHand);
+ short fortuneLevel = getFortune(itemInHand, debugInfo );
- debugInfo.append( "(calculateFortune: fort " + fortuneLevel + ")" );
+// debugInfo.append( "(calculateFortune: fort " + fortuneLevel + ")" );
for ( SpigotItemStack itemStack : drops ) {
// calculateFortune directly modifies the quantity on the blocks ItemStack:
- calculateFortune( itemStack, fortuneLevel );
+ calculateFortune( itemStack, fortuneLevel, pmEvent.getDebugInfo() );
}
}
@@ -763,13 +812,13 @@ protected int autoPickup( PrisonMinesBlockBreakEvent pmEvent,
String mineName = pmEvent.getMine() == null ? null : pmEvent.getMine().getName();
// PlayerCache log block breaks:
- TreeMap targetBlockCounts = pmEvent.getTargetBlockCounts();
- for ( Entry targetBlockCount : targetBlockCounts.entrySet() )
- {
-
- PlayerCache.getInstance().addPlayerBlocks( pmEvent.getSpigotPlayer(), mineName,
- targetBlockCount.getKey(), targetBlockCount.getValue().intValue() );
- }
+// TreeMap targetBlockCounts = pmEvent.getTargetBlockCounts();
+// for ( Entry targetBlockCount : targetBlockCounts.entrySet() )
+// {
+//
+// PlayerCache.getInstance().addPlayerBlocks( pmEvent.getSpigotPlayer(), mineName,
+// targetBlockCount.getKey(), targetBlockCount.getValue().intValue() );
+// }
DecimalFormat fFmt = Prison.get().getDecimalFormat("#,##0.0000");
@@ -927,20 +976,52 @@ public int calculateNormalDrop( PrisonMinesBlockBreakEvent pmEvent ) {
// block.clearDrops();
// }
+ calculateSilkTouch( pmEvent );
+
List drops = pmEvent.getBukkitDrops();
if (drops != null && drops.size() > 0 ) {
- pmEvent.getDebugInfo().append( "[normalDrops]" );
+ DecimalFormat drFmt = Prison.get().getDecimalFormat("#,##0.0000");
+ double bukkitDropsMultiplier =
+ isBoolean( AutoFeatures.isCalculateFortuneEnabled ) ?
+ getDouble( AutoFeatures.fortuneBukkitDropsMultiplier ) :
+ 1.0d;
+
+ StringBuilder sb = new StringBuilder();
+ for (SpigotItemStack sItemStack : drops) {
+ if ( sb.length() > 0 ) {
+ sb.append( "," );
+ }
+ int amtBukkit = sItemStack.getAmount();
+ int amt = (int) (amtBukkit * bukkitDropsMultiplier);
+ if ( amt < 1 ) {
+ amt = 1;
+ }
+ sb.append( sItemStack.getName() ).append( ":" )
+ .append( amt );
+ if ( amt != amtBukkit ) {
+ sItemStack.setAmount( amt );
+ sb.append( "(").append( amtBukkit ).append( ")" );
+ }
+ }
+ if ( bukkitDropsMultiplier != 1.0d ) {
+ sb.insert( 0, ": " );
+ sb.insert( 0, drFmt.format( bukkitDropsMultiplier) );
+ sb.insert( 0, "bukkitDropMult=" );
+ }
+
+ pmEvent.getDebugInfo().append( "[normalDrops:: " ).append( sb ).append( "] ");
+
// Need better drop calculation that is not using the getDrops function.
- short fortuneLevel = getFortune( pmEvent.getItemInHand() );
+ short fortuneLevel = getFortune( pmEvent.getItemInHand(), pmEvent.getDebugInfo() );
- calculateSilkTouch( pmEvent.getItemInHand(), drops );
+// calculateSilkTouch( pmEvent.getItemInHand(), drops );
// Adds in additional drop items: Add Flint with gravel drops:
- calculateDropAdditions( pmEvent.getItemInHand(), drops );
+ calculateDropAdditions( pmEvent.getItemInHand(), drops, pmEvent.getDebugInfo() );
if ( isBoolean( AutoFeatures.isCalculateFortuneEnabled ) ) {
@@ -949,7 +1030,7 @@ public int calculateNormalDrop( PrisonMinesBlockBreakEvent pmEvent ) {
for ( SpigotItemStack itemStack : drops ) {
// calculateFortune directly modifies the quantity on the blocks ItemStack:
- calculateFortune( itemStack, fortuneLevel );
+ calculateFortune( itemStack, fortuneLevel, pmEvent.getDebugInfo() );
}
}
@@ -970,16 +1051,16 @@ public int calculateNormalDrop( PrisonMinesBlockBreakEvent pmEvent ) {
}
- String mineName = pmEvent.getMine() == null ? null : pmEvent.getMine().getName();
+// String mineName = pmEvent.getMine() == null ? null : pmEvent.getMine().getName();
- // PlayerCache log block breaks:
- TreeMap targetBlockCounts = pmEvent.getTargetBlockCounts();
- for ( Entry targetBlockCount : targetBlockCounts.entrySet() )
- {
-
- PlayerCache.getInstance().addPlayerBlocks( pmEvent.getSpigotPlayer(), mineName,
- targetBlockCount.getKey(), targetBlockCount.getValue().intValue() );
- }
+// // PlayerCache log block breaks:
+// TreeMap targetBlockCounts = pmEvent.getTargetBlockCounts();
+// for ( Entry targetBlockCount : targetBlockCounts.entrySet() )
+// {
+//
+// PlayerCache.getInstance().addPlayerBlocks( pmEvent.getSpigotPlayer(), mineName,
+// targetBlockCount.getKey(), targetBlockCount.getValue().intValue() );
+// }
@@ -991,7 +1072,7 @@ public int calculateNormalDrop( PrisonMinesBlockBreakEvent pmEvent ) {
count += itemStack.getAmount();
// Since this is not auto pickup, then only autosell if set in the pmEvent:
- if ( pmEvent.isForceAutoSell() ) {
+ if ( pmEvent.isForceAutoSell() && SellAllUtil.get() != null ) {
Player player = pmEvent.getPlayer();
@@ -1014,10 +1095,15 @@ public int calculateNormalDrop( PrisonMinesBlockBreakEvent pmEvent ) {
// Just get the calculated value for the drops... do not sell:
Player player = pmEvent.getPlayer();
- double amount = SellAllUtil.get().sellAllSell( player, itemStack, true, false, false );
- autosellTotal += amount;
+ pmEvent.getDebugInfo().append( "(dropping: " + itemStack.getName() + " qty: " + itemStack.getAmount() );
- pmEvent.getDebugInfo().append( "(adding: " + itemStack.getName() + " qty: " + itemStack.getAmount() + " value: " + amount + ") ");
+ if ( SellAllUtil.get() != null ) {
+
+ double amount = SellAllUtil.get().sellAllSell( player, itemStack, true, false, false );
+ autosellTotal += amount;
+ pmEvent.getDebugInfo().append( " value: " + amount );
+ }
+ pmEvent.getDebugInfo().append( ") ");
}
dropAtBlock( itemStack, pmEvent.getSpigotBlock() );
@@ -1259,7 +1345,7 @@ protected void dropExtra( HashMap extra, Player player
final long nanoStart = System.nanoTime();
// bypass delay (cooldown), no sound
- SellAllUtil.get().sellAllSell(player, false, !saNote, saNote, false, false, false, amounts );
+ sellAllUtil.sellAllSell(player, false, !saNote, saNote, false, false, false, amounts );
final long nanoStop = System.nanoTime();
long nanoTime = nanoStop - nanoStart;
@@ -2296,12 +2382,36 @@ protected void incrementCounterInName( ItemStack itemInHand, ItemMeta meta ) {
* @param blocks
* @param fortuneLevel
*/
- protected void calculateFortune(SpigotItemStack blocks, int fortuneLevel) {
+ protected void calculateFortune(SpigotItemStack blocks, int fortuneLevelOriginal, StringBuilder debugInfo ) {
- if (fortuneLevel > 0) {
+ if (fortuneLevelOriginal > 0) {
+
+ StringBuilder debugSb = new StringBuilder();
+
+
+ DecimalFormat dFmt = new DecimalFormat( "#,##0.0000" );
+ DecimalFormat iFmt = new DecimalFormat( "#,##0" );
+
+ int blockCount = blocks.getAmount();
+
+ // Apply max fortune level if setup:
+ int fortuneLevel = fortuneLevelOriginal;
+
+ double fortuneMultiplierGlobal = getDouble( AutoFeatures.fortuneMultiplierGlobal );
+
+ // If the adjustedfortuneMultipler is greater than the permitted max value then use the max value.
+ // A zero value for fortuneMultiplierMax indicates no max should be used.
+ int fortuneMultiplierMax = getInteger( AutoFeatures.fortuneMultiplierMax );
+ String maxFort = "";
+ if ( fortuneMultiplierMax != 0d && fortuneLevel > fortuneMultiplierMax ) {
+ fortuneLevel = fortuneMultiplierMax;
+ maxFort = String.format("max=%s ", iFmt.format( fortuneMultiplierMax ));
+ }
- int count = blocks.getAmount();
+
+ int count = blockCount;
+ int multiplier = 1;
if ( isBoolean( AutoFeatures.isExtendBukkitFortuneCalculationsEnabled ) ) {
@@ -2317,12 +2427,21 @@ protected void calculateFortune(SpigotItemStack blocks, int fortuneLevel) {
// The count has the final value so set it as the amount:
blocks.setAmount( count );
}
- return;
+
+ String msg = String.format(
+ "(calcExtdBukkitFortune: oDrops=%s mult= %sglbMult=%s drops=%s %s) ",
+ iFmt.format( blockCount ),
+// iFmt.format( multiplier ),
+ maxFort,
+ dFmt.format( fortuneMultiplierGlobal ),
+ iFmt.format( count ),
+ debugSb
+ );
+ debugInfo.append( msg );
}
- if ( isBoolean( AutoFeatures.isCalculateAltFortuneEnabled ) ) {
+ else if ( isBoolean( AutoFeatures.isCalculateAltFortuneEnabled ) ) {
- int multiplier = 1;
// Due to variations with gold and wood PickAxe need to use a dynamic
// Material name selection which will fit for the version of MC that is
@@ -2348,6 +2467,8 @@ protected void calculateFortune(SpigotItemStack blocks, int fortuneLevel) {
xMat == XMaterial.POTATO ||
xMat == XMaterial.GRASS ||
xMat == XMaterial.WHEAT ) {
+
+
multiplier = getRandom().nextInt( fortuneLevel );
// limits slightly greater than standard:
@@ -2369,15 +2490,18 @@ protected void calculateFortune(SpigotItemStack blocks, int fortuneLevel) {
}
- // If the adjustedfortuneMultipler is greater than the permitted max value then use the max value.
- // A zero value for fortuneMultiplierMax indicates no max should be used.
- int fortuneMultiplierMax = getInteger( AutoFeatures.fortuneMultiplierMax );
- if ( fortuneMultiplierMax != 0d && multiplier > fortuneMultiplierMax ) {
- multiplier = fortuneMultiplierMax;
- }
+// // If the adjustedfortuneMultipler is greater than the permitted max value then use the max value.
+// // A zero value for fortuneMultiplierMax indicates no max should be used.
+// int fortuneMultiplierMax = getInteger( AutoFeatures.fortuneMultiplierMax );
+// if ( fortuneMultiplierMax != 0d && multiplier > fortuneMultiplierMax ) {
+// multiplier = fortuneMultiplierMax;
+// }
+
+
+
+// // add the multiplier to the count:
+// count *= (multiplier * fortuneMultiplierGlobal);
- // add the multiplier to the count:
- count += multiplier;
}
@@ -2434,17 +2558,41 @@ else if (
xMat == XMaterial.SNOW_BLOCK
) {
- multiplier = calculateFortuneMultiplier( fortuneLevel, multiplier );
- // multiply the multiplier:
- count *= multiplier;
+ multiplier = calculateFortuneMultiplier( fortuneLevel, debugSb );
+// // multiply the multiplier:
+// count *= multiplier;
+
+// // add the multiplier to the count:
+// count *= (multiplier * fortuneMultiplierGlobal);
+//
+ }
+
+ // add the multiplier to the count:
+ count *= (multiplier * fortuneMultiplierGlobal);
+
+ // Ensure that there are no ZERO drops:
+ if ( count <= 1 ) {
+ count = 1;
}
+ // The count has the final value so set it as the amount:
+ blocks.setAmount( count );
+
+
+ String msg = String.format(
+ "(calcAltFortune: blks=%s mult=%s %sglbMult=%s drops=%s %s) ",
+ iFmt.format( blockCount ),
+ iFmt.format( multiplier ),
+ maxFort,
+ dFmt.format( fortuneMultiplierGlobal ),
+ iFmt.format( count ),
+ debugSb
+ );
+ debugInfo.append( msg );
}
- // The count has the final value so set it as the amount:
- blocks.setAmount( count );
}
}
@@ -2514,19 +2662,25 @@ private int calculateBukkitExtendedFortuneBlockCount( SpigotItemStack blocks, in
adjFortuneMultiplierCapped = fortuneMultiplierMax;
}
+ double fortuneMultiplierGlobal = getDouble( AutoFeatures.fortuneMultiplierGlobal );
- bukkitExtendedFortuneBlockCount = (int) (blocks.getAmount() * adjFortuneMultiplierCapped);
+ bukkitExtendedFortuneBlockCount = (int) (blocks.getAmount() *
+ adjFortuneMultiplierCapped *
+ fortuneMultiplierGlobal );
if ( Output.get().isDebug( DebugTarget.blockBreakFortune ) ) {
String message = "### calculateBukkitExtendedFortuneBlockCount ### " +
"fortuneLevel: %d defaultBlocks: %d fortMult: %f " +
+ "fortMultGlobal: %f " +
"rndRngLow: %f rndRngHigh: %f rndFactor: %f adjFortMult: %f " +
"maxMultiplier: %f extendedFortuneBlockCount= %d";
message = String.format( message,
fortuneLevel, blocks.getAmount(),
- fortuneMultiplier, randomFactorRangeLow, randomFactorRangeHigh,
+ fortuneMultiplier,
+ fortuneMultiplierGlobal,
+ randomFactorRangeLow, randomFactorRangeHigh,
randomFactor, adjustedFortuneMultiplier,
adjFortuneMultiplierCapped, bukkitExtendedFortuneBlockCount );
@@ -2606,13 +2760,26 @@ private int calculateBukkitExtendedFortuneBlockCount( SpigotItemStack blocks, in
*
* The results of this function will be the number of drops with an input value of one.
+ * So without fortune, it's is assumed the number of drops for breaking one block will always
+ * be one. So the results of this function are the number of drops that should be used instead.
+ * But since multiple blocks can be broken and processed with this function, the results of this
+ * function should be multiplied the quantity of drops that are calculated without fortune.
+ * For example, if the results is 3, that means that 3 items should be dropped, but if there were
+ * 10 input blocks from an explosion event, then it needs to be multiplied by 3 for a total drop
+ * value of 30.
+ *
+ *
* @param fortuneLevel
* @param multiplier
- * @return
+ * @return Drop quantity to apply for 1 block breakage.
*/
- private int calculateFortuneMultiplier(int fortuneLevel, int multiplier) {
+ private int calculateFortuneMultiplier(int fortuneLevel, StringBuilder debugInfo) {
int rnd = getRandom().nextInt( 100 );
-
+
+ int multiplier = 1;
+
switch (fortuneLevel) {
case 0:
break;
@@ -2704,6 +2871,8 @@ else if (rnd <= 70) {
// Use a random number that is a double:
double rndD = getRandom().nextDouble() * 100d;
+ DecimalFormat dFmt = new DecimalFormat( "#,##0.0000" );
+
if ( rndD <= threshold ) {
// Passed the threshold, so calculate the multiplier.
@@ -2717,40 +2886,70 @@ else if (rnd <= 70) {
// The multiplier is the floor of units. Do not round up.
multiplier = 1 + (int) Math.floor( units );
+
+ debugInfo.append( " [rnd: " + dFmt.format( rndD ) )
+ .append( " / threshold: " + threshold )
+ .append( " / fort: " + fortuneLevel )
+ .append( " =: " + multiplier )
+ .append( "] " );
}
-
- }
-
-
- // If the adjustedfortuneMultipler is greater than the permitted max value then use the max value.
- // A zero value for fortuneMultiplierMax indicates no max should be used.
- int fortuneMultiplierMax = getInteger( AutoFeatures.fortuneMultiplierMax );
- if ( fortuneMultiplierMax != 0d && multiplier > fortuneMultiplierMax ) {
- multiplier = fortuneMultiplierMax;
+ else {
+
+ debugInfo.append( " [multNotApplied rnd: " + dFmt.format( rndD ) )
+ .append( " threshold: " + threshold )
+ .append( " fort: " + fortuneLevel )
+ .append( " mult: " + multiplier )
+ .append( "] " );
+ }
+
}
- return multiplier;
+ return (int) multiplier;
}
/**
+ * If silk touch is enabled, then use block-for-block block mined is the blocks dropped.
+ * No provision is provided for the block types.
+ *
+ *
* This function has yet to be implemented, but it should implement behavior if
* silk touch is enabled for the tool.
*
*
- * @param itemInHand
- * @param drops
+ * https://minecraft.fandom.com/wiki/Silk_Touch
+ *
+ * @param pmEvent
*/
- @SuppressWarnings( "unused" )
- private void calculateSilkTouch(SpigotItemStack itemInHand, List drops) {
+ private void calculateSilkTouch( PrisonMinesBlockBreakEvent pmEvent ) {
+
+ SpigotItemStack itemInHand = pmEvent.getItemInHand();
if ( isBoolean( AutoFeatures.isCalculateSilkEnabled ) && hasSilkTouch( itemInHand )) {
+
+ List stacks = new ArrayList<>();
- for (SpigotItemStack itemStack : drops) {
-
- // If stack is gravel, then there is a 10% chance of dropping flint.
+ SpigotBlock sBlock = pmEvent.getSpigotBlock();
+
+ String lore = null;
+ stacks.add( new SpigotItemStack( 1, sBlock, lore) );
+
+ for ( SpigotBlock spBlock : pmEvent.getExplodedBlocks() ) {
+ stacks.add( new SpigotItemStack( 1, spBlock, lore) );
}
+
+ // Merge all of the single quantity item stacks together, then
+ // set as the new drops:
+ pmEvent.setBukkitDrops( mergeDrops( stacks ) );
+
+ int count = 0;
+ for ( SpigotItemStack sItemStack : pmEvent.getBukkitDrops() ) {
+ count += sItemStack.getAmount();
+ }
+ String msg = String.format( "(SilkDrops: %d) " , count );
+
+ pmEvent.getDebugInfo().append( msg );
}
}
@@ -2776,7 +2975,8 @@ private void calculateSilkTouch(SpigotItemStack itemInHand, List drops) {
+ private void calculateDropAdditions(SpigotItemStack itemInHand, List drops,
+ StringBuilder debugInfo ) {
if ( isBoolean( AutoFeatures.isCalculateDropAdditionsEnabled ) ) {
@@ -2787,7 +2987,7 @@ private void calculateDropAdditions(SpigotItemStack itemInHand, List 0 ) {
@@ -2814,19 +3014,22 @@ private void calculateDropAdditions(SpigotItemStack itemInHand, List calculateDropAdditionsGravelFlint(SpigotItemStack itemInHand,
SpigotItemStack itemStack,
- List drops ) {
+ List drops,
+ StringBuilder debugInfo ) {
List adds = new ArrayList();
PrisonBlock gravel = SpigotUtil.getPrisonBlock( XMaterial.GRAVEL );
if (itemStack.getMaterial().compareTo( gravel ) == 0 && !hasSilkTouch(itemInHand)) {
+ StringBuilder debugSb = new StringBuilder();
+
int quantity = 1;
int threshold = 10;
// If fortune is enabled on the tool, then increase drop odds by:
// 1 = 14%, 2 = 25%, 3+ = 100%
- int fortune = getFortune(itemInHand);
+ int fortune = getFortune(itemInHand, debugSb);
switch (fortune) {
case 0:
// No additional threshold when fortune is zero:
@@ -2860,7 +3063,14 @@ private List calculateDropAdditionsGravelFlint(SpigotItemStack
PrisonBlock flint = SpigotUtil.getPrisonBlock( XMaterial.FLINT );
SpigotItemStack flintStack = new SpigotItemStack( quantity, flint );
adds.add(flintStack);
+
+ debugInfo.append( "(add flint drop: qty=" )
+ .append( quantity )
+ .append( " [)" )
+ .append( debugSb )
+ .append( "])" );
}
+
}
return adds;
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerBlockBreakEvents.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerBlockBreakEvents.java
index 65c296129..55dd38947 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerBlockBreakEvents.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerBlockBreakEvents.java
@@ -255,12 +255,13 @@ private void handleBlockBreakEvent( BlockBreakEvent e, BlockBreakPriority bbPrio
// If the event is canceled, it still needs to be processed because of the
// MONITOR events:
// An event will be "canceled" and "ignored" if the block
- // BlockUtils.isUnbreakable(), or if the mine is activly resetting.
+ // BlockUtils.isUnbreakable(), or if the mine is actively resetting.
// The event will also be ignored if the block is outside of a mine
// or if the targetBlock has been set to ignore all block events which
// means the block has already been processed.
MinesEventResults eventResults = ignoreMinesBlockBreakEvent( e,
- e.getPlayer(), e.getBlock() );
+ e.getPlayer(), e.getBlock(), bbPriority, false );
+
if ( eventResults.isIgnoreEvent() ) {
return;
}
@@ -278,6 +279,7 @@ private void handleBlockBreakEvent( BlockBreakEvent e, BlockBreakPriority bbPrio
(e.isCancelled() ? "TRUE " : "FALSE")
) );
+ debugInfo.append( eventResults.getDebugInfo() );
// Process all priorities if the event has not been canceled, and
// process the MONITOR priority even if the event was canceled:
@@ -292,11 +294,14 @@ private void handleBlockBreakEvent( BlockBreakEvent e, BlockBreakPriority bbPrio
String triggered = null;
pmEvent = new PrisonMinesBlockBreakEvent(
- e.getBlock(),
- e.getPlayer(),
- eventResults.getMine(),
-// sBlock, sPlayer,
- bbPriority, eventType, triggered,
+ eventResults,
+// e.getBlock(),
+// e.getPlayer(),
+// eventResults.getMine(),
+//// sBlock, sPlayer,
+// bbPriority,
+ eventType,
+ triggered,
debugInfo );
@@ -310,7 +315,6 @@ private void handleBlockBreakEvent( BlockBreakEvent e, BlockBreakPriority bbPrio
if ( checkIfNoAccess( pmEvent, start ) ) {
e.setCancelled( true );
-
return;
}
@@ -356,13 +360,13 @@ else if ( pmEvent.getBbPriority().isMonitor() ) {
if ( cancelBy == EventListenerCancelBy.event ) {
e.setCancelled( true );
- debugInfo.append( "(event canceled) " );
+ debugInfo.append( "(cancelByEvent) " );
}
else if ( cancelBy == EventListenerCancelBy.drops ) {
try
{
e.setDropItems( false );
- debugInfo.append( "(drop canceled) " );
+ debugInfo.append( "(cancelByDrop) " );
}
catch ( NoSuchMethodError e1 )
{
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerCrazyEnchants.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerCrazyEnchants.java
index 8baa62e26..7d5b598e9 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerCrazyEnchants.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerCrazyEnchants.java
@@ -270,12 +270,14 @@ public void handleBlastUseEvent( BlastUseEvent e, BlockBreakPriority bbPriority
// If the event is canceled, it still needs to be processed because of the
// MONITOR events:
// An event will be "canceled" and "ignored" if the block
- // BlockUtils.isUnbreakable(), or if the mine is activly resetting.
+ // BlockUtils.isUnbreakable(), or if the mine is actively resetting.
// The event will also be ignored if the block is outside of a mine
// or if the targetBlock has been set to ignore all block events which
// means the block has already been processed.
MinesEventResults eventResults = ignoreMinesBlockBreakEvent( e,
- e.getPlayer(), e.getBlockList().get( 0 ) );
+ e.getPlayer(), e.getBlockList().get( 0 ),
+ bbPriority, true );
+
if ( eventResults.isIgnoreEvent() ) {
return;
}
@@ -289,6 +291,8 @@ public void handleBlastUseEvent( BlastUseEvent e, BlockBreakPriority bbPriority
(e.isCancelled() ? "TRUE " : "FALSE")
) );
+ debugInfo.append( eventResults.getDebugInfo() );
+
// NOTE that check for auto manager has happened prior to accessing this function.
@@ -299,17 +303,20 @@ public void handleBlastUseEvent( BlastUseEvent e, BlockBreakPriority bbPriority
e.getBlockList().size() > 0 ) {
- Block bukkitBlock = e.getBlockList().get( 0 );
+// Block bukkitBlock = e.getBlockList().get( 0 );
BlockEventType eventType = BlockEventType.CEXplosion;
String triggered = null;
pmEvent = new PrisonMinesBlockBreakEvent(
- bukkitBlock,
- e.getPlayer(),
- eventResults.getMine(),
- bbPriority, eventType, triggered,
+ eventResults,
+// bukkitBlock,
+// e.getPlayer(),
+// eventResults.getMine(),
+// bbPriority,
+ eventType,
+ triggered,
debugInfo );
@@ -347,7 +354,7 @@ public void handleBlastUseEvent( BlastUseEvent e, BlockBreakPriority bbPriority
// The validation was successful, but stop processing for the MONITOR priorities.
- // Note that BLOCKEVENTS processing occured already within validateEvent():
+ // Note that BLOCKEVENTS processing occurred already within validateEvent():
else if ( pmEvent.getBbPriority().isMonitor() ) {
// Stop here, and prevent additional processing.
// Monitors should never process the event beyond this.
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerPrisonEnchants.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerPrisonEnchants.java
index bf5b992f7..799113caa 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerPrisonEnchants.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerPrisonEnchants.java
@@ -266,12 +266,14 @@ public void handlePEExplosionEvent( PEExplosionEvent e, BlockBreakPriority bbPri
// If the event is canceled, it still needs to be processed because of the
// MONITOR events:
// An event will be "canceled" and "ignored" if the block
- // BlockUtils.isUnbreakable(), or if the mine is activly resetting.
+ // BlockUtils.isUnbreakable(), or if the mine is actively resetting.
// The event will also be ignored if the block is outside of a mine
// or if the targetBlock has been set to ignore all block events which
// means the block has already been processed.
MinesEventResults eventResults = ignoreMinesBlockBreakEvent( e,
- e.getPlayer(), e.getBlockBroken());
+ e.getPlayer(), e.getBlockBroken(),
+ bbPriority, true );
+
if ( eventResults.isIgnoreEvent() ) {
return;
}
@@ -286,6 +288,8 @@ public void handlePEExplosionEvent( PEExplosionEvent e, BlockBreakPriority bbPri
(e.isCancelled() ? "TRUE " : "FALSE")
) );
+ debugInfo.append( eventResults.getDebugInfo() );
+
// Process all priorities if the event has not been canceled, and
// process the MONITOR priority even if the event was canceled:
@@ -297,10 +301,13 @@ public void handlePEExplosionEvent( PEExplosionEvent e, BlockBreakPriority bbPri
String triggered = null; // e.getTriggeredBy();
pmEvent = new PrisonMinesBlockBreakEvent(
- e.getBlockBroken(),
- e.getPlayer(),
- eventResults.getMine(),
- bbPriority, eventType, triggered,
+ eventResults,
+// e.getBlockBroken(),
+// e.getPlayer(),
+// eventResults.getMine(),
+// bbPriority,
+ eventType,
+ triggered,
debugInfo );
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerPrisonsExplosiveBlockBreakEvents.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerPrisonsExplosiveBlockBreakEvents.java
index d50418cb0..64d5c0995 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerPrisonsExplosiveBlockBreakEvents.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerPrisonsExplosiveBlockBreakEvents.java
@@ -228,7 +228,8 @@ public void dumpEventListeners( StringBuilder sb ) {
}
}
- protected void handleExplosiveBlockBreakEvent( ExplosiveBlockBreakEvent e, BlockBreakPriority bbPriority ) {
+ protected void handleExplosiveBlockBreakEvent( ExplosiveBlockBreakEvent e,
+ BlockBreakPriority bbPriority ) {
PrisonMinesBlockBreakEvent pmEvent = null;
long start = System.nanoTime();
@@ -236,12 +237,13 @@ protected void handleExplosiveBlockBreakEvent( ExplosiveBlockBreakEvent e, Block
// If the event is canceled, it still needs to be processed because of the
// MONITOR events:
// An event will be "canceled" and "ignored" if the block
- // BlockUtils.isUnbreakable(), or if the mine is activly resetting.
+ // BlockUtils.isUnbreakable(), or if the mine is actively resetting.
// The event will also be ignored if the block is outside of a mine
// or if the targetBlock has been set to ignore all block events which
// means the block has already been processed.
MinesEventResults eventResults = ignoreMinesBlockBreakEvent( e,
- e.getPlayer(), e.getBlock());
+ e.getPlayer(), e.getBlock(),
+ bbPriority, true );
if ( eventResults.isIgnoreEvent() ) {
return;
@@ -257,6 +259,8 @@ protected void handleExplosiveBlockBreakEvent( ExplosiveBlockBreakEvent e, Block
(e.isCancelled() ? "TRUE " : "FALSE")
) );
+ debugInfo.append( eventResults.getDebugInfo() );
+
// Process all priorities if the event has not been canceled, and
// process the MONITOR priority even if the event was canceled:
@@ -268,10 +272,12 @@ protected void handleExplosiveBlockBreakEvent( ExplosiveBlockBreakEvent e, Block
String triggered = e.getTriggeredBy();
pmEvent = new PrisonMinesBlockBreakEvent(
- e.getBlock(),
- e.getPlayer(),
- eventResults.getMine(),
- bbPriority, eventType, triggered,
+ eventResults,
+// e.getBlock(),
+// e.getPlayer(),
+// eventResults.getMine(),
+// bbPriority,
+ eventType, triggered,
debugInfo );
@@ -333,7 +339,7 @@ protected void handleExplosiveBlockBreakEvent( ExplosiveBlockBreakEvent e, Block
// The validation was successful, but stop processing for the MONITOR priorities.
- // Note that BLOCKEVENTS processing occured already within validateEvent():
+ // Note that BLOCKEVENTS processing occurred already within validateEvent():
else if ( pmEvent.getBbPriority().isMonitor() ) {
// Stop here, and prevent additional processing.
// Monitors should never process the event beyond this.
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerRevEnchantsExplosiveEvent.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerRevEnchantsExplosiveEvent.java
index f5cbcc8c5..982094061 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerRevEnchantsExplosiveEvent.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerRevEnchantsExplosiveEvent.java
@@ -268,8 +268,10 @@ public void handleRevEnchantsExplosiveEvent( ExplosiveEvent e, BlockBreakPriorit
// or if the targetBlock has been set to ignore all block events which
// means the block has already been processed.
MinesEventResults eventResults = ignoreMinesBlockBreakEvent( e,
- e.getPlayer(), e.getBlocks().get( 0 ) );
- if ( eventResults.isIgnoreEvent() ) {
+ e.getPlayer(), e.getBlocks().get( 0 ),
+ bbPriority, true );
+
+ if ( eventResults.isIgnoreEvent() ) {
return;
}
@@ -283,6 +285,8 @@ public void handleRevEnchantsExplosiveEvent( ExplosiveEvent e, BlockBreakPriorit
(e.isCancelled() ? "TRUE " : "FALSE")
) );
+ debugInfo.append( eventResults.getDebugInfo() );
+
// NOTE that check for auto manager has happened prior to accessing this function.
@@ -294,17 +298,19 @@ public void handleRevEnchantsExplosiveEvent( ExplosiveEvent e, BlockBreakPriorit
- Block bukkitBlock = e.getBlocks().get( 0 );
+// Block bukkitBlock = e.getBlocks().get( 0 );
BlockEventType eventType = BlockEventType.RevEnExplosion;
String triggered = null;
pmEvent = new PrisonMinesBlockBreakEvent(
- bukkitBlock,
- e.getPlayer(),
- eventResults.getMine(),
- bbPriority, eventType, triggered,
+ eventResults,
+// bukkitBlock,
+// e.getPlayer(),
+// eventResults.getMine(),
+// bbPriority,
+ eventType, triggered,
debugInfo );
@@ -343,7 +349,7 @@ public void handleRevEnchantsExplosiveEvent( ExplosiveEvent e, BlockBreakPriorit
// The validation was successful, but stop processing for the MONITOR priorities.
- // Note that BLOCKEVENTS processing occured already within validateEvent():
+ // Note that BLOCKEVENTS processing occurred already within validateEvent():
else if ( pmEvent.getBbPriority().isMonitor() ) {
// Stop here, and prevent additional processing.
// Monitors should never process the event beyond this.
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerRevEnchantsJackHammerEvent.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerRevEnchantsJackHammerEvent.java
index 50d69b806..e5c1bc2ee 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerRevEnchantsJackHammerEvent.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerRevEnchantsJackHammerEvent.java
@@ -1,5 +1,7 @@
package tech.mcprison.prison.spigot.autofeatures.events;
+import java.util.List;
+
import org.bukkit.Bukkit;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@@ -14,12 +16,16 @@
import me.revils.revenchants.events.JackHammerEvent;
import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig.AutoFeatures;
+import tech.mcprison.prison.bombs.MineBombs;
import tech.mcprison.prison.mines.features.MineBlockEvent.BlockEventType;
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.SpigotPrison;
+import tech.mcprison.prison.spigot.SpigotUtil;
import tech.mcprison.prison.spigot.api.PrisonMinesBlockBreakEvent;
import tech.mcprison.prison.spigot.autofeatures.AutoManagerFeatures;
import tech.mcprison.prison.spigot.block.BlockBreakPriority;
+import tech.mcprison.prison.spigot.block.SpigotBlock;
+import tech.mcprison.prison.util.Location;
public class AutoManagerRevEnchantsJackHammerEvent
extends AutoManagerFeatures
@@ -265,13 +271,15 @@ public void handleRevEnchantsJackHammerEvent( JackHammerEvent e, BlockBreakPrior
// If the event is canceled, it still needs to be processed because of the
// MONITOR events:
// An event will be "canceled" and "ignored" if the block
- // BlockUtils.isUnbreakable(), or if the mine is activly resetting.
+ // BlockUtils.isUnbreakable(), or if the mine is actively resetting.
// The event will also be ignored if the block is outside of a mine
// or if the targetBlock has been set to ignore all block events which
// means the block has already been processed.
MinesEventResults eventResults = ignoreMinesBlockBreakEvent( e,
- e.getPlayer(), e.getBlocks().get( 0 ) );
- if ( eventResults.isIgnoreEvent() ) {
+ e.getPlayer(), e.getBlocks().get( 0 ),
+ bbPriority, true );
+
+ if ( eventResults.isIgnoreEvent() ) {
return;
}
@@ -285,6 +293,8 @@ public void handleRevEnchantsJackHammerEvent( JackHammerEvent e, BlockBreakPrior
(e.isCancelled() ? "TRUE " : "FALSE")
) );
+ debugInfo.append( eventResults.getDebugInfo() );
+
// NOTE that check for auto manager has happened prior to accessing this function.
@@ -296,16 +306,19 @@ public void handleRevEnchantsJackHammerEvent( JackHammerEvent e, BlockBreakPrior
- Block bukkitBlock = e.getBlocks().get( 0 );
+// Block bukkitBlock = e.getBlocks().get( 0 );
BlockEventType eventType = BlockEventType.RevEnJackHammer;
String triggered = null;
pmEvent = new PrisonMinesBlockBreakEvent(
- bukkitBlock, e.getPlayer(),
- eventResults.getMine(),
- bbPriority, eventType, triggered,
+ eventResults,
+// bukkitBlock, e.getPlayer(),
+// eventResults.getMine(),
+// bbPriority,
+ eventType,
+ triggered,
debugInfo );
@@ -322,11 +335,30 @@ public void handleRevEnchantsJackHammerEvent( JackHammerEvent e, BlockBreakPrior
return;
}
-
- for ( int i = 1; i < e.getBlocks().size(); i++ ) {
- pmEvent.getUnprocessedRawBlocks().add( e.getBlocks().get( i ) );
+ Location loc1 = SpigotUtil.bukkitLocationToPrison( e.getPoint1() );
+ Location loc2 = SpigotUtil.bukkitLocationToPrison( e.getPoint2() );
+
+ List blocks = MineBombs.getInstance().calculateCube( loc1, loc2 );
+
+ String msg = String.format(
+ "(JackHammerEvent: e.blocks=%d locationBlocks=%d %s %s) ",
+ e.getBlocks().size(),
+ blocks.size(),
+ loc1.toWorldCoordinates(),
+ loc2.toWorldCoordinates()
+ );
+ debugInfo.append( msg );
+
+ for (Location loc : blocks) {
+ SpigotBlock block = (SpigotBlock) loc.getBlockAt();
+
+ pmEvent.getUnprocessedRawBlocks().add( block.getWrapper() );
}
+// for ( int i = 1; i < blocks.size(); i++ ) {
+// pmEvent.getUnprocessedRawBlocks().add( blocks.get( i ) );
+// }
+
if ( !validateEvent( pmEvent ) ) {
@@ -344,7 +376,7 @@ public void handleRevEnchantsJackHammerEvent( JackHammerEvent e, BlockBreakPrior
// The validation was successful, but stop processing for the MONITOR priorities.
- // Note that BLOCKEVENTS processing occured already within validateEvent():
+ // Note that BLOCKEVENTS processing occurred already within validateEvent():
else if ( pmEvent.getBbPriority().isMonitor() ) {
// Stop here, and prevent additional processing.
// Monitors should never process the event beyond this.
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerTokenEnchant.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerTokenEnchant.java
index 0c7468bda..88240da24 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerTokenEnchant.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerTokenEnchant.java
@@ -325,12 +325,13 @@ public void handleTEBlockExplodeEvent( TEBlockExplodeEvent e, BlockBreakPriority
// If the event is canceled, it still needs to be processed because of the
// MONITOR events:
// An event will be "canceled" and "ignored" if the block
- // BlockUtils.isUnbreakable(), or if the mine is activly resetting.
+ // BlockUtils.isUnbreakable(), or if the mine is actively resetting.
// The event will also be ignored if the block is outside of a mine
// or if the targetBlock has been set to ignore all block events which
// means the block has already been processed.
MinesEventResults eventResults = ignoreMinesBlockBreakEvent( e, e.getPlayer(),
- e.getBlock());
+ e.getBlock(), bbPriority, true );
+
if ( eventResults.isIgnoreEvent() ) {
return;
}
@@ -345,6 +346,8 @@ public void handleTEBlockExplodeEvent( TEBlockExplodeEvent e, BlockBreakPriority
(e.isCancelled() ? "TRUE " : "FALSE")
) );
+ debugInfo.append( eventResults.getDebugInfo() );
+
// Process all priorities if the event has not been canceled, and
// process the MONITOR priority even if the event was canceled:
@@ -356,10 +359,13 @@ public void handleTEBlockExplodeEvent( TEBlockExplodeEvent e, BlockBreakPriority
String triggered = checkTEBlockExplodeEventTriggered( e );
pmEvent = new PrisonMinesBlockBreakEvent(
- e.getBlock(),
- e.getPlayer(),
- eventResults.getMine(),
- bbPriority, eventType, triggered,
+ eventResults,
+// e.getBlock(),
+// e.getPlayer(),
+// eventResults.getMine(),
+// bbPriority,
+ eventType,
+ triggered,
debugInfo );
@@ -401,7 +407,7 @@ public void handleTEBlockExplodeEvent( TEBlockExplodeEvent e, BlockBreakPriority
// The validation was successful, but stop processing for the MONITOR priorities.
- // Note that BLOCKEVENTS processing occured already within validateEvent():
+ // Note that BLOCKEVENTS processing occurred already within validateEvent():
else if ( pmEvent.getBbPriority().isMonitor() ) {
// Stop here, and prevent additional processing.
// Monitors should never process the event beyond this.
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerZenchantments.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerZenchantments.java
index bb016a7a4..15745d535 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerZenchantments.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerZenchantments.java
@@ -268,12 +268,14 @@ private void handleZenchantmentsBlockBreakEvent( BlockBreakEvent e, BlockBreakPr
// If the event is canceled, it still needs to be processed because of the
// MONITOR events:
// An event will be "canceled" and "ignored" if the block
- // BlockUtils.isUnbreakable(), or if the mine is activly resetting.
+ // BlockUtils.isUnbreakable(), or if the mine is actively resetting.
// The event will also be ignored if the block is outside of a mine
// or if the targetBlock has been set to ignore all block events which
// means the block has already been processed.
MinesEventResults eventResults = ignoreMinesBlockBreakEvent( e,
- e.getPlayer(), e.getBlock());
+ e.getPlayer(), e.getBlock(),
+ bbPriority, true );
+
if ( eventResults.isIgnoreEvent() ) {
return;
}
@@ -287,6 +289,8 @@ private void handleZenchantmentsBlockBreakEvent( BlockBreakEvent e, BlockBreakPr
(e.isCancelled() ? "TRUE " : "FALSE")
) );
+ debugInfo.append( eventResults.getDebugInfo() );
+
// Process all priorities if the event has not been canceled, and
// process the MONITOR priority even if the event was canceled:
@@ -298,10 +302,13 @@ private void handleZenchantmentsBlockBreakEvent( BlockBreakEvent e, BlockBreakPr
String triggered = null;
pmEvent = new PrisonMinesBlockBreakEvent(
- e.getBlock(),
- e.getPlayer(),
- eventResults.getMine(),
- bbPriority, eventType, triggered,
+ eventResults,
+// e.getBlock(),
+// e.getPlayer(),
+// eventResults.getMine(),
+// bbPriority,
+ eventType,
+ triggered,
debugInfo );
@@ -333,7 +340,7 @@ private void handleZenchantmentsBlockBreakEvent( BlockBreakEvent e, BlockBreakPr
}
// The validation was successful, but stop processing for the MONITOR priorities.
- // Note that BLOCKEVENTS processing occured already within validateEvent():
+ // Note that BLOCKEVENTS processing occurred already within validateEvent():
else if ( pmEvent.getBbPriority().isMonitor() ) {
// Stop here, and prevent additional processing.
// Monitors should never process the event beyond this.
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/PrisonDebugBlockInspector.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/PrisonDebugBlockInspector.java
index 99122fb13..27981860d 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/PrisonDebugBlockInspector.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/PrisonDebugBlockInspector.java
@@ -27,7 +27,13 @@
public class PrisonDebugBlockInspector
// extends OnBlockBreakMines
{
- OnBlockBreakMines obbMines;
+ private OnBlockBreakMines obbMines;
+
+ public enum EventDropsStatus {
+ normal,
+ canceled,
+ notSupported;
+ }
public PrisonDebugBlockInspector() {
super();
@@ -36,11 +42,46 @@ public PrisonDebugBlockInspector() {
}
public void init() {
+
+
Prison.get().getEventBus().register(this);
+
+
+
+// // Check to see if the class BlockBreakEvent even exists:
+// try {
+//
+// Output.get().logInfo( "AutoManager: Trying to register PrisonDebugBlockInspector" );
+//
+//
+//
+//
+//
+// if ( getBbPriority() != BlockBreakPriority.DISABLED ) {
+// if ( bbPriority.isComponentCompound() ) {
+//
+// for (BlockBreakPriority subBBPriority : bbPriority.getComponentPriorities()) {
+//
+// createListener( subBBPriority );
+// }
+// }
+// else {
+//
+// createListener(bbPriority);
+// }
+//
+// }
+//
+// }
+// catch ( Exception e ) {
+// Output.get().logInfo( "AutoManager: BlockBreakEvent failed to load. [%s]", e.getMessage() );
+// }
}
@Subscribe
public void onPlayerInteract( PrisonPlayerInteractEvent e ) {
+
+
ItemStack ourItem = e.getItemInHand();
ItemStack toolItem = SelectionManager.SELECTION_TOOL;
@@ -83,15 +124,16 @@ public void onPlayerInteract( PrisonPlayerInteractEvent e ) {
// // Check if it's a custom block, if it is, then change PrisonBlockType and blockName:
// checkForCustomBlock( sBlock, targetBlock );
-
- player.sendMessage(
- String.format(
+ String m1 = String.format(
"&dDebugBlockInfo: &3Mine &7%s &3Rank: &7%s " +
"&5%s &7%s",
mine.getName(),
(mine.getRank() == null ? "---" : mine.getRank().getName()),
sBlock.getBlockName(),
- location.toWorldCoordinates()) );
+ location.toWorldCoordinates());
+
+ player.sendMessage( m1 );
+ Output.get().logInfo( m1 );
// Get the mine's targetBlock:
// MineTargetPrisonBlock tBlock = mine.getTargetPrisonBlock( sBlock );
@@ -104,7 +146,7 @@ public void onPlayerInteract( PrisonPlayerInteractEvent e ) {
}
else {
- String message = String.format( "&3TargetBlock: &7%s " +
+ String message = String.format( " &3TargetBlock: &7%s " +
"&3Mined: %s%b &3Broke: &7%b",
targetBlock.getPrisonBlock().getBlockName(),
(targetBlock.isMined() ? "&d" : "&2"),
@@ -113,9 +155,10 @@ public void onPlayerInteract( PrisonPlayerInteractEvent e ) {
);
player.sendMessage( message );
+ Output.get().logInfo( message );
String message2 = String.format( " &3Counted: &7%b &3Edge: &7%b " +
- "&3Exploded: %s%b &3IgnorAllEvents: &7%b",
+ "&3Exploded: %s%b &3IgnoreAllEvents: &7%b",
targetBlock.isCounted(),
targetBlock.isEdge(),
(targetBlock.isExploded() ? "&d" : "&2"),
@@ -124,6 +167,7 @@ public void onPlayerInteract( PrisonPlayerInteractEvent e ) {
);
player.sendMessage( message2 );
+ Output.get().logInfo( message2 );
}
}
@@ -132,7 +176,7 @@ public void onPlayerInteract( PrisonPlayerInteractEvent e ) {
if ( !isSneaking ) {
player.sendMessage(
String.format(
- "&dDebugBlockInfo: &7Sneak to test BlockBreakEvent with block."
+ " &d(&7Sneak to test BlockBreakEvent with block.&d)"
) );
}
@@ -143,9 +187,8 @@ public void onPlayerInteract( PrisonPlayerInteractEvent e ) {
// ) );
// Debug the block break events:
-
+
dumpBlockBreakEvent( player, sBlock, targetBlock );
-
}
@@ -251,10 +294,18 @@ public void dumpBlockBreakEvent( SpigotPlayer player, SpigotBlock sBlock, MineTa
printEventStatus( bbe, "-initial-", "", checkBlock, targetBlock, tool, output, player );
+
for ( RegisteredListener listener : bbe.getHandlers().getRegisteredListeners() ) {
try {
- listener.callEvent( bbe );
+// boolean isPrison = listener.getPlugin().getName().equalsIgnoreCase( "Prison" );
+// boolean isSpigotListener = isPrison && listener.getListener() instanceof SpigotListener;
+
+// if ( !isSpigotListener ) {
+
+ listener.callEvent( bbe );
+// }
+
}
catch ( EventException e ) {
output.add(
@@ -308,14 +359,24 @@ public void dumpBlockBreakEvent( SpigotPlayer player, SpigotBlock sBlock, MineTa
private void printEventStatus( BlockBreakEvent bbe,
String plugin, String priority,
- SpigotBlock sBlock, MineTargetPrisonBlock targetBlock,
+ SpigotBlock sBlock,
+ MineTargetPrisonBlock targetBlock,
SpigotItemStack tool,
- List output, SpigotPlayer player ) {
+ List output,
+ SpigotPlayer player ) {
+
StringBuilder sb = new StringBuilder();
sb.append( " " );
boolean isCanceled = bbe.isCancelled();
- boolean isDropItems = isDropItems( bbe );
+ EventDropsStatus isDropCanceled = isDropCanceled( bbe );
+ String dropStats = "&7" + isDropCanceled.name();
+ if ( isDropCanceled == EventDropsStatus.canceled ) {
+ dropStats = "&4" + isDropCanceled.name();
+ }
+ else if ( isDropCanceled == EventDropsStatus.notSupported ) {
+ dropStats = "&d" + isDropCanceled.name();
+ }
// Get a fresh copy of the block to ensure we pickup the latest status:
SpigotBlock sBlk = (SpigotBlock) sBlock.getLocation().getBlockAt();
@@ -324,56 +385,73 @@ private void printEventStatus( BlockBreakEvent bbe,
obbMines.collectBukkitDrops( bukkitDrops, targetBlock, tool, sBlk, player );
bukkitDrops = obbMines.mergeDrops( bukkitDrops );
- sb.append( " &3Plugin: &7" ).append( plugin ).append( " " )
- .append( priority == null ? "" : priority ).append( " " );
- sb.append( "&3Canceled: " ).append( isCanceled ? "&c" : "&a" )
- .append( isCanceled ? "true " : "false" );
-
-// if ( !sBlock.getBlockName().equalsIgnoreCase( sBlk.getBlockName() )) {
-//
-// sb.append( " &a" ).append( sBlk.getBlockName() ).append( " " );
-// }
+ String msg = String.format( " &3Plugin: &7%-15s &2EventPriority: &7%-9s "
+ + "&2EventCanceled: &7%5s &2DropsCanceled: &7%s",
+ plugin,
+ ( priority == null ? "$dnone" : priority ),
+ ( isCanceled ? "&4true " : "false" ),
+ dropStats
+ );
+ sb.append( msg );
-
- if ( !isDropItems ) {
-
- sb.append( " &3No Drops" );
- }
+
output.add( sb.toString() );
+ sb.setLength( 0 );
- if ( isDropItems ) {
- sb.setLength( 0 );
+ SpigotBlock eventBlock = SpigotBlock.getSpigotBlock( bbe.getBlock() );
+
+ String msg2 = String.format( " &aEventBlock: &b%s ",
+ eventBlock == null ?
+ "&4none" :
+ eventBlock.getBlockNameFormal() );
+ sb.append( msg2 );
+
+ sb.append( " &aDrops:" );
+ if ( bukkitDrops.size() > 0 ) {
- sb.append( " &3Drops:" );
// List drops = sBlk.getDrops( tool );
for ( ItemStack itemStack : bukkitDrops )
{
- sb.append( " &a" ).append( itemStack.getName() );
+// SpigotItemStack sis = (SpigotItemStack) itemStack;
+
+ sb.append( " &b" ).append( itemStack.getName() );
if ( itemStack.getAmount() > 0 ) {
- sb.append( "&3(&2" ).append( itemStack.getAmount() ).append( "&3)" );
+ sb.append( "&a(&b" ).append( itemStack.getAmount() ).append( "&a)" );
}
}
-
- if ( bukkitDrops.size() > 0 ) {
- output.add( sb.toString() );
- }
}
+ else {
+ sb.append( "&4none" );
+ }
+
+ if ( sb.length() > 0 ) {
+ output.add( sb.toString() );
+ sb.setLength( 0 );
+ }
+
}
- private boolean isDropItems( BlockBreakEvent bbe ) {
- boolean results = true;
+ private EventDropsStatus isDropCanceled( BlockBreakEvent bbe ) {
+ EventDropsStatus results = EventDropsStatus.normal;
try {
- results = bbe.isDropItems();
+ if ( bbe.isDropItems() ) {
+ results = EventDropsStatus.canceled;
+ }
+ else {
+ results = EventDropsStatus.normal;
+ }
}
catch ( NoSuchMethodError e ) {
// ignore.... not supported in this version of spigot:
+ results = EventDropsStatus.notSupported;
}
catch ( Exception e ) {
// ignore.... not supported in this version of spigot:
+ results = EventDropsStatus.notSupported;
}
return results;
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/BlockBreakPriority.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/BlockBreakPriority.java
index 544a9f659..ab938a0fc 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/BlockBreakPriority.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/BlockBreakPriority.java
@@ -19,8 +19,9 @@
* nor can it run any commands through the BlockEvents.
*
*
- * BLOCKEVENT will run with a priority of HIGHEST, but will process the same as
- * MONITOR with the addition of running the BlockEvents. This will NOT break any
+ *
BLOCKEVENT will run with a priority of MONItoR, but will process the same as
+ * MONITOR with the addition of running the BlockEvents and enabling sellall on
+ * full inventory. This will NOT break any
* blocks, or process any drops.
*
*
@@ -35,11 +36,11 @@ public enum BlockBreakPriority {
HIGH( EventPriority.HIGH ),
HIGHEST( EventPriority.HIGHEST ),
- BLOCKEVENTS( EventPriority.HIGHEST ),
+ BLOCKEVENTS( EventPriority.MONITOR ),
MONITOR( EventPriority.MONITOR ),
ACCESS( EventPriority.LOWEST ),
- ACCESSBLOCKEVENTS( EventPriority.HIGHEST, ACCESS, BLOCKEVENTS ),
+ ACCESSBLOCKEVENTS( EventPriority.MONITOR, ACCESS, BLOCKEVENTS ),
ACCESSMONITOR( EventPriority.MONITOR, ACCESS, MONITOR ),
;
@@ -77,6 +78,13 @@ public static BlockBreakPriority fromString( String value ) {
return results;
}
+ public boolean isAccess() {
+ return this == ACCESS ||
+ this == ACCESSBLOCKEVENTS ||
+ this == ACCESSMONITOR
+ ;
+ }
+
public boolean isMonitor() {
return this == MONITOR ||
this == BLOCKEVENTS ||
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 0d0c02134..760da3281 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
@@ -156,9 +156,12 @@ public enum ItemLoreEnablers {
- protected MinesEventResults ignoreMinesBlockBreakEvent( Cancellable event, Player player, Block block ) {
+ protected MinesEventResults ignoreMinesBlockBreakEvent( Cancellable event, Player player,
+ Block block, BlockBreakPriority bbPriority,
+ boolean ignoreBlockReuse ) {
- MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block );
+ MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block,
+ bbPriority, ignoreBlockReuse );
if ( eventResults.isCancelEvent() ) {
event.setCancelled( eventResults.isCancelEvent() );
@@ -178,9 +181,12 @@ protected MinesEventResults ignoreMinesBlockBreakEvent( Cancellable event, Playe
* @param block
* @return
*/
- protected MinesEventResults ignoreMinesBlockBreakEvent( ExplosiveEvent event, Player player, Block block ) {
+ protected MinesEventResults ignoreMinesBlockBreakEvent( ExplosiveEvent event, Player player,
+ Block block, BlockBreakPriority bbPriority,
+ boolean ignoreBlockReuse ) {
- MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block );
+ MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block,
+ bbPriority, ignoreBlockReuse );
if ( eventResults.isCancelEvent() ) {
event.setCancelled( eventResults.isCancelEvent() );
@@ -189,9 +195,12 @@ protected MinesEventResults ignoreMinesBlockBreakEvent( ExplosiveEvent event, Pl
return eventResults;
}
- protected MinesEventResults ignoreMinesBlockBreakEvent( JackHammerEvent event, Player player, Block block ) {
+ protected MinesEventResults ignoreMinesBlockBreakEvent( JackHammerEvent event, Player player,
+ Block block, BlockBreakPriority bbPriority,
+ boolean ignoreBlockReuse ) {
- MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block );
+ MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block,
+ bbPriority, ignoreBlockReuse );
if ( eventResults.isCancelEvent() ) {
event.setCancelled( eventResults.isCancelEvent() );
@@ -200,9 +209,12 @@ protected MinesEventResults ignoreMinesBlockBreakEvent( JackHammerEvent event, P
return eventResults;
}
- protected MinesEventResults ignoreMinesBlockBreakEvent( PEExplosionEvent event, Player player, Block block ) {
+ protected MinesEventResults ignoreMinesBlockBreakEvent( PEExplosionEvent event, Player player,
+ Block block, BlockBreakPriority bbPriority,
+ boolean ignoreBlockReuse ) {
- MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block );
+ MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block,
+ bbPriority, ignoreBlockReuse );
if ( eventResults.isCancelEvent() ) {
event.setCancelled( eventResults.isCancelEvent() );
@@ -347,9 +359,9 @@ protected boolean validateEvent( PrisonMinesBlockBreakEvent pmEvent )
// pmEvent.setMine( mine );
Mine mine = pmEvent.getMine();
- debugInfo.append( "mine=" + (mine == null ? "none" : mine.getName()) + " " );
+// debugInfo.append( "mine=" + (mine == null ? "none" : mine.getName()) + " " );
- debugInfo.append( sBlockHit.getLocation().toWorldCoordinates() ).append( " " );
+// debugInfo.append( sBlockHit.getLocation().toWorldCoordinates() ).append( " " );
SpigotItemStack itemInHand = pmEvent.getItemInHand();
@@ -373,6 +385,7 @@ protected boolean validateEvent( PrisonMinesBlockBreakEvent pmEvent )
int unbreakable = 0;
int outsideOfMine = 0;
int alreadyMined = 0;
+ int monitorNotAir = 0;
int noTargetBlock = 0;
int blockTypeNotExpected = 0;
@@ -560,6 +573,11 @@ else if ( BlockUtils.getInstance().isUnbreakable( sBlockMined ) ) {
else if ( sBlockMined.isEmpty() ) {
alreadyMined++;
}
+ else if ( pmEvent.getBbPriority().isMonitor() && sBlockMined.isEmpty() &&
+ isBoolean( AutoFeatures.processMonitorEventsOnlyIfPrimaryBlockIsAIR ) ) {
+
+ monitorNotAir++;
+ }
else {
// Get the mine's targetBlock:
@@ -670,6 +688,11 @@ else if ( targetExplodedBlock.isMined() ) {
debugInfo.append( "BLOCKS_ALREADY_MINED (" + alreadyMined +
" ) " );
}
+ if ( monitorNotAir > 0 ) {
+
+ debugInfo.append( "MONITOR_BLOCKS_NOT_AIR (" + monitorNotAir +
+ " ) " );
+ }
if ( noTargetBlock > 0 ) {
debugInfo.append( "NO_TARGET_BLOCKS (" + noTargetBlock +
@@ -745,8 +768,13 @@ else if ( targetExplodedBlock.isMined() ) {
// The player does not have permission to access this mine, so do not process
//
+ String accessType = mine.isMineAccessByRank() ? "Rank" :
+ mine.isAccessPermissionEnabled() ? "Perms" : "Other?";
+
pmEvent.setCancelOriginalEvent( true );
- debugInfo.append( "ACCESS_DENIED (event canceled - Access by rank/perm/perms) " );
+ debugInfo.append( "ACCESS_DENIED (event canceled - Access by " )
+ .append( accessType )
+ .append( ") " );
results = false;
}
@@ -828,13 +856,14 @@ else if ( results && pmEvent.getBbPriority().isMonitor() && mine == null ) {
// Performs the MONITOR block counts, zero-block, and mine sweeper:
else if ( results && pmEvent.getBbPriority().isMonitor() && mine != null ) {
+ boolean isBlockEvents = pmEvent.getBbPriority() == BlockBreakPriority.BLOCKEVENTS ||
+ pmEvent.getBbPriority() == BlockBreakPriority.ACCESSBLOCKEVENTS;
// Process BLOCKEVENTS and ACCESSBLOCKEVENTs here...
// Include autosell on full inventory if isAutoSellIfInventoryIsFullForBLOCKEVENTSPriority
// is enabled.
// Includes running block events, mine sweeper, and zero-block (reset-threshold) reset.
- if ( pmEvent.getBbPriority() == BlockBreakPriority.BLOCKEVENTS ||
- pmEvent.getBbPriority() == BlockBreakPriority.ACCESSBLOCKEVENTS ) {
+ if ( isBlockEvents ) {
debugInfo.append( "(BLOCKEVENTS processing) " );
@@ -868,7 +897,10 @@ else if ( results && pmEvent.getBbPriority().isMonitor() && mine != null ) {
}
countBlocksMined( pmEvent, sBlockHit );
- processPrisonBlockEventCommands( pmEvent, sBlockHit );
+
+ if ( isBlockEvents ) {
+ processPrisonBlockEventCommands( pmEvent, sBlockHit );
+ }
debugInfo.append( "(MONITOR - singular) " );
@@ -877,7 +909,10 @@ else if ( results && pmEvent.getBbPriority().isMonitor() && mine != null ) {
for ( SpigotBlock sBlock : pmEvent.getExplodedBlocks() ) {
countBlocksMined( pmEvent, sBlock );
- processPrisonBlockEventCommands( pmEvent, sBlock );
+
+ if ( isBlockEvents ) {
+ processPrisonBlockEventCommands( pmEvent, sBlock );
+ }
}
debugInfo.append( "(MONITOR - " +
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventListener.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventListener.java
index 6fa167d13..d7ad293f5 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventListener.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakEventListener.java
@@ -1,16 +1,13 @@
package tech.mcprison.prison.spigot.block;
-import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig.AutoFeatures;
-import tech.mcprison.prison.mines.PrisonMines;
-import tech.mcprison.prison.modules.Module;
-
-import java.util.Optional;
-
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import tech.mcprison.prison.Prison;
+import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig.AutoFeatures;
import tech.mcprison.prison.autofeatures.AutoFeaturesWrapper;
+import tech.mcprison.prison.mines.PrisonMines;
+import tech.mcprison.prison.modules.Module;
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.SpigotPrison;
import tech.mcprison.prison.spigot.autofeatures.events.AutoManagerBlockBreakEvents;
@@ -136,9 +133,10 @@ public OnBlockBreakEventListener() {
public boolean isEnabled() {
boolean results = false;
- Optional mmOptional = Prison.get().getModuleManager().getModule( PrisonMines.MODULE_NAME );
- if ( mmOptional.isPresent() && mmOptional.get().isEnabled() ) {
- PrisonMines prisonMines = (PrisonMines) mmOptional.get();
+ Module module = Prison.get().getModuleManager().getModule( PrisonMines.MODULE_NAME );
+
+ if ( module != null && module.isEnabled() ) {
+ PrisonMines prisonMines = (PrisonMines) module;
results = prisonMines != null;
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakMines.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakMines.java
index 059dac480..382a535fb 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakMines.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/OnBlockBreakMines.java
@@ -2,7 +2,6 @@
import java.util.ArrayList;
import java.util.List;
-import java.util.Optional;
import java.util.TreeMap;
import java.util.UUID;
@@ -11,6 +10,8 @@
import tech.mcprison.prison.Prison;
import tech.mcprison.prison.PrisonAPI;
+import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig.AutoFeatures;
+import tech.mcprison.prison.autofeatures.AutoFeaturesWrapper;
import tech.mcprison.prison.integration.CustomBlockIntegration;
import tech.mcprison.prison.internal.ItemStack;
import tech.mcprison.prison.internal.block.MineTargetPrisonBlock;
@@ -20,10 +21,14 @@
import tech.mcprison.prison.mines.PrisonMines;
import tech.mcprison.prison.mines.data.Mine;
import tech.mcprison.prison.modules.Module;
+import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.SpigotUtil;
import tech.mcprison.prison.spigot.api.PrisonMinesBlockBreakEvent;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.utils.BlockUtils;
+import tech.mcprison.prison.tasks.PrisonCommandTaskData;
+import tech.mcprison.prison.tasks.PrisonCommandTasks;
+import tech.mcprison.prison.tasks.PrisonCommandTaskData.TaskMode;
public class OnBlockBreakMines
extends OnBlockBreakEventCoreMessages
@@ -31,6 +36,21 @@ public class OnBlockBreakMines
private PrisonMines prisonMineManager;
private boolean mineModuleDisabled = false;
+ enum EventResultsReasons {
+ result_reason_not_yet_set,
+ results_passed,
+ cancel_event__block_is_locked,
+ ignore_event__block_is_not_in_a_mine,
+ cancel_event__mine_mutex__mine_resetting,
+ ignore_event__target_block_ignore_all_events,
+ ignore_event__block_already_counted,
+ cancel_event__block_already_counted,
+ ignore_event__monitor_priority_but_not_AIR,
+ cancel_event__player_has_no_access
+ ;
+
+ }
+
public OnBlockBreakMines() {
super();
@@ -39,15 +59,93 @@ public OnBlockBreakMines() {
}
public class MinesEventResults {
+
+ private EventResultsReasons resultsReason = EventResultsReasons.result_reason_not_yet_set;
+
private boolean cancelEvent = false;
private boolean ignoreEvent = false;
+
+ BlockBreakPriority bbPriority;
private Mine mine = null;
+ private SpigotPlayer sPlayer;
+
+ private Block block;
+ private SpigotBlock spigotBlock;
+
- public MinesEventResults() {
+ public MinesEventResults( BlockBreakPriority bbPriority, SpigotPlayer sPlayer, Block block ) {
super();
+
+ this.bbPriority = bbPriority;
+ this.sPlayer = sPlayer;
+ this.block = block;
+ }
+
+ public void logDebugInfo() {
+ if ( isIgnoreEvent() &&
+ Output.get().isDebug() ) {
+
+ String blockName = getSpigotBlock() == null ?
+ "noPrisonBlock" :
+ getSpigotBlock().getBlockName();
+ String blockLocation = getSpigotBlock() == null ?
+ "" :
+ getSpigotBlock().getLocation().toWorldCoordinates();
+
+ Output.get().logInfo( "Prison AutoFeatures Fast-Fail: %s %s %s %s %s%s",
+ getResultsReason().name(),
+ getBbPriority().name(),
+ getSpigotPlayer().getName(),
+
+ getMine() == null ? "noMine" : getMine().getName(),
+ blockName,
+ blockLocation
+ );
+ }
}
+
+ public String getDebugInfo() {
+
+ String blockName = getSpigotBlock() == null ?
+ "noPrisonBlock" :
+ getSpigotBlock().getBlockName();
+ String blockLocation = getSpigotBlock() == null ?
+ "" :
+ getSpigotBlock().getLocation().toWorldCoordinates();
+
+ return String.format(
+ "AutoFeatures: %s %s %s %s %s%s ",
+ getResultsReason().name(),
+ getBbPriority().name(),
+ getSpigotPlayer().getName(),
+
+ getMine() == null ? "noMine" : getMine().getName(),
+ blockName,
+ blockLocation );
+ }
+ public EventResultsReasons getResultsReason() {
+ return resultsReason;
+ }
+ public void setResultsReason(EventResultsReasons resultsReason) {
+ this.resultsReason = resultsReason;
+ }
+
+ public BlockBreakPriority getBbPriority() {
+ return bbPriority;
+ }
+ public void setBbPriority(BlockBreakPriority bbPriority) {
+ this.bbPriority = bbPriority;
+ }
+
+ public SpigotPlayer getSpigotPlayer() {
+ return sPlayer;
+ }
+ public void setSpigotPlayer(SpigotPlayer sPlayer) {
+ this.sPlayer = sPlayer;
+ }
+
public Mine getMine() {
return mine;
}
@@ -68,6 +166,21 @@ public boolean isIgnoreEvent() {
public void setIgnoreEvent( boolean ignoreEvent ) {
this.ignoreEvent = ignoreEvent;
}
+
+ public Block getBlock() {
+ return block;
+ }
+ public void setBlock(Block block) {
+ this.block = block;
+ }
+
+ public SpigotBlock getSpigotBlock() {
+ return spigotBlock;
+ }
+ public void setSpigotBlock(SpigotBlock spigotBlock) {
+ this.spigotBlock = spigotBlock;
+ }
+
}
public Mine findMine( Player player, SpigotBlock sBlock, List altBlocksSource, PrisonMinesBlockBreakEvent pmEvent )
@@ -81,7 +194,7 @@ public Mine findMine( UUID playerUUID, SpigotBlock sBlock, List altBlocks
// Get the cached mine, if it exists:
Mine mine = getPlayerCache().get( playerUUIDLSB );
-
+
if ( mine == null || sBlock != null && !mine.isInMineExact( sBlock.getLocation() ) )
{
// Look for the correct mine to use.
@@ -163,48 +276,124 @@ public Mine findMine( UUID playerUUID, SpigotBlock sBlock, List altBlocks
* @param block
* @return
*/
- protected MinesEventResults ignoreMinesBlockBreakEvent( Player player, Block block ) {
+ protected MinesEventResults ignoreMinesBlockBreakEvent( Player player,
+ Block block,
+ BlockBreakPriority bbPriority,
+ boolean ignoreBlockReuse ) {
- MinesEventResults results = new MinesEventResults();
+ SpigotPlayer sPlayer = new SpigotPlayer( player );
+
+ MinesEventResults results = new MinesEventResults( bbPriority, sPlayer, block );
SpigotBlock sBlock = SpigotBlock.getSpigotBlock( block );
+ results.setSpigotBlock( sBlock );
+
if ( BlockUtils.getInstance().isUnbreakable( sBlock ) ) {
+ results.setResultsReason( EventResultsReasons.cancel_event__block_is_locked );
+
results.setCancelEvent( true );
results.setIgnoreEvent( true );
}
-
- Mine mine = findMine( player, sBlock, null, null );
- results.setMine( mine );
-
- if ( mine == null ) {
- // Prison is unable to process blocks outside of mines right now, so exit:
+ else if ( bbPriority.isMonitor() && !sBlock.isEmpty() &&
+ AutoFeaturesWrapper.getInstance().isBoolean(
+ AutoFeatures.processMonitorEventsOnlyIfPrimaryBlockIsAIR ) ) {
+
+ results.setResultsReason( EventResultsReasons.ignore_event__monitor_priority_but_not_AIR );
+
results.setIgnoreEvent( true );
}
else {
- // If not minable, then display message and exit.
- if ( !mine.getMineStateMutex().isMinable() ) {
+ Mine mine = findMine( player, sBlock, null, null );
+ results.setMine( mine );
+
+ if ( mine == null ) {
+ // Prison is unable to process blocks outside of mines right now, so exit:
+ results.setResultsReason( EventResultsReasons.ignore_event__block_is_not_in_a_mine );
- SpigotPlayer sPlayer = new SpigotPlayer( player );
- sPlayer.setActionBar( mineIsBeingResetMsg( mine.getTag() ) );
- results.setCancelEvent( true );
results.setIgnoreEvent( true );
}
else {
- MineTargetPrisonBlock targetBlock = mine.getTargetPrisonBlock( sBlock );
-
- // If ignore all block events, then exit this function without logging anything:
- if ( targetBlock != null && targetBlock.isIgnoreAllBlockEvents() ) {
+ // If not minable, then display message and exit.
+ if ( !mine.getMineStateMutex().isMinable() ) {
+ results.setResultsReason( EventResultsReasons.cancel_event__mine_mutex__mine_resetting );
+
+ sPlayer.setActionBar( mineIsBeingResetMsg( mine.getTag() ) );
+ results.setIgnoreEvent( true );
+ results.setCancelEvent( true );
+
+ }
+ else if ( bbPriority.isAccess() && !mine.hasMiningAccess(sPlayer) ) {
- // Do not cancel the event... let other plugins deal with it... prison does not care about this block.
- //event.setCancelled( true );
+ results.setResultsReason( EventResultsReasons.cancel_event__player_has_no_access );
results.setIgnoreEvent( true );
+ results.setCancelEvent( true );
+
+ if ( sPlayer != null &&
+ AutoFeaturesWrapper.getInstance()
+ .isBoolean( AutoFeatures.eventPriorityACCESSFailureTPToCurrentMine ) ) {
+ // run the `/mines tp` command for the player which will TP them to a
+ // mine they can access:
+
+ String debugInfo = String.format(
+ "ACCESS failed: teleport %s to valid mine.",
+ sPlayer.getName() );
+
+ PrisonCommandTaskData cmdTask = new PrisonCommandTaskData( debugInfo,
+ "mines tp", 0 );
+ cmdTask.setTaskMode( TaskMode.syncPlayer );
+
+ PrisonCommandTasks.submitTasks( sPlayer, cmdTask );
+
+ }
+
+ }
+ else {
+
+ MineTargetPrisonBlock targetBlock = mine.getTargetPrisonBlock( sBlock );
+
+ if ( targetBlock != null ) {
+
+ // If ignore all block events, then exit this function without logging anything:
+ if ( targetBlock.isIgnoreAllBlockEvents() ) {
+
+ // Do not cancel the event... let other plugins deal with it... prison does not care about this block.
+ results.setResultsReason( EventResultsReasons.ignore_event__target_block_ignore_all_events );
+
+ //event.setCancelled( true );
+ results.setIgnoreEvent( true );
+ }
+
+ // If the block's already been counted, then can ignore the event:
+ else if ( !ignoreBlockReuse && targetBlock.isCounted() ) {
+
+ results.setResultsReason( EventResultsReasons.ignore_event__block_already_counted );
+
+ results.setIgnoreEvent( true );
+
+ // Cancel the event if the setting is enabled:
+ if ( AutoFeaturesWrapper.getInstance().isBoolean(
+ AutoFeatures.ifBlockIsAlreadyCountedThenCancelEvent ) ) {
+
+ results.setResultsReason( EventResultsReasons.cancel_event__block_already_counted );
+
+ results.setCancelEvent( true );
+ }
+ }
+ }
}
+
+
}
-
}
+ if ( results.getResultsReason() == EventResultsReasons.result_reason_not_yet_set ) {
+ results.setResultsReason( EventResultsReasons.results_passed );
+ }
+
+ results.logDebugInfo();
+
return results;
}
@@ -490,9 +679,11 @@ private TreeMap getPlayerCache() {
private PrisonMines getPrisonMineManager() {
if ( prisonMineManager == null && !isMineModuleDisabled() ) {
- Optional mmOptional = Prison.get().getModuleManager().getModule( PrisonMines.MODULE_NAME );
- if ( mmOptional.isPresent() && mmOptional.get().isEnabled() ) {
- PrisonMines prisonMines = (PrisonMines) mmOptional.get();
+
+ Module module = Prison.get().getModuleManager().getModule( PrisonMines.MODULE_NAME );
+
+ if ( module != null && module.isEnabled() ) {
+ PrisonMines prisonMines = (PrisonMines) module;
this.prisonMineManager = prisonMines;
} else {
setMineModuleDisabled( true );
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/SpigotItemStack.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/SpigotItemStack.java
index 9c8b13e23..fa3c32710 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/SpigotItemStack.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/SpigotItemStack.java
@@ -13,13 +13,12 @@
import com.cryptomorin.xseries.XMaterial;
-import de.tr7zw.nbtapi.NBTItem;
import tech.mcprison.prison.Prison;
import tech.mcprison.prison.internal.ItemStack;
import tech.mcprison.prison.internal.block.PrisonBlock;
-import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.SpigotUtil;
import tech.mcprison.prison.spigot.compat.SpigotCompatibility;
+import tech.mcprison.prison.spigot.nbt.PrisonNBTUtil;
import tech.mcprison.prison.util.Text;
public class SpigotItemStack
@@ -29,6 +28,7 @@ public class SpigotItemStack
// private NBTItem nbtBukkitStack;
// private boolean nbtChecked = false;
// private org.bukkit.inventory.ItemStack bukkitStack;
+ private org.bukkit.inventory.ItemStack deserialize;
public SpigotItemStack( org.bukkit.inventory.ItemStack bukkitStack )
throws PrisonItemStackNotSupportedRuntimeException {
@@ -121,10 +121,26 @@ private void setupBukkitStack( org.bukkit.inventory.ItemStack bukkitStack ) {
public SpigotItemStack(String displayName, int amount, PrisonBlock material, String... lore) {
super(displayName, amount, material, lore );
+
+ SpigotItemStack sItemStack = SpigotUtil.getSpigotItemStack( material, amount );
+
+ this.bukkitStack = sItemStack.getBukkitStack();
+
+ if ( bukkitStack != null ) {
+ setupBukkitStack( bukkitStack );
+ }
}
public SpigotItemStack(int amount, PrisonBlock material, String... lore) {
super( amount, material, lore );
+
+ SpigotItemStack sItemStack = SpigotUtil.getSpigotItemStack( material, amount );
+
+ this.bukkitStack = sItemStack.getBukkitStack();
+
+ if ( bukkitStack != null ) {
+ setupBukkitStack( bukkitStack );
+ }
}
@@ -164,21 +180,21 @@ public void setPrisonBlock( PrisonBlock pBlock ) {
// return nbtBukkitStack != null;
// }
- public NBTItem getNBT() {
- NBTItem nbtItemStack = null;
-
- if ( getBukkitStack() != null && getBukkitStack().getType() != Material.AIR ) {
- try {
- nbtItemStack = new NBTItem( getBukkitStack(), true );
-
- nbtDebugLog( nbtItemStack, "getNbt" );
- } catch (Exception e) {
- // ignore - the bukkit item stack is not compatible with the NBT library
- }
- }
-
- return nbtItemStack;
- }
+// public NBTItem getNBT() {
+// NBTItem nbtItemStack = null;
+//
+// if ( getBukkitStack() != null && getBukkitStack().getType() != Material.AIR ) {
+// try {
+// nbtItemStack = new NBTItem( getBukkitStack(), true );
+//
+// nbtDebugLog( nbtItemStack, "getNbt" );
+// } catch (Exception e) {
+// // ignore - the bukkit item stack is not compatible with the NBT library
+// }
+// }
+//
+// return nbtItemStack;
+// }
// private void applyNbt( NBTItem nbtItem ) {
// if ( nbtItem != null && getBukkitStack() != null ) {
@@ -189,54 +205,57 @@ public NBTItem getNBT() {
// }
// }
- private void nbtDebugLog( NBTItem nbtItem, String desc ) {
- if ( Output.get().isDebug() ) {
- org.bukkit.inventory.ItemStack iStack = nbtItem.getItem();
-
- int sysId = System.identityHashCode(iStack);
-
- String message = String.format(
- "NBT %s ItemStack for %s: %s sysId: %d",
- desc,
- iStack.hasItemMeta() && iStack.getItemMeta().hasDisplayName() ?
- iStack.getItemMeta().getDisplayName() :
- iStack.getType().name(),
- nbtItem.toString(),
- sysId );
-
- Output.get().logInfo( message );
-
- Output.get().logInfo( "NBT: " + new NBTItem( getBukkitStack() ) );
-
- }
- }
+// private void nbtDebugLog( NBTItem nbtItem, String desc ) {
+// if ( Output.get().isDebug() ) {
+// org.bukkit.inventory.ItemStack iStack = nbtItem.getItem();
+//
+// int sysId = System.identityHashCode(iStack);
+//
+// String message = String.format(
+// "NBT %s ItemStack for %s: %s sysId: %d",
+// desc,
+// iStack.hasItemMeta() && iStack.getItemMeta().hasDisplayName() ?
+// iStack.getItemMeta().getDisplayName() :
+// iStack.getType().name(),
+// nbtItem.toString(),
+// sysId );
+//
+// Output.get().logInfo( message );
+//
+// Output.get().logInfo( "NBT: " + new NBTItem( getBukkitStack() ) );
+//
+// }
+// }
public boolean hasNBTKey( String key ) {
- boolean results = false;
+ boolean results = PrisonNBTUtil.hasNBTString( getBukkitStack(), key);
- NBTItem nbtItem = getNBT();
- if ( nbtItem != null ) {
- results = nbtItem.hasKey( key );
- }
+// NBTItem nbtItem = getNBT();
+// if ( nbtItem != null ) {
+// results = nbtItem.hasKey( key );
+// }
return results;
}
public String getNBTString( String key ) {
- String results = null;
+ String results = PrisonNBTUtil.getNBTString( getBukkitStack(), key);
- NBTItem nbtItem = getNBT();
- if ( nbtItem != null ) {
- results = nbtItem.getString( key );
- }
+// NBTItem nbtItem = getNBT();
+// if ( nbtItem != null ) {
+// results = nbtItem.getString( key );
+// }
return results;
}
public void setNBTString( String key, String value ) {
- NBTItem nbtItem = getNBT();
- if ( nbtItem != null ) {
- nbtItem.setString( key, value );
- nbtDebugLog( nbtItem, "setNBTString" );
- }
+
+ PrisonNBTUtil.setNBTString( getBukkitStack(), key, value );
+
+// NBTItem nbtItem = getNBT();
+// if ( nbtItem != null ) {
+// nbtItem.setString( key, value );
+// nbtDebugLog( nbtItem, "setNBTString" );
+// }
}
// public int getNBTInt( String key ) {
@@ -431,6 +450,17 @@ public Map serialize()
return results;
}
+
+ public static SpigotItemStack deserialize( Map map )
+ {
+// -String prisonVersion = (String) map.get( "prison_version" );
+
+ org.bukkit.inventory.ItemStack iStack = org.bukkit.inventory.ItemStack.deserialize(map);
+
+ SpigotItemStack sItemStack = new SpigotItemStack( iStack );
+
+ return sItemStack;
+ }
/**
* This function will return information on the item in the item stack, which is for
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bstats/PrisonBStats.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bstats/PrisonBStats.java
index c4fc01adb..6b36cc4eb 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bstats/PrisonBStats.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bstats/PrisonBStats.java
@@ -4,7 +4,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
@@ -119,8 +118,8 @@ public void initMetricsOnEnable() {
getbStatsMetrics().addCustomChart( spApiLevel );
- Optional prisonMinesOpt = Prison.get().getModuleManager().getModule( PrisonMines.MODULE_NAME );
- Optional prisonRanksOpt = Prison.get().getModuleManager().getModule( PrisonRanks.MODULE_NAME );
+ PrisonMines prisonMines = (PrisonMines) Prison.get().getModuleManager().getModule( PrisonMines.MODULE_NAME );
+ PrisonRanks prisonRanks = (PrisonRanks) Prison.get().getModuleManager().getModule( PrisonRanks.MODULE_NAME );
// delete: "prison_ranks"
@@ -143,57 +142,63 @@ public void initMetricsOnEnable() {
// or they will never update their values when bstats runs them during their intervals!!
getbStatsMetrics().addCustomChart( new SimplePie( "prison_default_rank_counts", () -> {
- int defaultRankCount = prisonRanksOpt.map(module -> ((PrisonRanks) module).getDefaultLadderRankCount()).orElse(0);
+
+ int defaultRankCount = prisonRanks.getDefaultLadderRankCount();
+
+// int defaultRankCount = prisonRanksOpt.map(module -> ((PrisonRanks) module).getDefaultLadderRankCount()).orElse(0);
return Integer.toString( defaultRankCount );
}) );
getbStatsMetrics().addCustomChart( new SimplePie( "prison_prestiges_rank_counts", () -> {
- int prestigesRankCount = prisonRanksOpt.map(module -> ((PrisonRanks) module).getPrestigesLadderRankCount()).orElse(0);
+ int prestigesRankCount = prisonRanks.getPrestigesLadderRankCount();
return Integer.toString( prestigesRankCount );
}) );
getbStatsMetrics().addCustomChart( new SimplePie( "prison_other_rank_counts", () -> {
- int rankCountTotal = prisonRanksOpt.map(module -> ((PrisonRanks) module).getRankCount()).orElse(0);
- int defaultRankCount = prisonRanksOpt.map(module -> ((PrisonRanks) module).getDefaultLadderRankCount()).orElse(0);
- int prestigesRankCount = prisonRanksOpt.map(module -> ((PrisonRanks) module).getPrestigesLadderRankCount()).orElse(0);
+ int rankCountTotal = prisonRanks.getRankCount();
+ int defaultRankCount = prisonRanks.getDefaultLadderRankCount();
+ int prestigesRankCount = prisonRanks.getPrestigesLadderRankCount();
int otherRankCount = rankCountTotal - defaultRankCount - prestigesRankCount;
return Integer.toString( otherRankCount );
}) );
getbStatsMetrics().addCustomChart( new SimplePie( "prison_total_rank_counts", () -> {
- int rankCountTotal = prisonRanksOpt.map(module -> ((PrisonRanks) module).getRankCount()).orElse(0);
+ int rankCountTotal = prisonRanks.getRankCount();
return Integer.toString( rankCountTotal );
}) );
getbStatsMetrics().addCustomChart( new SimplePie( "prison_total_ladder_counts", () -> {
- int ladderCount = prisonRanksOpt.map(module -> ((PrisonRanks) module).getladderCount()).orElse(0);
+ int ladderCount = prisonRanks.getladderCount();
return Integer.toString( ladderCount );
}) );
getbStatsMetrics().addCustomChart( new SimplePie( "prison_total_mine_counts", () -> {
- int mineCount = prisonMinesOpt.map(module -> ((PrisonMines) module).getMineManager().getMines().size()).orElse(0);
+ int mineCount = prisonMines.getMineManager().getMines().size();
return Integer.toString( mineCount );
}) );
getbStatsMetrics().addCustomChart( new SimplePie( "prison_total_player_counts", () -> {
- int playerCount = prisonRanksOpt.map(module -> ((PrisonRanks) module).getPlayersCount()).orElse(0);
+ int playerCount = prisonRanks.getPlayersCount();
return Integer.toString( playerCount );
}) );
+ boolean ranksEnabled = ( PrisonRanks.getInstance() != null && PrisonRanks.getInstance().isEnabled() );
+
getbStatsMetrics().addCustomChart( new SimplePie( "prison_total_active_player_counts", () -> {
- int playerCountActive = PrisonRanks.getInstance().getPlayerManager() == null ?
+ int playerCountActive = !ranksEnabled ?
-1 :
TopNPlayers.getInstance().getTopNSize();
return Integer.toString( playerCountActive );
}) );
+
getbStatsMetrics().addCustomChart( new SimplePie( "prison_total_archived_player_counts", () -> {
- int playerCountArchived = PrisonRanks.getInstance().getPlayerManager() == null ?
+ int playerCountArchived = !ranksEnabled ?
-1 :
TopNPlayers.getInstance().getArchivedSize();
return Integer.toString( playerCountArchived );
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 f2a9b8a8d..2481f67dc 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
@@ -1,7 +1,5 @@
package tech.mcprison.prison.spigot.commands;
-import java.util.Optional;
-
import org.bukkit.entity.Player;
import tech.mcprison.prison.Prison;
@@ -94,8 +92,9 @@ protected void cmdPrisonManagerPrestiges( CommandSender sender, int page, String
}
}
- Optional ranksModule = Prison.get().getModuleManager().getModule( PrisonRanks.MODULE_NAME );
- if ( !ranksModule.isPresent() || ranksModule.isPresent() && !ranksModule.get().isEnabled() ) {
+ Module ranksModule = Prison.get().getModuleManager().getModule( PrisonRanks.MODULE_NAME );
+
+ if ( ranksModule == null || ranksModule != null && !ranksModule.isEnabled() ) {
Output.get().sendWarn( sender, "The command '/gui prestiges' is disabled because the Ranks module is not active." );
return;
@@ -232,8 +231,9 @@ protected void cmdPrisonManagerRanks(CommandSender sender, int page, String cmdP
}
}
- Optional ranksModule = Prison.get().getModuleManager().getModule( PrisonRanks.MODULE_NAME );
- if ( !ranksModule.isPresent() || ranksModule.isPresent() && !ranksModule.get().isEnabled() ) {
+ Module module = Prison.get().getModuleManager().getModule( PrisonRanks.MODULE_NAME );
+
+ if ( module == null || module != null && !module.isEnabled() ) {
Output.get().sendWarn( sender, "The command '/gui ranks' is disabled because the Ranks module is not active." );
return;
@@ -273,8 +273,8 @@ protected void cmdPrisonManagerAdminRanks(CommandSender sender, String ladder,
}
- Optional ranksModule = Prison.get().getModuleManager().getModule( PrisonRanks.MODULE_NAME );
- if ( !ranksModule.isPresent() || ranksModule.isPresent() && !ranksModule.get().isEnabled() ) {
+ Module ranksModule = Prison.get().getModuleManager().getModule( PrisonRanks.MODULE_NAME );
+ if ( ranksModule == null || ranksModule != null && !ranksModule.isEnabled() ) {
Output.get().sendWarn( sender, "The command '/gui admin ranks' is disabled because the Ranks module is not active." );
return;
@@ -351,8 +351,9 @@ protected void cmdPrisonManagerLadders(CommandSender sender, int page, String cm
}
}
- Optional ranksModule = Prison.get().getModuleManager().getModule( PrisonRanks.MODULE_NAME );
- if ( !ranksModule.isPresent() || ranksModule.isPresent() && !ranksModule.get().isEnabled() ) {
+ Module ranksModule = Prison.get().getModuleManager().getModule( PrisonRanks.MODULE_NAME );
+
+ if ( ranksModule == null || ranksModule != null && !ranksModule.isEnabled() ) {
Output.get().sendWarn( sender, "The command '/gui ladders' is disabled because the Ranks module is not active." );
return;
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 de747116b..da434a465 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
@@ -2,7 +2,6 @@
import java.util.ArrayList;
import java.util.List;
-import java.util.Optional;
import org.bukkit.entity.Player;
@@ -34,8 +33,9 @@ public void prestigesGUICommand(CommandSender sender) {
return;
}
- Optional ranksModule = Prison.get().getModuleManager().getModule( PrisonRanks.MODULE_NAME );
- if ( !ranksModule.isPresent() || ranksModule.isPresent() && !ranksModule.get().isEnabled() ) {
+ Module ranksModule = Prison.get().getModuleManager().getModule( PrisonRanks.MODULE_NAME );
+
+ if ( ranksModule == null || ranksModule != null && !ranksModule.isEnabled() ) {
Output.get().sendWarn( sender, "The command '/prestiges' is disabled because the Ranks module is not active." );
return;
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotRanksCommands.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotRanksCommands.java
index 9514be5c8..608a0bcd4 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotRanksCommands.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotRanksCommands.java
@@ -1,7 +1,5 @@
package tech.mcprison.prison.spigot.commands;
-import java.util.Optional;
-
import tech.mcprison.prison.Prison;
import tech.mcprison.prison.commands.Arg;
import tech.mcprison.prison.commands.Command;
@@ -31,8 +29,9 @@ public void ranksGUICommand(CommandSender sender,
// NOTE: This command will NOT be registered if ranks module fails to load, so this is just a fallback
// safety measure:
- Optional ranksModule = Prison.get().getModuleManager().getModule( PrisonRanks.MODULE_NAME );
- if ( !ranksModule.isPresent() || ranksModule.isPresent() && !ranksModule.get().isEnabled() ) {
+ Module ranksModule = Prison.get().getModuleManager().getModule( PrisonRanks.MODULE_NAME );
+
+ if ( ranksModule == null || ranksModule != null && !ranksModule.isEnabled() ) {
Output.get().sendWarn( sender, "The command '/ranks' is disabled because the Ranks module is not active." );
return;
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 d4108c081..9bb582477 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
@@ -501,7 +501,7 @@ private void sellAllGuiCommand(CommandSender sender,
// If the sender's an admin (OP or have the prison.admin permission) it'll send an error message.
if (p.hasPermission("prison.admin")) {
- new SpigotVariousGuiMessages().sellallIsDisabledMsg( sender );
+ new SpigotVariousGuiMessages().sellallGUIIsDisabledMsg(sender);
// Output.get().sendError(sender,
// messages.getString(MessagesConfig.StringID.spigot_message_gui_sellall_disabled));
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/CompatibilityBlocks.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/CompatibilityBlocks.java
index 1c983191f..dc3bc50ad 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/CompatibilityBlocks.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/CompatibilityBlocks.java
@@ -64,5 +64,10 @@ public interface CompatibilityBlocks
public void setBlockFace( Block bBlock, BlockFace blockFace );
public ItemStack getLapisItemStack();
+
+
+ public int getMinY();
+
+ public int getMaxY();
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/CompatibilityCache.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/CompatibilityCache.java
index 70d3a6095..d03d50497 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/CompatibilityCache.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/CompatibilityCache.java
@@ -7,7 +7,6 @@
import com.cryptomorin.xseries.XMaterial;
-import tech.mcprison.prison.internal.block.PrisonBlock;
import tech.mcprison.prison.spigot.SpigotPrison;
/**
@@ -95,7 +94,7 @@ private void initializeForcedCache() {
- public XMaterial getCachedXMaterial( PrisonBlock prisonBlock )
+ public XMaterial getCachedXMaterial( tech.mcprison.prison.internal.block.Block prisonBlock )
{
String key = prisonBlock.getBlockName();
@@ -105,7 +104,7 @@ public XMaterial getCachedXMaterial( PrisonBlock prisonBlock )
return xMat; // xMat == NULL_TOKEN ? null : xMat;
}
- public void putCachedXMaterial( PrisonBlock prisonBlock, XMaterial xMat )
+ public void putCachedXMaterial( tech.mcprison.prison.internal.block.Block prisonBlock, XMaterial xMat )
{
String key = prisonBlock.getBlockName();
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot118.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot118.java
new file mode 100644
index 000000000..f4ef76aab
--- /dev/null
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot118.java
@@ -0,0 +1,18 @@
+package tech.mcprison.prison.spigot.compat;
+
+public class Spigot118
+ extends Spigot113
+{
+
+
+ @Override
+ public int getMinY() {
+ return -64;
+ }
+
+ @Override
+ public int getMaxY() {
+ return 320;
+ }
+
+}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot18Blocks.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot18Blocks.java
index ce648dfd8..8594d6924 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot18Blocks.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot18Blocks.java
@@ -731,5 +731,17 @@ public ItemStack getLapisItemStack() {
// }
// return null;
}
+
+
+
+ @Override
+ public int getMinY() {
+ return 0;
+ }
+
+ @Override
+ public int getMaxY() {
+ return 255;
+ }
}
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 60381bd77..6199c23c5 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
@@ -41,14 +41,14 @@ else if ( svData.compareTo( new BluesSemanticVersionData( "1.13.0" ) ) < 0 ) {
results = new Spigot19();
}
-// else if ( svData.compareTo( new BluesSemanticVersionData( "1.13.0" ) ) < 0 ) {
-//
-// results = new Spigot110();
-// }
- else {
+ else if ( svData.compareTo( new BluesSemanticVersionData( "1.18.0" ) ) < 0 ) {
results = new Spigot113();
}
+ else {
+
+ results = new Spigot118();
+ }
}
Output.get().logInfo( "Using version adapter " + results.getClass().getName());
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/GuiConfig.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/GuiConfig.java
index 904f97b4c..1335180ba 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/GuiConfig.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/GuiConfig.java
@@ -3,11 +3,16 @@
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.LinkedHashMap;
import java.util.List;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
+import com.cryptomorin.xseries.XMaterial;
+
+import tech.mcprison.prison.mines.PrisonMines;
+import tech.mcprison.prison.mines.data.Mine;
import tech.mcprison.prison.output.Output;
import tech.mcprison.prison.spigot.SpigotPrison;
@@ -189,6 +194,31 @@ public void initialize() {
changeCount++;
}
+ if ( conf.get( "Options.Mines.MaterialType" ) == null ) {
+
+ if ( PrisonMines.getInstance() != null ) {
+
+ LinkedHashMap map = new LinkedHashMap<>();
+
+ map.put("NoMineAccess", XMaterial.REDSTONE_BLOCK.name() );
+
+ for ( Mine mine : PrisonMines.getInstance().getMineManager().getMines() ) {
+ if ( mine.getPrisonBlocks().size() > 0 ) {
+ map.put( mine.getName(), mine.getPrisonBlocks().get(0).getBlockName() );
+ }
+ }
+
+ conf.set("Options.Mines.MaterialType", map);
+ changeCount++;
+ }
+ }
+ else if ( conf.get( "Options.Mines.MaterialType.NoMineAccess" ) == null ) {
+
+ String noMineAccess = XMaterial.REDSTONE_BLOCK.name();
+
+ conf.set("Options.Mines.MaterialType.NoMineAccess", noMineAccess );
+ changeCount++;
+ }
// Count and save
if (changeCount > 0) {
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/customblock/PrisonItemsAdder.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/customblock/PrisonItemsAdder.java
index da8153d09..18387d4fd 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/customblock/PrisonItemsAdder.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/customblock/PrisonItemsAdder.java
@@ -184,6 +184,15 @@ public List getCustomBlockList()
}
+ public void testCustomBlockRegistry() {
+
+ Output.get().logInfo( " Will list all custom blocks: ItemsAdder.getAllItems() with only isBlock():" );
+
+ for ( String itemId : itemsAdderWrapper.getNamedspacedIdsInRegistry() ) {
+ Output.get().logInfo( " CustomBlock namedspacedId: %s ", itemId );
+ }
+ }
+
@Override
public String getPluginSourceURL() {
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/customblock/PrisonItemsAdderWrapper.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/customblock/PrisonItemsAdderWrapper.java
index b327280e3..26621859d 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/customblock/PrisonItemsAdderWrapper.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/customblock/PrisonItemsAdderWrapper.java
@@ -2,6 +2,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@@ -22,6 +23,14 @@
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.util.Location;
+/**
+ *
+ * https://github.com/LoneDev6/API-ItemsAdder/
+ *
+ * https://github.com/LoneDev6/API-ItemsAdder/tree/master/src/main/java/dev/lone/itemsadder/api
+ *
+ *
+ */
public class PrisonItemsAdderWrapper {
private boolean supportsDrops = false;
@@ -32,6 +41,14 @@ public PrisonItemsAdderWrapper() {
this.plugin = SpigotPrison.getInstance();
}
+
+ public Set getNamedspacedIdsInRegistry() {
+
+ Set items = CustomBlock.getNamespacedIdsInRegistry();
+
+ return items;
+ }
+
public String getCustomBlockId( Block block ) {
org.bukkit.block.Block spigotBlock = ((SpigotBlock) block).getWrapper();
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotLocation.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotLocation.java
new file mode 100644
index 000000000..3768d291b
--- /dev/null
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotLocation.java
@@ -0,0 +1,23 @@
+package tech.mcprison.prison.spigot.game;
+
+import tech.mcprison.prison.spigot.SpigotUtil;
+import tech.mcprison.prison.util.Location;
+
+public class SpigotLocation
+ extends Location {
+
+ private org.bukkit.Location bukkitLocation;
+
+ public SpigotLocation( org.bukkit.Location bukkitLocation ) {
+ super( SpigotUtil.bukkitLocationToPrison( bukkitLocation ) );
+
+ this.bukkitLocation = bukkitLocation;
+ }
+
+ public org.bukkit.Location getBukkitLocation() {
+ return bukkitLocation;
+ }
+ public void setBukkitLocation(org.bukkit.Location bukkitLocation) {
+ this.bukkitLocation = bukkitLocation;
+ }
+}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotOfflinePlayer.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotOfflinePlayer.java
index 758ca41a6..044dc3dab 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotOfflinePlayer.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotOfflinePlayer.java
@@ -349,5 +349,24 @@ public PlayerCachePlayerData getPlayerCachePlayerData() {
public boolean isSneaking() {
return false;
}
+
+
+ @Override
+ public boolean isMinecraftStatisticsEnabled() {
+ return false;
+ }
+
+
+ @Override
+ public void incrementMinecraftStatsMineBlock( tech.mcprison.prison.internal.Player player,
+ String blockName, int quantity) {
+
+ }
+ @Override
+ public void incrementMinecraftStatsDropCount( tech.mcprison.prison.internal.Player player,
+ String blockName, int quantity) {
+
+ }
+
}
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 0c13c3c9f..d1dd9ed9d 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
@@ -25,14 +25,22 @@
import org.bukkit.GameMode;
import org.bukkit.Material;
+import org.bukkit.Statistic;
import org.bukkit.block.Block;
import org.bukkit.entity.ExperienceOrb;
import org.bukkit.event.player.PlayerTeleportEvent;
+import com.cryptomorin.xseries.XMaterial;
+
+import tech.mcprison.prison.PrisonAPI;
+import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig.AutoFeatures;
+import tech.mcprison.prison.autofeatures.AutoFeaturesWrapper;
import tech.mcprison.prison.autofeatures.PlayerMessaging.MessageType;
import tech.mcprison.prison.cache.PlayerCache;
import tech.mcprison.prison.cache.PlayerCachePlayerData;
import tech.mcprison.prison.file.JsonFileIO;
+import tech.mcprison.prison.integration.EconomyCurrencyIntegration;
+import tech.mcprison.prison.integration.EconomyIntegration;
import tech.mcprison.prison.internal.ItemStack;
import tech.mcprison.prison.internal.Player;
import tech.mcprison.prison.internal.inventory.Inventory;
@@ -665,6 +673,42 @@ public PlayerCachePlayerData getPlayerCachePlayerData() {
return PlayerCache.getInstance().getOnlinePlayer( this );
}
+
+ /**
+ * Based upon the RankPlayer's addBalance, except that this does not cache any
+ * of the transactions, so it could possibly lead to lag due to the economy plugin
+ * not have good performance on many rapid payments.
+ *
+ *
+ * @param currency
+ * @param amount
+ * @return
+ */
+ public boolean addBalance( String currency, double amount ) {
+ boolean results = false;
+
+ if ( currency == null || currency.trim().isEmpty() || "default".equalsIgnoreCase( currency ) ) {
+ // No currency specified, so use the default currency:
+
+ EconomyIntegration economy = PrisonAPI.getIntegrationManager().getEconomy();
+
+ if ( economy != null ) {
+ results = economy.addBalance( this, amount );
+ }
+
+ }
+ else {
+ EconomyCurrencyIntegration currencyEcon = PrisonAPI.getIntegrationManager()
+ .getEconomyForCurrency(currency );
+
+ if ( currencyEcon != null ) {
+ results = currencyEcon.addBalance( this, amount, currency );
+// addCachedRankPlayerBalance( currency, amount );
+ }
+ }
+ return results;
+ }
+
public boolean enableFlying( Mine mine, float flightSpeed ) {
boolean enabled = false;
@@ -723,7 +767,60 @@ public boolean isSneaking() {
}
return sneaking;
}
+
+
+ @Override
+ public boolean isMinecraftStatisticsEnabled() {
+ return AutoFeaturesWrapper.getInstance().isBoolean( AutoFeatures.isMinecraftStatsReportingEnabled );
+ }
+ @Override
+ public void incrementMinecraftStatsMineBlock( Player player, String blockName, int quantity) {
+
+// Statistic.BREAK_ITEM;
+// Statistic.DROP_COUNT;
+// Statistic.MINE_BLOCK;
+// Statistic.PICKUP;
+
+ XMaterial xMat = XMaterial.matchXMaterial( blockName ).orElse( null );
+// XMaterial xMat = SpigotCompatibility.getInstance().getXMaterial( block );
+
+ if ( xMat != null ) {
+ Material mat = xMat.parseMaterial();
+
+ if ( mat != null ) {
+
+ getWrapper().incrementStatistic( Statistic.MINE_BLOCK, xMat.parseMaterial(), quantity );
+
+ }
+ }
+
+// Statistic.MINE_BLOCK;
+// player.setStatistic(null, count);
+// player.incrementStatistic(null, null);
+// player.incrementStatistic(null, null, count);
+// player.statistic
+
+ }
+
+ @Override
+ public void incrementMinecraftStatsDropCount( Player player, String blockName, int quantity) {
+
+ XMaterial xMat = XMaterial.matchXMaterial( blockName ).orElse( null );
+
+ if ( xMat != null ) {
+ Material mat = xMat.parseMaterial();
+
+ if ( mat != null ) {
+
+ getWrapper().incrementStatistic( Statistic.DROP_COUNT, xMat.parseMaterial(), quantity );
+
+ }
+ }
+
+ }
+
+
public boolean isInventoryFull() {
boolean results = false;
@@ -737,5 +834,6 @@ public boolean isInventoryFull() {
return results;
}
-
+
+
}
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 cb91343e8..ba981046d 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
@@ -56,12 +56,12 @@
import tech.mcprison.prison.spigot.gui.mine.SpigotMinesBlocksGUI;
import tech.mcprison.prison.spigot.gui.mine.SpigotMinesConfirmGUI;
import tech.mcprison.prison.spigot.gui.mine.SpigotMinesGUI;
+import tech.mcprison.prison.spigot.gui.rank.SpigotGUIMessages;
import tech.mcprison.prison.spigot.gui.rank.SpigotLaddersGUI;
import tech.mcprison.prison.spigot.gui.rank.SpigotRankManagerGUI;
import tech.mcprison.prison.spigot.gui.rank.SpigotRankPriceGUI;
import tech.mcprison.prison.spigot.gui.rank.SpigotRankUPCommandsGUI;
import tech.mcprison.prison.spigot.gui.rank.SpigotRanksGUI;
-import tech.mcprison.prison.spigot.gui.rank.SpigotGUIMessages;
import tech.mcprison.prison.spigot.gui.sellall.SellAllAdminAutoSellGUI;
import tech.mcprison.prison.spigot.gui.sellall.SellAllAdminBlocksGUI;
import tech.mcprison.prison.spigot.gui.sellall.SellAllAdminGUI;
@@ -405,7 +405,7 @@ public void onClick(InventoryClickEvent e){
// Get parameters.
buttonNameMain = SpigotPrison.stripColor(e.getCurrentItem().getItemMeta().getDisplayName());
parts = buttonNameMain.split(" ");
- module = Prison.get().getModuleManager().getModule(PrisonRanks.MODULE_NAME).orElse(null);
+ module = Prison.get().getModuleManager().getModule(PrisonRanks.MODULE_NAME);
title = Text.stripColor( compat.getGUITitle(e) );
} catch (ArrayIndexOutOfBoundsException ex){
Output.get().sendWarn(new SpigotPlayer(p), "An error occurred while using the GUI, please check logs.");
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotGUIMenuTools.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotGUIMenuTools.java
index e5279fe08..195fb4b9b 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotGUIMenuTools.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotGUIMenuTools.java
@@ -11,7 +11,6 @@
import com.cryptomorin.xseries.XMaterial;
-import de.tr7zw.nbtapi.NBTItem;
import tech.mcprison.prison.spigot.gui.guiutility.Button;
import tech.mcprison.prison.spigot.gui.guiutility.ButtonLore;
import tech.mcprison.prison.spigot.gui.guiutility.PrisonGUI;
@@ -348,12 +347,12 @@ public boolean processGUIPage( Player p, String title, InventoryClickEvent e ) {
if ( currentItem != null ) {
- PrisonNBTUtil nbtUtil = new PrisonNBTUtil();
- NBTItem nbtItem = nbtUtil == null ? null : nbtUtil.getNBT(currentItem);
+// PrisonNBTUtil nbtUtil = new PrisonNBTUtil();
+// NBTItem nbtItem = nbtUtil == null ? null : nbtUtil.getNBT(currentItem);
// process if NBTs are enabled:
- if ( nbtItem != null && nbtUtil.hasNBTKey(nbtItem, GUI_MENU_TOOLS_NBT_ENABLED) ) {
- String command = nbtUtil.getNBTString(nbtItem, GUI_MENU_TOOLS_NBT_COMMAND);
+ if ( PrisonNBTUtil.getNBTBoolean(currentItem, GUI_MENU_TOOLS_NBT_ENABLED) ) {
+ String command = PrisonNBTUtil.getNBTString(currentItem, GUI_MENU_TOOLS_NBT_COMMAND);
if ( command != null ) {
isPageAction = true;
@@ -410,18 +409,19 @@ private void addButtonNBT( Button guiButton, GUIMenuPageData pageData, int page
if ( pageData != null ) {
- PrisonNBTUtil nbtUtil = new PrisonNBTUtil();
- NBTItem nbtItem = nbtUtil == null ? null : nbtUtil.getNBT( guiButton.getButtonItem() );
+// PrisonNBTUtil nbtUtil = new PrisonNBTUtil();
+// NBTItem nbtItem = nbtUtil == null ? null : nbtUtil.getNBT( guiButton.getButtonItem() );
// process if NBTs are enabled:
- if ( nbtItem != null ) {
+// if ( nbtItem != null )
+ {
String command = pageData.getCommandToRun() +
( page <= 0 ? "" : " " + page);
// String command = GUI_MENU_TOOLS_COMMAND + pageData.getCommandToRun() +
// ( page <= 0 ? "" : " " + page);
- nbtUtil.setNBTString(nbtItem, GUI_MENU_TOOLS_NBT_ENABLED, "true");
- nbtUtil.setNBTString(nbtItem, GUI_MENU_TOOLS_NBT_COMMAND, command );
+ PrisonNBTUtil.setNBTBoolean( guiButton.getButtonItem(), GUI_MENU_TOOLS_NBT_ENABLED, true);
+ PrisonNBTUtil.setNBTString( guiButton.getButtonItem(), GUI_MENU_TOOLS_NBT_COMMAND, command );
}
}
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 8e059a685..23ef463ea 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
@@ -150,7 +150,7 @@ protected List createLore( String... lores ) {
* @param p
* */
protected boolean checkRanks(Player p){
- Module module = Prison.get().getModuleManager().getModule( PrisonRanks.MODULE_NAME ).orElse( null );
+ Module module = Prison.get().getModuleManager().getModule( PrisonRanks.MODULE_NAME );
if(!(module instanceof PrisonRanks)){
Output.get().sendWarn(new SpigotPlayer(p), "&c[ERROR] The GUI can't open because the &3Ranks module &cisn't loaded");
p.closeInventory();
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 f3161c9ad..33437fced 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
@@ -9,7 +9,6 @@
import com.cryptomorin.xseries.XMaterial;
-import de.tr7zw.nbtapi.NBTItem;
import me.clip.placeholderapi.PlaceholderAPI;
import tech.mcprison.prison.Prison;
import tech.mcprison.prison.mines.PrisonMines;
@@ -105,7 +104,20 @@ public void open() {
// Load the generic mine LORE that would be displayed first:
List configCustomLore = guiConfig.getStringList("EditableLore.Mines");
-
+ String noMineAccessBlockType = guiConfig.getString( "Options.Mines.MaterialType.NoMineAccess" );
+ if ( noMineAccessBlockType == null ) {
+ noMineAccessBlockType = XMaterial.REDSTONE_BLOCK.name();
+ }
+ else {
+ // Validate that it is valid, otherwise use redstone_block:
+ try {
+ XMaterial.valueOf( noMineAccessBlockType );
+ }
+ catch (Exception e) {
+ noMineAccessBlockType = XMaterial.REDSTONE_BLOCK.name();
+ }
+ }
+
// Make the buttons for every Mine with info
for (Mine m : minesDisplay) {
// for (Mine m : mines.getSortedList()) {
@@ -121,7 +133,8 @@ public void open() {
mineLore.addAll( mineLore2 );
- XMaterial xMat = XMaterial.REDSTONE_BLOCK;
+ XMaterial xMat = XMaterial.valueOf( noMineAccessBlockType );
+// XMaterial xMat = XMaterial.REDSTONE_BLOCK;
// Bug: Cannot safely use Material due to variants prior to bukkit v1.13:
// Material material;
@@ -257,11 +270,11 @@ public void open() {
p.getName() );
// Before adding the button, add an NBT tag for the command and rank name:
- PrisonNBTUtil nbtUtil = new PrisonNBTUtil();
- NBTItem nbtItem = nbtUtil == null ? null : nbtUtil.getNBT( itemMine.getButtonItem());
- nbtUtil.setNBTString(nbtItem, SpigotGUIMenuTools.GUI_MENU_TOOLS_NBT_ENABLED, "true");
- nbtUtil.setNBTString(nbtItem, SpigotGUIMenuTools.GUI_MENU_TOOLS_NBT_COMMAND, mineTeleportCommand );
- nbtUtil.setNBTString(nbtItem, SpigotGUIMenuTools.GUI_MENU_TOOLS_NBT_MINE_NAME, m.getName() );
+// PrisonNBTUtil nbtUtil = new PrisonNBTUtil();
+// NBTItem nbtItem = nbtUtil == null ? null : nbtUtil.getNBT( itemMine.getButtonItem());
+ PrisonNBTUtil.setNBTBoolean( itemMine.getButtonItem(), SpigotGUIMenuTools.GUI_MENU_TOOLS_NBT_ENABLED, true);
+ PrisonNBTUtil.setNBTString( itemMine.getButtonItem(), SpigotGUIMenuTools.GUI_MENU_TOOLS_NBT_COMMAND, mineTeleportCommand );
+ PrisonNBTUtil.setNBTString( itemMine.getButtonItem(), SpigotGUIMenuTools.GUI_MENU_TOOLS_NBT_MINE_NAME, m.getName() );
// Add the button to the inventory.
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 139a8e11c..0ea8b0a8e 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
@@ -58,7 +58,7 @@ public SpigotPlayerPrestigesGUI(Player player, int page, String cmdPage, String
PrisonRanks rankPlugin;
RankPlayer rPlayer;
ModuleManager modMan = Prison.get().getModuleManager();
- Module module = modMan == null ? null : modMan.getModule( PrisonRanks.MODULE_NAME ).orElse( null );
+ Module module = modMan == null ? null : modMan.getModule( PrisonRanks.MODULE_NAME );
rankPlugin = (PrisonRanks) module;
if (rankPlugin == null){
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 d59b2aec3..4b1cccdb2 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
@@ -12,7 +12,6 @@
import com.cryptomorin.xseries.XMaterial;
-import de.tr7zw.nbtapi.NBTItem;
import me.clip.placeholderapi.PlaceholderAPI;
import tech.mcprison.prison.Prison;
import tech.mcprison.prison.modules.Module;
@@ -70,7 +69,7 @@ public SpigotPlayerRanksGUI(Player player, String ladderName, int page, String c
PrisonRanks rankPlugin;
RankPlayer rPlayer;
ModuleManager modMan = Prison.get().getModuleManager();
- Module module = modMan == null ? null : modMan.getModule( PrisonRanks.MODULE_NAME ).orElse( null );
+ Module module = modMan == null ? null : modMan.getModule( PrisonRanks.MODULE_NAME );
rankPlugin = (PrisonRanks) module;
// Check
@@ -268,11 +267,11 @@ public void open() {
// Before adding the button, add an NBT tag for the command and rank name:
- PrisonNBTUtil nbtUtil = new PrisonNBTUtil();
- NBTItem nbtItem = nbtUtil == null ? null : nbtUtil.getNBT( itemRank.getButtonItem());
- nbtUtil.setNBTString(nbtItem, SpigotGUIMenuTools.GUI_MENU_TOOLS_NBT_ENABLED, "true");
+// PrisonNBTUtil nbtUtil = new PrisonNBTUtil();
+// NBTItem nbtItem = nbtUtil == null ? null : nbtUtil.getNBT( itemRank.getButtonItem());
+ PrisonNBTUtil.setNBTBoolean( itemRank.getButtonItem(), SpigotGUIMenuTools.GUI_MENU_TOOLS_NBT_ENABLED, true);
// nbtUtil.setNBTString(nbtItem, SpigotGUIMenuTools.GUI_MENU_TOOLS_NBT_COMMAND, noCommmand );
- nbtUtil.setNBTString(nbtItem, SpigotGUIMenuTools.GUI_MENU_TOOLS_NBT_RANK_NAME, rank.getName() );
+ PrisonNBTUtil.setNBTString( itemRank.getButtonItem(), SpigotGUIMenuTools.GUI_MENU_TOOLS_NBT_RANK_NAME, rank.getName() );
gui.addButton(itemRank);
@@ -305,10 +304,10 @@ public void open() {
Button rankupButton = new Button( 0, XMaterial.EMERALD_BLOCK, rankupLore, rankupTitle );
String rankupCommand = "rankup " + (ladderName.equalsIgnoreCase("default") ? "" : ladderName);
- PrisonNBTUtil nbtUtil = new PrisonNBTUtil();
- NBTItem nbtItem = nbtUtil == null ? null : nbtUtil.getNBT(rankupButton.getButtonItem());
- nbtUtil.setNBTString(nbtItem, SpigotGUIMenuTools.GUI_MENU_TOOLS_NBT_ENABLED, "true");
- nbtUtil.setNBTString(nbtItem, SpigotGUIMenuTools.GUI_MENU_TOOLS_NBT_COMMAND, rankupCommand);
+// PrisonNBTUtil nbtUtil = new PrisonNBTUtil();
+// NBTItem nbtItem = nbtUtil == null ? null : nbtUtil.getNBT(rankupButton.getButtonItem());
+ PrisonNBTUtil.setNBTBoolean( rankupButton.getButtonItem(), SpigotGUIMenuTools.GUI_MENU_TOOLS_NBT_ENABLED, true);
+ PrisonNBTUtil.setNBTString( rankupButton.getButtonItem(), SpigotGUIMenuTools.GUI_MENU_TOOLS_NBT_COMMAND, rankupCommand);
// SpigotPrison.format(messages.getString(MessagesConfig.StringID.spigot_gui_lore_rankup)));
// NOTE: Button position will be properly assigned in the setButtonNextAvilable:
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/nbt/PrisonNBTUtil.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/nbt/PrisonNBTUtil.java
index 07b8f68f7..c35f26d5d 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/nbt/PrisonNBTUtil.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/nbt/PrisonNBTUtil.java
@@ -1,9 +1,9 @@
package tech.mcprison.prison.spigot.nbt;
-import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
-import de.tr7zw.nbtapi.NBTItem;
+import de.tr7zw.changeme.nbtapi.NBT;
+import de.tr7zw.changeme.nbtapi.iface.ReadWriteNBT;
import tech.mcprison.prison.output.Output;
/**
@@ -17,92 +17,173 @@
* more for testing new sections of code.
*
*
+ * References:
+ * https://github.com/tr7zw/Item-NBT-API/wiki/Using-the-NBT-API
+ *
+ *
* @author Blue
*
*/
public class PrisonNBTUtil {
- private boolean enableDebugLogging = false;
+ private static boolean enableDebugLogging = false;
- public NBTItem getNBT( ItemStack bukkitStack ) {
- NBTItem nbtItemStack = null;
-
- if ( bukkitStack != null && bukkitStack.getType() != Material.AIR ) {
- try {
- nbtItemStack = new NBTItem( bukkitStack, true );
-
- if ( isEnableDebugLogging() ) {
- nbtDebugLog( nbtItemStack, "getNbt" );
- }
-
- } catch (Exception e) {
- // ignore - the bukkit item stack is not compatible with the NBT library
- }
- }
-
- return nbtItemStack;
- }
-
-
- private void nbtDebugLog( NBTItem nbtItem, String desc ) {
+
+ public static boolean hasNBTString( ItemStack bukkitStack, String key ) {
+ String results = null;
+
+ results = getNBTString( bukkitStack, key );
+
+ return results != null && results.trim().length() > 0;
+ }
+
+ public static String getNBTString( ItemStack bukkitStack, String key ) {
+ String results = null;
+
+ results = NBT.get(bukkitStack, nbt -> nbt.getString(key));
+
+ return results;
+ }
+
+ public static void setNBTString( ItemStack bukkitStack, String key, String value ) {
+
+ NBT.modify(bukkitStack, nbt -> {
+ nbt.setString(key, value);
+ });
+
+ if ( isEnableDebugLogging() ) {
+ nbtDebugLog( bukkitStack, "setNBTString" );
+ }
+ }
+
+ public static boolean getNBTBoolean( ItemStack bukkitStack, String key ) {
+ boolean results = false;
+
+ results = NBT.get(bukkitStack, nbt -> nbt.getBoolean(key));
+
+ return results;
+ }
+
+ public static void setNBTBoolean( ItemStack bukkitStack, String key, boolean value ) {
+
+ NBT.modify(bukkitStack, nbt -> {
+ nbt.setBoolean(key, value);
+ });
+
+ if ( isEnableDebugLogging() ) {
+ nbtDebugLog( bukkitStack, "setNBTBoolean" );
+ }
+ }
+
+
+ public static void nbtDebugLog( ItemStack bukkitStack, String desc ) {
if ( Output.get().isDebug() ) {
- org.bukkit.inventory.ItemStack iStack = nbtItem.getItem();
- int sysId = System.identityHashCode(iStack);
+ String nbtDebug = nbtDebugString( bukkitStack );
+
+ int sysId = System.identityHashCode(bukkitStack);
String message = Output.stringFormat(
"NBT %s ItemStack for %s: %s sysId: %d",
desc,
- iStack.hasItemMeta() && iStack.getItemMeta().hasDisplayName() ?
- iStack.getItemMeta().getDisplayName() :
- iStack.getType().name(),
- nbtItem.toString(),
- sysId );
+ bukkitStack.hasItemMeta() && bukkitStack.getItemMeta().hasDisplayName() ?
+ bukkitStack.getItemMeta().getDisplayName() :
+ bukkitStack.getType().name(),
+ nbtDebug,
+ sysId );
Output.get().logInfo( message );
//Output.get().logInfo( "NBT: " + new NBTItem( getBukkitStack() ) );
}
- }
+ }
+
+ public static String nbtDebugString( ItemStack bukkitStack ) {
+
+ ReadWriteNBT nbtItem = NBT.itemStackToNBT(bukkitStack);
+ return nbtItem.toString();
+ }
+
+// public NBTItem getNBT( ItemStack bukkitStack ) {
+// NBTItem nbtItemStack = null;
+//
+// if ( bukkitStack != null && bukkitStack.getType() != Material.AIR ) {
+// try {
+// nbtItemStack = new NBTItem( bukkitStack, true );
+//
+// if ( isEnableDebugLogging() ) {
+// nbtDebugLog( nbtItemStack, "getNbt" );
+// }
+//
+// } catch (Exception e) {
+// // ignore - the bukkit item stack is not compatible with the NBT library
+// }
+// }
+//
+// return nbtItemStack;
+// }
- public boolean hasNBTKey( NBTItem nbtItem, String key ) {
- boolean results = false;
-
- if ( nbtItem != null ) {
- results = nbtItem.hasKey( key );
- }
-
- return results;
- }
+// private void nbtDebugLog( NBTItem nbtItem, String desc ) {
+// if ( Output.get().isDebug() ) {
+// org.bukkit.inventory.ItemStack iStack = nbtItem.getItem();
+//
+// int sysId = System.identityHashCode(iStack);
+//
+// String message = Output.stringFormat(
+// "NBT %s ItemStack for %s: %s sysId: %d",
+// desc,
+// iStack.hasItemMeta() && iStack.getItemMeta().hasDisplayName() ?
+// iStack.getItemMeta().getDisplayName() :
+// iStack.getType().name(),
+// nbtItem.toString(),
+// sysId );
+//
+// Output.get().logInfo( message );
+//
+// //Output.get().logInfo( "NBT: " + new NBTItem( getBukkitStack() ) );
+//
+// }
+// }
- public String getNBTString( NBTItem nbtItem, String key ) {
- String results = null;
-
- if ( nbtItem != null ) {
- results = nbtItem.getString( key );
- }
- return results;
- }
- public void setNBTString( NBTItem nbtItem, String key, String value ) {
-
- if ( nbtItem != null ) {
- nbtItem.setString( key, value );
-
- if ( isEnableDebugLogging() ) {
- nbtDebugLog( nbtItem, "setNBTString" );
- }
- }
- }
+// public boolean hasNBTKey( NBTItem nbtItem, String key ) {
+// boolean results = false;
+//
+// if ( nbtItem != null ) {
+// results = nbtItem.hasKey( key );
+// }
+//
+// return results;
+// }
+
+// private String getNBTString( NBTItem nbtItem, String key ) {
+// String results = null;
+//
+// if ( nbtItem != null ) {
+// results = nbtItem.getString( key );
+// }
+// return results;
+// }
+
+// private void setNBTString( NBTItem nbtItem, String key, String value ) {
+//
+// if ( nbtItem != null ) {
+// nbtItem.setString( key, value );
+//
+// if ( isEnableDebugLogging() ) {
+// nbtDebugLog( nbtItem, "setNBTString" );
+// }
+// }
+// }
- public boolean isEnableDebugLogging() {
+ public static boolean isEnableDebugLogging() {
return enableDebugLogging;
}
- public void setEnableDebugLogging(boolean enableDebugLogging) {
- this.enableDebugLogging = enableDebugLogging;
+ public static void setEnableDebugLogging(boolean enableDebugLogging) {
+ PrisonNBTUtil.enableDebugLogging = enableDebugLogging;
}
}
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 8a3c8859b..ec41604a3 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
@@ -17,6 +17,7 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.PlayerInventory;
import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XSound;
@@ -317,18 +318,23 @@ public double getPlayerMultiplier(Player p){
SpigotPlayer sPlayer = new SpigotPlayer(p);
double multiplier = defaultMultiplier;
- RankPlayer rPlayer = sPlayer.getRankPlayer();
+ if ( PrisonRanks.getInstance() != null && PrisonRanks.getInstance().isEnabled() ) {
+
+ RankPlayer rPlayer = sPlayer.getRankPlayer();
// rPlayer.getSellAllMultiplier(); // NOTE: This actually calls this function
- PlayerRank pRank = rPlayer.getPlayerRankPrestiges();
- Rank rank = pRank == null ? null : pRank.getRank();
-
- if ( pRank != null ) {
- String rankName = rank.getName();
- String multiplierRankString = sellAllConfig.getString("Multiplier." + rankName + ".MULTIPLIER");
- if (multiplierRankString != null && sellAllPrestigeMultipliers.containsKey( rankName )){
- multiplier = sellAllPrestigeMultipliers.get( rankName );
+ PlayerRank pRank = rPlayer.getPlayerRankPrestiges();
+ Rank rank = pRank == null ? null : pRank.getRank();
+
+ if ( pRank != null ) {
+ String rankName = rank.getName();
+ String multiplierRankString = sellAllConfig.getString("Multiplier." + rankName + ".MULTIPLIER");
+ if (multiplierRankString != null && sellAllPrestigeMultipliers.containsKey( rankName )){
+ multiplier = sellAllPrestigeMultipliers.get( rankName );
+ }
}
+
}
+
// long tPoint2 = System.nanoTime();
@@ -537,6 +543,63 @@ public double getSellMoney( Player p, SpigotItemStack itemStack )
return results;
}
+
+ /**
+ * This gets the player's inventory, ignoring the armor slots.
+ *
+ * @param p
+ * @return
+ */
+ private List getPlayerInventory( Player p ) {
+
+ return getPlayerInventory( p.getInventory() );
+
+// List results = new ArrayList<>();
+//
+// PlayerInventory inv = p.getInventory();
+//
+// for ( ItemStack iStack : inv.getStorageContents() ) {
+// if ( iStack != null ) {
+// results.add(iStack);
+// }
+// }
+// for ( ItemStack iStack : inv.getExtraContents() ) {
+// if ( iStack != null ) {
+// results.add(iStack);
+// }
+// }
+//
+// return results;
+ }
+ private List getPlayerInventory( PlayerInventory inv ) {
+ List results = new ArrayList<>();
+
+ for ( ItemStack iStack : inv.getContents() ) {
+ if ( iStack != null ) {
+ results.add(iStack);
+ }
+ }
+
+ try {
+ for ( ItemStack iStack : inv.getExtraContents() ) {
+ if ( iStack != null ) {
+ results.add(iStack);
+ }
+ }
+ } catch (NoSuchMethodError e) {
+ // Ignore on older versions of spigot... Spigot 1.8.8 does not have this function.
+ }
+
+ // then remove the armor ItemStacks:
+ for ( ItemStack iStack : inv.getArmorContents() ) {
+ if ( iStack != null ) {
+ results.remove(iStack);
+ }
+ }
+
+ return results;
+ }
+
/**
* Get HashMap with all the items of a Player.
*
@@ -573,7 +636,8 @@ private HashMap getHashMapOfPlayerInventories(Player p) {
}
}
- xMaterialIntegerHashMap = addInventoryToHashMap(xMaterialIntegerHashMap, p.getInventory());
+ xMaterialIntegerHashMap = addInventoryToHashMap(xMaterialIntegerHashMap, getPlayerInventory( p ));
+// xMaterialIntegerHashMap = addInventoryToHashMap(xMaterialIntegerHashMap, p.getInventory());
return xMaterialIntegerHashMap;
}
@@ -901,7 +965,8 @@ public boolean addSellAllBlock(XMaterial xMaterial, double value){
* */
public boolean addPrestigeMultiplier(String prestigeName, double multiplier){
- PrisonRanks rankPlugin = (PrisonRanks) (Prison.get().getModuleManager() == null ? null : Prison.get().getModuleManager().getModule(PrisonRanks.MODULE_NAME).orElse(null));
+ PrisonRanks rankPlugin = (PrisonRanks) (Prison.get().getModuleManager() == null ?
+ null : Prison.get().getModuleManager().getModule(PrisonRanks.MODULE_NAME) );
if (rankPlugin == null) {
return false;
}
@@ -1043,22 +1108,52 @@ public void addDelayedEarningAutoSellNotification(Player p, double value){
}
private HashMap addInventoryToHashMap(HashMap xMaterialIntegerHashMap, Inventory inv) {
- for (ItemStack itemStack : inv.getContents()){
+
+ List inventory = new ArrayList<>();
+
+ for (ItemStack itemStack : inv.getContents()){
if (itemStack != null){
- XMaterial xMaterial = getXMaterialOrLapis(itemStack);
-
- if ( xMaterial != null ) {
-
- if (xMaterialIntegerHashMap.containsKey(xMaterial)){
- xMaterialIntegerHashMap.put(xMaterial, xMaterialIntegerHashMap.get(xMaterial) + itemStack.getAmount());
- }
- else {
- xMaterialIntegerHashMap.put(xMaterial, itemStack.getAmount());
- }
- }
+ inventory.add(itemStack);
}
- }
- return xMaterialIntegerHashMap;
+ }
+
+ return addInventoryToHashMap( xMaterialIntegerHashMap, inventory );
+
+// for (ItemStack itemStack : inv.getContents()){
+// if (itemStack != null){
+// XMaterial xMaterial = getXMaterialOrLapis(itemStack);
+//
+// if ( xMaterial != null ) {
+//
+// if (xMaterialIntegerHashMap.containsKey(xMaterial)){
+// xMaterialIntegerHashMap.put(xMaterial, xMaterialIntegerHashMap.get(xMaterial) + itemStack.getAmount());
+// }
+// else {
+// xMaterialIntegerHashMap.put(xMaterial, itemStack.getAmount());
+// }
+// }
+// }
+// }
+// return xMaterialIntegerHashMap;
+ }
+
+ private HashMap addInventoryToHashMap(HashMap xMaterialIntegerHashMap, List inv) {
+ for (ItemStack itemStack : inv){
+ if (itemStack != null){
+ XMaterial xMaterial = getXMaterialOrLapis(itemStack);
+
+ if ( xMaterial != null ) {
+
+ if (xMaterialIntegerHashMap.containsKey(xMaterial)){
+ xMaterialIntegerHashMap.put(xMaterial, xMaterialIntegerHashMap.get(xMaterial) + itemStack.getAmount());
+ }
+ else {
+ xMaterialIntegerHashMap.put(xMaterial, itemStack.getAmount());
+ }
+ }
+ }
+ }
+ return xMaterialIntegerHashMap;
}
/**
@@ -1769,6 +1864,7 @@ public boolean sellAllSell(Player p, boolean isUsingSign, boolean completelySile
return false;
}
+ //TODO inventory access: getHashMapOfPlayerInventories() && removeSellableItems(p, p.getInventory());
double money = getSellMoney(p);
if (money != 0){
@@ -1777,17 +1873,28 @@ public boolean sellAllSell(Player p, boolean isUsingSign, boolean completelySile
amounts.add( money );
}
- SpigotPlayer sPlayer = new SpigotPlayer(p);
- RankPlayer rankPlayer = PrisonRanks.getInstance().getPlayerManager().getPlayer(sPlayer.getUUID(), sPlayer.getName());
-
- if (sellAllCurrency != null && sellAllCurrency.equalsIgnoreCase("default")) {
- sellAllCurrency = null;
- }
-
-
- removeSellableItems(p);
-
- rankPlayer.addBalance(sellAllCurrency, money);
+ if (sellAllCurrency != null && sellAllCurrency.equalsIgnoreCase("default")) {
+ sellAllCurrency = null;
+ }
+
+
+ //TODO inventory access: getHashMapOfPlayerInventories() && removeSellableItems(p, p.getInventory());
+ removeSellableItems(p);
+
+ SpigotPlayer sPlayer = new SpigotPlayer(p);
+
+ if ( PrisonRanks.getInstance() != null && PrisonRanks.getInstance().isEnabled() ) {
+
+ RankPlayer rankPlayer = PrisonRanks.getInstance().getPlayerManager().getPlayer(sPlayer.getUUID(), sPlayer.getName());
+
+
+ rankPlayer.addBalance(sellAllCurrency, money);
+ }
+ else {
+
+ // Ranks are not enabled, so use a non-cached way to pay the player:
+ sPlayer.addBalance(sellAllCurrency, money);
+ }
if (isSellAllDelayEnabled){
addToDelay(p);
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 f0e88deff..b1c4c6ee4 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,7 +9,6 @@
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
-import de.tr7zw.nbtapi.NBTItem;
import tech.mcprison.prison.bombs.MineBombData;
import tech.mcprison.prison.bombs.MineBombs;
import tech.mcprison.prison.mines.data.Mine;
@@ -19,6 +18,7 @@
import tech.mcprison.prison.spigot.compat.Compatibility.EquipmentSlot;
import tech.mcprison.prison.spigot.compat.SpigotCompatibility;
import tech.mcprison.prison.spigot.game.SpigotPlayer;
+import tech.mcprison.prison.spigot.nbt.PrisonNBTUtil;
import tech.mcprison.prison.util.Location;
/**
@@ -68,18 +68,23 @@ public void onInteract( PlayerInteractEvent event ) {
// Check to see if this is an mine bomb by checking the NBT key-value pair,
// which will also identify which mine bomb it is too.
// NOTE: Because we're just checking, do not auto update the itemstack.
- NBTItem nbtItem = new NBTItem( event.getItem() );
+// NBTItem nbtItem = new NBTItem( event.getItem() );
- if ( !nbtItem.hasKey( MineBombs.MINE_BOMBS_NBT_BOMB_KEY ) ) {
+ String bombName = PrisonNBTUtil.getNBTString( event.getItem(), MineBombs.MINE_BOMBS_NBT_BOMB_KEY );
+
+ if ( bombName == null || bombName.trim().length() == 0 ) {
+// if ( !nbtItem.hasKey( MineBombs.MINE_BOMBS_NBT_BOMB_KEY ) ) {
return;
}
- String bombName = nbtItem.getString( MineBombs.MINE_BOMBS_NBT_BOMB_KEY );
+// String bombName = nbtItem.getString( MineBombs.MINE_BOMBS_NBT_BOMB_KEY );
if ( Output.get().isDebug() ) {
Output.get().logInfo( "PrisonBombListener.onInteract bombName: &7%s&r &3:: nbt: &r%s",
bombName,
- (nbtItem == null ? "&a-no-nbt-" : nbtItem.toString()) );
+ PrisonNBTUtil.nbtDebugString( event.getItem() )
+// (nbtItem == null ? "&a-no-nbt-" : nbtItem.toString())
+ );
}
Player player = event.getPlayer();
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 3341b3053..b57eb1124 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
@@ -15,7 +15,6 @@
import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XSound;
-import de.tr7zw.nbtapi.NBTItem;
import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig.AutoFeatures;
import tech.mcprison.prison.autofeatures.AutoFeaturesWrapper;
import tech.mcprison.prison.bombs.MineBombData;
@@ -38,6 +37,7 @@
import tech.mcprison.prison.spigot.game.SpigotPlayer;
import tech.mcprison.prison.spigot.game.SpigotWorld;
import tech.mcprison.prison.spigot.inventory.SpigotPlayerInventory;
+import tech.mcprison.prison.spigot.nbt.PrisonNBTUtil;
import tech.mcprison.prison.spigot.spiget.BluesSpigetSemVerComparator;
import tech.mcprison.prison.util.Location;
import tech.mcprison.prison.util.Text;
@@ -52,11 +52,26 @@ public class PrisonUtilsMineBombs
private boolean enableMineBombs = false;
+ private static PrisonUtilsMineBombs instance;
public PrisonUtilsMineBombs() {
super();
+ instance = this;
+ }
+
+ public static PrisonUtilsMineBombs getInstance() {
+ if ( instance == null ) {
+ synchronized ( PrisonUtilsMineBombs.class ) {
+
+ if ( instance == null ) {
+ new PrisonUtilsMineBombs();
+ }
+ }
+ }
+
+ return instance;
}
/**
@@ -192,6 +207,17 @@ public void utilsMineBombsReload( CommandSender sender
}
}
+ /**
+ * Just a wrapper to reload mine bombs so it does not have to pass a null value.
+ * This can also be used for initially loading the configs to force data updates.
+ *
+ *
+ */
+ public void reloadPrisonMineBombs() {
+
+ utilsMineBombsReload( null );
+ }
+
@Command(identifier = "prison utils bomb list",
description = "A list of all available bombs, including their full details. " +
@@ -629,7 +655,7 @@ public void utilsMineBombsGive( CommandSender sender,
public static ItemStack getItemStackBomb( MineBombData bombData ) {
ItemStack sItemStack = null;
SpigotItemStack bombs = null;
- NBTItem nbtItem = null;
+// NBTItem nbtItem = null;
XMaterial xBomb = XMaterial.matchXMaterial( bombData.getItemType() ).orElse( null );
@@ -653,6 +679,12 @@ public static ItemStack getItemStackBomb( MineBombData bombData ) {
if ( bombs != null ) {
bombs.setDisplayName( bombData.getName() );
+
+ if ( bombData.getItemName() != null ) {
+ String itemName = bombData.getItemName().replace("{name}", bombData.getName() );
+
+ bombs.setDisplayName( itemName );
+ }
//bombs.setAmount( count );
@@ -673,11 +705,12 @@ public static ItemStack getItemStackBomb( MineBombData bombData ) {
if ( sItemStack != null ) {
// Set the NBT String key-value pair:
- nbtItem = new NBTItem( sItemStack, true );
- nbtItem.setString( MineBombs.MINE_BOMBS_NBT_BOMB_KEY, bombData.getName() );
+ PrisonNBTUtil.setNBTString(sItemStack, MineBombs.MINE_BOMBS_NBT_BOMB_KEY, bombData.getName() );
+// nbtItem = new NBTItem( sItemStack, true );
+// nbtItem.setString( MineBombs.MINE_BOMBS_NBT_BOMB_KEY, bombData.getName() );
- if ( Output.get().isDebug() && nbtItem != null && nbtItem.toString() != null ) {
- Output.get().logInfo( "getItemStackBombs ntb: %s", nbtItem.toString() );
+ if ( Output.get().isDebug() ) {
+ Output.get().logInfo( "getItemStackBombs ntb: %s", PrisonNBTUtil.nbtDebugString(sItemStack) );
}
}
diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsPotions.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsPotions.java
index eaea640ab..303affc24 100644
--- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsPotions.java
+++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/utils/PrisonUtilsPotions.java
@@ -185,17 +185,21 @@ public void utilPotionEffects( CommandSender sender,
// boolean isForceConfictRemoval = effects.contains( PotionEffectOptions.forceConfictRemoval );
- LivingEntity entity = player.getWrapper();
-
- addPotion( entity, potion, durationTicks, ampliferValue );
-
-// PotionEffect potionEffect = new PotionEffect( potion, durationTicks, ampliferValue,
-// isAmbient, isParticles, isIcon );
+ if ( player != null && player.getWrapper() != null ) {
+
+ LivingEntity entity = player.getWrapper();
+
+ addPotion( entity, potion, durationTicks, ampliferValue );
+
+// PotionEffect potionEffect = new PotionEffect( potion, durationTicks, ampliferValue,
+// isAmbient, isParticles, isIcon );
//
-// if ( potionEffect != null ) {
-// player.getWrapper().addPotionEffect( potionEffect, isForceConfictRemoval );
-// }
-
+// if ( potionEffect != null ) {
+// player.getWrapper().addPotionEffect( potionEffect, isForceConfictRemoval );
+// }
+
+
+ }
}
}
diff --git a/prison-spigot/src/main/resources/config.yml b/prison-spigot/src/main/resources/config.yml
index a1caed820..3eaf8a39c 100644
--- a/prison-spigot/src/main/resources/config.yml
+++ b/prison-spigot/src/main/resources/config.yml
@@ -50,6 +50,11 @@ show-alerts: true
# The value for prestige.no-prestige-value is use when a player has no prestige rank with
# the base placeholders: prison_rank, prison_rank_laddername, prison_rank_tag, and
# prison_rank_tag_laddername. If not defined, an empty String is used.
+#
+# If 'enable__ranks_rankup_prestiges__permission' is enabled, then the players
+# must have perm `ranks.rankup.prestiges` enabled. If this setting is false, then
+# all players will be able to use the prestiges command without any special
+# perm.
prestige:
enabled: true
resetMoney: true
@@ -58,15 +63,39 @@ prestige:
prestige-confirm-gui: true
force-sellall: false
no-prestige-value: ""
+ enable__ranks_rankup_prestiges__permission: false
+
+#
+# These are various ranks settings:
+#
+# The setting `add-new-players-on-startup` will allow prison to scan for new players that
+# have not been setup in prison, and add them at server startup.
+# This can be disabled. If it is, then when new players are "accessed" then they should be
+# added to prison upon demand. It's been reported that adding new players can take a few
+# seconds (2 to 5 seconds) per player, which has not been confirmed. But if true, then
+# existing servers switching over to Prison could take a long time to setup all players
+# at startup. So this setting may make sense in those conditions.
+# NOTE: Its not possible to test all situations where new players are bypassed when starting
+# Prison. Therefore disabling this setting is at your own risk. But if any issues are
+# encountered, then PLEASE contact support on our discord server ASAP and we will
+# fix the issues for you. We want Prison to be bug free, but are not able to ensure
+# all functions able to handle new players that have not been added to Prison due to
+# the degree of complexity of some sections of prison.
+#
ranks:
+ startup:
+ add-new-players-on-startup: true
gui-default-include-rankup-button: true
gui-prestiges-include-rankup-button: true
gui-others-include-rankup-button: true
+prison-ranks:
+
+
# WARNING: Never use the following setting to disable the vault-economy
# integration unless directed by Prison support to do so.
# WARNING: Prison will not allow the Ranks module to be enabled if a valid
@@ -244,6 +273,8 @@ prison-mines:
enable-suffocation-in-mines: false
+
+
# Warning: Do not use the following option. This could break the natural Bukkit
# loading behavior of Prison and other plugins. It can have unexpected
# side effects.
@@ -352,8 +383,8 @@ prison-events:
#
prisonCommandHandler:
exclude-worlds:
- - lobby
- - plotWorld
+ - miniGameWorld
+ - playerPlotWorld
exclude-non-ops:
exclude-related-aliases: true
commands:
diff --git a/prison-spigot/src/main/resources/plugin.yml b/prison-spigot/src/main/resources/plugin.yml
index 9e1e90088..a464b02ef 100644
--- a/prison-spigot/src/main/resources/plugin.yml
+++ b/prison-spigot/src/main/resources/plugin.yml
@@ -3,7 +3,7 @@ main: tech.mcprison.prison.spigot.SpigotPrison
version: "${version}"
description: Prison is an all-in-one plugin for the Minecraft prison game mode.
website: https://prison.jar-mc.com
-softdepend: [Essentials, Vault, ProtocolLib, LuckPerms, WorldEdit, WorldGuard, Multiverse-Core, Multiworld, MVdWPlaceholderAPI, PlaceholderAPI, PermissionsEx, GroupManagerX, GemsEconomy, TokenEnchant, CMI, CMILib, CMIEInjector, CMIPaperLib, Economy_CMI, mcMMO, PlotSquared, Multiverse, FastAsyncWorldEdit]
+softdepend: [Essentials, Vault, ProtocolLib, LuckPerms, WorldEdit, WorldGuard, Multiverse-Core, Multiworld, MVdWPlaceholderAPI, PlaceholderAPI, PermissionsEx, GroupManagerX, GemsEconomy, TokenEnchant, CMI, CMILib, CMIEInjector, CMIPaperLib, Economy_CMI, mcMMO, PlotSquared, Multiverse, FastAsyncWorldEdit, ExaltedEconomy]
# Older versions than 1.13 will ignore this, but this will allow 1.13 and up to use newer block types?
api-version: 1.13