From bb31881f266a583e209bf976981e3b0643938543 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Mon, 23 Jan 2023 04:42:12 -0500 Subject: [PATCH 01/75] Update change long... minor. --- docs/changelog_v3.3.x.md | 3 +++ docs/prison_changelog_v3.3.0-alpha.14.md | 3 +++ 2 files changed, 6 insertions(+) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 2a9af13a4..12becdac5 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -57,6 +57,9 @@ The following are significant changes that are included in the alpha.14 release * Prison support new feature: tracking command usage along with average run times: `/prison support cmdStats`. +* Improved some of the `/prison support submit` features to include more of the newer data that prison is using. + + * Updates to a number of libraries that prison uses: placeholderApi: v2.10.9 to v2.11.2 XSeries: v9.0.0 to v9.2.0 diff --git a/docs/prison_changelog_v3.3.0-alpha.14.md b/docs/prison_changelog_v3.3.0-alpha.14.md index 90628eeb1..51fcd5f35 100644 --- a/docs/prison_changelog_v3.3.0-alpha.14.md +++ b/docs/prison_changelog_v3.3.0-alpha.14.md @@ -55,6 +55,9 @@ The following are significant changes that are included in the alpha.14 release * Prison support new feature: tracking command usage along with average run times: `/prison support cmdStats`. +* Improved some of the `/prison support submit` features to include more of the newer data that prison is using. + + * Updates to a number of libraries that prison uses: placeholderApi: v2.10.9 to v2.11.2 XSeries: v9.0.0 to v9.2.0 From d0c95d387cc5b23ac4d3dd1aaef3f4250d9363fb Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Mon, 23 Jan 2023 07:09:05 -0500 Subject: [PATCH 02/75] Changed the example world names in the config.yml file where Prison is disabled. Too many people were running in to the problem where they just happened to have those worlds, and that's where they were trying to use prison. So they were thinking Prison was not working instead of Prison being disable in those worlds because that's what was in the configs. --- docs/changelog_v3.3.x.md | 3 +++ prison-spigot/src/main/resources/config.yml | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 12becdac5..892395b6c 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,9 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14 2023-01-23 +* Changed the example world names in the config.yml file where Prison is disabled. Too many people were running in to the problem where they just happened to have those worlds, and that's where they were trying to use prison. So they were thinking Prison was not working instead of Prison being disable in those worlds because that's what was in the configs. + + **Prison v3.3.0-alpha.14 2023-01-23** diff --git a/prison-spigot/src/main/resources/config.yml b/prison-spigot/src/main/resources/config.yml index a1caed820..458a9d67b 100644 --- a/prison-spigot/src/main/resources/config.yml +++ b/prison-spigot/src/main/resources/config.yml @@ -352,8 +352,8 @@ prison-events: # prisonCommandHandler: exclude-worlds: - - lobby - - plotWorld + - miniGameWorld + - playerPlotWorld exclude-non-ops: exclude-related-aliases: true commands: From 9c53763269323effac7fd888d3e4ca718d80226e Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Thu, 26 Jan 2023 06:09:49 -0500 Subject: [PATCH 03/75] doc updates --- ...rison_docs_012_setting_up_prison_basics.md | 112 ++++++++++++------ 1 file changed, 76 insertions(+), 36 deletions(-) diff --git a/docs/prison_docs_012_setting_up_prison_basics.md b/docs/prison_docs_012_setting_up_prison_basics.md index 2429d4229..1255707f5 100644 --- a/docs/prison_docs_012_setting_up_prison_basics.md +++ b/docs/prison_docs_012_setting_up_prison_basics.md @@ -7,7 +7,7 @@ This document provides a quick overview on how to install Prison and get it running. -*Documented updated: 2023-01-14* +*Documented updated: 2023-01-26*
@@ -196,22 +196,42 @@ But perhaps the biggest reason why I dropped support for MVdW is because it's 10 ### Enchantment Plugins -* **CustomItems** - Recommended - Premium Plugin - Allows for the use of custom blocks within Prison. This provides for a great deal of customizations, including custom textures for your custom blocks. Prison supports CI at about 95% or more. If you need additional support added for CI, please contact Blue and he will add it for you. +* **CustomItems** - Recommended - *A Premium Plugin* - Allows for the use of custom blocks within Prison. This provides for a great deal of customizations, including custom textures for your custom blocks. Prison supports CI at about 95% or more. If you need additional support added for CI, please contact Blue and he will add it for you. [https://polymart.org/resource/custom-items.1](https://polymart.org/resource/custom-items.1) -* **TokenEnchant** - Recommended - Premium Plugin - This is one of the few recommended premium plugins that we would recommend, but it works very well with prison. It took a lot of effort to get this to work with Prison, but is perhaps the most supported one too. Keep in mind that it is premium and they also charge for other add on features, so the initial cost may not be your final cost. +* **TokenEnchant** - Recommended - *A Premium Plugin* - This is one of the few recommended premium plugins that we would recommend, but it works very well with prison. It took a lot of effort to get this to work with Prison, but is perhaps the most supported one too. Keep in mind that it is premium and they also charge for other add on features, so the initial cost may not be your final cost. [https://polymart.org/resource/tokenenchant-1-7-10-1-17.155](https://polymart.org/resource/tokenenchant-1-7-10-1-17.155) -* **Prison Enchants** Newest supported enchantment plugin supported. More information will be added soon. +* **Prison Enchants** Newest supported enchantment plugin supported. * **Crazy Enchantments** - Optional - Some support is provided for Crazy Enchantments, but it may not be at 100% in all areas. This is an open source project and supports Spigot 1.8 through 1.16. [https://www.spigotmc.org/resources/crazy-enchantments.16470/](https://www.spigotmc.org/resources/crazy-enchantments.16470/) -* **RevEnchants** - Prison now supports RevEnchants through their ExplosiveEvent and JackHammerEvent! To enable prison to work better with RevEnchants, you can enable it within the `autoFeaturesConfig.yml` file. Prison supports RevEnchants v11.2 or newer. It may work with older versions, but if there are issues, we cannot provide support if the older version of RevEnchants is missing either of the events. +* **RevEnchants** - *A Premium Plugin* - Prison now supports RevEnchants through their ExplosiveEvent and JackHammerEvent! To enable prison to work better with RevEnchants, you can enable it within the `autoFeaturesConfig.yml` file. Prison supports RevEnchants v11.2 or newer. It may work with older versions, but if there are issues, we cannot provide support if the older version of RevEnchants is missing either of the events. + +To use RevEnchant's block break handling, prison needs to just monitor the events so it can update the block counts. This is an example of what settings are needed if you are using Prison's Block Events. + +```yaml + blockBreakEventPriority: ACCESSBLOCKEVENTS + + RevEnchantsExplosiveEventPriority: BLOCKSEVENTS + RevEnchantsJackHammerEventPriority: BLOCKEVENTS +``` + +Or if you are not using Prison Block Events, then just MONITOR should be used for better performance. + +```yaml + blockBreakEventPriority: ACCESSMONITOR + + RevEnchantsExplosiveEventPriority: MONITOR + RevEnchantsJackHammerEventPriority: MONITOR +``` + +**Please note:** These settings may also apply to the other enchantment plugins if you do not want to use Prison's block handling. @@ -223,22 +243,24 @@ Warning: People have paid for this plugin only to find out after the fact that i If you purchase this plugin to use on your server, do so with great caution since it is not supported and it may not integrate with prison. [ * Not supported * Tokens * Not supported * ](https://www.spigotmc.org/resources/%E2%9A%A1%EF%B8%8F-tokens-%E2%9A%A1%EF%B8%8F-40-enchantments-%E2%AD%95-free-expansions-%E2%AD%95-25-off.79668/) +**Please Note:** There is another plugin by the same name "Tokens" that strictly deals with tokens and not enchantments, which works just fine with prison. + ### Enchantment Plugin Features Supported This table of supported Enchantment Plugins are plugins that have an event that Prison is able to hook in to for the purpose of communicating multiple block breakage. It should be noted that all of these events are related to block breakage, and originate from the original bukkit's **BlockBreakEvent**, but the other plugins takes the single block, then applies "effects" that expands the one block breakage to multiple blocks. These events are the mechanism for conveying the list of included blocks to Prison so Prison can do what it needs to do with the blocks. -| Plugin | Event | Settings ID | Cancel
Events | Cancel
Drops | External
Hooks | -| --- | --- | ----------- | :---: | :----: | :----: | -| Bukkit/Spigot | **BlockBreakEvent** | `blockBreakEventPriority` | **Yes** | **Yes** | **Yes** | -| Prison | **ExplosiveBlockBreakEvent** | `ProcessPrisons_ExplosiveBlockBreakEventsPriority` | **Yes** | *No* | *No* | -| TokenEnchant | **TEBlockExplodeEvent** | `TokenEnchantBlockExplodeEventPriority` | **Yes** | *No* | *No* | -| CrazyEnchants | **BlastUseEvent** | `CrazyEnchantsBlastUseEventPriority` | **Yes** | *No* | *No* | -| PrisonEnchants | **PEExplosionEvent** | `PrisonEnchantsExplosiveEventPriority` | **Yes** | *No* | *No* | -| RevEnchants | **ExplosiveEvent** | `RevEnchantsExplosiveEventPriority` | **Yes** | *No* | *No* | -| RevEnchants | **JackHammerEvent** | `RevEnchantsJackHammerEventPriority` | **Yes** | *No* | *No* | -| Zenchantments | **BlockShredEvent** | `ZenchantmentsBlockShredEventPriority` | **Yes** | **Yes** | **Yes** | +| Plugin | Event | Settings ID | Cancel
Events | Cancel
Drops | External
Hooks | ACCESS
Priority
Supported | +| --- | --- | ----------- | :---: | :----: | :----: | :----: | +| Bukkit/Spigot | **BlockBreakEvent** | `blockBreakEventPriority` | **Yes** | **Yes** | **Yes** | **Yes** | +| Prison | **ExplosiveBlockBreakEvent** | `ProcessPrisons_ExplosiveBlockBreakEventsPriority` | **Yes** | *No* | *No* | *No* | +| TokenEnchant | **TEBlockExplodeEvent** | `TokenEnchantBlockExplodeEventPriority` | **Yes** | *No* | *No* | *No* | +| CrazyEnchants | **BlastUseEvent** | `CrazyEnchantsBlastUseEventPriority` | **Yes** | *No* | *No* | *No* | +| PrisonEnchants | **PEExplosionEvent** | `PrisonEnchantsExplosiveEventPriority` | **Yes** | *No* | *No* | *No* | +| RevEnchants | **ExplosiveEvent** | `RevEnchantsExplosiveEventPriority` | **Yes** | *No* | *No* | *No* | +| RevEnchants | **JackHammerEvent** | `RevEnchantsJackHammerEventPriority` | **Yes** | *No* | *No* | *No* | +| Zenchantments | **BlockShredEvent** | `ZenchantmentsBlockShredEventPriority` | **Yes** | **Yes** | **Yes** | *No* | @@ -248,6 +270,8 @@ This table of supported Enchantment Plugins are plugins that have an event that 3. **External Hooks** refers to custom hooks in to mcMMO, EZBlock, and Quests. See config settings within **AutoFeaturesConfig.yml**. It's strongly suggested to use **Cancel Drops** instead so you won't have to enable these features. These provides a hacky-fix for the limitations when using **Cancel Events** and may not be perfect. 4. Zenchantments is flexible in how it's **BlockShredEvent** works, mostly because it extends the bukkit **BlockBreakEvent**. The events can possibly mix with normal **BlockBreakEvent**s. 5. It may take some effort to find the ideal priorities to use for your environment to ensure everything works as you envision it. +6. **ACCESS Priority Supported*** only the **BlockBreakEvent** should be used with the ACCESS, ACCESSBLOCKEVENTS, or ACCESSMONITOR. All events supports the use of ACCESS, but only the first block in their list is check. Therefore it really won't be ideal. Plus all of these events originate through the **BlockBreakEvent** so if that is checking ACCESS then it should be sufficient. + ### Event Listener Priorities @@ -255,30 +279,46 @@ This table of supported Enchantment Plugins are plugins that have an event that The above listed supported Events are assigned one of the available Prison Event Priorities. This table illustrates what features are associated with each priority, which can be somewhat complex and confusing. -| Priority | Access | In
Mine | In
World | Ignores
Canceled
Events | Block
Break | Block
Count | Reset
Threshold | Block
Events | Mine
Sweeper | AutoSell | -| --- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| DISABLED | *No* | *No* | *No* | *No* | *No* | *No* | *No* | *No* | *No* | *No* | -| ACCESS | **Yes** | **Yes** | *No* | *No* | *No* | *No* | *No* | *No* | *No* | *No* | -| ACCESSBLOCKEVENTS | **Yes** | **Yes** | *No* | *NoYes* | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | -| ACCESSMONITOR | **Yes** | **Yes** | *No* | *NoYes* | *No* | **Yes** | **Yes** | *No* | **Yes** | *No* | -| LOWEST | **Yes** | **Yes** | *No* | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | -| LOW | **Yes** | **Yes** | *No* | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | -| NORMAL | **Yes** | **Yes** | *No* | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | -| HIGH | **Yes** | **Yes** | *No* | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | -| HIGHEST | **Yes** | **Yes** | *No* | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | -| BLOCKEVENTS | *No* | **Yes** | *No* | **Yes** | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | -| MONITOR | *No* | **Yes** | *No* | **Yes** | *No* | **Yes** | **Yes** | *No* | **Yes** | *No* | -| *priority temp* | Access | In Mine | IN Wrld | IgCanEv | Blk Brk | Blk Cnt | ResetTh | BlkEvnt | MineSwp | AutoSel | +* **DISABED** - The event is not enabled within Prison's event monitoring. The event will not be included in the command `/prison support listeners blockBreak` command. + +* **ACCESS** - Access uses the identified block within the event to identify which mine the player is in, and if the player has access to the mine. If the player does not have access, then the event is canceled. If the event has more than one block in the event, and it does not specifically identify which block was broken, it will use the first block in the provided block list. Therefore, it may make the most sense that this priority, and it's variations, are best suited to be used with the Bukkit/Spigot's **BlockBreakEvent** since all other events originate through this event. + +* **ACCESSBLOCKEVENTS** - Same as ACCESS in that it generates a listener that for just mine access, but it also creates another listener for BLOCKEVENTS. This will be seen as two different listeners. + +* **ACCESSMONITOR** - Same as ACCESS in that it generates a listener that for just mine access, but it also creates another listener for MONITOR. This will be seen as two different listeners. + +* **LOWEST** - **HIGHEST** - These are the normal bukkit event priorities. The lower the priority, then it will handle the event before other plugins with higher priorities. + +* **BLOCKEVENTS** - Same as MONITOR, but also includes the processing of the Prison Block Events and sellall (auto sell) if enabled for full inventory. + +* **MONITOR** - Monitor performs no block handling within prison, but it will try to update the block counts. MONITOR will process the event even if it is canceled. + + +| Priority | Actual
Event
Priority | Access | In
Mine | In
World | Ignores
Canceled
Events | Block
Break | Block
Count | Reset
Threshold | Block
Events | Mine
Sweeper | AutoSell | +| --- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | +| DISABLED | -note1- | *No* | *No* | *No* | *No* | *No* | *No* | *No* | *No* | *No* | *No* | +| ACCESS | LOWEST | **Yes** | **Yes** | *No* | *No* | *No* | *No* | *No* | *No* | *No* | *No* | +| ACCESSBLOCKEVENTS | -note1- | **Yes** | **Yes** | *No* | *NoYes* | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | +| ACCESSMONITOR | -note1- | **Yes** | **Yes** | *No* | *NoYes* | *No* | **Yes** | **Yes** | *No* | **Yes** | *No* | +| LOWEST | LOWEST | **Yes** | **Yes** | *No* | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | +| LOW | LOW | **Yes** | **Yes** | *No* | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | +| NORMAL | NORMAL | **Yes** | **Yes** | *No* | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | +| HIGH | HIGH | **Yes** | **Yes** | *No* | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | +| HIGHEST | HIGHEST | **Yes** | **Yes** | *No* | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | +| BLOCKEVENTS | HIGHEST | *No* | **Yes** | *No* | **Yes** | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | +| MONITOR | MONITOR | *No* | **Yes** | *No* | **Yes** | *No* | **Yes** | **Yes** | *No* | **Yes** | *No* | +| *headers* | EvntPri | Access | In Mine | IN Wrld | IgCanEv | Blk Brk | Blk Cnt | ResetTh | BlkEvnt | MineSwp | AutoSel | **Notes:** -1. **DISABLED** will prevent a listener from starting, and it will prevent any processing of that event. -2. **Access** managed by Prison requires the use of Access by Rank (perferred) or Access by Perms. It also will vary in effectives based upon the priority level in relation to other plugins, where any plugin that has a lower priority than Prison will bypass Prison's attempts to control access. -3. **ACCESSBLOCKEVENTS** and **ACCESSMONITOR** are able to have a duel behavior because these priorities will create two different listeners, each at a different priority, and each having a different purpose. -4. **Block Break** refers to Prison handling the whole block break processing and drops. -5. **Mine Sweeper** should never be used unless there is no other way to count all the broken blocks. -6. Support for outside of the mine for auto features maybe added soon. The way it will probably be supported would be through a list of worlds in which it should be active, plus the use of WG regions too. -7. The **MONITOR** priority, including ***BLOCKEVENTS*** will ignore all events that have been canceled and will process them anyway. Therefore **ACCESSBLOCKEVENTS** and **ACCESSMONITOR** will fail on the "access" part if the event is canceled when Prison gets ahold of it the first time, which will deny access to the mines, but it will also still process the event under the priority of MONITOR or BLOCKEVENTS. +1. **DISABLED** will not have an actual event priority. **ACCESSBLOCKEVENTS** will have two processes; see actual priorities for ACCESS and BLOCKEVENTS. **ACCESSMONITOR** will have two processes; see actual priorities for ACCESS and MONITOR. +2. **DISABLED** will prevent a listener from starting, and it will prevent any processing of that event. +3. **Access** managed by Prison requires the use of Access by Rank (preferred) or Access by Perms. It also will vary in effectives based upon the priority level in relation to other plugins, where any plugin that has a lower priority than Prison will bypass Prison's attempts to control access. +4. **ACCESSBLOCKEVENTS** and **ACCESSMONITOR** are able to have a duel behavior because these priorities will create two different listeners, each at a different priority, and each having a different purpose. +5. **Block Break** refers to Prison handling the whole block break processing and drops. +6. **Mine Sweeper** should never be used unless there is no other way to count all the broken blocks. +7. Support for outside of the mine for auto features maybe added soon. The way it will probably be supported would be through a list of worlds in which it should be active, plus the use of WG regions too. +8. The **MONITOR** priority, including ***BLOCKEVENTS*** will ignore all events that have been canceled and will process them anyway. Therefore **ACCESSBLOCKEVENTS** and **ACCESSMONITOR** will fail on the "access" part if the event is canceled when Prison gets ahold of it the first time, which will deny access to the mines, but it will also still process the event under the priority of MONITOR or BLOCKEVENTS. From 60d4a28976356367815df5d0aa679e19f07c05a7 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Thu, 26 Jan 2023 08:16:41 -0500 Subject: [PATCH 04/75] MineBombs: Added a new field specifically for the item name for the bomb. The mine bombs now auto load upon startup and will auto update now if there is a change in mine data versions. --- docs/changelog_v3.3.x.md | 6 +++- .../mcprison/prison/bombs/MineBombData.java | 32 ++++++++++++++++- .../bombs/MineBombDefaultConfigSettings.java | 12 +++++++ .../tech/mcprison/prison/bombs/MineBombs.java | 34 ++++++++++++++++++- .../prison/bombs/MineBombsConfigData.java | 2 +- .../mcprison/prison/spigot/SpigotPrison.java | 16 ++++++--- .../spigot/utils/PrisonUtilsMineBombs.java | 32 +++++++++++++++++ 7 files changed, 125 insertions(+), 9 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 892395b6c..35da2b133 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,11 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14 2023-01-23 +# 3.3.0-alpha.14 2023-01-26 + + +* **MineBombs: Added a new field specifically for the item name for the bomb.** +The mine bombs now auto load upon startup and will auto update now if there is a change in mine data versions. * Changed the example world names in the config.yml file where Prison is disabled. Too many people were running in to the problem where they just happened to have those worlds, and that's where they were trying to use prison. So they were thinking Prison was not working instead of Prison being disable in those worlds because that's what was in the configs. diff --git a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombData.java b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombData.java index 5dce27843..f7a41d20d 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombData.java +++ b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombData.java @@ -9,6 +9,8 @@ public class MineBombData { + public static final String MINE_BOMB_DEFAULT_ITEM_NAME = "&c-= &7{name}&c =-"; + private String name; private String description; @@ -31,6 +33,20 @@ public class MineBombData { */ private String nameTag; + + /** + *

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... + *

+ * + *

If no value is provided, then the name will be used. + *

+ * + */ + private String itemName; + + /** *

The String name of an XMaterial item to use as the "bomb". *

@@ -193,9 +209,11 @@ public MineBombData( String name, String itemType, String explosionShape, this(); this.name = name; + this.nameTag = "{name}"; + this.itemType = itemType; + this.itemName = MINE_BOMB_DEFAULT_ITEM_NAME; - this.nameTag = "{name}"; this.explosionShape = explosionShape; this.radius = radius; @@ -239,6 +257,8 @@ public MineBombData clone() { cloned.setNameTag( getNameTag() ); + cloned.setItemName( getItemName() ); + cloned.setToolInHandName( getToolInHandName() ); cloned.setToolInHandFortuneLevel( getToolInHandFortuneLevel() ); cloned.setToolInHandDurabilityLevel( getToolInHandDurabilityLevel() ); @@ -324,6 +344,16 @@ public void setItemType( String itemType ) { this.itemType = itemType; } + public String getItemName() { + if ( itemName == null ) { + itemName = MINE_BOMB_DEFAULT_ITEM_NAME; + } + return itemName; + } + public void setItemName(String itemName) { + this.itemName = itemName; + } + public PrisonBlock getItem() { return item; } diff --git a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombDefaultConfigSettings.java b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombDefaultConfigSettings.java index 265f4e2a9..89494b456 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombDefaultConfigSettings.java +++ b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombDefaultConfigSettings.java @@ -53,6 +53,8 @@ public void setupDefaultMineBombData(MineBombs mineBombs) "SmallBomb", "brewing_stand", ExplosionShape.sphere.name(), 2, "&dSmall &6Mine &eBomb &3(lore line 1)" ); mbd.setNameTag( "&6&kABC&r&c-= &7{name}&c =-&6&kCBA" ); + mbd.setItemName( MineBombData.MINE_BOMB_DEFAULT_ITEM_NAME ); + mbd.setToolInHandName( "DIAMOND_PICKAXE" ); mbd.setToolInHandFortuneLevel( 0 ); @@ -85,6 +87,7 @@ public void setupDefaultMineBombData(MineBombs mineBombs) "but supercharged with a strange green glowing liquid."); mbd.setNameTag( "&6&k1 23 456&r&a-=- &7{name}&a -=-&6&k654 32 1" ); + mbd.setItemName( MineBombData.MINE_BOMB_DEFAULT_ITEM_NAME ); mbd.setToolInHandName( "DIAMOND_PICKAXE" ); mbd.setToolInHandFortuneLevel( 3 ); @@ -108,6 +111,10 @@ public void setupDefaultMineBombData(MineBombs mineBombs) { MineBombData mbd = new MineBombData( "LargeBomb", "tnt", ExplosionShape.sphereHollow.name(), 12, "Large Mine Bomb" ); + + mbd.setNameTag( "&a-=- &7{name}&a -=--" ); + mbd.setItemName( MineBombData.MINE_BOMB_DEFAULT_ITEM_NAME ); + mbd.setRadiusInner( 3 ); mbd.setDescription("A large mine bomb made from TNT with some strange parts " + "that maybe be described as alien technology."); @@ -136,6 +143,7 @@ public void setupDefaultMineBombData(MineBombs mineBombs) mbd.setRadiusInner( 3 ); mbd.setNameTag( "&c&k1&6&k23&e&k456&r&a-=- &4{countdown} &5-=- &7{name} &5-=- &4{countdown} &a-=-&e&k654&6&k32&c&k1" ); + mbd.setItemName( MineBombData.MINE_BOMB_DEFAULT_ITEM_NAME ); mbd.setDescription("An oof-ably large mine bomb made with a minecart heaping with TNT. " + "Unlike the large mine bomb, this one obviously is built with alien technology."); @@ -193,6 +201,7 @@ public void setupDefaultMineBombData(MineBombs mineBombs) // mbd.setLoreBombItemId( "&7A &2Wimpy &cBomb &9...&02A3F" ); mbd.setNameTag( "&7A &2Wimpy &cBomb" ); + mbd.setItemName( MineBombData.MINE_BOMB_DEFAULT_ITEM_NAME ); mbd.setRadiusInner( 2 ); mbd.setDescription("A whimpy bomb made with gunpowder and packs the punch of a " + @@ -243,6 +252,9 @@ public void setupDefaultMineBombData(MineBombs mineBombs) mbd.setDescription("The most anti-round bomb you will ever be able to find. " + "It's totally cubic."); + mbd.setNameTag( "&a-=- &7{name}&a -=--" ); + mbd.setItemName( MineBombData.MINE_BOMB_DEFAULT_ITEM_NAME ); + mbd.setToolInHandName( "DIAMOND_PICKAXE" ); mbd.setToolInHandFortuneLevel( 7 ); mbd.setRemovalChance( 100.0d ); diff --git a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java index fb872a6ff..1908ac841 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java +++ b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java @@ -3,6 +3,7 @@ import java.io.File; import java.util.ArrayList; import java.util.List; +import java.util.Set; import tech.mcprison.prison.file.JsonFileIO; import tech.mcprison.prison.internal.block.PrisonBlock; @@ -161,13 +162,14 @@ public void loadConfigJson() { MineBombsConfigData.MINE_BOMB_DATA_FORMAT_VERSION ) { // Need to update the format version then save a new copy of the configs. + mineBombApplyVersionUpdates( configs ); // first backup the old file by renaming it: int oldVersion = configs.getDataFormatVersion(); String backupTag = "ver_" + oldVersion; - File backupFile = fio.getBackupFile( configFile, backupTag, ".bu" ); + File backupFile = fio.getBackupFile( configFile, backupTag, "bu" ); boolean renamed = configFile.renameTo( backupFile ); @@ -194,6 +196,36 @@ public void loadConfigJson() { } + /** + *

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. 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-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPrison.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPrison.java index 53003fd97..a6694dc24 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,22 @@ public void onEnableStartup() { } - // Startup bStats: - prisonBStats.initMetricsOnEnable(); - - - // Force a backup if prison version is new: PrisonBackups backups = new PrisonBackups(); backups.serverStartupVersionCheck(); + + // Setup mine bombs: + PrisonUtilsMineBombs.getInstance().reloadPrisonMineBombs(); + + + // Startup bStats: + prisonBStats.initMetricsOnEnable(); + + + Output.get().logInfo( "Prison - Finished loading." ); 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..3f85fb056 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 @@ -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. " + @@ -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 ); From 1912964f6014279b93642a6223e8c30a56c024bd Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Thu, 26 Jan 2023 11:00:48 -0500 Subject: [PATCH 05/75] Mine BlockEvents: Enables the use of pipes in commands and messages now. --- docs/changelog_v3.3.x.md | 3 +++ .../mcprison/prison/mines/features/MineBlockEvent.java | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 35da2b133..831fc1136 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,9 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14 2023-01-26 +* **Mine BlockEvents: Enables the use of pipes in commands and messages now.** + + * **MineBombs: Added a new field specifically for the item name for the bomb.** The mine bombs now auto load upon startup and will auto update now if there is a change in mine data versions. 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 From 822b2d932a13d8885bb39b591bc4dbfa3910fbd9 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Fri, 27 Jan 2023 07:20:20 -0500 Subject: [PATCH 06/75] Some adjustments to AutoFeatures and monitor priority... it was processing block events under some conditions. --- docs/changelog_v3.3.x.md | 5 ++++- .../autofeatures/AutoManagerFeatures.java | 6 ++--- .../events/AutoManagerBlockBreakEvents.java | 1 - .../events/AutoManagerCrazyEnchants.java | 2 +- ...nagerPrisonsExplosiveBlockBreakEvents.java | 2 +- .../AutoManagerRevEnchantsExplosiveEvent.java | 2 +- ...AutoManagerRevEnchantsJackHammerEvent.java | 2 +- .../events/AutoManagerTokenEnchant.java | 2 +- .../events/AutoManagerZenchantments.java | 2 +- .../spigot/block/BlockBreakPriority.java | 7 ++++++ .../spigot/block/OnBlockBreakEventCore.java | 22 ++++++++++++++----- 11 files changed, 36 insertions(+), 17 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 831fc1136..a13ab95f0 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,10 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14 2023-01-26 +# 3.3.0-alpha.14 2023-01-27 + + +* **Some adjustments to AutoFeatures and monitor priority... it was processing block events under some conditions.** * **Mine BlockEvents: Enables the use of pipes in commands and messages now.** 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..c3cdb3521 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 @@ -106,10 +106,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 " 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..4be4f19d1 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 @@ -310,7 +310,6 @@ private void handleBlockBreakEvent( BlockBreakEvent e, BlockBreakPriority bbPrio if ( checkIfNoAccess( pmEvent, start ) ) { e.setCancelled( true ); - return; } 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..38f98dbad 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 @@ -347,7 +347,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/AutoManagerPrisonsExplosiveBlockBreakEvents.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerPrisonsExplosiveBlockBreakEvents.java index d50418cb0..1446a3493 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 @@ -333,7 +333,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..0e3ff4b09 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 @@ -343,7 +343,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..6d1ba9485 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 @@ -344,7 +344,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..f71b95f3e 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 @@ -401,7 +401,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..f77ab5e3e 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 @@ -333,7 +333,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/block/BlockBreakPriority.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/BlockBreakPriority.java index 544a9f659..f88f4ea97 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 @@ -77,6 +77,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..7b1290e32 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 @@ -745,8 +745,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 +833,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 +874,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 +886,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 - " + From f1affd5b934cf3cadfd57b7e3f8d722601ea9850 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 28 Jan 2023 10:13:25 -0500 Subject: [PATCH 07/75] Gui Player Mine config settings: Added `Options.Mines.MaterialType.NoMineAccess` which defaults to REDSTONE_BLOCK. If it does not exist in a player's GuiConfig.yml file, it will now be auto added. Also if the `Options.Mines.MaterialType` block list of material types to use for each mine does not exist, it will auto add them, using the first block in the mine's block list. --- docs/changelog_v3.3.x.md | 7 ++++- .../prison/spigot/configs/GuiConfig.java | 30 +++++++++++++++++++ .../spigot/gui/mine/SpigotPlayerMinesGUI.java | 4 ++- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index a13ab95f0..d9dd7b40b 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,12 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14 2023-01-27 +# 3.3.0-alpha.14 2023-01-28 + + +* **Gui Player Mine config settings: Added `Options.Mines.MaterialType.NoMineAccess` which defaults to REDSTONE_BLOCK.** +If it does not exist in a player's GuiConfig.yml file, it will now be auto added. +Also if the `Options.Mines.MaterialType` block list of material types to use for each mine does not exist, it will auto add them, using the first block in the mine's block list. * **Some adjustments to AutoFeatures and monitor priority... it was processing block events under some conditions.** 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..ff87640be 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.getMapList( "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.getMapList( "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/gui/mine/SpigotPlayerMinesGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotPlayerMinesGUI.java index f3161c9ad..553de2380 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 @@ -105,6 +105,7 @@ 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" ); // Make the buttons for every Mine with info for (Mine m : minesDisplay) { @@ -121,7 +122,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; From d14c222a82fb5265d25c991da70e92db2266d751 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 28 Jan 2023 11:24:56 -0500 Subject: [PATCH 08/75] Fixed the gui config which it needed to load after loading ranks and mines. So it's initialized a second time in the startup process. --- docs/changelog_v3.3.x.md | 3 +++ .../tech/mcprison/prison/spigot/SpigotPrison.java | 4 ++++ .../mcprison/prison/spigot/configs/GuiConfig.java | 4 ++-- .../spigot/gui/mine/SpigotPlayerMinesGUI.java | 14 +++++++++++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index d9dd7b40b..d49a7410b 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,9 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14 2023-01-28 +* **Fixed the gui config which it needed to load after loading ranks and mines. So it's initialized a second time in the startup process.** + + * **Gui Player Mine config settings: Added `Options.Mines.MaterialType.NoMineAccess` which defaults to REDSTONE_BLOCK.** If it does not exist in a player's GuiConfig.yml file, it will now be auto added. Also if the `Options.Mines.MaterialType` block list of material types to use for each mine does not exist, it will auto add them, using the first block in the mine's block list. 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 a6694dc24..99450fd4d 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 @@ -398,6 +398,10 @@ public void onEnableStartup() { backups.serverStartupVersionCheck(); + // Reload guiConfigs since ranks and mines have now been loaded: + guiConfig.initialize(); + + // Setup mine bombs: PrisonUtilsMineBombs.getInstance().reloadPrisonMineBombs(); 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 ff87640be..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 @@ -194,7 +194,7 @@ public void initialize() { changeCount++; } - if ( conf.getMapList( "Options.Mines.MaterialType" ) == null ) { + if ( conf.get( "Options.Mines.MaterialType" ) == null ) { if ( PrisonMines.getInstance() != null ) { @@ -212,7 +212,7 @@ public void initialize() { changeCount++; } } - else if ( conf.getMapList( "Options.Mines.MaterialType.NoMineAccess" ) == null ) { + else if ( conf.get( "Options.Mines.MaterialType.NoMineAccess" ) == null ) { String noMineAccess = XMaterial.REDSTONE_BLOCK.name(); 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 553de2380..84c168df4 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 @@ -106,7 +106,19 @@ public void open() { 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()) { From c358d37558f5e4f3752ba92597554981b060ef27 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 28 Jan 2023 11:28:47 -0500 Subject: [PATCH 09/75] Add new autoFeature setting to allow non-prison placed blocks to be handled by bukkit: ifBlockIsAlreadyCountedThenCancelEvent: true. Prison was canceling the event if it found a block placed in the mine that it did not place during a mine reset. This would allow players to place blocks and then remove them if they have the worldguard perms to do block breaks. These blocks are not tracked in prison and are not handled. Prison just ignores them. --- docs/changelog_v3.3.x.md | 5 +++ .../autofeatures/AutoFeaturesFileConfig.java | 1 + .../spigot/block/OnBlockBreakMines.java | 32 +++++++++++++++---- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index d49a7410b..e8ad11c9f 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,11 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14 2023-01-28 +* **Add new autoFeature setting to allow non-prison placed blocks to be handled by bukkit: ifBlockIsAlreadyCountedThenCancelEvent: true. (default setting).** +Prison was canceling the event if it found a block placed in the mine that it did not place during a mine reset. This would allow players to place blocks and then remove them if they have the worldguard perms to do block breaks. +These blocks are not tracked in prison and are not handled. Prison just ignores them. + + * **Fixed the gui config which it needed to load after loading ranks and mines. So it's initialized a second time in the startup process.** diff --git a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java index 0d3ea8fb8..0dc5c6f35 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java +++ b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java @@ -166,6 +166,7 @@ public enum AutoFeatures { isCalculateXPEnabled(general, true), givePlayerXPAsOrbDrops(general, false), + ifBlockIsAlreadyCountedThenCancelEvent(general, true), inventory(options), 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..b359ea3f2 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 @@ -11,6 +11,8 @@ import tech.mcprison.prison.Prison; import tech.mcprison.prison.PrisonAPI; +import tech.mcprison.prison.autofeatures.AutoFeaturesWrapper; +import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig.AutoFeatures; import tech.mcprison.prison.integration.CustomBlockIntegration; import tech.mcprison.prison.internal.ItemStack; import tech.mcprison.prison.internal.block.MineTargetPrisonBlock; @@ -187,22 +189,40 @@ protected MinesEventResults ignoreMinesBlockBreakEvent( Player player, Block blo SpigotPlayer sPlayer = new SpigotPlayer( player ); sPlayer.setActionBar( mineIsBeingResetMsg( mine.getTag() ) ); - results.setCancelEvent( true ); results.setIgnoreEvent( true ); + results.setCancelEvent( 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 ( 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. + //event.setCancelled( true ); + results.setIgnoreEvent( true ); + } - // Do not cancel the event... let other plugins deal with it... prison does not care about this block. - //event.setCancelled( true ); - results.setIgnoreEvent( true ); + // If the block's already been counted, then can ignore the event: + else if ( targetBlock.isCounted() ) { + + results.setIgnoreEvent( true ); + + // Cancel the event if the setting is enabled: + if ( AutoFeaturesWrapper.getInstance().isBoolean( + AutoFeatures.ifBlockIsAlreadyCountedThenCancelEvent ) ) { + + results.setCancelEvent( true ); + } + } } } + } return results; From 09532cc5db9bbe1cbbe036ced0287e9569092440 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 28 Jan 2023 13:50:12 -0500 Subject: [PATCH 10/75] Change the block break priority BLOCKEVENTS to MONITOR. Updated the docs too. --- docs/changelog_v3.3.x.md | 3 +++ docs/knownissues_v3.3.x.md | 8 ++++++ ...rison_docs_012_setting_up_prison_basics.md | 27 ++++++++++--------- .../spigot/block/BlockBreakPriority.java | 9 ++++--- 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index e8ad11c9f..c6ca81049 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,9 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14 2023-01-28 +* **Change the block break priority BLOCKEVENTS to MONITOR. Updated the docs too.** + + * **Add new autoFeature setting to allow non-prison placed blocks to be handled by bukkit: ifBlockIsAlreadyCountedThenCancelEvent: true. (default setting).** Prison was canceling the event if it found a block placed in the mine that it did not place during a mine reset. This would allow players to place blocks and then remove them if they have the worldguard perms to do block breaks. These blocks are not tracked in prison and are not handled. Prison just ignores them. diff --git a/docs/knownissues_v3.3.x.md b/docs/knownissues_v3.3.x.md index e52ca610f..880dca11d 100644 --- a/docs/knownissues_v3.3.x.md +++ b/docs/knownissues_v3.3.x.md @@ -8,6 +8,14 @@ # TODO Items for v3.3.0-alpha.13 +- break one block but blocks counts register 2 - Aimatt + +- DONE: change BLOCKEVENTS to use MONITOR priority - PrinceHatem + +- add option to allow AIR when at MONITOR priority - PrinceHatem + - issue with when a break is canceled on RevEn such as when durability is zero. + + - On the new cmdStats details, add nano run times for commands so we can include avg run times. diff --git a/docs/prison_docs_012_setting_up_prison_basics.md b/docs/prison_docs_012_setting_up_prison_basics.md index 1255707f5..0dee13510 100644 --- a/docs/prison_docs_012_setting_up_prison_basics.md +++ b/docs/prison_docs_012_setting_up_prison_basics.md @@ -7,7 +7,7 @@ This document provides a quick overview on how to install Prison and get it running. -*Documented updated: 2023-01-26* +*Documented updated: 2023-01-28*
@@ -281,15 +281,15 @@ The above listed supported Events are assigned one of the available Prison Event * **DISABED** - The event is not enabled within Prison's event monitoring. The event will not be included in the command `/prison support listeners blockBreak` command. -* **ACCESS** - Access uses the identified block within the event to identify which mine the player is in, and if the player has access to the mine. If the player does not have access, then the event is canceled. If the event has more than one block in the event, and it does not specifically identify which block was broken, it will use the first block in the provided block list. Therefore, it may make the most sense that this priority, and it's variations, are best suited to be used with the Bukkit/Spigot's **BlockBreakEvent** since all other events originate through this event. +* **ACCESS** - Access uses the identified block within the event to identify which mine the player is in, and if the player has access to the mine. This Prison priority will run at the bukkit priority of `LOWEST`. If the player does not have access, then the event is canceled. If the event has more than one block in the event, and it does not specifically identify which block was broken, it will use the first block in the provided block list. Therefore, it may make the most sense that this priority, and it's variations, are best suited to be used with the Bukkit/Spigot's **BlockBreakEvent** since all other events originate through this event. -* **ACCESSBLOCKEVENTS** - Same as ACCESS in that it generates a listener that for just mine access, but it also creates another listener for BLOCKEVENTS. This will be seen as two different listeners. +* **ACCESSBLOCKEVENTS** - Same as ACCESS in that it generates a listener that for just mine access, but it also creates another listener for BLOCKEVENTS. This will be seen as two different listeners. * **ACCESSMONITOR** - Same as ACCESS in that it generates a listener that for just mine access, but it also creates another listener for MONITOR. This will be seen as two different listeners. * **LOWEST** - **HIGHEST** - These are the normal bukkit event priorities. The lower the priority, then it will handle the event before other plugins with higher priorities. -* **BLOCKEVENTS** - Same as MONITOR, but also includes the processing of the Prison Block Events and sellall (auto sell) if enabled for full inventory. +* **BLOCKEVENTS** - Same as MONITOR, but also includes the processing of the Prison Block Events and sellall (auto sell) if enabled for full inventory. This Prison priority will run at the bukkit priority of `MONITOR`. * **MONITOR** - Monitor performs no block handling within prison, but it will try to update the block counts. MONITOR will process the event even if it is canceled. @@ -305,20 +305,21 @@ The above listed supported Events are assigned one of the available Prison Event | NORMAL | NORMAL | **Yes** | **Yes** | *No* | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | | HIGH | HIGH | **Yes** | **Yes** | *No* | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | | HIGHEST | HIGHEST | **Yes** | **Yes** | *No* | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | -| BLOCKEVENTS | HIGHEST | *No* | **Yes** | *No* | **Yes** | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | +| BLOCKEVENTS | MONITOR | *No* | **Yes** | *No* | **Yes** | *No* | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | | MONITOR | MONITOR | *No* | **Yes** | *No* | **Yes** | *No* | **Yes** | **Yes** | *No* | **Yes** | *No* | | *headers* | EvntPri | Access | In Mine | IN Wrld | IgCanEv | Blk Brk | Blk Cnt | ResetTh | BlkEvnt | MineSwp | AutoSel | **Notes:** -1. **DISABLED** will not have an actual event priority. **ACCESSBLOCKEVENTS** will have two processes; see actual priorities for ACCESS and BLOCKEVENTS. **ACCESSMONITOR** will have two processes; see actual priorities for ACCESS and MONITOR. -2. **DISABLED** will prevent a listener from starting, and it will prevent any processing of that event. -3. **Access** managed by Prison requires the use of Access by Rank (preferred) or Access by Perms. It also will vary in effectives based upon the priority level in relation to other plugins, where any plugin that has a lower priority than Prison will bypass Prison's attempts to control access. -4. **ACCESSBLOCKEVENTS** and **ACCESSMONITOR** are able to have a duel behavior because these priorities will create two different listeners, each at a different priority, and each having a different purpose. -5. **Block Break** refers to Prison handling the whole block break processing and drops. -6. **Mine Sweeper** should never be used unless there is no other way to count all the broken blocks. -7. Support for outside of the mine for auto features maybe added soon. The way it will probably be supported would be through a list of worlds in which it should be active, plus the use of WG regions too. -8. The **MONITOR** priority, including ***BLOCKEVENTS*** will ignore all events that have been canceled and will process them anyway. Therefore **ACCESSBLOCKEVENTS** and **ACCESSMONITOR** will fail on the "access" part if the event is canceled when Prison gets ahold of it the first time, which will deny access to the mines, but it will also still process the event under the priority of MONITOR or BLOCKEVENTS. +1. **ACCESSBLOCKEVENTS** and **ACCESSMONITOR** will run two events. One of which will be **ACCESS** which will have an actual bukkit priority of `LOWEST`. And the other listener will run a **BLOCKEVENTS** or **MONITOR** Prison priority which both will have an actual bukkit priority of `MONITOR`. +2. **DISABLED** will not have an actual event priority. **ACCESSBLOCKEVENTS** will have two processes; see actual priorities for ACCESS and BLOCKEVENTS. **ACCESSMONITOR** will have two processes; see actual priorities for ACCESS and MONITOR. +3. **DISABLED** will prevent a listener from starting, and it will prevent any processing of that event. +4. **Access** managed by Prison requires the use of Access by Rank (preferred) or Access by Perms. It also will vary in effectives based upon the priority level in relation to other plugins, where any plugin that has a lower priority than Prison will bypass Prison's attempts to control access. +5. **ACCESSBLOCKEVENTS** and **ACCESSMONITOR** are able to have a duel behavior because these priorities will create two different listeners, each at a different priority, and each having a different purpose. +6. **Block Break** refers to Prison handling the whole block break processing and drops. +7. **Mine Sweeper** should never be used unless there is no other way to count all the broken blocks. +8. Support for outside of the mine for auto features maybe added soon. The way it will probably be supported would be through a list of worlds in which it should be active, plus the use of WG regions too. +9. The **MONITOR** priority, including ***BLOCKEVENTS** will ignore all events that have been canceled and will process them anyway. Therefore **ACCESSBLOCKEVENTS** and **ACCESSMONITOR** will fail on the "access" part if the event is canceled when Prison gets a hold of it the first time, which will deny access to the mines, but it will also still process the event under the priority of MONITOR or BLOCKEVENTS. 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 f88f4ea97..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 ), ; From 0cfa5a095edbd6d661b041b6b978dce52b0a8268 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:52:56 -0500 Subject: [PATCH 11/75] AutoFeatures: new feature to process MONITOR and BLOCKEVENTS only if the block is AIR. The reason for this is that if we are monitoring a blockbreak event, then we can assume that the block should be AIR. This setting is important for enchantment plugins handling the block break events, since a non-AIR value would indicate that the player was not successful in breaking the block. Added more detailed debugging logging if the event is fast-failed or under normal conditions. --- docs/changelog_v3.3.x.md | 5 + docs/knownissues_v3.3.x.md | 2 +- .../autofeatures/AutoFeaturesFileConfig.java | 2 + .../api/PrisonMinesBlockBreakEvent.java | 33 +-- .../events/AutoManagerBlockBreakEvents.java | 16 +- .../events/AutoManagerCrazyEnchants.java | 18 +- .../events/AutoManagerPrisonEnchants.java | 16 +- ...nagerPrisonsExplosiveBlockBreakEvents.java | 18 +- .../AutoManagerRevEnchantsExplosiveEvent.java | 17 +- ...AutoManagerRevEnchantsJackHammerEvent.java | 16 +- .../events/AutoManagerTokenEnchant.java | 15 +- .../events/AutoManagerZenchantments.java | 16 +- .../spigot/block/OnBlockBreakEventCore.java | 35 ++- .../spigot/block/OnBlockBreakMines.java | 204 +++++++++++++++--- 14 files changed, 311 insertions(+), 102 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index c6ca81049..8518d6071 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,11 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14 2023-01-28 +* **AutoFeatures: new feature to process MONITOR and BLOCKEVENTS only if the block is AIR.** +The reason for this is that if we are monitoring a blockbreak event, then we can assume that the block should be AIR. This setting is important for enchantment plugins handling the block break events, since a non-AIR value would indicate that the player was not successful in breaking the block. +Added more detailed debugging logging if the event is fast-failed or under normal conditions. + + * **Change the block break priority BLOCKEVENTS to MONITOR. Updated the docs too.** diff --git a/docs/knownissues_v3.3.x.md b/docs/knownissues_v3.3.x.md index 880dca11d..9e10c2edd 100644 --- a/docs/knownissues_v3.3.x.md +++ b/docs/knownissues_v3.3.x.md @@ -12,7 +12,7 @@ - DONE: change BLOCKEVENTS to use MONITOR priority - PrinceHatem -- add option to allow AIR when at MONITOR priority - PrinceHatem +- DONE: add option to allow AIR when at MONITOR priority - PrinceHatem - issue with when a break is canceled on RevEn such as when durability is zero. diff --git a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java index 0dc5c6f35..689fd1837 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java +++ b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java @@ -168,6 +168,8 @@ public enum AutoFeatures { ifBlockIsAlreadyCountedThenCancelEvent(general, true), + processMonitorEventsOnlyIfPrimaryBlockIsAIR(general, true), + inventory(options), 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/autofeatures/events/AutoManagerBlockBreakEvents.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/events/AutoManagerBlockBreakEvents.java index 4be4f19d1..b3f4092e7 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 @@ -260,7 +260,7 @@ private void handleBlockBreakEvent( BlockBreakEvent e, BlockBreakPriority bbPrio // 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 ); if ( eventResults.isIgnoreEvent() ) { return; } @@ -278,6 +278,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 +293,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 ); 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 38f98dbad..8347de89e 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 @@ -275,7 +275,8 @@ public void handleBlastUseEvent( BlastUseEvent e, BlockBreakPriority bbPriority // 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 ); if ( eventResults.isIgnoreEvent() ) { return; } @@ -289,6 +290,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 +302,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 ); 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..0ac6a0ac0 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 @@ -271,7 +271,8 @@ public void handlePEExplosionEvent( PEExplosionEvent e, BlockBreakPriority bbPri // 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 ); if ( eventResults.isIgnoreEvent() ) { return; } @@ -286,6 +287,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 +300,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 1446a3493..18614e7a3 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(); @@ -241,7 +242,8 @@ protected void handleExplosiveBlockBreakEvent( ExplosiveBlockBreakEvent e, Block // 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 ); 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 ); 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 0e3ff4b09..fb9a4d918 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,7 +268,8 @@ 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 ) ); + e.getPlayer(), e.getBlocks().get( 0 ), + bbPriority ); if ( eventResults.isIgnoreEvent() ) { return; } @@ -283,6 +284,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 +297,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 ); 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 6d1ba9485..d48735dbc 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 @@ -270,7 +270,8 @@ public void handleRevEnchantsJackHammerEvent( JackHammerEvent e, BlockBreakPrior // 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 ) ); + e.getPlayer(), e.getBlocks().get( 0 ), + bbPriority ); if ( eventResults.isIgnoreEvent() ) { return; } @@ -285,6 +286,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 +299,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 ); 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 f71b95f3e..40d49069a 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 @@ -330,7 +330,7 @@ public void handleTEBlockExplodeEvent( TEBlockExplodeEvent e, BlockBreakPriority // 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 ); if ( eventResults.isIgnoreEvent() ) { return; } @@ -345,6 +345,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 +358,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 ); 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 f77ab5e3e..03b842014 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 @@ -273,7 +273,8 @@ private void handleZenchantmentsBlockBreakEvent( BlockBreakEvent e, BlockBreakPr // 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 ); if ( eventResults.isIgnoreEvent() ) { return; } @@ -287,6 +288,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 +301,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 ); 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 7b1290e32..cff209395 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,10 @@ public enum ItemLoreEnablers { - protected MinesEventResults ignoreMinesBlockBreakEvent( Cancellable event, Player player, Block block ) { + protected MinesEventResults ignoreMinesBlockBreakEvent( Cancellable event, Player player, + Block block, BlockBreakPriority bbPriority ) { - MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block ); + MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block, bbPriority ); if ( eventResults.isCancelEvent() ) { event.setCancelled( eventResults.isCancelEvent() ); @@ -178,9 +179,10 @@ 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 ) { - MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block ); + MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block, bbPriority ); if ( eventResults.isCancelEvent() ) { event.setCancelled( eventResults.isCancelEvent() ); @@ -189,9 +191,10 @@ 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 ) { - MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block ); + MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block, bbPriority ); if ( eventResults.isCancelEvent() ) { event.setCancelled( eventResults.isCancelEvent() ); @@ -200,9 +203,10 @@ 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 ) { - MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block ); + MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block, bbPriority ); if ( eventResults.isCancelEvent() ) { event.setCancelled( eventResults.isCancelEvent() ); @@ -347,9 +351,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 +377,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 +565,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 +680,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 + 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 b359ea3f2..cc0faab17 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 @@ -22,6 +22,7 @@ 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; @@ -33,6 +34,19 @@ public class OnBlockBreakMines private PrisonMines prisonMineManager; private boolean mineModuleDisabled = false; + enum EventResultsReasons { + result_reason_not_yet_set, + 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 + ; + + } + public OnBlockBreakMines() { super(); @@ -41,15 +55,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( + "Prison 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; } @@ -70,6 +162,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 ) @@ -83,7 +190,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. @@ -165,66 +272,93 @@ 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 ) { + + SpigotPlayer sPlayer = new SpigotPlayer( player ); - MinesEventResults results = new MinesEventResults(); + 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.setIgnoreEvent( true ); - results.setCancelEvent( true ); - } else { - MineTargetPrisonBlock targetBlock = mine.getTargetPrisonBlock( sBlock ); - - if ( targetBlock != null ) { + // If not minable, then display message and exit. + if ( !mine.getMineStateMutex().isMinable() ) { + results.setResultsReason( EventResultsReasons.cancel_event__mine_mutex__mine_resetting ); - // 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. - //event.setCancelled( true ); - results.setIgnoreEvent( true ); - } + sPlayer.setActionBar( mineIsBeingResetMsg( mine.getTag() ) ); + results.setIgnoreEvent( true ); + results.setCancelEvent( true ); - // If the block's already been counted, then can ignore the event: - else if ( targetBlock.isCounted() ) { + } + else { + + MineTargetPrisonBlock targetBlock = mine.getTargetPrisonBlock( sBlock ); + + if ( targetBlock != null ) { - results.setIgnoreEvent( true ); + // 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 ); + } - // Cancel the event if the setting is enabled: - if ( AutoFeaturesWrapper.getInstance().isBoolean( - AutoFeatures.ifBlockIsAlreadyCountedThenCancelEvent ) ) { + // If the block's already been counted, then can ignore the event: + else if ( targetBlock.isCounted() ) { + + results.setResultsReason( EventResultsReasons.ignore_event__block_already_counted ); + + results.setIgnoreEvent( true ); - results.setCancelEvent( 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 ); + } } } } + + } - - } + results.logDebugInfo(); + return results; } From d35184be8b671286bf3327ec37664a11172c4554 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 1 Feb 2023 01:38:19 -0500 Subject: [PATCH 12/75] Setup a temp test to test ItemsAdder. --- docs/changelog_v3.3.x.md | 5 +- .../mcprison/prison/spigot/SpigotCommand.java | 50 +++++++++++++++++++ .../spigot/customblock/PrisonItemsAdder.java | 9 ++++ .../customblock/PrisonItemsAdderWrapper.java | 17 +++++++ .../prison/spigot/game/SpigotLocation.java | 23 +++++++++ 5 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotCommand.java create mode 100644 prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotLocation.java diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 8518d6071..2a56f465d 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,10 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14 2023-01-28 +# 3.3.0-alpha.14 2023-01-31 + + +* **Setup a temp test to test ItemsAdder.** * **AutoFeatures: new feature to process MONITOR and BLOCKEVENTS only if the block is AIR.** 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/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; + } +} From 8b67725dc8026a602d1289cbd4c07815f4c6862b Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 1 Feb 2023 01:40:19 -0500 Subject: [PATCH 13/75] Setup a temp test to test ItemsAdder. --- .../src/main/java/tech/mcprison/prison/spigot/SpigotPrison.java | 2 ++ 1 file changed, 2 insertions(+) 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 99450fd4d..30d0a8920 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 @@ -407,6 +407,8 @@ public void onEnableStartup() { PrisonUtilsMineBombs.getInstance().reloadPrisonMineBombs(); + // Enable Temp spigot commands: + new SpigotCommand(); // Startup bStats: prisonBStats.initMetricsOnEnable(); From d0d9c378e8250212ee54f317e12528d5c82185c5 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 1 Feb 2023 01:45:07 -0500 Subject: [PATCH 14/75] Relocate the ACCESS failure which will trigger a TP to an accessible mine... this is relocated because it's not an event, but a behavior triggered by an event condition. --- docs/changelog_v3.3.x.md | 4 ++++ .../autofeatures/AutoFeaturesFileConfig.java | 15 ++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 2a56f465d..c3ddd5aed 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,10 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14 2023-01-31 +* **Relocate the ACCESS failure which will trigger a TP to an accessible mine...** +this is relocated because it's not an event, but a behavior triggered by an event condition. + + * **Setup a temp test to test ItemsAdder.** diff --git a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java index 689fd1837..6e4ea2e15 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java +++ b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java @@ -147,13 +147,6 @@ public enum AutoFeatures { + "ACCESSMONITOR combines two priorities: ACCESS and MONITOR." ), - eventPriorityACCESSFailureTPToCurrentMine(blockBreakEvents, true ), - - blockBreakEvents__ReadMe4(blockBreakEvents, - "ACCESS failure: if 'TPToCurrentMine' is enabled, then a failure with the " - + "ACCESS priority will TP the player back to the mine that is linked to " - + "their current rank using '/mines tp' with no mine specified." ), - general(options), @@ -171,6 +164,14 @@ public enum AutoFeatures { processMonitorEventsOnlyIfPrimaryBlockIsAIR(general, true), + eventPriorityACCESSFailureTPToCurrentMine(general, true ), + + general__ReadMe1(general, + "ACCESS failure: if 'TPToCurrentMine' is enabled, then a failure with the " + + "ACCESS priority will TP the player back to the mine that is linked to " + + "their current rank using '/mines tp' with no mine specified." ), + + inventory(options), From 0636286aef3c5950f6e27faad4b5a371119fe0f7 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 1 Feb 2023 01:51:10 -0500 Subject: [PATCH 15/75] Minor improvements to the EventResultsReasons to show a success and more detailed debug logging. --- docs/changelog_v3.3.x.md | 3 +++ .../mcprison/prison/spigot/block/OnBlockBreakMines.java | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index c3ddd5aed..17a247c79 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,9 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14 2023-01-31 +* **Minor improvements to the EventResultsReasons to show a success and more detailed debug logging.** + + * **Relocate the ACCESS failure which will trigger a TP to an accessible mine...** this is relocated because it's not an event, but a behavior triggered by an event condition. 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 cc0faab17..1db307fa1 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 @@ -36,6 +36,7 @@ public class OnBlockBreakMines 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, @@ -111,7 +112,7 @@ public String getDebugInfo() { getSpigotBlock().getLocation().toWorldCoordinates(); return String.format( - "Prison AutoFeatures: %s %s %s %s %s%s", + "AutoFeatures: %s %s %s %s %s%s ", getResultsReason().name(), getBbPriority().name(), getSpigotPlayer().getName(), @@ -357,6 +358,10 @@ else if ( targetBlock.isCounted() ) { } } + if ( results.getResultsReason() == EventResultsReasons.result_reason_not_yet_set ) { + results.setResultsReason( EventResultsReasons.results_passed ); + } + results.logDebugInfo(); return results; From d5995781b0c19e2132d60c387490ac8ff0c88809 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 1 Feb 2023 02:50:07 -0500 Subject: [PATCH 16/75] Remove the optional from getModule functions since java 17.0.6 was failing. Not sure if it's an actual java issue, or a problem caused by another plugin, or etc... this works well with java 17.0.2. --- docs/changelog_v3.3.x.md | 4 + .../prison/modules/ModuleManager.java | 119 +++++++++++------- .../prison/spigot/SpigotPlatform.java | 8 +- .../prison/spigot/api/PrisonSpigotAPI.java | 9 +- .../block/OnBlockBreakEventListener.java | 16 ++- .../spigot/block/OnBlockBreakMines.java | 11 +- .../prison/spigot/bstats/PrisonBStats.java | 26 ++-- .../commands/PrisonSpigotGUICommands.java | 21 ++-- .../PrisonSpigotPrestigeCommands.java | 6 +- .../commands/PrisonSpigotRanksCommands.java | 7 +- .../spigot/gui/ListenersPrisonManager.java | 4 +- .../gui/guiutility/SpigotGUIComponents.java | 2 +- .../gui/rank/SpigotPlayerPrestigesGUI.java | 2 +- .../spigot/gui/rank/SpigotPlayerRanksGUI.java | 2 +- .../prison/spigot/sellall/SellAllUtil.java | 3 +- 15 files changed, 136 insertions(+), 104 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 17a247c79..2fa68cec6 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,10 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14 2023-01-31 +* **Remove the optional from getModule functions since java 17.0.6 was failing.** +Not sure if it's an actual java issue, or a problem caused by another plugin, or etc... this works well with java 17.0.2. + + * **Minor improvements to the EventResultsReasons to show a success and more detailed debug logging.** 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-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPlatform.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPlatform.java index cc6d16eb1..e1df18d78 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 @@ -236,10 +236,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 +2087,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 ) { 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/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 1db307fa1..c5a716655 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,8 +10,8 @@ import tech.mcprison.prison.Prison; import tech.mcprison.prison.PrisonAPI; -import tech.mcprison.prison.autofeatures.AutoFeaturesWrapper; 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; @@ -649,9 +648,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/bstats/PrisonBStats.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/bstats/PrisonBStats.java index c4fc01adb..799d1eb61 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,43 +142,46 @@ 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 ); }) ); 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/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/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/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..533c6aaac 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 @@ -70,7 +70,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 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..6d0aa8c6d 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 @@ -901,7 +901,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; } From 1eed7dac4145fc65395323078425acf73b698972 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 1 Feb 2023 18:04:23 -0500 Subject: [PATCH 17/75] Prison Debug Block Inspector: Expand and enhanced the prison tool to provide an inspection of the block break events. Added event block details and drops being canceled for each listener. Reformatted to make it easier to read. --- docs/changelog_v3.3.x.md | 6 +- .../events/PrisonDebugBlockInspector.java | 141 ++++++++++++++---- 2 files changed, 113 insertions(+), 34 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 2fa68cec6..87bb2fffd 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,11 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14 2023-01-31 +# 3.3.0-alpha.14 2023-02-01 + + +* **Prison Debug Block Inspector: Expand and enhanced the prison tool to provide an inspection of the block break events.** +Added event block details and drops being canceled for each listener. Reformatted to make it easier to read. * **Remove the optional from getModule functions since java 17.0.6 was failing.** 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..7238a0e30 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; @@ -143,9 +184,8 @@ public void onPlayerInteract( PrisonPlayerInteractEvent e ) { // ) ); // Debug the block break events: - + dumpBlockBreakEvent( player, sBlock, targetBlock ); - } @@ -251,10 +291,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 +356,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 +382,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; From f047f96885297d90245b326797f31aebe7beedd5 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 1 Feb 2023 20:34:57 -0500 Subject: [PATCH 18/75] Update google guava from v19.0 to v31.1-jre. Guava is used for internal event listeners. --- build.gradle | 6 +++++- docs/changelog_v3.3.x.md | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 7ad958577..6da982372 100644 --- a/build.gradle +++ b/build.gradle @@ -138,7 +138,11 @@ subprojects { dependencies { implementation 'org.apache.commons:commons-lang3:3.12.0' - implementation 'com.google.guava:guava:19.0' + // https://mvnrepository.com/artifact/com.google.guava/guava + implementation 'com.google.guava:guava:31.1-jre' + + //implementation 'com.google.guava:guava:19.0' + implementation 'com.google.code.gson:gson:2.8.6' testImplementation 'junit:junit:4.12' } diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 87bb2fffd..7c2b9847e 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,10 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14 2023-02-01 + +* **Update google guava from v19.0 to v31.1-jre. Guava is used for internal event listeners.** + + * **Prison Debug Block Inspector: Expand and enhanced the prison tool to provide an inspection of the block break events.** Added event block details and drops being canceled for each listener. Reformatted to make it easier to read. From 1e398cbfafe0b86ba08cbada9ce6df41203398e6 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 1 Feb 2023 20:55:45 -0500 Subject: [PATCH 19/75] Update google gson (json IO tool) from v2.8.6 to v2.10.1 --- build.gradle | 5 ++++- docs/changelog_v3.3.x.md | 2 ++ prison-core/build.gradle | 5 ++++- prison-spigot/build.gradle | 7 +++++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 6da982372..8e7504ecf 100644 --- a/build.gradle +++ b/build.gradle @@ -143,7 +143,10 @@ subprojects { //implementation 'com.google.guava:guava:19.0' - implementation 'com.google.code.gson:gson:2.8.6' + // https://mvnrepository.com/artifact/com.google.code.gson/gson + implementation 'com.google.code.gson:gson:2.10.1' + //include(dependency('com.google.code.gson:gson:2.8.6')) + testImplementation 'junit:junit:4.12' } diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 7c2b9847e..a62d3f1be 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,8 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14 2023-02-01 +* **Update google gson (json IO tool) from v2.8.6 to v2.10.1** + * **Update google guava from v19.0 to v31.1-jre. Guava is used for internal event listeners.** diff --git a/prison-core/build.gradle b/prison-core/build.gradle index 32998645b..d158f866a 100644 --- a/prison-core/build.gradle +++ b/prison-core/build.gradle @@ -42,7 +42,10 @@ processResources { shadowJar { dependencies { include(dependency('org.apache.commons:commons-lang3:3.12.0')) - include(dependency('com.google.code.gson:gson:2.8.6')) + + // 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')) } classifier 'API' archiveVersion = null diff --git a/prison-spigot/build.gradle b/prison-spigot/build.gradle index 4be483662..675025c9c 100644 --- a/prison-spigot/build.gradle +++ b/prison-spigot/build.gradle @@ -211,8 +211,11 @@ processResources { shadowJar { dependencies { include(dependency('org.apache.commons:commons-lang3:3.12.0')) - include(dependency('com.google.code.gson:gson:2.8.6')) - + + // 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.0')) include(dependency('org.bstats:bstats-bukkit:3.0.0')) // include(dependency('org.bstats:bstats-base:2.2.1')) From f94a490fd41b2b41796649cb633189b606b0c15d Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Fri, 3 Feb 2023 21:21:28 -0500 Subject: [PATCH 20/75] Bug Fix autosell: was trying to access autosell when it was disabled. --- docs/changelog_v3.3.x.md | 5 ++++- .../prison/spigot/autofeatures/AutoManagerFeatures.java | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index a62d3f1be..6b107eb38 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,10 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14 2023-02-01 +# 3.3.0-alpha.14 2023-02-03 + + +* **Bug Fix autosell: was trying to access autosell when it was disabled.** * **Update google gson (json IO tool) from v2.8.6 to v2.10.1** 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 c3cdb3521..fe9078d01 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 @@ -989,7 +989,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(); @@ -1005,7 +1005,7 @@ public int calculateNormalDrop( PrisonMinesBlockBreakEvent pmEvent ) { } - if ( itemStack.getAmount() != 0 ) { + if ( itemStack.getAmount() != 0 && SellAllUtil.get() != null ) { if ( Output.get().isDebug() ) { From c573a9aab0f6fe6bc4bc096eaec0dc1430286a80 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Fri, 3 Feb 2023 21:45:08 -0500 Subject: [PATCH 21/75] Enable silk touch enchantment by dropping the actual blocks that are being broke. If alt fortune is being used, then fortune will apply to these silked drops. If players place silked blocks back in the mines (fi that feature is enabled), prison will ignore those blocks and won't break them... it will let bukkit or another plugin deal with them, but it will not apply any fortune to them. --- docs/changelog_v3.3.x.md | 5 +++ .../autofeatures/AutoManagerFeatures.java | 42 +++++++++++++++---- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 6b107eb38..a05cb7ff3 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,11 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14 2023-02-03 +* **Enable silk touch enchantment by dropping the actual blocks that are being broke.** +If alt fortune is being used, then fortune will apply to these silked drops. +If players place silked blocks back in the mines (fi that feature is enabled), prison will ignore those blocks and won't break them... it will let bukkit or another plugin deal with them, but it will not apply any fortune to them. + + * **Bug Fix autosell: was trying to access autosell when it was disabled.** 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 fe9078d01..c39b5b40f 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 @@ -700,6 +700,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, @@ -720,7 +724,7 @@ protected int autoPickup( PrisonMinesBlockBreakEvent pmEvent, // 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 ); @@ -925,6 +929,8 @@ public int calculateNormalDrop( PrisonMinesBlockBreakEvent pmEvent ) { // block.clearDrops(); // } + calculateSilkTouch( pmEvent ); + List drops = pmEvent.getBukkitDrops(); @@ -935,7 +941,7 @@ public int calculateNormalDrop( PrisonMinesBlockBreakEvent pmEvent ) { // Need better drop calculation that is not using the getDrops function. short fortuneLevel = getFortune( pmEvent.getItemInHand() ); - calculateSilkTouch( pmEvent.getItemInHand(), drops ); +// calculateSilkTouch( pmEvent.getItemInHand(), drops ); // Adds in additional drop items: Add Flint with gravel drops: calculateDropAdditions( pmEvent.getItemInHand(), drops ); @@ -2732,23 +2738,41 @@ else if (rnd <= 70) { } /** + *

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 ) ); + + } } From c46ead169c8b16a8c526174867a1bc0d52daeb0c Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 15 Feb 2023 03:34:27 -0500 Subject: [PATCH 22/75] Setup minecraft statistics so prison can report block mining through a new setting within the auto features. --- docs/changelog_v3.3.x.md | 5 +- .../autofeatures/AutoFeaturesFileConfig.java | 3 + .../mcprison/prison/cache/PlayerCache.java | 5 ++ .../tech/mcprison/prison/internal/Player.java | 7 +++ .../mcprison/prison/internal/block/Block.java | 6 ++ .../prison/ranks/data/RankPlayer.java | 15 +++++ .../java/tech/mcprison/prison/TestPlayer.java | 16 +++++ .../spigot/compat/CompatibilityCache.java | 5 +- .../spigot/game/SpigotOfflinePlayer.java | 19 ++++++ .../prison/spigot/game/SpigotPlayer.java | 61 ++++++++++++++++++- 10 files changed, 137 insertions(+), 5 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index a05cb7ff3..78975a11c 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,10 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14 2023-02-03 +# 3.3.0-alpha.14 2023-02-15 + + +* **Setup minecraft statistics so prison can report block mining through a new setting within the auto features.** * **Enable silk touch enchantment by dropping the actual blocks that are being broke.** diff --git a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java index 6e4ea2e15..d5d713bff 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java +++ b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java @@ -164,6 +164,9 @@ public enum AutoFeatures { processMonitorEventsOnlyIfPrimaryBlockIsAIR(general, true), + isMinecraftStatsReportingEnabled(general, true), + + eventPriorityACCESSFailureTPToCurrentMine(general, true ), general__ReadMe1(general, 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..190ba2498 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 @@ -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/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/ranks/data/RankPlayer.java b/prison-core/src/main/java/tech/mcprison/prison/ranks/data/RankPlayer.java index 26c6508d9..294523cca 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 @@ -1429,6 +1429,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 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-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/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..0e552171f 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,10 +25,15 @@ 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.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; @@ -723,7 +728,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 +795,6 @@ public boolean isInventoryFull() { return results; } - + + } From e9bb1b3c6c523e277b4990899c76dbd6034b5a39 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Thu, 16 Feb 2023 17:01:09 -0500 Subject: [PATCH 23/75] Move the check for access to the OnBlockBreakMines.ignoreMinesBlockBreakEvent so it is logged with the other conditions. --- docs/changelog_v3.3.x.md | 5 ++- .../events/AutoManagerBlockBreakEvents.java | 3 +- .../events/AutoManagerCrazyEnchants.java | 3 +- .../events/AutoManagerPrisonEnchants.java | 3 +- ...nagerPrisonsExplosiveBlockBreakEvents.java | 2 +- .../AutoManagerRevEnchantsExplosiveEvent.java | 3 +- ...AutoManagerRevEnchantsJackHammerEvent.java | 5 +-- .../events/AutoManagerTokenEnchant.java | 3 +- .../events/AutoManagerZenchantments.java | 3 +- .../spigot/block/OnBlockBreakMines.java | 31 ++++++++++++++++++- 10 files changed, 50 insertions(+), 11 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 78975a11c..118386aaa 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,10 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14 2023-02-15 +# 3.3.0-alpha.14 2023-02-16 + + +* **Move the check for access to the OnBlockBreakMines.ignoreMinesBlockBreakEvent so it is logged with the other conditions.** * **Setup minecraft statistics so prison can report block mining through a new setting within the auto features.** 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 b3f4092e7..496bac93d 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(), bbPriority ); + if ( eventResults.isIgnoreEvent() ) { return; } 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 8347de89e..87a117eb5 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,13 +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 ), bbPriority ); + if ( eventResults.isIgnoreEvent() ) { return; } 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 0ac6a0ac0..d33b81cb8 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,13 +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(), bbPriority ); + if ( eventResults.isIgnoreEvent() ) { return; } 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 18614e7a3..10fc2065d 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 @@ -237,7 +237,7 @@ protected void handleExplosiveBlockBreakEvent( ExplosiveBlockBreakEvent e, // 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. 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 fb9a4d918..954377e72 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 @@ -270,7 +270,8 @@ public void handleRevEnchantsExplosiveEvent( ExplosiveEvent e, BlockBreakPriorit MinesEventResults eventResults = ignoreMinesBlockBreakEvent( e, e.getPlayer(), e.getBlocks().get( 0 ), bbPriority ); - if ( eventResults.isIgnoreEvent() ) { + + if ( eventResults.isIgnoreEvent() ) { return; } 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 d48735dbc..ac81b525a 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 @@ -265,14 +265,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 ), bbPriority ); - if ( eventResults.isIgnoreEvent() ) { + + if ( eventResults.isIgnoreEvent() ) { return; } 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 40d49069a..e9172afe3 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(), bbPriority ); + if ( eventResults.isIgnoreEvent() ) { return; } 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 03b842014..2f09c93c4 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,13 +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(), bbPriority ); + if ( eventResults.isIgnoreEvent() ) { return; } 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 c5a716655..3d2cabbef 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 @@ -26,6 +26,9 @@ 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 @@ -42,7 +45,8 @@ enum EventResultsReasons { ignore_event__target_block_ignore_all_events, ignore_event__block_already_counted, cancel_event__block_already_counted, - ignore_event__monitor_priority_but_not_AIR + ignore_event__monitor_priority_but_not_AIR, + cancel_event__player_has_no_access ; } @@ -317,6 +321,31 @@ else if ( bbPriority.isMonitor() && !sBlock.isEmpty() && results.setIgnoreEvent( true ); results.setCancelEvent( true ); + } + else if ( bbPriority.isAccess() && !mine.hasMiningAccess(sPlayer) ) { + + 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 { From c7402bceb28e140d2f6cef1fcbaa879a205cc41f Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Thu, 16 Feb 2023 17:11:01 -0500 Subject: [PATCH 24/75] French support added by Maxcension. Thanks Maxcension! --- docs/changelog_v3.3.x.md | 3 + .../main/resources/lang/core/fr_FR.properties | 185 ++++++++++ .../resources/lang/mines/fr_FR.properties | 99 +++++ .../resources/lang/ranks/fr_FR.properties | 344 ++++++++++++++++++ .../resources/lang/sellall/fr_FR.properties | 67 ++++ .../resources/lang/spigot/fr_FR.properties | 321 ++++++++++++++++ 6 files changed, 1019 insertions(+) create mode 100644 prison-core/src/main/resources/lang/core/fr_FR.properties create mode 100644 prison-core/src/main/resources/lang/mines/fr_FR.properties create mode 100644 prison-core/src/main/resources/lang/ranks/fr_FR.properties create mode 100644 prison-core/src/main/resources/lang/sellall/fr_FR.properties create mode 100644 prison-core/src/main/resources/lang/spigot/fr_FR.properties diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 118386aaa..3ace89bcf 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,9 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14 2023-02-16 +* **French support added by Maxcension. Thanks Maxcension!** + + * **Move the check for access to the OnBlockBreakMines.ignoreMinesBlockBreakEvent so it is logged with the other conditions.** 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/fr_FR.properties b/prison-core/src/main/resources/lang/ranks/fr_FR.properties new file mode 100644 index 000000000..453e93337 --- /dev/null +++ b/prison-core/src/main/resources/lang/ranks/fr_FR.properties @@ -0,0 +1,344 @@ +# 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=27 +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] + 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..022228b3c --- /dev/null +++ b/prison-core/src/main/resources/lang/sellall/fr_FR.properties @@ -0,0 +1,67 @@ +# 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=1 +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é... + 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. + + From c4b5358f83a3105468065ec74d2935bc5d604ac6 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sun, 19 Feb 2023 10:05:31 -0500 Subject: [PATCH 25/75] Added a fortune multiplier that is applied to all fortune calculations, which allows for increasing or decreasing the results of the fortune. --- docs/changelog_v3.3.x.md | 5 +++- .../tech/mcprison/prison/PrisonCommand.java | 2 ++ .../autofeatures/AutoFeaturesFileConfig.java | 2 ++ .../prison/spigot/SpigotPlatform.java | 2 ++ .../autofeatures/AutoManagerFeatures.java | 25 ++++++++++++++----- 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 3ace89bcf..413566a19 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,10 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14 2023-02-16 +# 3.3.0-alpha.14 2023-02-19 + + +* **Added a fortune multiplier that is applied to all fortune calculations, which allows for increasing or decreasing the results of the fortune.** * **French support added by Maxcension. Thanks Maxcension!** diff --git a/prison-core/src/main/java/tech/mcprison/prison/PrisonCommand.java b/prison-core/src/main/java/tech/mcprison/prison/PrisonCommand.java index 56db240b5..6598e41b4 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/PrisonCommand.java +++ b/prison-core/src/main/java/tech/mcprison/prison/PrisonCommand.java @@ -1032,6 +1032,8 @@ public void autoFeaturesInformation(CommandSender sender) { afw.isBoolean( AutoFeatures.isCalculateXPEnabled )); display.addText( "&b options.general.givePlayerXPAsOrbDrops %s", afw.isBoolean( AutoFeatures.givePlayerXPAsOrbDrops )); + display.addText( "&b options.general.fortuneMultiplierGlobal %s", + afw.getMessage( AutoFeatures.fortuneMultiplierGlobal )); display.addText( "&b options.general.fortuneMultiplierMax %s", afw.getMessage( AutoFeatures.fortuneMultiplierMax )); diff --git a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java index d5d713bff..a19bf2146 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java +++ b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java @@ -271,7 +271,9 @@ public enum AutoFeatures { fortuneFeature(options), isCalculateFortuneEnabled(fortuneFeature, true), + + fortuneMultiplierGlobal(fortuneFeature, 1.0 ), fortuneMultiplierMax(fortuneFeature, 0 ), 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 e1df18d78..b6334f49d 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 @@ -2273,6 +2273,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 )) ); 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 c39b5b40f..311d697cb 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 @@ -381,7 +381,9 @@ protected short getFortune(SpigotItemStack itemInHand){ results = (short) maxFortuneLevel; } - return results; + double fortuneMultiplierGlobal = getDouble( AutoFeatures.fortuneMultiplierGlobal ); + + return (short) (results * fortuneMultiplierGlobal); } @@ -1263,7 +1265,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; @@ -2380,8 +2382,10 @@ protected void calculateFortune(SpigotItemStack blocks, int fortuneLevel) { multiplier = fortuneMultiplierMax; } + double fortuneMultiplierGlobal = getDouble( AutoFeatures.fortuneMultiplierGlobal ); + // add the multiplier to the count: - count += multiplier; + count += (multiplier * fortuneMultiplierGlobal); } @@ -2518,19 +2522,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 ); @@ -2733,8 +2743,11 @@ else if (rnd <= 70) { multiplier = fortuneMultiplierMax; } + + double fortuneMultiplierGlobal = getDouble( AutoFeatures.fortuneMultiplierGlobal ); + - return multiplier; + return (int) (multiplier * fortuneMultiplierGlobal); } /** From 66fbe787457cdbe90d5ae065f9aaa60fda6826d4 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Mon, 20 Feb 2023 16:39:06 -0500 Subject: [PATCH 26/75] Update auto manager docs --- docs/prison_docs_311_guide_automanager.md | 381 +++++++++++++++++++++- 1 file changed, 364 insertions(+), 17 deletions(-) diff --git a/docs/prison_docs_311_guide_automanager.md b/docs/prison_docs_311_guide_automanager.md index debd2dc93..eb578c4aa 100644 --- a/docs/prison_docs_311_guide_automanager.md +++ b/docs/prison_docs_311_guide_automanager.md @@ -14,15 +14,22 @@ See below for information on: # Auto Manager -Other content is coming soon... +AutoManager is Prison's block handler. It provides support for breaking blocks within mines, auto pickup, normal drops, fortune, mine access, block events, auto-sell, and many other features. Auto Manager has been one of the most enhanced features of Prison, and what it is capable of doing is probably more that what has been documented in this document due to the complexities involved, and the number of new features added that have not made it to this document. +Extensive work has been done with auto manager to improve the performance, and to extend the compatibility with other plugins. Many plugins have direct support (Auto Manager has event listeners for their custom events), but prison has been modified to work with many plugins that do not provide custom events too. + + +*Documented updated: 2023-02-20*


# Auto Manager Event Listener Priorities -Prison listens to a number of block break event types, and each one can be enabled or disabled. By enabling these listeners, any combination of priorities can be applied to any of the listeners. +Prison listens to a number of block break event types, and each one can be enabled or disabled. By enabling these listeners, any combination of priorities can be applied to any of the listeners. These priorities cover the standard Bukkit priorities (LOWEST to HIGHEST, plus MONITOR), but also has custom Prison priorities to extend the behaviors. + +At this time, these event listeners only apply within mines. In the near future they may be extended to work outside of mines and in other worlds too, but for now, they are only Prison mine specfic. + Valid values for the priorities are: @@ -36,12 +43,23 @@ Valid values for the priorities are: - `MONITOR` - This priority only allows Prison to record which blocks were broken in the mines. It will update the counts for the mines and the players. This setting will NOT run any Prison blockEvents. -Valid event listeners are as follows, including their default values: +- `ACCESS` - This is a new priority, where prison will check to see if a player has access to a mine, and if not, then it will cancel the block break event. If they have access, then Prison will ignore the event and will not process anything else. This `ACCESS` is designed to be used in place of WorldGuard regions if your other plugins do not require the use of WorldGuard regions. This priority does not count any block breakage. This `ACCESS` prison priority uses an event priority of `LOWEST` so it is one of the first plugins to check if a player has access to break the blocks. + +- `ACCESSMONIOR` - Same as `ACCESS` but adds a second listener to the stack for a `MONITOR` priority too. So this generates two listeners; see both `ACCESS` and `MONITOR`. + +- `ACCESSBLOCKEVENTS` - Same as `ACCESS` but adds a second listener to the stack for a `BLOCKEVENTS` priority too. So this generates two listeners; see both `ACCESS` and `BLOCKEVENTS`. + + + +Valid event listeners are as follows, including their default values. Any of the above Prison priorities can be used with the following: - `blockBreakEventPriority: LOW` - This applies to the org.bukkit.BlockBreakEvent and is the primary way Prison deals with standard block events. There may be some situations where prison would need to DISABLE this listener. - `ProcessPrisons_ExplosiveBlockBreakEventsPriority: LOW` - This is the event that must be enabled for Prison Mine Bombs to work. Other plugins may also use this Prison multi-block explosion event too. - `TokenEnchantBlockExplodeEventPriority: DISABLED` - For TokenEnchant (premium) - `CrazyEnchantsBlastUseEventPriority: DISABLED` - For CrazyEnchant (open source) +- `RevEnchantsExplosiveEventPriority: DISABLED` - For RevEnchants ExplosiveEvent (premium) +- `RevEnchantsJackHammerEventPriority: DISABLED` - For RevEnchants JackHammerEvent (premium) + - `ZenchantmentsBlockShredEventPriority: DISABLED` - For ZenChantments (open source) - `PrisonEnchantsExplosiveEventPriority: DISABLED` - Pulsi's Plugin - (Premium and free... not currently in active development for at this time) @@ -49,6 +67,24 @@ Valid event listeners are as follows, including their default values: Do not enable any event listener if you are not using that plugin. Doing so will not contribute to lag, but it will try to setup a useless event listener that could delay startup, and consume a little more memory. + + +
+ + +# Sync Tasks for Breaking Blocks + +Prison is trying its best to optimize performance so your server will have the best experience with no lag. In order to provide the best performance, some features do not always work the best on all servers due to memory limitations, processor performance, huge number of plugins, or almost any other variable which is outside of the control of Prison. Therefore, there are some performance features that work really well on some servers, but not on others. This is not a "problem" with any specific plugin, or server, but it's an expected behavior because all servers are different and they can perform in very different ways based upon configurations. + +One way Prison is able to improve performance when breaking blocks, is to process as much as it can within the block break events, except for breaking the actual blocks, and for that, prison submits a task that performs the actual block breakage. Since the act of breaking the blocks can be considerably slower than performing the calculations that lead up to the block breakage, it has been shown that by submitting the breakage as a task will improve the overall performance when you have very high over powered tools, and when there are many players online mining. + +But like everything else, there is a chance that because the block breakage is submitted as a task, that it can lead to some perceptions of lag. Its not actually causing lag on a server, but since there can be a longer delay between the calculations and the actual breaking of the blocks, it can appear as if it is lag. It's actually just a longer delay that becomes noticeable. Sometimes it's been described as it takes a while for the blocks to disappear, or the disappear for a split second, they reappear, then are removed again. This is not always related to a slow server, but can also be related to a server that has a lot of plugins that are trying to run at the same time (so the time between when the block breaks are calculated and when the submitted task to break the blocks actually runs becomes too great). + +This feature can be turned off with a simple setting change. The following is the default setting which enables the submission of the synchronized tasks. To turn it off, and to break the blocks when the listeners process the block break calculations, set this to a value of `FALSE`. + +`applyBlockBreaksThroughSyncTask: TRUE` + +
@@ -66,6 +102,9 @@ This was the original way of handling block breaks, and is the ONLY way of deali You can still cancel the events with newer versions of Spigot, but if you run in to compatibility issues with other plugins, then it may be the easiest solution. +**NOTE:** In the future, these two settings will be removed and replaced with just one setting to control what gets canceled, either the event or the drops. This will eliminate the risk of both settings being set to the same value. + + **Canceling the block break Events:** This is the default settings for Prison's Auto Features. This is the setting that must be used on Spigot versions prior to 1.12.x (Spigot 1.8.x through 1.11.x). It can also be used on newer versions of Spigot, but it may cause compatibility issues with some other plugins that need to monitor the event, which canceling the event will cause those plugins to ignore the event. @@ -84,6 +123,8 @@ options: cancelAllBlockEventBlockDrops: false ``` +*WARNING: Never set them to the same value.* + **Canceling the block drops:** @@ -106,6 +147,7 @@ options: cancelAllBlockEventBlockDrops: true ``` +*WARNING: Never set them to the same value.*
@@ -247,6 +289,78 @@ Enable by setting to any value other than `DISABLED`.
+# AutoFeatures & NormalDrops + +AutoFeatures is related to auto-pickup, auto-smelt, and auto-blocking. These are enabled with the following setting, which is on by default: + +`autoFeatures.isAutoFeaturesEnabled: TRUE` + +Please note, that these settings are "chained" together. If you disable auto-pickup, then auto-smelt and auto-block will not apply. If you have auto-pickup enabled, but disable auto-smelt, then auto-blocking is disabled too. + + +These auto features ONLY apply on priorities of LOWEST to HIGHEST. They do not apply to MONITOR, BLOCKEVENTS, ACCESS, ACCESSMONITOR, or ACCESSBLOCKEVENTS. + + +It is important to note, that this setting is a "global" setting. If it is set to `FALSE`, then it turns if off for everything, which includes the global settings, the permissions, and the lore that applies to auto-pickup, auto-smelt, and auto-blocking. + +**Global Settings** + +The following three "global" settings are on by default. This means that all players in all mines will be able to get auto-pickup, auto-smelting, and auto-blocking by default, in all mines. + +`autoPickupEnabled: TRUE` +`autoSmeltEnabled: TRUE` +`autoBlockEnabled: TRUE` + +If you do not want to apply these auto features to all players in all mines, then set the above three values to `FALSE` and then use a combination of permissions and/or lore to enable them, if desired. + + +**Permissions:** + +When using permissions for the auto features, the setting `isAutoFeaturesEnabled: TRUE` still must be enabled, but the other three "auto"s should be disabled globally. + +The default values for the perms are as follows, of which you can change the perms to anything you want them to be. + +`permissionAutoPickup: prison.automanager.pickup` +`permissionAutoSmelt: prison.automanager.smelt` +`permissionAutoBlock: prison.automanager.block` + +So any player who has these perms, whenever they are in any mine, these perms will enable auto-pickup, auto-smelt, and/or auto-blocking for them. + + +**Lore:** + +An alternative to global and perms with the auto features, is to use lore on your tools. Any tools that have these lore values will enable auto-pickup, auto-smelt, and/or auto-blocking when they are using in any Prison mine. + +The following setting must be enabled, which is set to `TRUE` by default: + +`lore.isLoreEnabled: TRUE` + +Then the following controls the lore for the auto features. These are the default values, but can be changed to "match" what is used on other enchantment plugins. The Color codes are ignored when performing the comparisons so if they vary, they should still work. + +`lorePickupValue: &dAuto Pickup&7` +`loreSmeltValue: &dAuto Smelt&7` +`loreBlockValue: &dAuto Block&7` + + +Keep in mind that any combination of Perms, Lore, or global settings will work together (global overriding everything), but `isAutoFeaturesEnabled: TRUE` must be enabled for them to work. + + + +**Normal Drops:** + +Since prison is handling the block breakage, the bukkit drops are actually disabled and will not happen. So these normal drops are enabled by default and will exist just in case the auto-pickup is disabled for the player. Keep in mind, that auto pickup can be globally disabled, and yet it can be overridden (enabled) by perms and lore. + +`handleNormalDropsEvents: TRUE` +`normalDropSmelt: TRUE` +`normalDropBlock: TRUE` + +Keep in mind, if auto-pickup is disabled for the player, and if `handleNormalDropsEvents` is also disabled, then no drops will happen even though the player "successfully" breaks the blocks. + +If auto-pickup is disabled, the the auto-smelt and auto-blocking is automatically disabled too. Hence why there is a `normalDropSmelt` and a `normalDropBlock`. + +For the `normalDropBlock` it is important to realize the blocking is based upon only the "drop" and not what is in the players inventory. So if redstone requires 9 redstone dusts to make one block, and if the player only has 8, then no blocking will happen and it will drop 8 redstone dusts. If the player has a stack of 64 redstone dust in their inventory (which has no bearing on the blocking) and they drop 14 redstone dusts, then the `normalDropBlockk` will drop ONE redstone_block, and 5 redstone dusts; their inventory has no bearing on the blocking. + + # BlockEvents - Fortune Features @@ -254,13 +368,45 @@ Enable by setting to any value other than `DISABLED`. Prison provides a few options for controlling fortune. But before those options are discussed, the process of how fortune is calculated may be a very important topic to understand since it's not a simple calculation. -Initially, prison uses Bukkit's Block.getDrops() function to get a set of ItemStacks of the drops related to the block that is being broken. These drops are not fully inclusive as you would find within a vanilla game, but are somewhat limited, and they do vary from one version of spigot to another (1.8 vs 1.16 could be drastically different). +To enable Fortune calculations within Prison, the following setting must be set to a value of `TRUE`, which is the default value: + +`fortuneFeature.isCalculateFortuneEnabled: TRUE` + + +Once fortune is enabled within Prison, there are two types of fortune calculations that can be used. Both have their own benefits, but each also has their limitations. Both cannot be be used together, as only one can be enabled at a time. + + +Both types of fortune calculations are able to use fortune multipliers, the default values are shown here: + +`fortuneMultiplierGlobal: 1.0` +`fortuneMultiplierMax: 0` + + +The `fortuneMultiplierGlobal` is a multiplier that is applied to all calculations that determine how many blocks are included in the drops. A value of **1.0** changes none of the calculations and allows them to be applied as they are calculated. A value less than one will reduce the amount of the drops. A value greater than one will increase the value of the drops. All drops are forced to integer values (you won't get fractional drops). If you set this value too low, and the calculated drops is less than a value of ONE, then the drops will be zero, so be careful when using lower values. + +This is a great way to globally shift drops up or down based upon your feelings of how generous you want Prison to be with the drops. + + + +The setting `fortuneMultiplierMax` is a way to prevent OP (over powered) tools with super high fortune enchantment levels from destroying the game play, or the economy. What it does, is it sets the maximum permitted fortune level on tools, such that if a tool has a fortune level higher than that value, then the max value is used for all fortune calculations. For example, if you set it to a value of 200 and someone has a pickaxe with a fortune of 379, then all calculations will be performed with a fortune level of **200**. A max value of ZERO disables the fortune max limit and any value will be valid, even if it's well above 1000. + + + +**Extending Bukkit Drops** + + +Initially, prison uses Bukkit's Block.getDrops() function to get a set of ItemStacks of the drops related to the block that is being broken. These drops are not fully inclusive as you would find within a vanilla game, but are somewhat limited, and they do vary from one version of spigot to another (1.8 vs 1.19 could be drastically different). + + +The extended bukkit fortune calculations are enabled with the following, which is enabled by default: + +`isExtendBukkitFortuneCalculationsEnabled: TRUE` So to correct for omissions, such as a percent chance flint would be dropped with mining of gravel, and to adjust for the limited range of fortune within the vanilla server, prison has to make adjustments. -With Fortune, the standard is for fortune 1 through 3. But with OP prison setups, Prison needs to support higher fortune levels. +With Fortune, the bukkit standard is for fortune levels 1 through 3. But with OP prison setups, Prison needs to support higher fortune levels, including hundreds of levels. With a standard block break event, you break one block and you get one drop. That is standard without fortune. So the way Prison detects if fortune is applied, is if there is more than one block provided for a drop. With fortune 3 being the highest possible level to influence the drops, Prison checks the tool to see what it's fortune level is, then uses that within the calculations. @@ -272,10 +418,34 @@ So if the tool has a fortune level of three or less, then Prison does nothing wi The way prison extends the drops for higher fortune levels for tools with a fortune over three, is to divide the standard drop by three (since it maxes out at three), then multiplies that value by the actual fortune level on the tool. The reason is that all of the random variables that went in to calculating the standard drop have already been applied, so all that needs to be done is to extend the total drop amount to cover the tool's actual fortune level. Since a fortune 3 has a higher chance to adding more to the drop compared to a fortune 1, then we can assume those random chances are reflected in the standard drop. This also means prison should not apply a random chance to the drops since that chance was already applied. -One issue with extending the fortune on the standard drops is that the amounts can appear to be much higher than what would be expected. So prison provides a way to apply a multiplier to the results to pull down that generated value. +One issue with extending the fortune on the standard drops is that the amounts can appear to be much higher than what would be expected. So prison provides a way to apply a multiplier to the results to adjust the generated values so the drops have more variability. There are two settings that allow you to control the calculated range of drops. With the bukkit drops being at 100 percent, these two allow you to extend the drops to become a percentage range, such as 70 percent to 110 percent (the default values). + +`extendBukkitFortuneFactorPercentRangeLow: 70` +`extendBukkitFortuneFactorPercentRangeHigh: 110` + + +So if a given pickaxe's OP fortune always drops 50 diamonds when mining DIAMOND_ORE, this will allow it to change the range of the drops from 35 (50 * 0.70) to 55 (50 * 1.10) diamonds, which provides a greater variability in what is being dropped. Keep in mind that bukkit will have a slight variability in the drops, but they will fall in to about 3 to 5 different values, and when extended, will still be only 3 to 5 different values. So this extendedBukkitFortuneFactor range prevents the same quantity for each drop. + + + +**Prison's Alternative Fortune Calculations** + +If you want to use the alternative fortune calculations, then you need to disable the above `isExtendBukkitFortuneCalculationsEnabled: FALSE` and then enable it with the following setting, which `FASLSE` is the default value. + +`isCalculateAltFortuneEnabled: FALSE` + +The limitations of the bukkit fortunes, is that they will never apply fortune to some blocks, such as diamond_block, emerald_block, or other solid blocks that may not be naturally occurring in the wild. -**If Auto Pickup is enabled** +The alt fortune calculations are based upon the formulas provided within the Minecraft Wiki's for standard fortune levels. The big difference is that it applies to all blocks, not just a select few. But some blocks, such as diamond_ore and redstone_ore, gets higher multipliers as with their vanilla counter parts. Also Prison's alt fortune provides higher fortune levels and will support an unlimited high fortune. + + +Remember that both the settings for `fortuneMultiplierGlobal` and `fortuneMultiplierMax` apply too, so you can have some better control over the overall drop amounts. + + + + +**Some general notes to better explain the logic of how the extended bukkit fortune is calculated:** * Bukkit's Block.getDrops() * If drops == 1 then no fortune has been added. @@ -287,41 +457,100 @@ One issue with extending the fortune on the standard drops is that the amounts c * Formula: raw_adjusted_drops x -**If Auto Pickup is disabled, and Process Normal Drops is Enabled** +
-
+# Durability Calculations (Wear) + +By default, Prison does not apply any durability (wear) to the tools that are being used within the mines. The reason Prison does not apply wear by default, is that it depends upon the version of spigot that you are running on your server, or the flavor of spigot (paper). Sometimes bukkit handles the wear, sometimes it doesn't. If bukkit is applying the wear, and you enable it within Prison too, then a tool can actually wear out twice as fast as it normally should wear out. So to error on the safe side, Prison will not enable durability calculations by default. + +`durability.isCalculateDurabilityEnabled: FALSE` + +To enable it, set the value to `TRUE`. + +When it is calculated to apply wear to the tools, it only adds 1 to the total durability on the tool. When the durability, or wear, exceeds the max durability level for the tool, then the tool will break. + +The tool's durability level will impact, and reduce, the chance to add wear to the tool. Also if the tool has the Durability Resistance enchantment, levels 1 through 100, it too will make it more difficult to add wear to the tool. If the Durability Resistance enchantment has a level of 100 (or no specified level assumes to be 100), then no wear will ever be applied to the tool. +To prevent Prison from breaking the tool when it wears out, set the following configuration settings: + +`isPreventToolBreakage: FALSE` +`preventToolBreakageThreshold: 10` + +If `isPreventToolBreakage` is enabled, then prison will not allow a tool with a threshold of the specified value, or less, to break any blocks. If a player tries, nothing will happen. Also the tool will not be worn down any more, and it will remain at that threshold value. + +The reason why there is a threshold value, is to prevent the tool from reaching ZERO and having some other plugin, or the vanilla bukkit, break the tool. It's an insurance policy to help prevent the tool from breaking. + +Please be aware that Prison will NOT prevent the tool from breaking by another plugin or by bukkit. So if a tool reaches the threshold and is not able to workk within the mines, if they use the tool out in the wild, outside of a mine, then bukkit can continue to wear the tool down until it breaks. + +Prison's preventToolBreakage is a simple process for Prison's purpose. It is not a global, complex solution that will ensure the tool will never-ever break and be lost. + + +**Durability Resistance Lore:** + +Prison has it's own custom lore that will prevent durability from being applied to the tool that is used for mining, and it is disabled by default. + +`lore.loreDurabiltyResistance: FALSE` +`loreDurabiltyResistanceName: &dDurability Resistance&7` + +To use this lore, Prison's lore handling must also be enabled. +`lore.isLoreEnabled: TRUE` -# BlockEvents - Silk Touch Features +When it's enabled, it is treated as a percentage from 1 percent to 100 percent. The percentage is a number that follows the durability resistance's name. If no number is provided, then it is treated as 100 percent. +If a random number is "rolled", from 0 to 99, and that number is greater than the durability resistance value, then prison will allow durability to be calculated normally. + +If the random number is the same as the durability resistance value, or less, then the durability calculations will be skipped. + +High values for Durability Resistance is not recommended since it will prevent wear to the tools. Smaller values could help extend the life of the tools, especially when the tools are being used with Prison explosions which may include hundreds of blocks in one hit. -At this time, Prison does not provide any support for silk touch. Internally the basics are in place, but there has never been a request to enable anything related to silk touch within the mines.
-# BlockEvents - Durability (Wear) Calculations -Sometimes the durability on the tools used for mining are applied, and sometimes they are not. +# Silk Touch Features -Prison has the ability to enable durability calculations to add wear to the tools, if needed. If bukkit is applying the durability calculations and wear, and if the prison calculations are also enabled, then too much durability wear could be applied to your tools (a doubling effect). -When it is calculated to apply wear to the tools, it only adds 1 to the total durability on the tool. When the durability, or wear, exceeds the max durability level for the tool, then the tool will break. +If a tool with Silk Touch enchantment is used, then no fortune is applied, and the blockk that is broken, is the blockk that is provided. The bukkit drops, or the alt drops, are ignored. + +Silk is enabled with the following setting, which defaults to enabled: + +`general.isCalculateSilkEnabled: TRUE` -The tool's durability level will impact, and reduce, the chance to add wear to the tool. Also if the tool has the Durability Resistance enchantment, levels 1 through 100, it too will make it more difficult to add wear to the tool. If the Durability Resistance enchantment has a level of 100 (or no specified level assumes to be 100), then no wear will ever be applied to the tool.
+# Dropping Extras + +Dropping extras is enabled by default, and an example would be dropping flint when mining gravel. The odds for dropping flint is based upon the published rates as defined by the Minecraft wiki pages. + + +`general.isCalculateDropAdditionsEnabled: TRUE` + + +
+ -# BlockEvents - XP +# Giving XP Prison has the ability to give the player XP for mining certain kinds of blocks. The XP can be give either directly, or though the generation of XP Orbs. + +The following are the default settings: + +`general.isCalculateXPEnabled: true` +`general.givePlayerXPAsOrbDrops: false` + + +Please note that drop XP as Orbs is disabled by default. If dropping by orbs, they behave as normal XP orbs behave. As such, the player may not be able to collect them all, if any, and other players may collect the XP instead of the player that earned them. There is no way to change this default orb behavior within Prison, so use with caution. + + +
@@ -331,6 +560,124 @@ Prison has the ability to give the player XP for mining certain kinds of blocks. Prison provides block break counts on tools through the use of lore, if enabled. This will track how blocks a tool has broken over it's life span. + +
+ + + +# Minecraft Stats Reporting + +*since v3.3.0-alpha.15a* + +Java based minecraft clients keep track of some basic stats. Prison, now supports updating these stats by default: + +`general.isMinecraftStatsReportingEnabled: TRUE` + +Older versions of Prison did not update them, and therefore, if you set the value to `FALSE` then it will not provide any updates to the stats. + + + +
+ + +# Calculating Food Exhaustion + +By default it is enabled: + +`general.isCalculateFoodExhustion: TRUE` +
+# Cancel Event if Block is Already Counted (prevent player placed blocks from breaking) + +This setting is enabled by default. This is a performance consideration that prevents prison from processing blocks that it has already counted and processed before. + +`general.ifBlockIsAlreadyCountedThenCancelEvent: TRUE` + +If this is set to a value of `FALSE`, Prison will then immediately ignore the event, and won't cancel it. It's impossible to "force" prison to process the same block twice. + +When this is set to a value of `TRUE`, it will prevent any player placed blocks in the mine from being broken. This includes OP'd players too. + +Setting this value to `FALSE` will allow other plugins, or bukkit, to break the block if world has be configured to allow players to break blocks within the mines. Prison will not have anything to do with the permissions on player placed blocks. For example, a world guard region would need to be setup to allow players to break blocks within a mine even if Mine Access by Rank is enabled. Some servers may allow players to place block in mines, and then break them too. This is the only way to allow Prison to ignore such blocks so they can be broken by other means. + + +
+ +# MONITOR Priority Only with AIR + +The following setting is enabled by default. It allows MONITOR priorities to be enabled only when the block that is being processed is an AIR block. This helps to ensure that the player was successful in being able to break the block. + +`general.processMonitorEventsOnlyIfPrimaryBlockIsAIR: TRUE` + +An example of where this will prevent a block from being processed under a MONITOR or BLOCKEVENTS priority, would be if the player tried to mine a block in a mine they have access to, but their pickaxe is worn out and they were not able to break the block. Because they did not break the block, the block is not an AIR block, and therefore should not be counted and processed as if it was successfully broken. + + +
+ + +# ACCESS failure - TP Player to A Mine they have access to + +This defaults to enabled: + +`general.eventPriorityACCESSFailureTPToCurrentMine: TRUE` + +When using one of the ACCESS priorities, and if a player tries to mine in a mine they do not have access to, then this feature will force the player to TP to a mine they have access to. + +This runs the command for the player: +`/mines tp` + +The behavior of `/mines tp` when no mine is specified, is that it will take the player's current rank, and find the first mine that is linked to that rank, and then it will TP them to that mine. + +If the player does not have a rank, or the ranks are not tied to mines, then this command will do nothing. + +
+ + +# Prison Tokens + +Prison tokens are not enabled by default: + +`tokensEnabled: FALSE` +`tokensBlocksPerToken: 100` + + +When they are enabled, the `tokensBlocksPerToken` defines how many blocks need to be broken before the player earns one token. + +Currently there is nothing within prison that can use tokens, but there are a some commands that can be used with other plugins to create custom uses for tokens. + +The following command will show all Prison token commands: + +`/prison tokens` + +When a player earns tokens, prison tracks which mines they earned each token in, and their total tokens earned, and their current token balance. Since tokens will be used internally in the future to control different features and allow players to "earn" specific rewards, prison also tracks how many tokens admins gave them, or removed from their balance. So for example, if a mine requires that a player earns 500 tokens within that mine, or just earn 500 tokens in general, then they cannot use tokens that were "given" to them by other players, or by admmins. Prison will be able to differentiate earned tokens from given tokens. + + +Prison command options are "add", "balance", "remove", and "set" tokens for a player. + +``` +/prison tokens add help +/prison tokens balance help +/prison tokens remove help +/prison tokens set help +``` + +If a player is given any of the tokens by these commands, they are tracked as if they are given, or removed, by an admin. There is an "option" on these commands called `forcePlayer` which forces the token transaction to be treated as if the player earned them, or spent them under normal conditions. It is not advisable to use the `forcePlayer` option since it will potentially break quests that require the player to earn tokens on their own. + +Another token option is `silent` which will prevent any notifications from being sent to the player. + +In the near future, rankup requirements will be expanded to include: + - A monetary cost (currently how rankups work) + - Require so many blocks be mined (anywhere) + - Require so many blocks be mined within the current rank's mines + - Require so many tokens be earned (anywhere) + - Require so many tokens be earned within the current rank's mines + - Require a token cost with tokens earned (or any tokens) + - And other requirements as considered possible, such as mining a specific number of blocks of a specific type from a specific mine, etc... + + + + + +
+ From 4779330e83e59a079813143a49da76bd245cc918 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Thu, 23 Feb 2023 14:35:16 -0500 Subject: [PATCH 27/75] Fixed an issue with player counts being doubled. Counts should no longer be done within the auto pickup or the normal drops... it's being handled at a higher level for consistency with other priorities. --- docs/changelog_v3.3.x.md | 5 ++- .../mcprison/prison/cache/PlayerCache.java | 2 +- .../autofeatures/AutoManagerFeatures.java | 33 +++++++++---------- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 413566a19..d8bdc1a79 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,10 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14 2023-02-19 +# 3.3.0-alpha.14 2023-02-23 + + +* **Fixed an issue with player counts being doubled. Counts should no longer be done within the auto pickup or the normal drops... it's being handled at a higher level for consistency with other priorities.** * **Added a fortune multiplier that is applied to all fortune calculations, which allows for increasing or decreasing the results of the fortune.** 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 190ba2498..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) + 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 311d697cb..86fde582a 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; @@ -767,13 +766,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"); @@ -976,16 +975,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() ); +// } From 8bb7029fbb6943d4a0df083bbcf202a1fa96dc50 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Fri, 24 Feb 2023 12:47:14 -0500 Subject: [PATCH 28/75] Enhanced some of the auto features logging related to fortune, silk touch, and event and drop canceling to eliminate ambiguity and provide more specific details. --- docs/changelog_v3.3.x.md | 5 +- .../autofeatures/AutoManagerFeatures.java | 60 +++++++++++++------ .../events/AutoManagerBlockBreakEvents.java | 4 +- 3 files changed, 47 insertions(+), 22 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index d8bdc1a79..fc672c2b6 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,10 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14 2023-02-23 +# 3.3.0-alpha.14 2023-02-24 + + +* **Enhanced some of the auto features logging related to fortune, silk touch, and event and drop canceling to eliminate ambiguity and provide more specific details.** * **Fixed an issue with player counts being doubled. Counts should no longer be done within the auto pickup or the normal drops... it's being handled at a higher level for consistency with other priorities.** 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 86fde582a..62a20e62a 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 @@ -275,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 ); @@ -359,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 ) { @@ -375,14 +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; + int maxFortuneLevel = getInteger( AutoFeatures.fortuneMultiplierMax ); - if ( maxFortuneLevel > 0 && results > maxFortuneLevel ) { + String maxFort = ""; + if ( maxFortuneLevel > 0 && fortLevel > maxFortuneLevel ) { results = (short) maxFortuneLevel; + maxFort = String.format("max=%d ", maxFortuneLevel); } double fortuneMultiplierGlobal = getDouble( AutoFeatures.fortuneMultiplierGlobal ); - return (short) (results * fortuneMultiplierGlobal); + results *= fortuneMultiplierGlobal; + + String fortInfo = String.format( "(calcFort: fort=%d %sglbMult=%d final=%d) ", + fortLevel, + maxFort, + fortuneMultiplierGlobal, + results); + + debugInfo.append( fortInfo ); + + return results; } @@ -728,14 +742,14 @@ protected int autoPickup( PrisonMinesBlockBreakEvent pmEvent, // 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 ) { @@ -940,12 +954,12 @@ public int calculateNormalDrop( PrisonMinesBlockBreakEvent pmEvent ) { pmEvent.getDebugInfo().append( "[normalDrops]" ); // 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 ); // Adds in additional drop items: Add Flint with gravel drops: - calculateDropAdditions( pmEvent.getItemInHand(), drops ); + calculateDropAdditions( pmEvent.getItemInHand(), drops, pmEvent.getDebugInfo() ); if ( isBoolean( AutoFeatures.isCalculateFortuneEnabled ) ) { @@ -2784,7 +2798,13 @@ private void calculateSilkTouch( PrisonMinesBlockBreakEvent pmEvent ) { // 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 ); } } @@ -2810,7 +2830,8 @@ private void calculateSilkTouch( PrisonMinesBlockBreakEvent pmEvent ) { * @param itemInHand * @param drops */ - private void calculateDropAdditions(SpigotItemStack itemInHand, List drops) { + private void calculateDropAdditions(SpigotItemStack itemInHand, List drops, + StringBuilder debugInfo ) { if ( isBoolean( AutoFeatures.isCalculateDropAdditionsEnabled ) ) { @@ -2821,7 +2842,7 @@ private void calculateDropAdditions(SpigotItemStack itemInHand, List 0 ) { @@ -2848,7 +2869,8 @@ 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 ); @@ -2860,7 +2882,7 @@ private List calculateDropAdditionsGravelFlint(SpigotItemStack // 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, debugInfo); switch (fortune) { case 0: // No additional threshold when fortune is zero: 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 496bac93d..4afceb0d1 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 @@ -360,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 ) { From ec7f16d8977f7b4a9bafc30d76230157d6d29c26 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Fri, 24 Feb 2023 12:48:45 -0500 Subject: [PATCH 29/75] Updated the auto features config file to include the ACCESS priorities in the list of priorities so its better understood what the real options are. --- docs/changelog_v3.3.x.md | 3 +++ .../mcprison/prison/autofeatures/AutoFeaturesFileConfig.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index fc672c2b6..5e62cd94e 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,9 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14 2023-02-24 +* **Updated the auto features config file to include the ACCESS priorities in the list of priorities so its better understood what the real options are.** + + * **Enhanced some of the auto features logging related to fortune, silk touch, and event and drop canceling to eliminate ambiguity and provide more specific details.** diff --git a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java index a19bf2146..ad339873c 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java +++ b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java @@ -130,7 +130,8 @@ public enum AutoFeatures { blockBreakEvents__ReadMe(blockBreakEvents, "Use the following event priorities with the blockBreakEvents: " + - "DISABLED, LOWEST, LOW, NORMAL, HIGH, HIGHEST, BLOCKEVENTS, MONITOR" ), + "DISABLED, LOWEST, LOW, NORMAL, HIGH, HIGHEST, BLOCKEVENTS, MONITOR, " + + "ACESS, ACCESSBLOCKEVENTS, ACCESSMONITOR"), blockBreakEvents__ReadMe2(blockBreakEvents, "MONITOR: Processed even if event is canceled. Includes block counts, " From e72eed3b401ddc606592f24d18f3db67dae1ae60 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Fri, 24 Feb 2023 12:51:34 -0500 Subject: [PATCH 30/75] Updated the formatting on the prison's mine wand for debug reporting of which blocks are clicked on. The information has been cleaned up to be easier to read and follow. It's now being logged in the console too so the details can more easily be reported back for troubleshooting. --- docs/changelog_v3.3.x.md | 4 ++++ .../events/PrisonDebugBlockInspector.java | 17 ++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 5e62cd94e..1f9ffa366 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,10 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14 2023-02-24 +* **Updated the formatting on the prison's mine wand for debug reporting of which blocks are clicked on.** +The information has been cleaned up to be easier to read and follow. It's now being logged in the console too so the details can more easily be reported back for troubleshooting. + + * **Updated the auto features config file to include the ACCESS priorities in the list of priorities so its better understood what the real options are.** 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 7238a0e30..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 @@ -124,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 ); @@ -145,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"), @@ -154,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"), @@ -165,6 +167,7 @@ public void onPlayerInteract( PrisonPlayerInteractEvent e ) { ); player.sendMessage( message2 ); + Output.get().logInfo( message2 ); } } @@ -173,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)" ) ); } From 52610da8fab76f5a3226b97c995c12469cdfce21 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 25 Feb 2023 17:31:54 -0500 Subject: [PATCH 31/75] Enhanced the debug reporting for fortune calculations and fixed a few uses of the newer fortune settings, some of which were used in the wrong locations. --- docs/changelog_v3.3.x.md | 5 +- .../autofeatures/AutoManagerFeatures.java | 179 +++++++++++++----- 2 files changed, 133 insertions(+), 51 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 1f9ffa366..c1501a929 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,10 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14 2023-02-24 +# 3.3.0-alpha.14 2023-02-25 + + +* **Enhanced the debug reporting for fortune calculations and fixed a few uses of the newer fortune settings, some of which were used in the wrong locations.** * **Updated the formatting on the prison's mine wand for debug reporting of which blocks are clicked on.** 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 62a20e62a..d0e020b73 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 @@ -376,23 +376,24 @@ protected short getFortune(SpigotItemStack itemInHand, StringBuilder debugInfo ) } short results = (short) fortLevel; +// DecimalFormat dFmt = new DecimalFormat( "#,##0.0000" ); + DecimalFormat iFmt = new DecimalFormat( "#,##0" ); int maxFortuneLevel = getInteger( AutoFeatures.fortuneMultiplierMax ); String maxFort = ""; if ( maxFortuneLevel > 0 && fortLevel > maxFortuneLevel ) { results = (short) maxFortuneLevel; - maxFort = String.format("max=%d ", maxFortuneLevel); + maxFort = String.format(" max=%s result=%s", + iFmt.format( maxFortuneLevel ), + iFmt.format( results )); } - double fortuneMultiplierGlobal = getDouble( AutoFeatures.fortuneMultiplierGlobal ); +// double fortuneMultiplierGlobal = getDouble( AutoFeatures.fortuneMultiplierGlobal ); +// results *= fortuneMultiplierGlobal; - results *= fortuneMultiplierGlobal; - - String fortInfo = String.format( "(calcFort: fort=%d %sglbMult=%d final=%d) ", - fortLevel, - maxFort, - fortuneMultiplierGlobal, - results); + String fortInfo = String.format( "(getToolFort: fort=%s%s) ", + iFmt.format( fortLevel ), + maxFort ); debugInfo.append( fortInfo ); @@ -517,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 [") @@ -525,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 [") @@ -533,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( "] "); } @@ -754,7 +755,7 @@ protected int autoPickup( PrisonMinesBlockBreakEvent pmEvent, for ( SpigotItemStack itemStack : drops ) { // calculateFortune directly modifies the quantity on the blocks ItemStack: - calculateFortune( itemStack, fortuneLevel ); + calculateFortune( itemStack, fortuneLevel, pmEvent.getDebugInfo() ); } } @@ -968,7 +969,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() ); } } @@ -2315,12 +2316,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; - int count = blocks.getAmount(); + 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 = blockCount; + int multiplier = 1; if ( isBoolean( AutoFeatures.isExtendBukkitFortuneCalculationsEnabled ) ) { @@ -2336,12 +2361,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 @@ -2367,6 +2401,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: @@ -2388,17 +2424,17 @@ 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; +// } + - double fortuneMultiplierGlobal = getDouble( AutoFeatures.fortuneMultiplierGlobal ); // add the multiplier to the count: - count += (multiplier * fortuneMultiplierGlobal); + count *= (multiplier * fortuneMultiplierGlobal); } @@ -2455,17 +2491,33 @@ 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); } + // 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 ); } } @@ -2633,13 +2685,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; @@ -2731,6 +2796,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. @@ -2744,23 +2811,26 @@ 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( "] " ); + } + } - - double fortuneMultiplierGlobal = getDouble( AutoFeatures.fortuneMultiplierGlobal ); - - return (int) (multiplier * fortuneMultiplierGlobal); + return (int) multiplier; } /** @@ -2877,12 +2947,14 @@ private List calculateDropAdditionsGravelFlint(SpigotItemStack 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, debugInfo); + int fortune = getFortune(itemInHand, debugSb); switch (fortune) { case 0: // No additional threshold when fortune is zero: @@ -2916,7 +2988,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; } From 06c98e231573a12c6fda935f05fec294893b4dd2 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 25 Feb 2023 17:42:53 -0500 Subject: [PATCH 32/75] Update to v3.3.0-alpha.14a --- docs/changelog_v3.3.x.md | 6 +++++- gradle.properties | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index c1501a929..0e2ae899f 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,11 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14 2023-02-25 +# 3.3.0-alpha.14a 2023-02-25 + + + +**Update to v3.3.0-alpha.14a** 2023-02-25 * **Enhanced the debug reporting for fortune calculations and fixed a few uses of the newer fortune settings, some of which were used in the wrong locations.** diff --git a/gradle.properties b/gradle.properties index 0d2683ffa..93c3695e4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ ## # This is actually the "correct" place to define the version for the project. ## # Used within build.gradle with ${project.version}. ## # Can be overridden on the command line: gradle -Pversion=3.2.1-alpha.3 -version=3.3.0-alpha.14 +version=3.3.0-alpha.14a From fe39268a4bf01f6ca4d925daed4a745a4898d540 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sun, 26 Feb 2023 12:45:14 -0500 Subject: [PATCH 33/75] Fixed an issue with the initial event check for events that will break multiple blocks. The issue is that the initial check will ignore the event if the primary block is air. The issue is that since the events are fired based upon the BlockBreakEvent then the odds of the primary block is AIR is very high. So for those events, the primary block should not be checked for AIR to be bypassed. This fix allows things like explosions to work. --- docs/changelog_v3.3.x.md | 5 +++- .../events/AutoManagerBlockBreakEvents.java | 2 +- .../events/AutoManagerCrazyEnchants.java | 2 +- .../events/AutoManagerPrisonEnchants.java | 2 +- ...nagerPrisonsExplosiveBlockBreakEvents.java | 2 +- .../AutoManagerRevEnchantsExplosiveEvent.java | 2 +- ...AutoManagerRevEnchantsJackHammerEvent.java | 2 +- .../events/AutoManagerTokenEnchant.java | 2 +- .../events/AutoManagerZenchantments.java | 2 +- .../spigot/block/OnBlockBreakEventCore.java | 24 ++++++++++++------- .../spigot/block/OnBlockBreakMines.java | 8 ++++--- 11 files changed, 33 insertions(+), 20 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 0e2ae899f..e0ccc3406 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,9 +10,12 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14a 2023-02-25 +# 3.3.0-alpha.14a 2023-02-26 +* **Fixed an issue with the initial event check for events that will break multiple blocks.** +The issue is that the initial check will ignore the event if the primary block is air. The issue is that since the events are fired based upon the BlockBreakEvent then the odds of the primary block is AIR is very high. So for those events, the primary block should not be checked for AIR to be bypassed. This fix allows things like explosions to work. + **Update to v3.3.0-alpha.14a** 2023-02-25 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 4afceb0d1..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 @@ -260,7 +260,7 @@ private void handleBlockBreakEvent( BlockBreakEvent e, BlockBreakPriority bbPrio // 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(), bbPriority ); + e.getPlayer(), e.getBlock(), bbPriority, false ); if ( eventResults.isIgnoreEvent() ) { return; 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 87a117eb5..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 @@ -276,7 +276,7 @@ public void handleBlastUseEvent( BlastUseEvent e, BlockBreakPriority bbPriority // means the block has already been processed. MinesEventResults eventResults = ignoreMinesBlockBreakEvent( e, e.getPlayer(), e.getBlockList().get( 0 ), - bbPriority ); + bbPriority, true ); if ( eventResults.isIgnoreEvent() ) { return; 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 d33b81cb8..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 @@ -272,7 +272,7 @@ public void handlePEExplosionEvent( PEExplosionEvent e, BlockBreakPriority bbPri // means the block has already been processed. MinesEventResults eventResults = ignoreMinesBlockBreakEvent( e, e.getPlayer(), e.getBlockBroken(), - bbPriority ); + bbPriority, true ); if ( eventResults.isIgnoreEvent() ) { return; 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 10fc2065d..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 @@ -243,7 +243,7 @@ protected void handleExplosiveBlockBreakEvent( ExplosiveBlockBreakEvent e, // means the block has already been processed. MinesEventResults eventResults = ignoreMinesBlockBreakEvent( e, e.getPlayer(), e.getBlock(), - bbPriority ); + bbPriority, true ); if ( eventResults.isIgnoreEvent() ) { return; 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 954377e72..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 @@ -269,7 +269,7 @@ public void handleRevEnchantsExplosiveEvent( ExplosiveEvent e, BlockBreakPriorit // means the block has already been processed. MinesEventResults eventResults = ignoreMinesBlockBreakEvent( e, e.getPlayer(), e.getBlocks().get( 0 ), - bbPriority ); + bbPriority, true ); if ( eventResults.isIgnoreEvent() ) { return; 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 ac81b525a..182eb619e 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 @@ -271,7 +271,7 @@ public void handleRevEnchantsJackHammerEvent( JackHammerEvent e, BlockBreakPrior // means the block has already been processed. MinesEventResults eventResults = ignoreMinesBlockBreakEvent( e, e.getPlayer(), e.getBlocks().get( 0 ), - bbPriority ); + bbPriority, true ); if ( eventResults.isIgnoreEvent() ) { return; 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 e9172afe3..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 @@ -330,7 +330,7 @@ public void handleTEBlockExplodeEvent( TEBlockExplodeEvent e, BlockBreakPriority // 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(), bbPriority ); + e.getBlock(), bbPriority, true ); if ( eventResults.isIgnoreEvent() ) { return; 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 2f09c93c4..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 @@ -274,7 +274,7 @@ private void handleZenchantmentsBlockBreakEvent( BlockBreakEvent e, BlockBreakPr // means the block has already been processed. MinesEventResults eventResults = ignoreMinesBlockBreakEvent( e, e.getPlayer(), e.getBlock(), - bbPriority ); + bbPriority, true ); if ( eventResults.isIgnoreEvent() ) { return; 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 cff209395..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 @@ -157,9 +157,11 @@ public enum ItemLoreEnablers { protected MinesEventResults ignoreMinesBlockBreakEvent( Cancellable event, Player player, - Block block, BlockBreakPriority bbPriority ) { + Block block, BlockBreakPriority bbPriority, + boolean ignoreBlockReuse ) { - MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block, bbPriority ); + MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block, + bbPriority, ignoreBlockReuse ); if ( eventResults.isCancelEvent() ) { event.setCancelled( eventResults.isCancelEvent() ); @@ -180,9 +182,11 @@ protected MinesEventResults ignoreMinesBlockBreakEvent( Cancellable event, Playe * @return */ protected MinesEventResults ignoreMinesBlockBreakEvent( ExplosiveEvent event, Player player, - Block block, BlockBreakPriority bbPriority ) { + Block block, BlockBreakPriority bbPriority, + boolean ignoreBlockReuse ) { - MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block, bbPriority ); + MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block, + bbPriority, ignoreBlockReuse ); if ( eventResults.isCancelEvent() ) { event.setCancelled( eventResults.isCancelEvent() ); @@ -192,9 +196,11 @@ protected MinesEventResults ignoreMinesBlockBreakEvent( ExplosiveEvent event, Pl } protected MinesEventResults ignoreMinesBlockBreakEvent( JackHammerEvent event, Player player, - Block block, BlockBreakPriority bbPriority ) { + Block block, BlockBreakPriority bbPriority, + boolean ignoreBlockReuse ) { - MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block, bbPriority ); + MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block, + bbPriority, ignoreBlockReuse ); if ( eventResults.isCancelEvent() ) { event.setCancelled( eventResults.isCancelEvent() ); @@ -204,9 +210,11 @@ protected MinesEventResults ignoreMinesBlockBreakEvent( JackHammerEvent event, P } protected MinesEventResults ignoreMinesBlockBreakEvent( PEExplosionEvent event, Player player, - Block block, BlockBreakPriority bbPriority ) { + Block block, BlockBreakPriority bbPriority, + boolean ignoreBlockReuse ) { - MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block, bbPriority ); + MinesEventResults eventResults = ignoreMinesBlockBreakEvent( player, block, + bbPriority, ignoreBlockReuse ); if ( eventResults.isCancelEvent() ) { event.setCancelled( eventResults.isCancelEvent() ); 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 3d2cabbef..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 @@ -276,8 +276,10 @@ public Mine findMine( UUID playerUUID, SpigotBlock sBlock, List altBlocks * @param block * @return */ - protected MinesEventResults ignoreMinesBlockBreakEvent( Player player, Block block, - BlockBreakPriority bbPriority ) { + protected MinesEventResults ignoreMinesBlockBreakEvent( Player player, + Block block, + BlockBreakPriority bbPriority, + boolean ignoreBlockReuse ) { SpigotPlayer sPlayer = new SpigotPlayer( player ); @@ -364,7 +366,7 @@ else if ( bbPriority.isAccess() && !mine.hasMiningAccess(sPlayer) ) { } // If the block's already been counted, then can ignore the event: - else if ( targetBlock.isCounted() ) { + else if ( !ignoreBlockReuse && targetBlock.isCounted() ) { results.setResultsReason( EventResultsReasons.ignore_event__block_already_counted ); From 9728b7787b7359b93171deb2583d8a3658543834 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sun, 26 Feb 2023 12:47:10 -0500 Subject: [PATCH 34/75] AutoFeatures bug fix: If global fortune multiplier is set to a value lower than 1, then there is a risk of zero drops; this prevents zero drops and returns a drop of one. --- docs/changelog_v3.3.x.md | 4 ++++ .../autofeatures/AutoManagerFeatures.java | 19 ++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index e0ccc3406..25ffbfa20 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,10 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14a 2023-02-26 +* **AutoFeatures bug fix: If global fortune multiplier is set to a value lower than 1, then there is a risk of zero drops; this prevents zero drops and returns a drop of one.** + + + * **Fixed an issue with the initial event check for events that will break multiple blocks.** The issue is that the initial check will ignore the event if the primary block is air. The issue is that since the events are fired based upon the BlockBreakEvent then the odds of the primary block is AIR is very high. So for those events, the primary block should not be checked for AIR to be bypassed. This fix allows things like explosions to work. 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 d0e020b73..67622da7d 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 @@ -2433,8 +2433,9 @@ else if ( isBoolean( AutoFeatures.isCalculateAltFortuneEnabled ) ) { - // add the multiplier to the count: - count *= (multiplier * fortuneMultiplierGlobal); +// // add the multiplier to the count: +// count *= (multiplier * fortuneMultiplierGlobal); + } @@ -2497,9 +2498,17 @@ else if ( // // multiply the multiplier: // count *= multiplier; - // add the multiplier to the count: - count *= (multiplier * fortuneMultiplierGlobal); - +// // 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: From 6a4e4756441859cf7d4ca602675049b1dec2e91c Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sun, 26 Feb 2023 12:52:24 -0500 Subject: [PATCH 35/75] Update to v3.3.0-alpha.14b 2023-02-26 --- docs/changelog_v3.3.x.md | 8 ++++++-- gradle.properties | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 25ffbfa20..c20df8c8d 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,12 +10,16 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14a 2023-02-26 +# 3.3.0-alpha.14b 2023-02-26 -* **AutoFeatures bug fix: If global fortune multiplier is set to a value lower than 1, then there is a risk of zero drops; this prevents zero drops and returns a drop of one.** +**Update to v3.3.0-alpha.14b** 2023-02-26 + + +* **AutoFeatures bug fix: If global fortune multiplier is set to a value lower than 1, then there is a risk of zero drops; this prevents zero drops and returns a drop of one.** + * **Fixed an issue with the initial event check for events that will break multiple blocks.** The issue is that the initial check will ignore the event if the primary block is air. The issue is that since the events are fired based upon the BlockBreakEvent then the odds of the primary block is AIR is very high. So for those events, the primary block should not be checked for AIR to be bypassed. This fix allows things like explosions to work. diff --git a/gradle.properties b/gradle.properties index 93c3695e4..7b9bae689 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ ## # This is actually the "correct" place to define the version for the project. ## # Used within build.gradle with ${project.version}. ## # Can be overridden on the command line: gradle -Pversion=3.2.1-alpha.3 -version=3.3.0-alpha.14a +version=3.3.0-alpha.14b From 29b2b3b1cb04931c848a6cbcfb44c2f70f25ffea Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Tue, 28 Feb 2023 15:49:23 -0500 Subject: [PATCH 36/75] AutoFeatures: Add a bukkit drops multiplier which is applied to the bukkit drops before the fortune calculations are performed. This can be used to reduce the total number of drops if a value less than 1.0 is used. A value of 1.0 does nothing. A value greater than one will increase the bukkit drops. All values are floored and are integers. --- docs/changelog_v3.3.x.md | 5 +- docs/prison_docs_311_guide_automanager.md | 19 ++++-- .../autofeatures/AutoFeaturesFileConfig.java | 1 + .../autofeatures/AutoManagerFeatures.java | 65 ++++++++++++++++++- 4 files changed, 82 insertions(+), 8 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index c20df8c8d..51cd1387f 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,10 +10,13 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14b 2023-02-26 +# 3.3.0-alpha.14b 2023-02-28 +* **AutoFeatures: Add a bukkit drops multiplier which is applied to the bukkit drops before the fortune calculations are performed.** +This can be used to reduce the total number of drops if a value less than 1.0 is used. A value of 1.0 does nothing. A value greater than one will increase the bukkit drops. All values are floored and are integers. + **Update to v3.3.0-alpha.14b** 2023-02-26 diff --git a/docs/prison_docs_311_guide_automanager.md b/docs/prison_docs_311_guide_automanager.md index eb578c4aa..3cbe8227f 100644 --- a/docs/prison_docs_311_guide_automanager.md +++ b/docs/prison_docs_311_guide_automanager.md @@ -19,7 +19,7 @@ AutoManager is Prison's block handler. It provides support for breaking blocks Extensive work has been done with auto manager to improve the performance, and to extend the compatibility with other plugins. Many plugins have direct support (Auto Manager has event listeners for their custom events), but prison has been modified to work with many plugins that do not provide custom events too. -*Documented updated: 2023-02-20* +*Documented updated: 2023-02-28*
@@ -380,17 +380,24 @@ Both types of fortune calculations are able to use fortune multipliers, the defa `fortuneMultiplierGlobal: 1.0` `fortuneMultiplierMax: 0` +`fortuneBukkitDropsMultiplier: 1.0` -The `fortuneMultiplierGlobal` is a multiplier that is applied to all calculations that determine how many blocks are included in the drops. A value of **1.0** changes none of the calculations and allows them to be applied as they are calculated. A value less than one will reduce the amount of the drops. A value greater than one will increase the value of the drops. All drops are forced to integer values (you won't get fractional drops). If you set this value too low, and the calculated drops is less than a value of ONE, then the drops will be zero, so be careful when using lower values. - -This is a great way to globally shift drops up or down based upon your feelings of how generous you want Prison to be with the drops. +The `fortuneMultiplierGlobal` is a multiplier that is applied to all calculations that determine how many blocks are included in the drops. This is applied after calculating the fortune. A value of **1.0** changes none of the calculations and allows them to be applied as they are calculated. A value less than one will reduce the amount of the drops. A value greater than one will increase the value of the drops. All drops are forced to integer values (you won't get fractional drops). The lowest value that can be returned from this adjustment is ONE; cannot return a zero value. The setting `fortuneMultiplierMax` is a way to prevent OP (over powered) tools with super high fortune enchantment levels from destroying the game play, or the economy. What it does, is it sets the maximum permitted fortune level on tools, such that if a tool has a fortune level higher than that value, then the max value is used for all fortune calculations. For example, if you set it to a value of 200 and someone has a pickaxe with a fortune of 379, then all calculations will be performed with a fortune level of **200**. A max value of ZERO disables the fortune max limit and any value will be valid, even if it's well above 1000. +The new setting `fortuneBukkitDropsMultiplier` has a default value of 1.0 and is applied to the bukkit drops before any fortune is applied. This actually adjusts the bukkit drops so if bukkit is dropping too many items or ores compared to normal blocks, this can help reduce those amounts before the fortune calculations. This is a good way to control fortune on drops that are too plentiful since it can reduce the amount that spigot is suggesting. Use a value of 1.0 (the default) to prevent the drops from being modified. + +Use a value less than one to reduce the drops, or a value greater than one to increase the drops. The minimal result value is set to one; cannot be zero. The drops are expressed in integers and no rounding is performed so a calculated value of 1.9 will have a drop of 1. + + +The use of `fortuneBukkitDropsMultiplier` is a great way to control how much bukkit drops, to keep the drops closer to a value of one per block. And then with the use of `fortuneMultiplierGlobal` it controls how generous all the calculated drops are. A combination of settings can help reduce how many redstone drop, without hurting the normal block drops. + + **Extending Bukkit Drops** @@ -437,10 +444,12 @@ If you want to use the alternative fortune calculations, then you need to disabl The limitations of the bukkit fortunes, is that they will never apply fortune to some blocks, such as diamond_block, emerald_block, or other solid blocks that may not be naturally occurring in the wild. +The alt fortune is initially based upon the bukkit drops. Therefore there is a risk that ores, such as redstone or lapis, could drop huge amounts when processed by the alt fortune. This can be controlled by the `fortuneBukkitDropsMultiplier` to lower the range of the bukkit drops, and also use `fortuneMultiplierGlobal` to adjust the final calculations. + The alt fortune calculations are based upon the formulas provided within the Minecraft Wiki's for standard fortune levels. The big difference is that it applies to all blocks, not just a select few. But some blocks, such as diamond_ore and redstone_ore, gets higher multipliers as with their vanilla counter parts. Also Prison's alt fortune provides higher fortune levels and will support an unlimited high fortune. -Remember that both the settings for `fortuneMultiplierGlobal` and `fortuneMultiplierMax` apply too, so you can have some better control over the overall drop amounts. +Remember that the settings for `fortuneBukkitDropsMultiplier`, `fortuneMultiplierGlobal` and `fortuneMultiplierMax` apply too, so you can have some better control over the overall drop amounts. diff --git a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java index ad339873c..b2498aff3 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java +++ b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java @@ -276,6 +276,7 @@ public enum AutoFeatures { fortuneMultiplierGlobal(fortuneFeature, 1.0 ), fortuneMultiplierMax(fortuneFeature, 0 ), + fortuneBukkitDropsMultiplier(fortuneFeature, 1.0 ), isExtendBukkitFortuneCalculationsEnabled(fortuneFeature, 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 67622da7d..95875ce3c 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 @@ -736,7 +736,38 @@ 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. @@ -952,7 +983,37 @@ public int calculateNormalDrop( PrisonMinesBlockBreakEvent pmEvent ) { 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(), pmEvent.getDebugInfo() ); From 11e205874b8f01e2f59815484473eff70686f76c Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Tue, 28 Feb 2023 15:53:16 -0500 Subject: [PATCH 37/75] BugFix: Fixes an issue with sellall where it is trying to sell an invalid ItemStack. As a result, the sellall pays the player for the itemstack but the itemstack is not removed. This fixes it by not trying to sell the questionable itemstacks. --- docs/changelog_v3.3.x.md | 3 + .../prison/spigot/sellall/SellAllUtil.java | 121 +++++++++++++++--- 2 files changed, 109 insertions(+), 15 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 51cd1387f..0c0486a5b 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,9 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14b 2023-02-28 +* **BugFix: Fixes an issue with sellall where it is trying to sell an invalid ItemStack.** +As a result, the sellall pays the player for the itemstack but the itemstack is not removed. This fixes it by not trying to sell the questionable itemstacks. + * **AutoFeatures: Add a bukkit drops multiplier which is applied to the bukkit drops before the fortune calculations are performed.** This can be used to reduce the total number of drops if a value less than 1.0 is used. A value of 1.0 does nothing. A value greater than one will increase the bukkit drops. All values are floored and are integers. 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 6d0aa8c6d..2968d42ab 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; @@ -537,6 +538,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 +631,8 @@ private HashMap getHashMapOfPlayerInventories(Player p) { } } - xMaterialIntegerHashMap = addInventoryToHashMap(xMaterialIntegerHashMap, p.getInventory()); + xMaterialIntegerHashMap = addInventoryToHashMap(xMaterialIntegerHashMap, getPlayerInventory( p )); +// xMaterialIntegerHashMap = addInventoryToHashMap(xMaterialIntegerHashMap, p.getInventory()); return xMaterialIntegerHashMap; } @@ -1044,22 +1103,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; } /** @@ -1770,6 +1859,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){ @@ -1786,6 +1876,7 @@ public boolean sellAllSell(Player p, boolean isUsingSign, boolean completelySile } + //TODO inventory access: getHashMapOfPlayerInventories() && removeSellableItems(p, p.getInventory()); removeSellableItems(p); rankPlayer.addBalance(sellAllCurrency, money); From 47019246bda9fc6598823f03640c42e50e561155 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Tue, 28 Feb 2023 15:56:34 -0500 Subject: [PATCH 38/75] AutoFeatures: Rev Enchants JackHammerEvent: Bug fix: The jackhammer event was not returning a list of all of the blocks involved in the event, which could be excluding hundreds if not more than 1000 blocks. The fix, uses the two points to calculate which blocks to include, and then include them through that cuboid instead of getting a list of blocks from the event. --- docs/changelog_v3.3.x.md | 4 ++ .../tech/mcprison/prison/bombs/MineBombs.java | 46 +++++++++++++++++++ ...AutoManagerRevEnchantsJackHammerEvent.java | 31 +++++++++++-- 3 files changed, 78 insertions(+), 3 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 0c0486a5b..18490d7b7 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,10 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14b 2023-02-28 +* **AutoFeatures: Rev Enchants JackHammerEvent: Bug fix: The jackhammer event was not returning a list of all of the blocks involved in the event, which could be excluding hundreds if not more than 1000 blocks.** +The fix, uses the two points to calculate which blocks to include, and then include them through that cuboid instead of getting a list of blocks from the event. + + * **BugFix: Fixes an issue with sellall where it is trying to sell an invalid ItemStack.** As a result, the sellall pays the player for the itemstack but the itemstack is not removed. This fixes it by not trying to sell the questionable itemstacks. diff --git a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java index 1908ac841..2f65a6392 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java +++ b/prison-core/src/main/java/tech/mcprison/prison/bombs/MineBombs.java @@ -465,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-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 182eb619e..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 @@ -329,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 ) ) { From 083b2193007ebd6957fd1b98dc3847743a18cdab Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Tue, 28 Feb 2023 20:08:02 -0500 Subject: [PATCH 39/75] Fixed an issue with prison utils potions where if the player was null, then it was throwing an NPE. --- docs/changelog_v3.3.x.md | 3 +++ .../spigot/utils/PrisonUtilsPotions.java | 24 +++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 18490d7b7..fe436c06d 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,9 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14b 2023-02-28 +* **Fixed an issue with prison utils potions where if the player was null, then it was throwing an NPE. ** + + * **AutoFeatures: Rev Enchants JackHammerEvent: Bug fix: The jackhammer event was not returning a list of all of the blocks involved in the event, which could be excluding hundreds if not more than 1000 blocks.** The fix, uses the two points to calculate which blocks to include, and then include them through that cuboid instead of getting a list of blocks from the event. 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 ); +// } + + + } } } From 5baa97fd88f68a2d9dba0387a69192f6feaf50bb Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Tue, 28 Feb 2023 20:11:19 -0500 Subject: [PATCH 40/75] AutoFeatures bug fix: If normal drops is enabled (no auto pickup), and sellall was disabled, then normal drops were being disabled. The location of checking for if sellall was active was in the wrong location, which was preventing prison from actually dropping the blocks for the player. --- docs/changelog_v3.3.x.md | 4 ++++ .../spigot/autofeatures/AutoManagerFeatures.java | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index fe436c06d..208ccabd7 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,10 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14b 2023-02-28 +* **AutoFeatures bug fix: If normal drops is enabled (no auto pickup), and sellall was disabled, then normal drops were being disabled.** +The location of checking for if sellall was active was in the wrong location, which was preventing prison from actually dropping the blocks for the player. + + * **Fixed an issue with prison utils potions where if the player was null, then it was throwing an NPE. ** 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 95875ce3c..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 @@ -1088,17 +1088,22 @@ public int calculateNormalDrop( PrisonMinesBlockBreakEvent pmEvent ) { } - if ( itemStack.getAmount() != 0 && SellAllUtil.get() != null ) { + if ( itemStack.getAmount() != 0 ) { if ( Output.get().isDebug() ) { // 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() ); From d75f511e2225300c9a4734a18b9de59f65feab77 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Tue, 7 Mar 2023 23:48:10 -0500 Subject: [PATCH 41/75] Fixed an issue when cannot get a player from bukkit --- docs/changelog_v3.3.x.md | 5 ++- .../prison/ranks/managers/PlayerManager.java | 37 ++++++++++++++----- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 208ccabd7..dc65cdc3c 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,10 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14b 2023-02-28 +# 3.3.0-alpha.14b 2023-03-07 + + +* **Fixed an issue when cannot get a player from bukkit** * **AutoFeatures bug fix: If normal drops is enabled (no auto pickup), and sellall was disabled, then normal drops were being disabled.** 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..b60235875 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 @@ -1455,24 +1455,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 ) { From 4455b0aca45b1bb4c141fa2eff285e823c9a8483 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 8 Mar 2023 00:08:08 -0500 Subject: [PATCH 42/75] Bug fix: bstats and topn was using the wrong function to check to see if ranks were enabled. --- docs/changelog_v3.3.x.md | 3 +++ .../tech/mcprison/prison/spigot/bstats/PrisonBStats.java | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index dc65cdc3c..c1a35c4ee 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,9 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14b 2023-03-07 +* **Bug fix: bstats and topn was using the wrong function to check to see if ranks were enabled.** + + * **Fixed an issue when cannot get a player from bukkit** 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 799d1eb61..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 @@ -185,17 +185,20 @@ public void initMetricsOnEnable() { 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 ); From 49e38e0b91117c30984f93f5c93a04a6327725bc Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 8 Mar 2023 01:19:36 -0500 Subject: [PATCH 43/75] Get part of sellall to work if ranks are disabled. The command /sellall sell works, but the other sellall commands need to be tested and fixed. --- docs/changelog_v3.3.x.md | 3 + .../mcprison/prison/spigot/SpigotPrison.java | 12 ++-- .../prison/spigot/game/SpigotPlayer.java | 39 +++++++++++++ .../prison/spigot/sellall/SellAllUtil.java | 57 ++++++++++++------- 4 files changed, 84 insertions(+), 27 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index c1a35c4ee..424c9ba84 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,9 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14b 2023-03-07 +* **Get part of sellall to work if ranks are disabled. The command /sellall sell works, but the other sellall commands need to be tested and fixed.** + + * **Bug fix: bstats and topn was using the wrong function to check to see if ranks were enabled.** 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 30d0a8920..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 @@ -1087,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 { @@ -1120,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/game/SpigotPlayer.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/game/SpigotPlayer.java index 0e552171f..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 @@ -32,12 +32,15 @@ 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; @@ -670,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; 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 2968d42ab..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 @@ -318,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(); @@ -1868,18 +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; - } - - - //TODO inventory access: getHashMapOfPlayerInventories() && removeSellableItems(p, p.getInventory()); - 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); From 211aec69b0717693682cd2cc688e3d8f131fa5b5 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 8 Mar 2023 02:05:42 -0500 Subject: [PATCH 44/75] A sellall gui message that was supposed to say that the gui was not enabled only said sellall was not enabled. Added a new message to clearly state it's the gui that is not enabled. --- docs/changelog_v3.3.x.md | 3 +++ .../src/main/resources/lang/sellall/en_US.properties | 3 ++- .../src/main/resources/lang/sellall/fi_FI.properties | 3 ++- .../src/main/resources/lang/sellall/fr_FR.properties | 3 ++- .../src/main/resources/lang/sellall/pt_PT.properties | 3 ++- .../src/main/resources/lang/sellall/zh_CN.properties | 3 ++- .../prison/sellall/messages/SpigotVariousGuiMessages.java | 6 ++++++ .../prison/spigot/commands/PrisonSpigotSellAllCommands.java | 2 +- 8 files changed, 20 insertions(+), 6 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 424c9ba84..956e85d16 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,9 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14b 2023-03-07 +* **A sellall gui message that was supposed to say that the gui was not enabled only said sellall was not enabled. Added a new message to clearly state it's the gui that is not enabled.** + + * **Get part of sellall to work if ranks are disabled. The command /sellall sell works, but the other sellall commands need to be tested and fixed.** 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 index 022228b3c..10d609a7a 100644 --- a/prison-core/src/main/resources/lang/sellall/fr_FR.properties +++ b/prison-core/src/main/resources/lang/sellall/fr_FR.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=&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-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/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)); } From 721a4150f1a65bec1cd187a67335d51d3fdea426 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Fri, 17 Mar 2023 23:36:56 -0400 Subject: [PATCH 45/75] Fixed an issue that if the prison config files are manually modified and as a result, the block events cannot be parsed, this fix prevents a null value being inserted in to the loaded block events. For example, a trailing comma would produce a null block event because the parser that prison uses will read the comma, then with nothing else following it, it injects a null in to the collection of raw data for the block events. Then when that raw data is parsed, it passed along that null as a valid block event. The fix, prevents any of the nulls from being added to the active block events. --- docs/changelog_v3.3.x.md | 6 +++++- .../java/tech/mcprison/prison/mines/data/Mine.java | 14 +++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 956e85d16..7326cddd9 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,11 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14b 2023-03-07 +# 3.3.0-alpha.14b 2023-03-17 + + +* **Fixed an issue that if the prison config files are manually modified and as a result, the block events cannot be parsed, this fix prevents a null value being inserted in to the loaded block events.** +For example, a trailing comma would produce a null block event because the parser that prison uses will read the comma, then with nothing else following it, it injects a null in to the collection of raw data for the block events. Then when that raw data is parsed, it passed along that null as a valid block event. The fix, prevents any of the nulls from being added to the active block events. * **A sellall gui message that was supposed to say that the gui was not enabled only said sellall was not enabled. Added a new message to clearly state it's the gui that is not enabled.** 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 + "]" ); + } + } } } From 0869b06a03f68daae3641a63e908bc5b8684ea28 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 24 May 2023 21:54:39 -0400 Subject: [PATCH 46/75] Added ExaltedEconomy to the soft depends so prison will wait until it is loaded before trying to startup. --- docs/changelog_v3.3.x.md | 3 +++ prison-spigot/src/main/resources/plugin.yml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 7326cddd9..653d6143f 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,9 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14b 2023-03-17 +* **Added ExaltedEconomy to the soft depends so prison will wait until it is loaded before trying to startup.** 2023-05-24 + + * **Fixed an issue that if the prison config files are manually modified and as a result, the block events cannot be parsed, this fix prevents a null value being inserted in to the loaded block events.** For example, a trailing comma would produce a null block event because the parser that prison uses will read the comma, then with nothing else following it, it injects a null in to the collection of raw data for the block events. Then when that raw data is parsed, it passed along that null as a valid block event. The fix, prevents any of the nulls from being added to the active block events. 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 From 8db3d1ec766d9f0ec4fca38c0beb5f94a6ba2718 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 24 May 2023 21:56:55 -0400 Subject: [PATCH 47/75] Update nbt api to v2.11.2 from v2.11.1 --- docs/changelog_v3.3.x.md | 3 +++ prison-spigot/build.gradle | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 653d6143f..0367cd6bb 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,9 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14b 2023-03-17 +* **Update nbt api to v2.11.2 from v2.11.1** + + * **Added ExaltedEconomy to the soft depends so prison will wait until it is loaded before trying to startup.** 2023-05-24 diff --git a/prison-spigot/build.gradle b/prison-spigot/build.gradle index 675025c9c..8d4d95085 100644 --- a/prison-spigot/build.gradle +++ b/prison-spigot/build.gradle @@ -154,7 +154,7 @@ dependencies { // NOTE: This maven repo was failing to be accessable during online builds. So added to the /lib. // 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-plugin:2.11.2' // implementation 'de.tr7zw:item-nbt-api-plugin:2.10.0' // implementation 'de.tr7zw:item-nbt-api-plugin:2.9.2' @@ -228,7 +228,7 @@ shadowJar { //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')) + include(dependency('de.tr7zw:item-nbt-api-plugin:2.11.2')) //include(dependency('de.tr7zw:item-nbt-api-plugin:2.10.0')) //include(dependency('org.inventivetalent.spiget-update:bukkit:1.4.2-SNAPSHOT')) From 71dcadd8ec3ce51d218ed4a3a71c4edd0dc9c8db Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 24 May 2023 21:58:34 -0400 Subject: [PATCH 48/75] Simple example illustrating the weakness of doubles with large values. --- docs/changelog_v3.3.x.md | 3 + .../util/ExampleJavaDoubleVsBigDecimal.java | 63 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 prison-core/src/main/java/tech/mcprison/prison/util/ExampleJavaDoubleVsBigDecimal.java diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 0367cd6bb..946352336 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,9 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14b 2023-03-17 +* **Simple example illustrating the weakness of doubles with large values.** + + * **Update nbt api to v2.11.2 from v2.11.1** 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; + } +} From 55cd4ae7ad6df7bb33c82754e4ec31aae81b9c86 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Tue, 13 Jun 2023 18:15:38 -0400 Subject: [PATCH 49/75] Update how the player objects are written when dirty. There were some situations where the RankPlayer object would be written to the file system 2 or 3 times for one change. The logic of how things are nested remains the same (to minimize breakage of the code), but the RankPlayer is not utilizing a dirty flag internally so if it's saved once, it skip the other attempts to save without changes. --- docs/changelog_v3.3.x.md | 5 ++++ .../prison/ranks/data/RankPlayer.java | 21 +++++++++++++- .../mcprison/prison/ranks/PrisonRanks.java | 11 +++++-- .../prison/ranks/data/RankPlayerFactory.java | 3 +- .../prison/ranks/managers/PlayerManager.java | 29 ++++++++++++++----- .../prison/ranks/managers/RankManager.java | 4 +++ 6 files changed, 61 insertions(+), 12 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 946352336..09ad9e394 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,11 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14b 2023-03-17 +2023-06-13 : +* **Update how the player objects are written when dirty.** There were some situations where the RankPlayer object would be written to the file system 2 or 3 times for one change. +The logic of how things are nested remains the same (to minimize breakage of the code), but the RankPlayer is not utilizing a dirty flag internally so if it's saved once, it skip the other attempts to save without changes. + + * **Simple example illustrating the weakness of doubles with large values.** 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 294523cca..95c46b7f8 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. 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..4466513f6 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,6 +36,7 @@ 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; @@ -278,7 +279,9 @@ public void checkAllPlayersForJoin() // 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 ); + RankLadder defaultLadder = getLadderManager().getLadderDefault(); + +// RankLadder defaultLadder = getLadderManager().getLadder( LadderManager.LADDER_DEFAULT ); if ( defaultLadder != null && defaultLadder.getRanks().size() > 0 ) { int addedPlayers = 0; int fixedPlayers = 0; @@ -319,9 +322,11 @@ public void checkAllPlayersForJoin() Rank rankOnDefault = null; - if ( rankPlayerFactory.getRank( rPlayer, defaultLadder ) != null ) { + PlayerRank pRank = rankPlayerFactory.getRank( rPlayer, defaultLadder ); + + if ( pRank != null ) { - rankOnDefault = rankPlayerFactory.getRank( rPlayer, defaultLadder ).getRank(); + rankOnDefault = pRank.getRank(); // Output.get().logInfo( "#### %s ladder = %s isRankNull= %s rank= %s %s [%s]" , // rPlayer.getName(), 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/managers/PlayerManager.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/managers/PlayerManager.java index b60235875..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 ); 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..af99a95c7 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() From c88a41a99dd4eab5d1a4161bf9b1f6678bf21c66 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Tue, 13 Jun 2023 18:36:16 -0400 Subject: [PATCH 50/75] Changed config.yml to be able to bypass the add new player at prison startup. This would be more related to servers that already have a large player base when they switch to this plugin. --- docs/changelog_v3.3.x.md | 4 + .../mcprison/prison/ranks/PrisonRanks.java | 158 ++++++++++-------- prison-spigot/src/main/resources/config.yml | 19 +++ 3 files changed, 108 insertions(+), 73 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 09ad9e394..be449f0da 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,10 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14b 2023-03-17 +* **Changed config.yml to be able to bypass the add new player at prison startup.** This would be more related to servers that already have a large player base when they switch to this plugin. +NOTE: It's not possible to fully test all conditions where a player object may be null. Use at your own risk if you do not allow prison to scan for new players at startup. If an error is found, please contact support ASAP in our discord server so we can get it fixed for you. + + 2023-06-13 : * **Update how the player objects are written when dirty.** There were some situations where the RankPlayer object would be written to the file system 2 or 3 times for one change. The logic of how things are nested remains the same (to minimize breakage of the code), but the RankPlayer is not utilizing a dirty flag internally so if it's saved once, it skip the other attempts to save without changes. 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 4466513f6..0c1b7c8a4 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 @@ -275,89 +275,101 @@ public void enable() { public void checkAllPlayersForJoin() { - RankUpCommand rankupCommands = rankManager.getRankupCommands(); + boolean addNewPlayers = Prison.get().getPlatform().getConfigBooleanTrue( + "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().getLadderDefault(); - + 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++; - } - } - } - - - 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 ( 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; - - PlayerRank pRank = rankPlayerFactory.getRank( rPlayer, defaultLadder ); - - if ( pRank != null ) { - - rankOnDefault = pRank.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 " + + "'prison-ranks.startup.add-new-players-on-startup: true'."); + } + } diff --git a/prison-spigot/src/main/resources/config.yml b/prison-spigot/src/main/resources/config.yml index 458a9d67b..d23e8177e 100644 --- a/prison-spigot/src/main/resources/config.yml +++ b/prison-spigot/src/main/resources/config.yml @@ -244,6 +244,25 @@ prison-mines: enable-suffocation-in-mines: false +# +# 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. +prison-ranks: + startup: + add-new-players-on-startup: true + + # 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. From b9578cae39483ef5438bb3af70e0ae5205a65463 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Tue, 13 Jun 2023 18:43:05 -0400 Subject: [PATCH 51/75] Update libraries: Update bstats from v3.0.0 to v3.0.2. Update XSeries from v9.2.0 to v9.4.0. Update vaultAPI from v1.7.0 to v1.7.1. --- docs/changelog_v3.3.x.md | 8 +++++++- prison-spigot/build.gradle | 22 +++++++++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index be449f0da..5278423eb 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,13 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14b 2023-03-17 +# 3.3.0-alpha.14b 2023-06-13 + + +* **Update libraries:** +Update bstats from v3.0.0 to v3.0.2. +Update XSeries from v9.2.0 to v9.4.0. +Update vaultAPI from v1.7.0 to v1.7.1. * **Changed config.yml to be able to bypass the add new player at prison startup.** This would be more related to servers that already have a large player base when they switch to this plugin. diff --git a/prison-spigot/build.gradle b/prison-spigot/build.gradle index 8d4d95085..b1fc33fb6 100644 --- a/prison-spigot/build.gradle +++ b/prison-spigot/build.gradle @@ -92,8 +92,8 @@ dependencies { implementation project(':prison-sellall') - implementation 'org.bstats:bstats-base:3.0.0' - implementation 'org.bstats:bstats-bukkit:3.0.0' + 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' @@ -119,7 +119,8 @@ dependencies { // 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.4.0' + //implementation 'com.github.cryptomorin:XSeries:9.2.0' //implementation 'com.github.cryptomorin:XSeries:9.0.0' //implementation 'com.github.cryptomorin:XSeries:8.8.0' @@ -142,7 +143,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' @@ -216,18 +220,22 @@ shadowJar { 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.0')) - include(dependency('org.bstats:bstats-bukkit:3.0.0')) + 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')) + + // https://mvnrepository.com/artifact/de.tr7zw/item-nbt-api-plugin include(dependency('de.tr7zw:item-nbt-api-plugin:2.11.2')) //include(dependency('de.tr7zw:item-nbt-api-plugin:2.10.0')) From f4c0568a9ae6ff62c6f80cf6c6dc1ad0eb7a1671 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Tue, 13 Jun 2023 20:57:32 -0400 Subject: [PATCH 52/75] Update the item-nbt-api library to v2.11.3 from v2.11.2. Turned out the maven repo they actually use was not mavencentral.com, of which, has not yet pulled in the updated version. Using the correct repo now. --- docs/changelog_v3.3.x.md | 4 ++++ prison-spigot/build.gradle | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 5278423eb..a1a4ee88c 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,10 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14b 2023-06-13 +* **Update the item-nbt-api library to v2.11.3 from v2.11.2.** +Turned out the maven repo they actually use was not mavencentral.com, of which, has not yet pulled in the updated version. Using the correct repo now. + + * **Update libraries:** Update bstats from v3.0.0 to v3.0.2. Update XSeries from v9.2.0 to v9.4.0. diff --git a/prison-spigot/build.gradle b/prison-spigot/build.gradle index b1fc33fb6..6f0ac8d53 100644 --- a/prison-spigot/build.gradle +++ b/prison-spigot/build.gradle @@ -67,7 +67,8 @@ repositories { maven { - url = 'https://mvnrepository.com/artifact/de.tr7zw/item-nbt-api-plugin' + 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' } @@ -155,10 +156,13 @@ dependencies { // compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.1' + // NOTE: mavenrepository.com is not the offical repo: + // 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://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.2' + implementation 'de.tr7zw:item-nbt-api-plugin: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' @@ -236,7 +240,7 @@ shadowJar { // https://mvnrepository.com/artifact/de.tr7zw/item-nbt-api-plugin - include(dependency('de.tr7zw:item-nbt-api-plugin:2.11.2')) + include(dependency('de.tr7zw:item-nbt-api-plugin:2.11.3')) //include(dependency('de.tr7zw:item-nbt-api-plugin:2.10.0')) //include(dependency('org.inventivetalent.spiget-update:bukkit:1.4.2-SNAPSHOT')) From 2f0b05eb0ccdc3a508241e98c3a0e5ad88ef1912 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Tue, 13 Jun 2023 22:28:06 -0400 Subject: [PATCH 53/75] Trying to get nbt-api setup properly with shadowing. It looks like it's correctly shadowed, but it's being improperly reported as not being shadowed. I have a conversation with the developer open to figure out what's going on with this issue. --- docs/changelog_v3.3.x.md | 3 +++ prison-spigot/build.gradle | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index a1a4ee88c..93656473a 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,9 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14b 2023-06-13 +* **Trying to get nbt-api setup properly with shadowing.** It looks like it's correctly shadowed, but it's being improperly reported as not being shadowed. I have a conversation with the developer open to figure out what's going on with this issue. + + * **Update the item-nbt-api library to v2.11.3 from v2.11.2.** Turned out the maven repo they actually use was not mavencentral.com, of which, has not yet pulled in the updated version. Using the correct repo now. diff --git a/prison-spigot/build.gradle b/prison-spigot/build.gradle index 6f0ac8d53..7b2ade208 100644 --- a/prison-spigot/build.gradle +++ b/prison-spigot/build.gradle @@ -257,7 +257,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', 'tech.mcprison.prison.nbtapi' +// relocate 'de.tr7zw.nbtapi', 'tech.mcprison.prison.nbtapi' //relocate 'me.badbones69.crazyenchantments.api.events.BlastUseEvent', 'tech.mcprison.prison.crazyenchantments.api' From 028f89ca62c69c4d21b118aecffc6106c4b100a9 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 14 Jun 2023 15:09:49 -0400 Subject: [PATCH 54/75] Fixed the way prison was using the nbt-api. Now using the correct repo and the newer API functions. --- docs/changelog_v3.3.x.md | 6 +- prison-spigot/build.gradle | 11 +- .../prison/spigot/block/SpigotItemStack.java | 136 +++++++----- .../prison/spigot/gui/SpigotGUIMenuTools.java | 20 +- .../spigot/gui/mine/SpigotPlayerMinesGUI.java | 11 +- .../spigot/gui/rank/SpigotPlayerRanksGUI.java | 17 +- .../prison/spigot/nbt/PrisonNBTUtil.java | 205 ++++++++++++------ .../spigot/utils/PrisonBombListener.java | 15 +- .../spigot/utils/PrisonUtilsMineBombs.java | 13 +- 9 files changed, 278 insertions(+), 156 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 93656473a..a858b0616 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,11 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14b 2023-06-13 +# 3.3.0-alpha.14b 2023-06-14 + + +* **Fixed the way prison was using the nbt-api.** +Now using the correct repo and the newer API functions. * **Trying to get nbt-api setup properly with shadowing.** It looks like it's correctly shadowed, but it's being improperly reported as not being shadowed. I have a conversation with the developer open to figure out what's going on with this issue. diff --git a/prison-spigot/build.gradle b/prison-spigot/build.gradle index 7b2ade208..eaccd6e17 100644 --- a/prison-spigot/build.gradle +++ b/prison-spigot/build.gradle @@ -67,7 +67,9 @@ repositories { maven { - url = 'https://repo.codemc.io/service/rest/repository/browse/maven-public/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' @@ -159,9 +161,10 @@ dependencies { // NOTE: mavenrepository.com is not the offical repo: // 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.3' + 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' @@ -240,7 +243,7 @@ shadowJar { // https://mvnrepository.com/artifact/de.tr7zw/item-nbt-api-plugin - include(dependency('de.tr7zw:item-nbt-api-plugin:2.11.3')) + 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')) @@ -257,7 +260,7 @@ shadowJar { relocate 'org.inventivetalent.update.spiget', 'tech.mcprison.prison.spiget' relocate 'com.cryptomorin', 'tech.mcprison.prison.cryptomorin' - relocate 'de.tr7zw', '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/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/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/mine/SpigotPlayerMinesGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotPlayerMinesGUI.java index 84c168df4..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; @@ -271,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/SpigotPlayerRanksGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerRanksGUI.java index 533c6aaac..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; @@ -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/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 3f85fb056..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; @@ -655,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 ); @@ -705,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) ); } } From 4ca035a06a29ad76a2a064435a20c1f4cfd0b7d4 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Thu, 15 Jun 2023 10:35:08 -0400 Subject: [PATCH 55/75] Totally stupid change: github's compiler forgot how to use overloaded functions so it was trying to use the wrong one. Renaming the function should help it's anti-AI skill sets. --- docs/changelog_v3.3.x.md | 6 +++++- .../tech/mcprison/prison/spigot/SpigotUtil.java | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index a858b0616..61f4f6222 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,11 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14b 2023-06-14 +# 3.3.0-alpha.14b 2023-06-15 + + +* **Totally stupid change: github's compiler forgot how to use overloaded functions so it was trying to use the wrong one.** +Renaming the function should help it's anti-AI skill sets. * **Fixed the way prison was using the nbt-api.** 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 ) { From c05afbd6671ab3721e36db2fcf2d1b75536adbc9 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Fri, 23 Jun 2023 13:23:21 -0400 Subject: [PATCH 56/75] Updated the PrisonJarReporter tool to include java versions 19, 20, and 21. Also fixed a bug in which if the version signature is not known, then it was returning a null. Now it returns an enum of type "JavaSE_UnknownVersion" which will prevent future errors. --- .../tech/mcprison/prison/util/PrisonJarReporter.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 ) { From 779c9dfd34381de37845dca39764e965e51320ac Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 24 Jun 2023 03:03:30 -0400 Subject: [PATCH 57/75] 2023-06-20: Version 3.3.0-alpha.14c released --- docs/changelog_v3.3.x.md | 5 ++++- gradle.properties | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 61f4f6222..5a53a6b41 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,10 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14b 2023-06-15 +# 3.3.0-alpha.14c 2023-06-20 + + +* **2023-06-20: Version 3.3.0-alpha.14c released** * **Totally stupid change: github's compiler forgot how to use overloaded functions so it was trying to use the wrong one.** diff --git a/gradle.properties b/gradle.properties index 7b9bae689..31f2bbd9e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ ## # This is actually the "correct" place to define the version for the project. ## # Used within build.gradle with ${project.version}. ## # Can be overridden on the command line: gradle -Pversion=3.2.1-alpha.3 -version=3.3.0-alpha.14b +version=3.3.0-alpha.14c From e8c0f5744420b2900969efd2a1bf6db7b19d6958 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 24 Jun 2023 11:24:37 -0400 Subject: [PATCH 58/75] Changes to the help for `/rankup` and `/prestige` commands to make it a little more clearer as to what is expected with perms and to provide more details. Added a new config setting to disable the need to use the prestige perm `ranks.rankup.presetiges` which may make it easier to get presetiges working on most servers. Prestiges still requires the use of the `ranks.user` perm which is the same perm used for `/rankup`. --- docs/changelog_v3.3.x.md | 13 +- docs/prison_docs_107_setting_up_prestiges.md | 188 +++++++++++++++++- .../prison/ranks/commands/RankUpCommand.java | 56 ++++-- prison-spigot/src/main/resources/config.yml | 46 +++-- 4 files changed, 266 insertions(+), 37 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 5a53a6b41..5bfe5d1a4 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,18 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14c 2023-06-20 +# 3.3.0-alpha.14c 2023-06-24 + + + +* **Changes to the help for `/rankup` and `/prestige` commands to make it a little more clearer** as to what is expected with perms and to provide more details. +Added a new config setting to disable the need to use the prestige perm `ranks.rankup.presetiges` which may make it easier to get presetiges working on most servers. +Prestiges still requires the use of the `ranks.user` perm which is the same perm used for `/rankup`. + + +* **Updated the PrisonJarReporter tool to include java versions 19, 20, and 21.** +Also fixed a bug in which if the version signature is not known, then it was returning a null. Now it returns an enum of type "JavaSE_UnknownVersion" which will prevent future errors. + * **2023-06-20: Version 3.3.0-alpha.14c released** diff --git a/docs/prison_docs_107_setting_up_prestiges.md b/docs/prison_docs_107_setting_up_prestiges.md index 0f3934547..c57100e20 100644 --- a/docs/prison_docs_107_setting_up_prestiges.md +++ b/docs/prison_docs_107_setting_up_prestiges.md @@ -7,6 +7,8 @@ This document provides information how to setup and use prestiges. +*Documented updated: 2023-06-24* +
# Overview @@ -17,13 +19,15 @@ This document should be able to provide the basic information to get the built i Prestiges are generally used to track how many times a player has gone through all of the default ranks. There are many variations on how prestiges are implemented, but they area always a status symbol that sets the top players from the rest. Some features may include resetting a player's monetary balance to zero, setting their rank back to the beginning, or some other change to make the next pass through the ranks slightly different, but usually more difficult. +Please use the command `/prestige help` within the console for more information about this command.
# Enabling Prestiges -By default, prestiges are disabled and must be enabled before you can use them. Even though the prestiges feature is disabled, prison still auto generates a prestige ladder. +By default, prestiges are now enabled. They may be disabled by changing the configuration setting within the +`config.yml` file. Even if the prestiges option is disabled, Prison will generate a prestige ladder. Edit the following file: @@ -32,22 +36,197 @@ Edit the following file: plugins/Prison/config.yml ``` + +Prestiges are enabled with the settings `prestige.enabled: true`. + +``` +prestige: + enabled: true + resetMoney: true + resetDefaultLadder: true + confirmation-enabled: true + prestige-confirm-gui: true + force-sellall: false + no-prestige-value: "" + enable__ranks_rankup_prestiges__permission: false +``` + + + +Note: The following setting is obsolete, but still active for now. If you have this setting in your +existing `config.yml` file, then you can still use it. But please consider updating to the newer +settings. You can "upgrade" by ranaming `config.yml` to something else, like `config_old.yml`, and +then restart your server. A new fresh copy of the `config.yml` file will be added when the +server starts up. + Then set the following item to `true` and then save the file and restart the server. ``` prestiges: true ``` -Example of enabled prestige setting +# Required Permission to use the `/prestige` Command + +In order for players to use the `/prestige` command, they must have the follow permission: +`ranks.user` + + +This permission is not related to just `/prestige`, but enables the players to use the +`/rankup` command too. + + +This permission is a core perm for the rankup commands, and therefore the Prison command handler will +enforce this perm on all players trying to use `/prestige`. If players do not have this perm, +then attempts to use the command will just end silently. + + +To differentiate `/prestige` from `/rankup`, at least on controlling who can use this command, +there is a prestige specific permission that needs to be set: +`ranks.rankup.prestiges` + + +This prestige permission can actually be disabled. See the section below titled "Prestiges: Enable the use of the perm `ranks.rankup.prestiges`" for more information. + + + + +
+ + + + +# Other Prestige Settings + + +Within the `config.yml` file, there are a few other prestiges settings that can help customize how +Prestiges works on your server. Please see the config settings list above. + + +### Prestiges: Reset Money + +`prestige.resetMoney: true` + + +When enabled, the player's balance will be reset to zero. + + + +
+ + + +
+ + +### Prestiges: Reset Default Ladder + +`prestige.resetDefaultLadder: true` + + +When enabled, the player's default rank will be reset to the default rank. +Generally that is Rank A as configured with the command `/ranks autoConfigure`. + +Please use the following command in the console to check for the default rank: +`/ranks list` + + + +
+ +### Prestiges: Confirmation Enabled + +`prestige.confirmation-enabled: true` + + +When enabled, the player will be required to reenter the command a second time +with the keyword `confirm` to provide confirmation that they want to prestige. +This is not a GUI option. + +``` +/prestige +/prestige confirm + +``` + +Please see the command `/presetige help` to see more information about the command usage. + +
+ +### Prestiges: Confirmation Enabled for the GUI + +`prestige.prestige-confirm-gui: true` + +When enabled, the player will need to confirm the prestige through a GUI confirmation +dialog. + + +
+ + +### Prestiges: Force SellAll + +`prestige.force-sellall: false` + + +When enabled, the player will be forced to go through a `/sellall` command process +when the prestige is successful. This is performed before the player's money is +reset if that option is enabled. + +The purpose of this setting is to clear the player's inventory and backpack so they +cannot sell all of it at the next higher rank which may provide far more money. +As an example, the if the highest default rank's mine has emerald blocks, and if they +fill up their inventory, and backpack, then after prestiging, they sell everything +at rank A, they may earn enough money to skip over a few of the lower default ranks. + +
+### Prestiges: No Prestige Value + +`prestige.no-prestige-value: ""` + + +This is a value that will be used within the placeholders for players that do not +have a prestige rank. This will be applied to the rank's name and tag value. + +Example of a placeholder that would use this setting would be +`prison_rank_laddername`. So inserting "prestige' for the *laddername* would result in: +`prison_rank_prestige`. + + + +
+ + +### Prestiges: Enable the use of the perm `ranks.rankup.prestiges` + +`prestige.enable__ranks_rankup_prestiges__permission: false` + + +When this setting is enabled, then all players who may use the `/prestige` command +would have to have the permission `ranks.rankup.prestiges`. + + +When this setting is disabled, all players will be able to use the `/prestige` +command without having to have a permission set. + + +
+ + + +
+ + + + # The Prestige Ladder -The prestige ladder is created by default and is named `prestiges`, even if prestiges are not enabled. Ranks can be added to the presetige ladder, even if it is not enabled. +The prestige ladder is created by default and is named `prestiges`, even if prestiges are not enabled. Ranks can be added to the prestige ladder, even if it is not enabled. In order to use prestiges, you need to create new ranks for each prestige level. Add them as you would for the default ladder and the normal ranks, but you need to specify the prestige ladder name within the commands. @@ -201,6 +380,3 @@ This command is intended for players and can be enabled, or disabled, within the
- - - 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-spigot/src/main/resources/config.yml b/prison-spigot/src/main/resources/config.yml index d23e8177e..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,23 +273,6 @@ prison-mines: enable-suffocation-in-mines: false -# -# 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. -prison-ranks: - startup: - add-new-players-on-startup: true # Warning: Do not use the following option. This could break the natural Bukkit From 2cbc297862e66253576e49b0c29c15b675ab9ea2 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 24 Jun 2023 15:18:31 -0400 Subject: [PATCH 59/75] I made a mistake when adding the new feature to skip player scans on startup. I added a new root perm in config.yml that started with `prison-ranks` when `ranks` already existed. Therefore, I changed the defaults in config.sys to fix this and changed the code to allow the old version of the config (the bad version) and the newer version. --- docs/changelog_v3.3.x.md | 3 +++ .../java/tech/mcprison/prison/ranks/PrisonRanks.java | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 5bfe5d1a4..ddc25e7bf 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,9 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14c 2023-06-24 +* **I made a mistake when adding the new feature to skip player scans on startup.** +I added a new root perm in config.yml that started with `prison-ranks` when `ranks` already existed. Therefore, I changed the defaults in config.sys to fix this and changed the code to allow the old version of the config (the bad version) and the newer version. + * **Changes to the help for `/rankup` and `/prestige` commands to make it a little more clearer** as to what is expected with perms and to provide more details. Added a new config setting to disable the need to use the prestige perm `ranks.rankup.presetiges` which may make it easier to get presetiges working on most servers. 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 0c1b7c8a4..bbe888768 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 @@ -275,8 +275,11 @@ public void enable() { public void checkAllPlayersForJoin() { - boolean addNewPlayers = Prison.get().getPlatform().getConfigBooleanTrue( - "prison-ranks.startup.add-new-players-on-startup" ); + 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 ( addNewPlayers ) { @@ -367,7 +370,7 @@ public void checkAllPlayersForJoin() else { Output.get().logInfo( "Ranks: First Join Checks disabled. Enable in 'config.yml' by adding " + - "'prison-ranks.startup.add-new-players-on-startup: true'."); + "'ranks.startup.add-new-players-on-startup: true'."); } } From 7c8418a3cca71494e052c4c37f1906fcd92fb084 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 28 Jun 2023 00:17:45 -0400 Subject: [PATCH 60/75] Bug fix: found that under a rare situation that it was trying to use an empty String with decimal formatting. This was found while testing some placeholders while players were offline. --- docs/changelog_v3.3.x.md | 6 ++++- .../prison/ranks/data/RankPlayer.java | 8 +++--- .../prison/ranks/managers/RankManager.java | 27 ++++++++++++++++--- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index ddc25e7bf..07d9f7f8f 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,11 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14c 2023-06-24 +# 3.3.0-alpha.14c 2023-06-28 + + +* **Bug fix: found that under a rare situation that it was trying to use an empty String with decimal formatting.** +This was found while testing some placeholders while players were offline. * **I made a mistake when adding the new feature to skip player scans on startup.** 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 95c46b7f8..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 @@ -1705,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, @@ -1752,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-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 af99a95c7..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 @@ -730,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 ); @@ -1273,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 ) { From 37dbc08e58b6513631e5fe66a5105674aea4ef74 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Wed, 28 Jun 2023 00:45:15 -0400 Subject: [PATCH 61/75] MC 1.18 new world height support. Prison now supports the newer world heights as found in mc 1.18.x and newer. The new range for Y is from -64 to 320. --- docs/changelog_v3.3.x.md | 5 +++++ .../prison/internal/platform/Platform.java | 5 +++++ .../java/tech/mcprison/prison/util/Bounds.java | 12 ++++++++---- .../tech/mcprison/prison/TestPlatform.java | 10 ++++++++++ .../mcprison/prison/spigot/SpigotPlatform.java | 10 ++++++++++ .../spigot/compat/CompatibilityBlocks.java | 5 +++++ .../prison/spigot/compat/Spigot118.java | 18 ++++++++++++++++++ .../prison/spigot/compat/Spigot18Blocks.java | 12 ++++++++++++ .../spigot/compat/SpigotCompatibility.java | 10 +++++----- 9 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot118.java diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 07d9f7f8f..2af92c7c7 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,11 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14c 2023-06-28 +* **MC 1.18 new world height support.** +Prison now supports the newer world heights as found in mc 1.18.x and newer. +The new range for Y is from -64 to 320. + + * **Bug fix: found that under a rare situation that it was trying to use an empty String with decimal formatting.** This was found while testing some placeholders while players were offline. 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/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/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-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPlatform.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPlatform.java index b6334f49d..5dae47706 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 @@ -3099,4 +3099,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/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/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()); From 9df55e057ec33e806a9da1a73ea94a758551ecab Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Thu, 6 Jul 2023 18:28:10 -0400 Subject: [PATCH 62/75] Update topN Stats. This is not the same as topNPlayers and this is not yet being used. This tracks topN on blocks mined, tokens, and the player's ranks and balances. The comparator was not correct and was fixed. --- docs/changelog_v3.3.x.md | 7 +- .../prison/cache/TopNRanksComparator.java | 69 ++++++++++++------- .../mcprison/prison/cache/TopNStatsData.java | 44 +++++++++++- ...TopNStats.java => TopNStatsSingleton.java} | 12 ++-- .../prison/ranks/data/RankLadder.java | 21 ++++++ 5 files changed, 121 insertions(+), 32 deletions(-) rename prison-core/src/main/java/tech/mcprison/prison/cache/{TopNStats.java => TopNStatsSingleton.java} (76%) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 2af92c7c7..fd7f04ee8 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,12 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14c 2023-06-28 +# 3.3.0-alpha.14c 2023-07-06 + + +* **Update topN Stats.** This is not the same as topNPlayers and this is not yet being used. +This tracks topN on blocks mined, tokens, and the player's ranks and balances. +The comparator was not correct and was fixed. * **MC 1.18 new world height support.** 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/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. * From a81f2e25cb69a4952e9e4d7187dd417446e38205 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Thu, 6 Jul 2023 21:02:00 -0400 Subject: [PATCH 63/75] Updated ItemsAdder from v3.2.5 to v3.5.0b because github's build was failing to find v3.2.5 online and was killing the prison build. --- docs/changelog_v3.3.x.md | 4 ++++ prison-spigot/build.gradle | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index fd7f04ee8..06abb663c 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,10 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14c 2023-07-06 +* **Updated ItemsAdder from v3.2.5 to v3.5.0b** +because github's build was failing to find v3.2.5 online and was killing the prison build. + + * **Update topN Stats.** This is not the same as topNPlayers and this is not yet being used. This tracks topN on blocks mined, tokens, and the player's ranks and balances. The comparator was not correct and was fixed. diff --git a/prison-spigot/build.gradle b/prison-spigot/build.gradle index eaccd6e17..39c36162e 100644 --- a/prison-spigot/build.gradle +++ b/prison-spigot/build.gradle @@ -172,7 +172,8 @@ dependencies { // 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' From f4692c10158c2e2283f436ecdfd1980b43340d4b Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Fri, 7 Jul 2023 02:02:18 -0400 Subject: [PATCH 64/75] Update the topN command to eliminate the use of the save file. All players are dynamically loaded by the refresh task. Stats have been added and are not a new option for the command. To act as a form of debugging feature, the save of the topN data has been disconnected from the current process. --- docs/changelog_v3.3.x.md | 5 + .../mcprison/prison/ranks/PrisonRanks.java | 8 +- .../prison/ranks/commands/RanksCommands.java | 63 ++++++- .../ranks/commands/RanksCommandsMessages.java | 21 +++ .../prison/ranks/data/TopNPlayers.java | 164 ++++++++++++++---- ...anksStartupPlayerValidationsAsyncTask.java | 6 +- .../tasks/TopNPlayerUpdateAsyncTask.java | 20 ++- 7 files changed, 239 insertions(+), 48 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 06abb663c..a788ca04c 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,11 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14c 2023-07-06 +* **Update the topN command to eliminate the use of the save file.** +All players are dynamically loaded by the refresh task. Stats have been added and are not a new option for the command. +To act as a form of debugging feature, the save of the topN data has been disconnected from the current process. + + * **Updated ItemsAdder from v3.2.5 to v3.5.0b** because github's build was failing to find v3.2.5 online and was killing the prison build. 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 bbe888768..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 @@ -41,6 +41,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.LadderManager; import tech.mcprison.prison.ranks.managers.PlayerManager; import tech.mcprison.prison.ranks.managers.RankManager; @@ -200,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." ); @@ -228,7 +230,7 @@ public void enable() { - // Load up all else + // Load up everything else new FirstJoinHandler(); new ChatHandler(); @@ -261,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: 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..8a40e2cf6 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,37 @@ 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 ) ) { + DecimalFormat dFmt = Prison.get().getDecimalFormat("#,##0.000"); + DecimalFormat iFmt = Prison.get().getDecimalFormat("#,##0"); + + String statsBuildMs = dFmt.format( + TopNPlayers.getInstance().getStatsBuildDataNanoSec() / 1_000_000 ); + String statsRefreshMs = dFmt.format( + TopNPlayers.getInstance().getStatsRefreshDataNanoSec() / 1_000_000 ); + String statsSaveMs = dFmt.format( + TopNPlayers.getInstance().getStatsSaveDataNanoSec() / 1_000_000 ); + String statsLoadMs = dFmt.format( + TopNPlayers.getInstance().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 + ); + sender.sendMessage(msg); + } + + try { page = Integer.parseInt(pageNumber); } @@ -2114,8 +2165,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/TopNPlayers.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/TopNPlayers.java index 869cd16c0..4e99327a4 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 @@ -14,6 +14,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 +55,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 +88,7 @@ public static TopNPlayers getInstance() { if ( instance == null ) { instance = new TopNPlayers(); - instance.loadSaveFile(); +// instance.loadSaveFile(); instance.launchTopNPlayerUpdateAsyncTask(); } @@ -124,6 +143,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 +168,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 +179,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 +243,8 @@ public void forceReloadAllPlayers() { if ( PrisonRanks.getInstance().getPlayerManager() != null ) { + long start = System.nanoTime(); + getTopNList().clear(); getTopNMap().clear(); @@ -230,8 +265,12 @@ public void forceReloadAllPlayers() { // Sort: sortTopN(); + + long end = System.nanoTime(); - saveToJson(); + setStatsBuildDataNanoSec( end - start ); + +// saveToJson(); } @@ -240,9 +279,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 +383,8 @@ public void refreshAndSort() { return; } + long start = System.nanoTime(); + if ( !calculatedRankScores ) { calculateAllRankScores( getTopNList() ); @@ -408,7 +456,10 @@ public void refreshAndSort() { setDirty( true ); - + + long end = System.nanoTime(); + + setStatsRefreshDataNanoSec( end - start ); } ArrayList newTopNList = new ArrayList<>(); @@ -652,4 +703,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/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; } } From 55e35735d9c9efb49d1162c27af4eb2af9bd71c8 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Fri, 7 Jul 2023 18:28:21 -0400 Subject: [PATCH 65/75] Added the language files for the three new topN messages. --- .../src/main/resources/lang/ranks/en_US.properties | 9 +++++++-- .../src/main/resources/lang/ranks/fr_FR.properties | 6 +++++- .../src/main/resources/lang/ranks/pt_PT.properties | 7 ++++++- .../src/main/resources/lang/ranks/zh-CN.properties | 7 ++++++- .../src/main/resources/lang/ranks/zh_TW.properties | 7 ++++++- 5 files changed, 30 insertions(+), 6 deletions(-) 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 index 453e93337..90af5af69 100644 --- a/prison-core/src/main/resources/lang/ranks/fr_FR.properties +++ b/prison-core/src/main/resources/lang/ranks/fr_FR.properties @@ -50,7 +50,7 @@ ## -messages__version=27 +messages__version=28 messages__auto_refresh=true ranks_rankup__rankup_no_player_name=Tu as @@ -342,3 +342,7 @@ 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. + From 60eed2d4bfd14f6517269a5c6511de5525dbb0c4 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Fri, 7 Jul 2023 23:58:47 -0400 Subject: [PATCH 66/75] Setup the topN stats to be included in the /prison version information. --- docs/changelog_v3.3.x.md | 8 ++++- .../prison/ranks/commands/RanksCommands.java | 25 ++------------ .../prison/ranks/data/TopNPlayers.java | 33 +++++++++++++++++++ .../prison/spigot/SpigotPlatform.java | 6 ++++ 4 files changed, 48 insertions(+), 24 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index a788ca04c..5d5f09210 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,13 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14c 2023-07-06 +# 3.3.0-alpha.14c 2023-07-07 + + +* **Setup the topN stats to be included in the /prison version information.** + + +* **Added the language files for the three new topN messages.** * **Update the topN command to eliminate the use of the save file.** 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 8a40e2cf6..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 @@ -2117,29 +2117,8 @@ public void rankTopN(CommandSender sender, if ( contains( "stats", pageNumber, pageSizeNumber, options ) ) { - DecimalFormat dFmt = Prison.get().getDecimalFormat("#,##0.000"); - DecimalFormat iFmt = Prison.get().getDecimalFormat("#,##0"); - - String statsBuildMs = dFmt.format( - TopNPlayers.getInstance().getStatsBuildDataNanoSec() / 1_000_000 ); - String statsRefreshMs = dFmt.format( - TopNPlayers.getInstance().getStatsRefreshDataNanoSec() / 1_000_000 ); - String statsSaveMs = dFmt.format( - TopNPlayers.getInstance().getStatsSaveDataNanoSec() / 1_000_000 ); - String statsLoadMs = dFmt.format( - TopNPlayers.getInstance().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 - ); - sender.sendMessage(msg); + + sender.sendMessage( TopNPlayers.getInstance().getTopNStats() ); } 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 4e99327a4..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; @@ -597,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(); } 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 5dae47706..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; @@ -2450,6 +2451,11 @@ else if ( !isBasic ) { } + + display.addText(""); + display.addText( TopNPlayers.getInstance().getTopNStats() ); + + display.addText(""); display.addText("&7Locale Settings:"); From 85d46df0485b2a29aae0f1380cee3a09c34c15be Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 8 Jul 2023 00:28:03 -0400 Subject: [PATCH 67/75] Added comments to the prison-spigot/build.gradle configs to add more descriptive comments. Checked the libraries and all are up to date. --- docs/changelog_v3.3.x.md | 4 ++++ .../tech/mcprison/prison/modules/ModuleStatus.java | 7 ++++--- prison-spigot/build.gradle | 14 +++++++++----- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 5d5f09210..18270c1f8 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -13,6 +13,10 @@ These build logs represent the work that has been going on within prison. # 3.3.0-alpha.14c 2023-07-07 +* **Added comments to the prison-spigot/build.gradle configs to add more descriptive comments.** +Checked the libraries and all are up to date. + + * **Setup the topN stats to be included in the /prison version information.** 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-spigot/build.gradle b/prison-spigot/build.gradle index 39c36162e..3ab4ae5fe 100644 --- a/prison-spigot/build.gradle +++ b/prison-spigot/build.gradle @@ -95,6 +95,8 @@ dependencies { implementation project(':prison-sellall') + // 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' @@ -106,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' @@ -116,7 +119,8 @@ 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' @@ -124,8 +128,6 @@ dependencies { // https://mvnrepository.com/artifact/com.github.cryptomorin/XSeries implementation 'com.github.cryptomorin:XSeries:9.4.0' //implementation 'com.github.cryptomorin:XSeries:9.2.0' - //implementation 'com.github.cryptomorin:XSeries:9.0.0' - //implementation 'com.github.cryptomorin:XSeries:8.8.0' @@ -158,8 +160,10 @@ dependencies { // compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.1' - // NOTE: mavenrepository.com is not the offical repo: - // https://repo.codemc.io/service/rest/repository/browse/maven-public/de/tr7zw/item-nbt-api-plugin/2.11.3/ + // 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/ From edf033e9172d42b9560f62e20ebf2999414b8c10 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 8 Jul 2023 00:35:08 -0400 Subject: [PATCH 68/75] v3.3.0-alpha.15 Released --- docs/changelog_v3.3.x.md | 5 ++++- gradle.properties | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 18270c1f8..5a53a7560 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -10,7 +10,10 @@ These build logs represent the work that has been going on within prison. -# 3.3.0-alpha.14c 2023-07-07 +# 3.3.0-alpha.15 2023-07-07 + + +**2023-07-07 v3.3.0-alpha.15 Released** * **Added comments to the prison-spigot/build.gradle configs to add more descriptive comments.** diff --git a/gradle.properties b/gradle.properties index 31f2bbd9e..1e461305f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ ## # This is actually the "correct" place to define the version for the project. ## # Used within build.gradle with ${project.version}. ## # Can be overridden on the command line: gradle -Pversion=3.2.1-alpha.3 -version=3.3.0-alpha.14c +version=3.3.0-alpha.15 From 21df45724d6c59569d66c168efc07e657cbc8662 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 8 Jul 2023 15:15:49 -0400 Subject: [PATCH 69/75] Update the change logs to have a dedicated doc for v3.3.0-alpha.15. --- docs/prison_changelog_v3.3.0-alpha.14.md | 2 +- docs/prison_changelog_v3.3.0-alpha.15.md | 290 +++++++++++++++++++++++ docs/prison_changelogs.md | 1 + 3 files changed, 292 insertions(+), 1 deletion(-) create mode 100644 docs/prison_changelog_v3.3.0-alpha.15.md diff --git a/docs/prison_changelog_v3.3.0-alpha.14.md b/docs/prison_changelog_v3.3.0-alpha.14.md index 51fcd5f35..e995dab6c 100644 --- a/docs/prison_changelog_v3.3.0-alpha.14.md +++ b/docs/prison_changelog_v3.3.0-alpha.14.md @@ -4,7 +4,7 @@ ## Build logs - **[v3.3.0-alpha - Current](changelog_v3.3.x.md)** - - [v3.2.0 through v3.3.0-alpha.14](prison_changelogs.md) + - [v3.2.0 through v3.3.0-alpha.15](prison_changelogs.md) These build logs represent the work that has been going on within prison. diff --git a/docs/prison_changelog_v3.3.0-alpha.15.md b/docs/prison_changelog_v3.3.0-alpha.15.md new file mode 100644 index 000000000..80f7b0ef7 --- /dev/null +++ b/docs/prison_changelog_v3.3.0-alpha.15.md @@ -0,0 +1,290 @@ +[Prison Documents - Table of Contents](prison_docs_000_toc.md) + +## Prison Build Logs for v3.3.x + +## Build logs + - **[v3.3.0-alpha - Current](changelog_v3.3.x.md)** + - [v3.2.0 through v3.3.0-alpha.15](prison_changelogs.md) + + +These build logs represent the work that has been going on within prison. + + +# 3.3.0-alpha.15 2023-07-07 + + + +The following is a highlight of changes for the alpha.15 release since the alpha.14 release. + +-Full support for 1.20.x including the heights and blocks. + +- MineBombs - Added a new field specifically for use with item names which supports color codes. + + +- AutoFeatures - Fine tune block break priorities for custom events. New feature to process MONITOR and BLOCKEVENTS only if the current block is AIR. + + +- New feature: If invalid player access, then TP player to their current mine. Optional Setting. + + +- Expand Prison's debug block inspector: added more information. + + +- Updates to many internal libraries. + + +- Added support for silk touch + +- Added a fortune multiplier - this is used to fine tune highly OP tools so the drops can be better controlled. + +- Fix: Rev Enchants JackHammerEvent: found out that this event returns the corner blocks of a cuboid of blocks. Now calculates all included blocks to process this event correctly. + +- Sellall now partially works when ranks are disabled. + +- Fixed problems introduced when config files were manually edited incorrectly and they were injecting null values in to some properties. + +- Fixed how NBT-api is being shadowed and used to get it to work properly with Spigot 1.20.x. + +- Minor fixes and enchancements: blockEvents, autoFeatures and monitor priorities, GUI Player Mine config options, prevent GUI configs from loading twice, when mining now can control non-prison placed blocks to pass through to be handled by bukkit, fix autosell when disabled, hooked up support for minecraft stats to track block mining, prevent zero drops if calcs are less than 1, fix sellall trying to sell an invalid stack, fix prison utils potion effects when no player is provided, support for ExaltedEconomy, able to bypass adding new players on startup, updated Prison's jar reporter to identify Java versions 19, 20, and 21, clearified help on `/rankup` and `/presetige`, update of how topN is being processed, added topN stats which reports some of the core info. + + + +- = - = - = - = - = - = - + + +**2023-07-07 v3.3.0-alpha.15 Released** + + +* **Added comments to the prison-spigot/build.gradle configs to add more descriptive comments.** +Checked the libraries and all are up to date. + + +* **Setup the topN stats to be included in the /prison version information.** + + +* **Added the language files for the three new topN messages.** + + +* **Update the topN command to eliminate the use of the save file.** +All players are dynamically loaded by the refresh task. Stats have been added and are not a new option for the command. +To act as a form of debugging feature, the save of the topN data has been disconnected from the current process. + + +* **Updated ItemsAdder from v3.2.5 to v3.5.0b** +because github's build was failing to find v3.2.5 online and was killing the prison build. + + +* **Update topN Stats.** This is not the same as topNPlayers and this is not yet being used. +This tracks topN on blocks mined, tokens, and the player's ranks and balances. +The comparator was not correct and was fixed. + + +* **MC 1.18 new world height support.** +Prison now supports the newer world heights as found in mc 1.18.x and newer. +The new range for Y is from -64 to 320. + + +* **Bug fix: found that under a rare situation that it was trying to use an empty String with decimal formatting.** +This was found while testing some placeholders while players were offline. + + +* **I made a mistake when adding the new feature to skip player scans on startup.** +I added a new root perm in config.yml that started with `prison-ranks` when `ranks` already existed. Therefore, I changed the defaults in config.sys to fix this and changed the code to allow the old version of the config (the bad version) and the newer version. + + +* **Changes to the help for `/rankup` and `/prestige` commands to make it a little more clearer** as to what is expected with perms and to provide more details. +Added a new config setting to disable the need to use the prestige perm `ranks.rankup.presetiges` which may make it easier to get presetiges working on most servers. +Prestiges still requires the use of the `ranks.user` perm which is the same perm used for `/rankup`. + + +* **Updated the PrisonJarReporter tool to include java versions 19, 20, and 21.** +Also fixed a bug in which if the version signature is not known, then it was returning a null. Now it returns an enum of type "JavaSE_UnknownVersion" which will prevent future errors. + + + +* **2023-06-20: Version 3.3.0-alpha.14c released** + + +* **Totally stupid change: github's compiler forgot how to use overloaded functions so it was trying to use the wrong one.** +Renaming the function should help it's anti-AI skill sets. + + +* **Fixed the way prison was using the nbt-api.** +Now using the correct repo and the newer API functions. + + +* **Trying to get nbt-api setup properly with shadowing.** It looks like it's correctly shadowed, but it's being improperly reported as not being shadowed. I have a conversation with the developer open to figure out what's going on with this issue. + + +* **Update the item-nbt-api library to v2.11.3 from v2.11.2.** +Turned out the maven repo they actually use was not mavencentral.com, of which, has not yet pulled in the updated version. Using the correct repo now. + + +* **Update libraries:** +Update bstats from v3.0.0 to v3.0.2. +Update XSeries from v9.2.0 to v9.4.0. +Update vaultAPI from v1.7.0 to v1.7.1. + + +* **Changed config.yml to be able to bypass the add new player at prison startup.** This would be more related to servers that already have a large player base when they switch to this plugin. +NOTE: It's not possible to fully test all conditions where a player object may be null. Use at your own risk if you do not allow prison to scan for new players at startup. If an error is found, please contact support ASAP in our discord server so we can get it fixed for you. + + +2023-06-13 : +* **Update how the player objects are written when dirty.** There were some situations where the RankPlayer object would be written to the file system 2 or 3 times for one change. +The logic of how things are nested remains the same (to minimize breakage of the code), but the RankPlayer is not utilizing a dirty flag internally so if it's saved once, it skip the other attempts to save without changes. + + +* **Simple example illustrating the weakness of doubles with large values.** + + +* **Update nbt api to v2.11.2 from v2.11.1** + + +* **Added ExaltedEconomy to the soft depends so prison will wait until it is loaded before trying to startup.** 2023-05-24 + + +* **Fixed an issue that if the prison config files are manually modified and as a result, the block events cannot be parsed, this fix prevents a null value being inserted in to the loaded block events.** +For example, a trailing comma would produce a null block event because the parser that prison uses will read the comma, then with nothing else following it, it injects a null in to the collection of raw data for the block events. Then when that raw data is parsed, it passed along that null as a valid block event. The fix, prevents any of the nulls from being added to the active block events. + + +* **A sellall gui message that was supposed to say that the gui was not enabled only said sellall was not enabled. Added a new message to clearly state it's the gui that is not enabled.** + + +* **Get part of sellall to work if ranks are disabled. The command /sellall sell works, but the other sellall commands need to be tested and fixed.** + + +* **Bug fix: bstats and topn was using the wrong function to check to see if ranks were enabled.** + + +* **Fixed an issue when cannot get a player from bukkit** + + +* **AutoFeatures bug fix: If normal drops is enabled (no auto pickup), and sellall was disabled, then normal drops were being disabled.** +The location of checking for if sellall was active was in the wrong location, which was preventing prison from actually dropping the blocks for the player. + + +* **Fixed an issue with prison utils potions where if the player was null, then it was throwing an NPE. ** + + +* **AutoFeatures: Rev Enchants JackHammerEvent: Bug fix: The jackhammer event was not returning a list of all of the blocks involved in the event, which could be excluding hundreds if not more than 1000 blocks.** +The fix, uses the two points to calculate which blocks to include, and then include them through that cuboid instead of getting a list of blocks from the event. + + +* **BugFix: Fixes an issue with sellall where it is trying to sell an invalid ItemStack.** +As a result, the sellall pays the player for the itemstack but the itemstack is not removed. This fixes it by not trying to sell the questionable itemstacks. + + +* **AutoFeatures: Add a bukkit drops multiplier which is applied to the bukkit drops before the fortune calculations are performed.** +This can be used to reduce the total number of drops if a value less than 1.0 is used. A value of 1.0 does nothing. A value greater than one will increase the bukkit drops. All values are floored and are integers. + + +**Update to v3.3.0-alpha.14b** 2023-02-26 + + +* **AutoFeatures bug fix: If global fortune multiplier is set to a value lower than 1, then there is a risk of zero drops; this prevents zero drops and returns a drop of one.** + + +* **Fixed an issue with the initial event check for events that will break multiple blocks.** +The issue is that the initial check will ignore the event if the primary block is air. The issue is that since the events are fired based upon the BlockBreakEvent then the odds of the primary block is AIR is very high. So for those events, the primary block should not be checked for AIR to be bypassed. This fix allows things like explosions to work. + + +**Update to v3.3.0-alpha.14a** 2023-02-25 + + +* **Enhanced the debug reporting for fortune calculations and fixed a few uses of the newer fortune settings, some of which were used in the wrong locations.** + + +* **Updated the formatting on the prison's mine wand for debug reporting of which blocks are clicked on.** +The information has been cleaned up to be easier to read and follow. It's now being logged in the console too so the details can more easily be reported back for troubleshooting. + + +* **Updated the auto features config file to include the ACCESS priorities in the list of priorities so its better understood what the real options are.** + + +* **Enhanced some of the auto features logging related to fortune, silk touch, and event and drop canceling to eliminate ambiguity and provide more specific details.** + + +* **Fixed an issue with player counts being doubled. Counts should no longer be done within the auto pickup or the normal drops... it's being handled at a higher level for consistency with other priorities.** + + +* **Added a fortune multiplier that is applied to all fortune calculations, which allows for increasing or decreasing the results of the fortune.** + + +* **French support added by Maxcension. Thanks Maxcension!** + + +* **Move the check for access to the OnBlockBreakMines.ignoreMinesBlockBreakEvent so it is logged with the other conditions.** + + +* **Setup minecraft statistics so prison can report block mining through a new setting within the auto features.** + + +* **Enable silk touch enchantment by dropping the actual blocks that are being broke.** +If alt fortune is being used, then fortune will apply to these silked drops. +If players place silked blocks back in the mines (fi that feature is enabled), prison will ignore those blocks and won't break them... it will let bukkit or another plugin deal with them, but it will not apply any fortune to them. + + +* **Bug Fix autosell: was trying to access autosell when it was disabled.** + + +* **Update google gson (json IO tool) from v2.8.6 to v2.10.1** + + +* **Update google guava from v19.0 to v31.1-jre. Guava is used for internal event listeners.** + + +* **Prison Debug Block Inspector: Expand and enhanced the prison tool to provide an inspection of the block break events.** +Added event block details and drops being canceled for each listener. Reformatted to make it easier to read. + + +* **Remove the optional from getModule functions since java 17.0.6 was failing.** +Not sure if it's an actual java issue, or a problem caused by another plugin, or etc... this works well with java 17.0.2. + + +* **Minor improvements to the EventResultsReasons to show a success and more detailed debug logging.** + + +* **Relocate the ACCESS failure which will trigger a TP to an accessible mine...** +this is relocated because it's not an event, but a behavior triggered by an event condition. + + +* **Setup a temp test to test ItemsAdder.** + + +* **AutoFeatures: new feature to process MONITOR and BLOCKEVENTS only if the block is AIR.** +The reason for this is that if we are monitoring a blockbreak event, then we can assume that the block should be AIR. This setting is important for enchantment plugins handling the block break events, since a non-AIR value would indicate that the player was not successful in breaking the block. +Added more detailed debugging logging if the event is fast-failed or under normal conditions. + + +* **Change the block break priority BLOCKEVENTS to MONITOR. Updated the docs too.** + + +* **Add new autoFeature setting to allow non-prison placed blocks to be handled by bukkit: ifBlockIsAlreadyCountedThenCancelEvent: true. (default setting).** +Prison was canceling the event if it found a block placed in the mine that it did not place during a mine reset. This would allow players to place blocks and then remove them if they have the worldguard perms to do block breaks. +These blocks are not tracked in prison and are not handled. Prison just ignores them. + + +* **Fixed the gui config which it needed to load after loading ranks and mines. So it's initialized a second time in the startup process.** + + +* **Gui Player Mine config settings: Added `Options.Mines.MaterialType.NoMineAccess` which defaults to REDSTONE_BLOCK.** +If it does not exist in a player's GuiConfig.yml file, it will now be auto added. +Also if the `Options.Mines.MaterialType` block list of material types to use for each mine does not exist, it will auto add them, using the first block in the mine's block list. + + +* **Some adjustments to AutoFeatures and monitor priority... it was processing block events under some conditions.** + + +* **Mine BlockEvents: Enables the use of pipes in commands and messages now.** + + +* **MineBombs: Added a new field specifically for the item name for the bomb.** +The mine bombs now auto load upon startup and will auto update now if there is a change in mine data versions. + + +* Changed the example world names in the config.yml file where Prison is disabled. Too many people were running in to the problem where they just happened to have those worlds, and that's where they were trying to use prison. So they were thinking Prison was not working instead of Prison being disable in those worlds because that's what was in the configs. + + + + diff --git a/docs/prison_changelogs.md b/docs/prison_changelogs.md index b39762745..b4f658b2f 100644 --- a/docs/prison_changelogs.md +++ b/docs/prison_changelogs.md @@ -10,6 +10,7 @@ These build logs represent the work that has been going on within prison. - Future updates will be under the v3.3.x release + - [v3.3.3-alpha.15 - 2023-07-07](prison_changelog_v3.3.0-alpha.15.md)   - [v3.3.3-alpha.14 - 2023-01-23](prison_changelog_v3.3.0-alpha.14.md)   From a5c614a631804b45c25cf1eab99f49212aee55a2 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 8 Jul 2023 15:38:33 -0400 Subject: [PATCH 70/75] Update the known issues doc... --- docs/knownissues_v3.3.x.md | 137 +++++++++++++++++++++++++------------ 1 file changed, 95 insertions(+), 42 deletions(-) diff --git a/docs/knownissues_v3.3.x.md b/docs/knownissues_v3.3.x.md index 9e10c2edd..68655fa40 100644 --- a/docs/knownissues_v3.3.x.md +++ b/docs/knownissues_v3.3.x.md @@ -2,27 +2,35 @@ # Prison Known Issues and To Do's for v3.3.x +These known issues are an informal list of concerns and bugs. Also includes some wish-list items too. +These are notes for personal references. These are not intended to explain anything useful, but they do track some issues and perspectives that may not be fully expressed in the change logs because initial impressions may not turn out to be the actual problem or the final course of changes and enhancements. -# TODO Items for v3.3.0-alpha.13 +# TODO Items for v3.3.0-alpha.14 -- break one block but blocks counts register 2 - Aimatt +- Reported that a freshly placed mine would not work with an /mtp command - noza3 + (marked as done below since it could not be reproduced, but should test with a new build) + -- DONE: change BLOCKEVENTS to use MONITOR priority - PrinceHatem +- Mine bomb save files - the name used for the data structure (in the hash) is ignored when loading? - FqdedStqr + - He changed that name and it caused problems. Maybe change the bombs to just an array? -- DONE: add option to allow AIR when at MONITOR priority - PrinceHatem - - issue with when a break is canceled on RevEn such as when durability is zero. + +- Prestige confirmations are not working - Axar + - Cannot prestige without a confirmation too. -- On the new cmdStats details, add nano run times for commands so we can include avg run times. +- Auto pickup is not working when OP'd in creative mode vs survival mode. - Axar + +- New alpha release for alernos - drops and sellall are messed up - notify when published to spigotmc.org - slab -- Add a command usage count to commands. Then a simple report to list what commands were used, along with total command count of active commands. +- break one block but blocks counts register 2 - Aimatt -- Expand upon the config.yml command lockout so that if the player does not have access to a command, then suppress that command from all players, including command listings. Not all commands will be able to reject access due to the nature of the commands (all access to everyone) and/or the use of alt-perms (programmatic evaluation to the commands). - Josh-65 +- On the new cmdStats details, add nano run times for commands so we can include avg run times. - File save to new format - OmarG @@ -30,42 +38,22 @@ - pre-req for custom mine shapes -- Ability to turn of TP on mine resets. OmarG + +- Ability to turn off TP on mine resets. OmarG - Maybe have a special value for spawn to indicate it should TP? - Could still have a spawn point, but just not tp during resets. +- Custom mine shapes - Chain / darragh - custom mine shapes - Chain and Fiba1 and OmarG - Have a new command to edit and save the mine's shapes - edit would spawn red/yellow wool - remove blocks - save would only save the wool blocks. -- fix gui ranks to remove italics from the rank names. This may be the gui ranks and/or the gui prestiges. - Bryton - Cannot reproduce - No italics are being added by prison. - - -- DONE: Gui prestiges - option to remove the gui prestige button. Not sure if any of the options in the config.sys really supports that. - Bryton - - - -- Prestige - needs improvements - DONE: rewrote the prestige handling to exist in the ranks module. Everything is handled properly now. The GUI is passed the correct lore so no rankup logic is in the gui anymore. Prechecks are now enabled too. - - DONE: Confirmation does not perform any prechecks to confirm if the player can even prestige - - DONE: Confirmation does not reflect prestige settins. It always shows that rank and balance will be reset, even if that is disabled. - - DONE: It's not clear how to confirm via chat - when testing the block breakage with the SHIFT-click with the mine wand, I also saw that it processed the same block twice. The first time looked as if the drop was being canceled, then the second time the event was being canceled. Or vice-a-versa. I don't remember setting it up both ways. - - - -- bStats: - - DONE: Remove Plugins & Prison Ladders - - DONE: Add: modules, Economy (integrations), Perms (integrations), Placeholder (intg) - - DONE: Add: Language - - Eliminate zero counts (don't report) - - validate that plugins listed in other reports are being removed from plugins a-z. - + - NOTE: This is an issue with Google Guava. I am not sure why it submits all listeners twice, but it does. - `/ranks player` is not including all of the info for rank multipliers like it should have. @@ -74,7 +62,6 @@ -- Custom mine shapes - Chain / darragh @@ -121,9 +108,6 @@ -- TEST: Add nbt support to gui menus. Issue with rankup not getting the correct ladder name. - - Partially added and is working. Expand to other menu options, which will be time consuming. - - Print warnings if auto features configs prevent any drops. Include notice when drops don't occur due to autosell. - On server startup... not sure how to best check. @@ -150,10 +134,6 @@ -- DONE?: Archive old players - budderman18 - - archive all player files to a zip. Remove the originals. If player logs back on, then restore the archives. Prevent startup from adding these players back. - - Archiving players in topN - this may address the archive needs. Part of the issue was related to performance calculations upon startup, which the new topn does address. - - Placeholders - dynamic content - - custom placeholders based upon other primary placeholders? @@ -269,8 +249,6 @@ https://github.com/Auxilor/EcoEnchants/blob/master/eco-core/core-plugin/src/main * ShiftAndRightClickSellAll is not working --> DONE: Hook in to quests - Only on block break events so may not work as expected? - * Found a problem with mcMMO, Quest, and EZBlock support... only works on BlockBreakEvents. I added logging to identify when they are called, but if an explosion has 20,000 blocks, then it will log 20,000 times! 😂 So I need to figure out something before hooking it up to multi-block breaks. @@ -286,6 +264,81 @@ https://github.com/Auxilor/EcoEnchants/blob/master/eco-core/core-plugin/src/main +DONE - permission for prestiges not working correctly +Rayne — Today at 9:52 AM +hey @RoyalBlueRanger, so someone is trying to prestige and they can't? +there's no errors or anything and they don't get a message it worked for me when i was op +Rayne — Today at 10:52 AM +So it turns out that the ranks.rankup.prestige permission works but not the ranks.user +- NOTE: Fixed some issues with prestiges and perms. But mostly was an issue with the help not properly explaining how important the perms are. Also added a new feature to turn off the need for the presetige perms so all players can use it without the perms; they may still need to have ranks.user enabled. + + +DONE - budderman18 reports: +Budderman18 — 06/21/2023 11:56 AM +If your server runs any plugin using java 19 or higher (java 18 might be the case as well), prison won't be able to startup +- NOTE: Updated NBT-api for v1.20.1. Found out Prison's use of NBT-api was setup wrong which caused conflicts. Now working the way it should. + + + +- DONE: change BLOCKEVENTS to use MONITOR priority - PrinceHatem + +- DONE: add option to allow AIR when at MONITOR priority - PrinceHatem + - issue with when a break is canceled on RevEn such as when durability is zero. + +- DONE - Add a command usage count to commands. Then a simple report to list what commands were used, along with total command count of active commands. + + +- DONE - Expand upon the config.yml command lockout so that if the player does not have access to a command, then suppress that command from all players, including command listings. Not all commands will be able to reject access due to the nature of the commands (all access to everyone) and/or the use of alt-perms (programmatic evaluation to the commands). - Josh-65 + + + + +DONE: > noza3 — 2023-06-29 at 1:09 PM +> Thanks royal blue but i’ve already fixed it. Only problem I was facing was using /mtp {minename} after creating the mines, which would say this is a virtual mine blah blah, but madog told me to do a restart which fixed the issue, so I created all of my mines, set them up properly, then restarted the server and all of the /mtp {minename} works now. Also the portal at my spawn that allows people to jump into and go to their mine works, now that I use the player command /mtp with the portal. Thanks for the help +- NOTE: could not reproduce this issue. + + + +- DONE - fix gui ranks to remove italics from the rank names. This may be the gui ranks and/or the gui prestiges. - Bryton + Cannot reproduce - No italics are being added by prison. + Changed the player gui for ranks and mines so it does not add anything extra. Can now fully control all of the lore. + + +- DONE: Gui prestiges - option to remove the gui prestige button. Not sure if any of the options in the config.sys really supports that. - Bryton + + + +- Prestige - needs improvements + DONE: rewrote the prestige handling to exist in the ranks module. Everything is handled properly now. The GUI is passed the correct lore so no rankup logic is in the gui anymore. Prechecks are now enabled too. + - DONE: Confirmation does not perform any prechecks to confirm if the player can even prestige + - DONE: Confirmation does not reflect prestige settins. It always shows that rank and balance will be reset, even if that is disabled. + - DONE: It's not clear how to confirm via chat + + +- bStats: + - DONE: Remove Plugins & Prison Ladders + - DONE: Add: modules, Economy (integrations), Perms (integrations), Placeholder (intg) + - DONE: Add: Language + - Eliminate zero counts (don't report) + - DONE: validate that plugins listed in other reports are being removed from plugins a-z. + - DONE: Removed the a-z listings of plugins. + + + + +DONE - TEST: Add nbt support to gui menus. Issue with rankup not getting the correct ladder name. + - Partially added and is working. Expand to other menu options, which will be time consuming. + + +- DONE?: Archive old players - budderman18 + - archive all player files to a zip. Remove the originals. If player logs back on, then restore the archives. Prevent startup from adding these players back. + - Archiving players in topN - this may address the archive needs. Part of the issue was related to performance calculations upon startup, which the new topn does address. + + +-> DONE: Hook in to quests - Only on block break events so may not work as expected? + + + - DONE: prison commands if using ; for multi-commands, and if a space follows ; then it's not working. From 758c63592edf9ec8cc1ed9d6009e37d0c9fe6614 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 8 Jul 2023 16:17:27 -0400 Subject: [PATCH 71/75] Doc updates for the latest alpha.15 release. --- docs/changelog_v3.3.x.md | 8 +- docs/index.md | 19 +- docs/knownissues_v3.2.x.md | 6 +- docs/knownissues_v3.3.x.md | 1326 +---------------------------------- docs/prison_changelogs.md | 15 +- docs/prison_docs_000_toc.md | 10 +- 6 files changed, 49 insertions(+), 1335 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 5a53a7560..7fd0ab352 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -2,12 +2,16 @@ ## Prison Build Logs for v3.3.x -## Build logs +## Change logs - **[v3.3.0-alpha - Current](changelog_v3.3.x.md)** - [v3.2.0 through v3.3.0-alpha.14](prison_changelogs.md) +* [Known Issues - Open](knownissues_v3.2.x.md) +* [Known Issues - Resolved](knownissues_v3.2.x_resolved.md) -These build logs represent the work that has been going on within prison. + + +These change logs represent the work that has been going on within prison. # 3.3.0-alpha.15 2023-07-07 diff --git a/docs/index.md b/docs/index.md index b76f0e30e..f1e42846e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,18 +8,29 @@ Prison's table of contents of all documents. -


+# Prison Now Fully Supports Spigot 1.20.x and Java 20 !! + + +
-# Prison Now Fully Supports Spigot 1.17 and Java 16 !! -### Prison Build Logs for v3.2.0 (2019-12-03) through v3.2.6-alpha (current) + + +### Prison Build Logs for v3.2.0 (2019-12-03) through v3.3.0-alpha-15 (2023-07-07-) - **[v3.3.0-alpha - Current](changelog_v3.3.x.md)** - - [v3.2.0 through v3.2.10](prison_changelogs.md) + - [v3.2.0 through v3.3.0-alpha.15](prison_changelogs.md) +### Prison Known Issues + +These are internal notes that may initially record ideas and issues. They may not +reflect the final actions taken as expressed in the change logs below, so these +may be insightful in to some of the evolutionary processes. +* [Known Issues - Open](knownissues_v3.2.x.md) +* [Known Issues - Resolved](knownissues_v3.2.x_resolved.md)
diff --git a/docs/knownissues_v3.2.x.md b/docs/knownissues_v3.2.x.md index ff5c65e00..2f4d95873 100644 --- a/docs/knownissues_v3.2.x.md +++ b/docs/knownissues_v3.2.x.md @@ -1,15 +1,17 @@ [Prison Documents - Table of Contents](prison_docs_000_toc.md) -# Prison Known Issues and To Do's for v3.2.x +# Prison Known Issues and To Do's This document is intended to keep track of known issues and also provide for a short list of To Do's. This list is intended to help work through known issues, and/or to serve as items that should be added, or fixed. +* [Known Issues - Resolved](knownissues_v3.2.x_resolved.md) -# To Do Items - During Alpha v3.2.5 + +# To Do Items diff --git a/docs/knownissues_v3.3.x.md b/docs/knownissues_v3.3.x.md index 68655fa40..b51f664f2 100644 --- a/docs/knownissues_v3.3.x.md +++ b/docs/knownissues_v3.3.x.md @@ -7,7 +7,11 @@ These known issues are an informal list of concerns and bugs. Also includes some These are notes for personal references. These are not intended to explain anything useful, but they do track some issues and perspectives that may not be fully expressed in the change logs because initial impressions may not turn out to be the actual problem or the final course of changes and enhancements. -# TODO Items for v3.3.0-alpha.14 +Resolved issues have been relocated to: +* [Known Issues - Resolved](knownissues_v3.2.x_resolved.md) + + +# TODO Items for v3.3.0-alpha.15 - Reported that a freshly placed mine would not work with an /mtp command - noza3 @@ -264,1326 +268,6 @@ https://github.com/Auxilor/EcoEnchants/blob/master/eco-core/core-plugin/src/main -DONE - permission for prestiges not working correctly -Rayne — Today at 9:52 AM -hey @RoyalBlueRanger, so someone is trying to prestige and they can't? -there's no errors or anything and they don't get a message it worked for me when i was op -Rayne — Today at 10:52 AM -So it turns out that the ranks.rankup.prestige permission works but not the ranks.user -- NOTE: Fixed some issues with prestiges and perms. But mostly was an issue with the help not properly explaining how important the perms are. Also added a new feature to turn off the need for the presetige perms so all players can use it without the perms; they may still need to have ranks.user enabled. - - -DONE - budderman18 reports: -Budderman18 — 06/21/2023 11:56 AM -If your server runs any plugin using java 19 or higher (java 18 might be the case as well), prison won't be able to startup -- NOTE: Updated NBT-api for v1.20.1. Found out Prison's use of NBT-api was setup wrong which caused conflicts. Now working the way it should. - - - -- DONE: change BLOCKEVENTS to use MONITOR priority - PrinceHatem - -- DONE: add option to allow AIR when at MONITOR priority - PrinceHatem - - issue with when a break is canceled on RevEn such as when durability is zero. - -- DONE - Add a command usage count to commands. Then a simple report to list what commands were used, along with total command count of active commands. - - -- DONE - Expand upon the config.yml command lockout so that if the player does not have access to a command, then suppress that command from all players, including command listings. Not all commands will be able to reject access due to the nature of the commands (all access to everyone) and/or the use of alt-perms (programmatic evaluation to the commands). - Josh-65 - - - - -DONE: > noza3 — 2023-06-29 at 1:09 PM -> Thanks royal blue but i’ve already fixed it. Only problem I was facing was using /mtp {minename} after creating the mines, which would say this is a virtual mine blah blah, but madog told me to do a restart which fixed the issue, so I created all of my mines, set them up properly, then restarted the server and all of the /mtp {minename} works now. Also the portal at my spawn that allows people to jump into and go to their mine works, now that I use the player command /mtp with the portal. Thanks for the help -- NOTE: could not reproduce this issue. - - - -- DONE - fix gui ranks to remove italics from the rank names. This may be the gui ranks and/or the gui prestiges. - Bryton - Cannot reproduce - No italics are being added by prison. - Changed the player gui for ranks and mines so it does not add anything extra. Can now fully control all of the lore. - - -- DONE: Gui prestiges - option to remove the gui prestige button. Not sure if any of the options in the config.sys really supports that. - Bryton - - - -- Prestige - needs improvements - DONE: rewrote the prestige handling to exist in the ranks module. Everything is handled properly now. The GUI is passed the correct lore so no rankup logic is in the gui anymore. Prechecks are now enabled too. - - DONE: Confirmation does not perform any prechecks to confirm if the player can even prestige - - DONE: Confirmation does not reflect prestige settins. It always shows that rank and balance will be reset, even if that is disabled. - - DONE: It's not clear how to confirm via chat - - -- bStats: - - DONE: Remove Plugins & Prison Ladders - - DONE: Add: modules, Economy (integrations), Perms (integrations), Placeholder (intg) - - DONE: Add: Language - - Eliminate zero counts (don't report) - - DONE: validate that plugins listed in other reports are being removed from plugins a-z. - - DONE: Removed the a-z listings of plugins. - - - - -DONE - TEST: Add nbt support to gui menus. Issue with rankup not getting the correct ladder name. - - Partially added and is working. Expand to other menu options, which will be time consuming. - - -- DONE?: Archive old players - budderman18 - - archive all player files to a zip. Remove the originals. If player logs back on, then restore the archives. Prevent startup from adding these players back. - - Archiving players in topN - this may address the archive needs. Part of the issue was related to performance calculations upon startup, which the new topn does address. - - --> DONE: Hook in to quests - Only on block break events so may not work as expected? - - - -- DONE: prison commands if using ; for multi-commands, and if a space follows ; then it's not working. - - -- DONE: The command `/rankupmax` needs to be fixed - redonthehead - - DONE: `/rankupmax`, or `/rankupmax default` is fine, but replaced getting the next rank with the new code so it works better. - - DONE: `/rankupmax prestiges` is the same as `/prestige` and `/rankup prestiges`. Change so it will go through the default ladder, then prestige, then repeat if enough money. - - -- NOT AN ISSUE: In the GUI menu, the config setting: Enchantment_effect_current_rank is off by 1. If D rank it shows E being unlocked. - CITYJD - - Looking at the code where this is used (player ranks and prestiges), the intention of this setting is to highlight the player's next rank. So the settings name is wrong... It should be `Enchantment_effect_next_rank: true` - - Locate docs that covers this topic and make a note explaing what this is for and why the settings name is wrong. - - - -- DONE: Add `*all*` to `/mines set notification` - CITYJD - - Fixed a few other commands too to provide applying the command to all mines. - - - -- DONE: Force sellall before prestiges - kikiisyourfriend - -- DONE: Auto-Forced-Rankups and prestiges when the player has enough money. Kikiisyourfriend - - a new autoFeatures entry - -- DONE: Enable Access to prior mines - kikiisyourfriend - - disable to prevent going back to prior rank mines. - - See `prison-mines.access-to-prior-mines` in config.yml - - -- DONE: prison_rank__linked_mines_rankname prison_r_lm_rankname provide a placeholder for the mine's tags. B0mer - - -- DONE: Mines tp: option to list all available mines per rank? Thaysa - - -- DONE: Option to skip applying the rank cost multiplier to a specific ladder. - - - -. DONE: Use of placeholders in gui mines is not working correctly - PassBl - - Trying to use: - '&7Test Cost P1: &3%prison_rank__player_cost_formatted_p1%' - - Using deluxe menus - may not be sending player info with placeholders? - - Fixed: complex new calculations for `prison_rank__player_cost` calculations. - - -- DONE: Mine Bomb Name and tags not showing color - Thaysa - - Works with 1.8.8 - - Fails with 1.18.2 - colors are fine in GUIs and commands - - -- DONE: Modified the `/mine blockEvent` commands to auto show the existing rows if only the mine name is entered for the command. It will show the list of rows, then the user can select it, then continue entering the rest of the command. There has been a lot of confusion on how to work with the blockEvent rows since it was not obvious they had to first "list" the blockEvents for that mine. - - -- DONE: If prison cannot hook in to the economy, prison should see if CMI is a plugin on the server, then it should try to enable the delayed startup for CMI. Kind of a forced-auto-enable if CMI is detected. - - -- DONE: Mine bombs - If at rank d and in mine w and I set off a mine bomb, it will not break any blocks, but it will lock them and prevent others at that rank from breaking them. - redonthehead - - player should not be able to "lock" blocks - - DONE: Player should not be able to drop a mine bomb in a mine they don't have access to - - -- DONE: command `/ranks topn` - does not appear to be sorting by prestiges first - redonthehead - - Fixed? Force sort when using the command each time. - - When player's rankup, should probably force a sort. - - The sorting should be somewhat low cost, since if players are in the same position, it short-circuits the sorting so there is less processing. Ie.. if nothing is sorted, it's only one quick pass. If only one player changes, then it's only moving that player. - - - DONE: Issue with topn Rank-Score. When player is at top of default ladder and has not prestiged yet. - - Rank-score looks like it's just their money balance? - - -- DONE: Sellall enablement - needs to be in module.yml, but must enable it in config.yml? - - bug in alpha.12? - - -- DONE: A placeholder in PLAYER that will show the next tag for both default and prestige. - surawesome - - but only show next prestige if on last rank in default. Default will show first rank. - - {prison_rankup_linked_rank_tag} <- [p]\\[d] - - {prison_rankup_linked_rank_tag_prestiges} {prison_rankup_linked_rank_tag_default} - -- DONE: Top block and top tokens - Phoung Nguyen - - -- DONE: When placing a mine, it spams resets while it's setting up the liner and the primary mine. May be an issue with zero block resets and having zero block counts remaining. May want to initially set the block counts to something like 1, then after the mine is done being laid out, then reset it. When it's in "tracer" mode, no blocks exist that can be broken, so a value of 1 cannot be decreased.i - - - -- DONE: percent is not being filtered from `/mines blockevent percent` and is causing errors in the formatting of the number. Percent is also not showing the list of events to get the rows... - - -- Mine Bomb Issues - - DONE: Not dropping blocks - - DONE: give bombs only works with lower case... camel case not working - - DONE: with a stack of 2 oof bombs, setting off one removes both. - - The is happening when the bomb is so large that it breaks the durability on the pseudo tool, which then removes whatever is in the player's hand when it breaks the item. - - DONE: color names for bombs do not work - xGeorge26 - - DONE: Control Y adjustment when setting the bomb. Defaults to -1. - - DONE: armorstand appears in animation when using color coded bomb name? - xGeorge26 - - DONE: Update to include more colorful names.. - - DONE: Provide a "count down" placeholder function within the armor stand bomb name?? - -- DONE: Need to externalize the time defaults... like Mine x will reset in x seconds from now. 1 seconds. - ShockCharge - -- DONE: Six - air count needs to be asynch'd since it is causing server not to respond for more than 10 seconds upon startup. - - Most mines are greater than 120,000 blocks. - - - -- DONE reload is doing NPE when blockconverters are not setup and disabled. - -- DONE mine gui - add custom lore to the configs - - DONE: can now use either `{mineName}` or `{mineTag}` and title is now rankTag too. fix using the mine tag and not mine name - -* FIXED: GUI Ladders - Perms are not checked so anyone can run these GUIs. But other than viewing the ladders, they cannot run successfully the /rankup ladder command. - - -- FIXED: autosell not working. McPingvin - - -- FIXED: Sellall signs not working when variant is other than oak. BOmer - -- DONE: placeholders are not using the time units as the mine notifications are using. Therefore, they are continuing to use english units. Need to fix the placeholders. One is `prison_mines_timeleft_formatted_Mine`. kstance - - -- DONE: add support for NBTs - mine bombs - ClumbsyIsNotReal - - having problems formatting mine bomb lore with current restrictions since it prevents bombs from working. - - -- DONE: placeholders - show next rank is skipping p1 when no p is assigned to player. xGeorge26 - - -- DONE: Many errors when prison hits a standard potion. - jamo - - -- DONE: autofeatures BLOCKEVENT priority - check for full inventory and perform sellall - Ryankayz - - -- DONE: Rankup - Still not working correctly. - - DONE: takes money but does not rank them up? - - DONE: rank changes does not alter the list of players at the ranks - - -- DONE: Top-n: hookup rank-score and penalty. - - Placeholders - hookup placeholders to support top=n players. -- DONE: Top-n balance calculations using essentials - 2 mins 31 secs - Budderman18 - - DONE: move to async thread on startup - high priority -- Top-n - phuong Nguyen -- CustomItems drops - harold -- DONE: Sellall - custom blocks/items and items that have been renamed - harold & RomainD -- DONE: sellall - no sell renamed items - RomainD -- DONE: mine bombs - fortune not using the mine bomb's pick with fortune.. always zero - RomainD - - debug is showing fortune 0 -- DONE: CustomItems - not doing drops, even when drops are set - harold -- DONE: CustomItems - Not block counting custom blocks -- DONE: Upgrade bStats to v3.0.0 -- auto features - normal drops may not be happening. May be using auto pickup code. - - - -* DONE: The function isUnbreakable could return a null for the SpigotBlock/PrisonBlock. Change it so the primary check for that function is location, then block is optional. This is failing because the bukkit block cannot be mapped to a XMaterial which should not be a factor. XMaterial will be null for custom blocks. - - -- (done ??) Placeholder bar is reversed. As the player earns more money, it shrinks instead of grows. - harold - - prison_rankup_cost_bar_default - - - -* Mine bombs: - - DONE: prison reload bombs - - DONE: validate mine bombs when initially loading... - - bomb name cannot have spaces or color formatting - - initial validation added - -* DONE: Works for me. HiPriority: Inventory full not producing any messages. alexaille - - -* DONE: HiPriority: NPCs are generating a lot of errors. Real_Ganster - - Citizens running command `mines` as player -` Prison | VaultEconomyWrapper.getBalance(): Error: Cannot get economy for player vote so returning a value of 0. Failed to get an bukkit offline player.` - - https://pastebin.com/JusySWDs - - -* DONE: HiPriority: Add a event priority of BLOCKEVENTS which only does the block events and counts. - -- DONE: **Fixed issues with vault economy and withdrawing from a player's balance.** -It now also reports any errors that may be returned. - - - -- DONE: placeholder for player blocks mined. artic1409 - - maybe use **prison_player_total_blocks__blockname** - -- DONE: update placeholderAPI with prison's updated placeholders - -- DONE: prison support submit are only sending to console, not the user if they are in game - -- DONE: When a mine reset time is disabled... it cancels/stops a /mines reset *all* - - -- DONE: when rank tag = none - was showing "null" for placeholder - -- DONE: work on getting CustomItems working in mines again - -- DONE: remove this warning message: no longer used. -[18:58:51 INFO]: | Prison | Cannot initialize NMS components - ClassNotFoundException - NMS is not functional - net.minecraft.server.v1_18_R1.EntityPlayer - -- DONE: RankPlayer addBalance cache for default currency -- RankPlayer addBalance cache for custom currency - still needed! - - - - DONE: You cannot afford the rankup is using a NBSP for the thousand separator. Using Prison v3.2.11, Java 16, and spigot 1.16.5. Cannot reproduce. Was a server hosting config issue, but not sure why it only impacted that one message. - - - - DONE: SELLALL has huge performance issues! It takes 2.3 ms to autosell, and full auto features block handling is 4.2 ms!! Serious performance issue with sellall, and autosell is bypassing the command handler too! - - added 'autosellTiming:' stats to auto features autosell to track actual sell time using nano-seconds... initial tests show there maybe significant performance issues. - - autosell in auto features causing lag? Flaco21 - - Issue with autosell causing lag? - - DONE: see RankPlayer addBalance cache - 1250 times improvement! - - -- DONE: admin gui - allows them to bypass No Economy safeguards. - - -* DONE: Add commands to list shop prices in console. Currently sellall is 100% gui so cannot be used offline. - - -- DONE: lapis lazuli is not auto selling - - -- DONE: Upon startup the first time, broadcast to everyone that they should use /ranks autoConfigure. - - Broadcast failed ranks too. - -- DONE: update CMI delayed loading docs... they are "backwards" - - - - DONE: No economy error message not showing - - works on delayed startup - - Fails when not delayed - gui ranks was registering on top of ranks warning - -- DONE: /ranks autoConfigure - review setup and maybe enable skip resets and tweak some notification settings. - - - - -# TODO Items for v3.2.11-alpha.13 - - - -**Tasks needed for the v3.2.11 release:** -* Review some documentation and udpate... especially with the luckperms. -* Finalize the event listeners to use only one event (was three, now two, but reduce down to one). -* Review placeholders -* Try to hook up a top-n command - may be too complex and may need to be pushed over to the next release -* Review Mine Bombs and see if there are some simple updates -* Backpacks - may need to push over to next version -* GUI menus - Add the new GUI Tools to more of the GUI menus to simplify some of the commands? - - - -* test Mine placements and resizing. Something does not look correct with tracer and liners. - - - -* create a command placeholder that will be able to add a delay between submitting commands. Have it based upon ms.. and have it setup to be used when more than one command is combined with others. - - -* Command cooldowns - ranks - use config file to customize on a per command basis. Modify the prison command handler to manage cooldows as a new attribte to the commands. - - -* Mine Bombs: identify bombs... new way. -See SelectionManager... Prison wand uses the whole items stack to identify a wand, instead of just one small part, such as name or lore. Well, actually, its only the display name and material... no lore. - - -* Add Mine Regions - Similar to mines in a way, where they will allow players to have access to the region, have mine effects (outside of a mine)... and mine effects would also be tied to these too. - - -* Placing mines could triggers many resets... also placing mines may not clear all blocks. - - -* DONE: command handler - Ignore commands in certain worlds - - -* DONE: Player Cache - Make sure the cache is loadable otherwise a new instance may be created that could wipe out the existing data. - - All player loads block... they do not submit a task anymore. - - ~block for all loads - currently it may return a null and load via async~ - - (no) Track file last saved date and if they don't match, then create a backup of the file version and don't delete it. - - -* GUI Menu Tools - - Page prior and page next - - Current page - - Go Back button - - Background colored panes when no options - - Current version is not tied to configs... future options... - -- Hook up to more gui menus - - -* DONE: Add a base class for the mine bomb configs... - - DONE: Add a version so as to be able to auto refresh the formats - - -* New documentation - Madog's knowledge - - look for pins - - -* Add mine effects. See conversation with Madog. - - Use PlayerCache and existing utils. - - Simple to implement some features, including flying in a mine. - - -**List for v3.2.11 release:** - - -* DONE: Players need to be restructured. Move rank player object, or at least most of the core, to the core project so as to reduce the number of player types. - -* Cache player - - cache player's balance - Hmm... may need to put it in RankPlayer - - cache player's ranks... only prestiges, default - -* Top-n ranks - - total blocks mined - - total tokens earned (or currently has) - - balance - - highest rank: prestiges, default, balance - - most online time, or most mining time (which will probably be better) - - -* DONE: FIXED: Issue with blocks. Explosions are creating "untouchable" blocks that cannot be included in other explosions. - - My observations were with multiple explosions leaving rings that are within the the radius of an explosion - - I could break the blocks. - - jamo said that the pillars that were created on his server could not be broke - - - -* Review placeholders - add and test placeholders that are tied to playerCache stats - -* Mine Bombs - Finish - - Add sound and particle effects - - Other features? - - Make sure the bomb is set within a mine. Do not allow it to be placed outside of a mine. - - DONE: When exploding large bombs with block decay, there is a chance that you can get the first block in the decay as part of the drops. - - DONE: Check to make sure the block broke is the one in the target block. If not, then ignore. - - make sure the block is not "locked" - - -* Add a top 10 listing commands - - Top player on server (rank / ladder) - - Top player per mine? - - Top Player per Blocks - - Top Player per time - -* Add Block & Time requirements for rankups - - Upon rankup, player will get a new "object" that would track rankup progress - - Would record current blocks and time for that rank, which is needed for when they - prestige. The rankup Progress won't change until they rankup and it will be reset. - It's used to subtract from current stats to get "progress". - -* BackPacks & Vaults & Warehouses - rewrite - - Add PlayerCache support with integrated backpack data object to track details - - Create new gradle module for backpacks and other items. Call it something like Accessories. - - Remove hooks in the spigot module except for the code to read existing old backpacks to migrate contents. - - Backpacks are able to have pickup and sell used against them. - - Vaults are protected from pickup and sell - Have to manually move items in and out to main inventory in order to sell them. Max size limit is a double chest. - - Backpacks can be protected from pickup and sell via command, which can be used to charge players. - - Warehouses are not normal player inventory/chests. They are virtual containers for items and blocks. - - Warehouses have slots, where each slot is one item. A slot can have a dynamic amount of items it can store. The player can buy more slots in their warehouse and increase the capacity of each slot. - - Warehouses - have formula to calculate costs of slots and capacity, where prices increase on both depending upon number of slots, and total capacity size of warehouse. - - Warehouses - Initial capacity of 5 slots, each at 100 to 200 capacity. - - Should vaults be tied to a physical location, such a server-wide "bank"? If so, then players has to physically go there to access their vaults. Same with warehouses. A defined bank or warehouse would be similar to a mine in such it would be 3d and access would work anywhere in there. Or a given mine could be designated as a bank or mine. So like for example, mine c could be the bank so a player would have to rank up to C to access it. Then a vault could be tied to a third tier prestige or something (but those don't have physical locations, but could make it mine a) or create a new mine that is empty, then link that new mine to that prestige rank so players have access to it. - - - - - - -* Mine reset messages: Have setting to control by percent remaining in the mine. - - -* Save files do not include the block type prefix. Such as used with CustomItems. -Not sure if it needs to? Need to test and confirm if working correctly. World coordinates would be wrong if missing. - - - - -- Not sure why the following would be needed: -* Auto Features Settings : Create an API object that has the auto features settings listed. Basically this would serve as a simple cache with a life span of about 10 seconds. So if a player is mining hundreds of blocks within 10 seconds, odds are these settings will not be changing... both server config settings, and the player's permissions. Can provide helper classes that will a simple check of all these details, such as passing tool in hand to check perms for auto pickup settings for the server, the player's perms and lore on the tool. ... as an example. -- Store in the player cache object, but make transient. Refresh every 10 to 15 seconds.. maybe even 30? -- Add to the auto features event so its available there -- Change function parameters to use the event and this new object as parameters... reduces number of parms... - - - - - -* Multi-language - Unable to create a custom language file that is not within the prison jar. It's been reported by Ingrosso that cannot create a new language file that does not match a file within the jar? - - -* BlockEvent processing queue - submit blockEvents to a job queue to run in another async thread... the individual commands would have to run in a sync thread. - - This will release the block break thread faster and won't contribute to lag. - - - - -* DONE: https://github.com/PrisonTeam/Prison/issues/222 - DecimalFormat not being used correctly in saving mine data so if different Locale is used, other than EN US, then parsing the saved file can result in a failure. - - MineBlockEvent is an example of where this was a problem - - The offending sections were corrected and should now work - - -* Add option to /ranks to rename a rank. Tag too? - - - - -# Start on mine bombs - - 1. Select size of bomb. Configuration. - 1a. DONE: Identify items to use as bombs - 1b. DONE: Bomb size - 1c. DONE: Bomb explosion pattern. Currently only sphere, but could include other shapes. - 2. DONE: Select list of blocks that will be effected by bomb explosion - 3. Throw bomb, or place bomb... start processing count down. - 4. Pre-fire effects: sound & particles (low priority) - 5. fire event - 6. Post-fire effects: sound & particles (low priority) - 7. Hook up prison's event handler for prison's explosion event - - - - -* DONE: Modified /ranks list to provide this feature - - Maybe provide a /rankcost command? Show current player rank costs with rank cost multipliers applied - - /rankcost - - Optional ranks can be provided as parameters and it will adjust the calculations. - - Example: /rankcost RoyalBlueRanger A p5 - * will show the rank costs based upon rank A and p5, no matter the players current ranks - - Will allow players to better understand what rankup costs will be if they prestige twice or 10 times. - - - -# **Mine Valuation Score** - **MVS** - - Calculate an estimated value for a mine based upon an inventory full. - - **Total Blocks** = 2,304 = 9 x 4 x 64 - - For each block, it's percent chance will be multiplied by the **Total Blocks** to get the number used in valuation. - - **BVS** = **Block Valuation Score** will be calculated by how many blocks are represented, times the block's value in /SELLALL - - **MVS** = **Rank Cost** divided by sum of all **Block Valuation Scores** - - Use block chances to determine amounts of each block. Ignore total stack sizes. - - Calculate how many inventory fulls it will take to reach the next rankup cost. - - This is a difficult calculation since it is based upon another rank's cost - - This will give a score value on Mine Valuation. - - MVS 1.0 or less indicates seriously easy and unbalanced. - - MVS 20.0 would be normalish range - - MVS 50.0 or higher would be considered extreme - - Prestiges Valuations should be calculated on the highest rank of the default ladder. - -Pickaxe enchantments, such as eff and fortune, will have a huge impact on how fast a player can rankup, but the Mine Valuation cannot take that in to consideration. - - -### others - -* placeholder for total block counts and other playercache stats - -* Include sellall costs in block lists - - - - -# **Possible bugs/issues:** - -* Test BlockEvent perms... they appear like they don't work. - -* If ranks module fails due to no economy, try to make that a little more obvious. - -* If no ranks are defined and the placeholders are attempted to be used, it is causing some errors. No economy plugin so Ranks did not load. {prison_rank_tag} was causing an error with /prison placeholder test. "Server: Invalid json. Unterminated escape sequence..." -The ranks module did not load due to no economy. - -* Sometimes Player Ranks lores placeholders from placeholderAPI aren't working, -it's unknown why it's happening. - -* Auto features - disable lore by default - Maybe provide finer grained control on lore features? - - - -# **Document updates needed:** - -1. Document how to use Ladder Rank Cost Multipliers - -2. Document that to get TE explosions to work, you must also create WG regions in the mine. - - may be able to bypass with creative use of Access by Ranks (have prison directly fire the BlockBreakEvents within TE's functions?) - -3. BlockEvent docs need to be updated to reflect recent changes (select by number). - -4. Review commands listed in TOC. Remove obsolete commands (some ladder commands were removed). - - - -* Top Lists - Command based - - Top ranked players by server - - Top ranked players by mine - - Top ranked players by blocks? - - - -* Add a `*all*` for mine name on remove mines blockEvents. - - -- hybrid placeholder graphs - hybars - - super impose text in the graph and have it still be colored correctly. - - text can be centered, such as the percentage that is feeding the bar - - For wider bars, the title could be left justified, and the percentage right justified - - - -* mine groups - - Have global sharing of BlockEvents - - groups cannot be in more than one world - - all mines must be a part of a group - - -* Eliminate the following message from logging an error, but just keep a note in the code: - - Cannot initialize NMS components - ClassNotFoundException - NMS is not functional - net.minecraft.server.v1_17_R1.EntityPlayer - - This does not appear to have much of an impact at this time. - - - -* add all commands to the server.yml file. spigot 1.17.1 is getting fussy. - - -* Conversion tool to import SuperiorPrison users: - - rank is based upon perms `permission.mine.A` and they keep former rank perms. - - No prestiges - - able to reset ranks so conversion can be ran multiple times. - - Unable to really do this due to offline players not having access to the perms. As such, and also due to the need ceasing to exist, this has been put on the back burner. - - -* extended fortune : Apply fortune to all blocks that bukkit does not apply them to. - - Maybe do this through a list instead of blindly applying fortune to all blocks with a qty of 1? Some fortune calculations will result in a qty of one. - -* hook up alternative processing to have prison force the running of another plugin if a setting is enabled. This way prison can "control" how it processes the "left-overs". - - -* prison command handler: - - Add command cooldowns - time in ticks - And cooldownTypes: server, player - - -* Player Cache: - * DONE: Money earned per minute with placeholders - * Add placeholders for blocks counts - * Add placeholders for time onlines - * DONE: Add time mining: per mine - * Tracking by items such as mines or ranks, where the player's status can be reset, presents some problems. Such as the block counts need to be reset for those items, but yet, we need to store them for historical purposes too. So if someone prestiges 10 times, then there will be 10 different times through mine/rank A. If block counts become a requirement for rankups, which it will, then the block counts for that mine must be reset back to zero. So there must be a "current" and "historical" tracking. - - Online stats: - - track which players are online... may need to get the active player list every minute? freq could be configurable. - - track location of player... if the player has not moved in over x-ticks, then mark them as afk. distance traveled is an important aspect... so afk machines may keep them moving in a 1 block radius. Might be able to see if a player is being pushed by water or pistons? - - - - - -* When adding block stats.... add player online stats. - - add events that run, similar to blockEvents, but maybe call them statsEvents? - - So after so many blocks are mined... or so many minutes a player is online, run a command - - - -* Enable mine sweeper when auto features is disabled. Not sure if this is still needed? - - - - -* Add support for BOSS BAR when holding pick axe. Maybe setup placeholders in the config.yml? -- Example would be showing the bar and percent to next rank. - - -* Add mine notifications by Rank - - I forget what this is.... - - -* Prestiges: Rewrite and enhance so as to make it "automatic" without the need to create ranks -* Externalize the mines module on multi-lang -* Add top-n rankings for mines and maybe other ratings -* Add block break counts to players - - - -* Issue with decay functions or at least it shows the problem exists. Enable a decay such as obby or rainbow, then test to confirm it works. Then enchant a tool (increase it's eff). Then test again and it does not. This was seen happening while OP'd. May not be related to decays, but it appears as if enchanting causes the pick to bypass prison? -- Was able to reproduce this at a later time - - - -* Add optional block counts to level up. So if money and block counts are used, then both have to be satisfied. -If only one, then only one of those would be used. -- DONE: Count only the block mined and not the results of fortune. It will be easier to control how much mining a player does by ruling out the results of fortune... after all, it's "Blocks Broken" and not "Blocks Received". - - -- Virtual Inventory Items from mining... With the player object, not only keep track of blocks mined, but have a virtual inventory to track what they have collected. - - Hooked up to sellall - - Have max limits and commands to increase and decrease the total inventory size... could have both "slots" and max stack size per slots. So that way the players can buy, or rank up those components, just like normal backpacks? - - Will prevent players from trading and cheating... - - - - -* Add support for mineTinker -https://www.spigotmc.org/resources/minetinker-50-modifiers-tools-and-armor.58940/ - - - - - - -* Plugin exception handling has problems - - This is a very rare condition that it happens, but when it does, the global trapping of Prison errors produces a stack trace that is missing details. Off hand it is not known where that code is. Need to look in to it and fix it. - - - - - -* Auto Features - - DONE: Add a reload for them. - - Enable alt fortune calculations as a fall through backup calculation if no fortune is provided for the given block - - -* /ranks autoConfigure: - * Show percent breakdown of blocks - * Option to name all mines: list of mines. Permit non A, B, C naming. - * list world guard commands to protect the world (would then have functional world) - - - - -* Add a message count to the `/prison debug` features where it will only print a specific number of messages before turning off the logging for those targets. - - - -* Support for Personal Mines: - - World support - main mines & Personal mines - - -* World support: Only have prison active in the worlds specified? - - World-main-mines: - - World-personal-mines: - -* Or have mine groups where you can specify one world for a given group. - - -* world specific exclusions: - - Have a world list that will shutdown prison commands when issued in that world: - - command handler should ignore those worlds - - chat handler should ignore those worlds - - - - -* Ranks have been converted to have all messages moved to files: -* UTF-8 support. - - If UTF-8 characters do not work, then they must be converted with a tool similar to this website: - - http://www.pinyin.info/tools/converter/chars2uninumbers.html - - - - -* Fix per rank progress bars. This includes adding a new placeholder series since you will have to include the rank name in the placeholder. Current ladder placeholders are based upon the player's current rank only. - - - -* BlockEvents - Action based upon blocks broken, not a percent chance. - - Based upon total count of blocks broken. Example, after a player breaks 1,000 blocks, then fire a BlockEvent. - - - - -* global virtual mine: To apply mine commands & blockEvents to all other mines. - - - -* possible change to /prison version all to include errors during startup. Errors would need to be captchured. - - - -* To `/ranks autoFeatures` add warnings at the completion identifying that the user must create any needed groups. - - Note that WG global region needs to have the flag `passthrough deny` set. - - - - -Personal mines. Work in conjunction with a plot world? -- sellable and so would be the features with various upgrades -- Create a new module based upon Mines with new features to support player interactions and upgrades. - - - - - -- /prison utils mining - - Add XP direct and ORBs - - - - -Auto features not working outside of the mines. -- Will not support auto features outside of the mines directly.... too many issues. -- Maybe be enabled and working now? -- This caused issues and may have been disabled. - - - -- Add new placeholders: - - Top-n - Blocks mined for mines - - Top-n - Most active mines (based upon blocks mined) - - Update papi's wiki - - Track stats on placeholders? Could be useful in tracking down expensive stats. - - -- Top Listings - - Ranks & Prestiges - - Individual Ranks - - Mine base - - placeholders - dynamic - position in list - - How to dynamically keep this in memory, without lag or delays? - - Timer to track updates to player's balance so it's not always performing updates - - Sort order: - - Ladder, Rank, percent, name - - Penalty for going over 100%? - - Encourage ranking up instead of sitting at one rank to dominate. - - if > 100% - Take excess and get % of rankup cost and divide by 10, then subtract. - - if rankup cost is 1 million and player has 2 M, then they will have a calculated rank score of 90.00. - - if cost is 1 M and they have 3 M then it will score them at 80.00 - - -- Provide a generic placeholder that can have the value supplied through the placeholder. - - - -- DONE: Add blocks mined for players - - - - -- Review the chat hander in the spigot module. It was rewritten a few weeks ago to fix some issues and to optimize how things are handled. The issue is that the new code (way of handling things) needs to be extended to other areas. So review the SpigotPlaceholders class and see how it can be updated. Then end result will be less code and less potential issues. - - - -- Optimize the handling of chat placeholder. They will always be the same for the whole server, so cache the PlaceholderKeys that are used. - - Partially done. The chat handler was updated, but the change could be pushed in to other existing code to improve the flexibility and resolve some of the weaknesses that may exist. - - - - - -Future Block Constraints: - - GradientBottom - The block has a greater chance to spawn near the bottom of the mine. - - GradientTop - The block has a greater chance to spawn near the top of the mine. - - - - -Maybe: Have an alt block list for mines were blocks that are not actually - defined in that mine included there. This is so air and other blocks that don't find hits can be included with the counts. Needed for when blocks are changed so it does not lose change status? - - - - - - -- auto features - - custom list of blocks for fortune - - - -- Issue with /ranks demote and refunding player. - If the current rank has a custom currency and the player is demoted with a refund, - the refund is credited to the wrong currency - - This will be easier to fix once currencies are fixed - - - - -* **Custom block issues** -- If CustomItems is loaded successfully but yet not using new block model, show error message -- Show a message at startup indicating that the new block model is enabled or not enabled - - - -* **Prestige Options** - - Auto Prestige - server setting or player setting? - - prestigemax - keep applying prestiges until run out of funds - - Eliminate prestige ranks - (optional) - * Would need ladder commands - * Need to define an upper limit of how many - * tags may have a placeholder: `&7[&3P&a{p_level}&7]` - * Have a base cost of prestige: example 100,000,000 - * Have a cost multiplier for ranks: example: 10% more expensive each rank with each prestige - * Have a cost multiplier for prestiging: example: 20% more expensive each prestige - * Have a cost multiplier for /sellall: Example: 0.005% (1/2 increase in sale price) or -0.015% (1.5% decrease in sale price to make it even more difficult per prestige) - * Have a list of permissions and permission groups - * The above settings are pretty general and would apply to all generated prestige levels, but to allow for customizations, then ladder ranks, perms and perm groups could be setup to accept a level parameter to be applied at a specific level. Tags set at a given level could also be applied to higher levels until another tag takes it place. - - - -- Prestiges max - if at max show 100% or Max, etc... Maybe set "max" on a placeholder attribute? - - -- Add a prestiges config option to auto add a zero rank entry for prestige ranks. - - - - - -* **Combine a few commands & Other short Notes:** - - DONE: Combine `/mines set rank` and `/mines set norank` - - Combine `/mines set notificationPerm` with `/mines set notification`. Add an option to enable perms. Allow the perm to be changed? Maybe even use as a default the same permission that is used in `/ranks autoConfigure`. - - Combine `/mines set zeroBlockResetDelay` with `/mines set resetThreshold` - - - Store the permission a mine uses so it can reused elsewhere (know what it is so it can be used). - - move `/mines playerinventory` to `/prison player showInventory` - - Add alias `/prison player info` on `/ranks player` - - Add alias `/prison player list` on `/ranks players` - - - - -* **Value estimates for a mine** -We know what blocks are in the mine and the percentages. If people equally mine all blocks (some only go for the more valuable ones if they can) then we can produce a formula that can tell you how many estimated inventory fulls it would take to reach the rankup cost. That could be a really awesome "validation" tool to make sure one or two ranks are not messed up with either being too easy or too difficult. Will need hooks in to auto manager tools to calculate fortune and what results from block breaks. Could be complex. -`/mines value info` show breakdown of a mine's defined ores and what it would take to reach /rankup -`/mines value list` show a listing of all mines with the key details: value per inventory full, how many inventory fulls to rankup. - - - - - - - - -* **Update config.yml when changes are detected** -Preserving the current settings, replace the out of date config.yml file with the latest that is stored within the jar. Updating the settings as it goes. - - - - - - -Enable zero block counts for parent mines. -if 100% block type of IGNORE, then after reset do an full mine air count so zero block reset works. :) - - - - -* **When creating a new mine, register that mine with the placeholders** -Might be easier to just reregister all mines? Not sure if that will work? -Right now, if a mine is added, in order for it to show up in the placeholders, you would have to restart the server so all the placeholders are reregistered. - * * maybe just automatically run reset when vital elements change? * * - - - -* **Redesign the save files to eliminate the magic numbers*** -Most of the save files within prison, for players, ranks, and ladders, are -using magic numbers which is highly prone to errors and is considered -very dangerous. Also prison would benefit from a redesign in file layout -to improve efficiencies in loading and saving, not to mention greatly reduce -the complexities within the actual prison code, which in turn will help -eliminate possible bugs too and give tighter code. - - - -Offers for translation: - Italian : Gabryca - Greek : NerdTastic - German: DeadlyKill ?? Did not ask, but a possibility? - French: LeBonnetRouge - Portuguese: 1Pedro ? - - - -
- - -# Features recently added for v3.2.11 - - - - - - - - - - -* DONE: New update to combine block processing results in many block.getDrops() being combined. Since they are combined, the extended fortune calculations may not work properly since it does not know how many original blocks were included. -- May need to have an intermediate object to better collect original blocks, drops, and targetBlocks. It can include some of the more basics that are not tracked, such as original block count to better calculate the fortunes. - - - -* DONE: Rewrite the `/prison utils titles` to use XSeries' title commands. XSeries only supports 1.9+ so I still need to support 1.8.8 directly within prison. - - - -* DONE: Common messaging framework so if hundreds of messages are sent, only one is displayed. Eliminate the duplicates. - - - - -* DONE: Revert a mine to a virtual mine. Maybe with the command: `/mines set area *virtual*`. Backup the mine's data file before updating and saving. - - -* DONE: the command /mines reset *all* is not working correctly. Could be an issue with the chaining not submitting the next reset since this is all done through async processes right now. - - -* DONE: Add a few more options to auto features for auto sell, such on full inventory. This was removed recently to stabilize some of the new code. - - Just refined what was already there. - - - - -* DONE: Concurrent modification error on the MineTargetPrisonBlock when resetting the mine. - tech.mcprison.prison.spigot.game.SpigotWorld.setBlocksSynchronously() (146). - Serialize Id the mine resets and provide a locking mechanism that will prevent auto features from being processed when it goes in to a reset mode. Also when in a reset mode, prevent another reset from being submitted so they cannot run concurrently or back to back. Maybe attach a cooldown to the resets too, such as 10 seconds would be long enough to prevent a runaway chained reaction. - - DONE: Create an object such as a MineStateToken that will hold the state of the mine reset (in progress, mineable, stable, usable, locked, etc... not sure proper terminology right now... or how many states), with a serial number that will be incremented on each reset. - - (on hold) Do not perform a clear on the collection of MineTargetPrisonBlocks within the mine. Just replace the collection with a new collection and let the garbage collection handle reclaiming all resources. Carefully review for possible memory leaks. May be a good idea to hold on to that collection and submit a task that runs in about 30 seconds to perform a clear on the collection to release the resources. This may be important since the target blocks contains references to the stats blocks and may not be GC'd automatically. May want to null those refs first too. - MineReset.clearMineTargetPrisonBlocks() (1799) - -* DONE: PlayerCache Time per Mine stats - not recording correctly. - -* DONE: new auto features autosell should place items in inventory that have no sell value. Items that cannot be auto sold. - - - - - -# Features recently added for v3.2.10 - - -# TODOs for v3.2.10 release: - -1. DONE: Final testing of ladder rank multipliers -2. DONE: /ranks ladder moveRank not working -3. DONE: Forced global refresh of rank multipliers when a ladder multiplier is changed. - - Should be simple - - Run as async task - - DONE: Force update when updating a ladder's multiplier - all players - - DONE: Force update when changing ranks - only targeted player -4. DONE: Add ladder base cost multiplier to /ranks autoConfigure. Start with a simple 10%. - - Include message that it's enabled and how to change it or disable it: - - /ranks ladder rankCostMultiplier prestiges 0 -5. Add to /ranks player the detail information on rank cost multipliers -6. DONE: For '/ranks autoConfigure' add an alias to '/prison autoConfigure' - -7. DONE: Change /ranks list so if non-op it does not show all the extra details. A simplified list for plain players. - -8. DONE: Liners: Some are only for later releases and do not work with 1.8.8. So need to setup something to restrict the liners that are not functional for the older releases of spigot. - -9. DONE: Hook up Prison's Explosion event. - - -### Others - -* DONE: Add a rank cost multiplier to ladders. Sum all active ranks a player has to get the total multiplier to use for rank costs. -* DONE: Fix the "next rank" value with PlayerRanks.... needs to recalc with the new rank. -* DONE: When a ladder's rate cost multiplier is changed, need to recalculate all player's multipliers. Setup a task? - - - -* DONE: /ranks ladder moveRank did not work to move from one ladder to another - -* DONE: When adding a new rank or mine, auto reload all placeholders so they pick up the new entry. - - - - - -# Features recently added since v3.2.9 - - - -* DONE: Enable and disable confirmations for prestiges - - DONE: Put in config.yml under the existing: prestiges. settings. - - DONE: Move the GUI confirm to the same group of prestiges. settings. - - - Player Cache possibilities? - * DONE: money earned per mine? - - -* DONE: Make ranks more expensive on each prestige.... - - -* NOT-AN-ISSUE: If automanager is turned off, and /prison reload automanager is ran, it will reload the settings, but the event listeners are only registered upon server startup. So if that condition happens... should display a warning indicating the server must be restarted. -- NOT-AN-ISSUE: Add a warning about event priority changes needing a server restart: --- NOTE: these are no longer an issue since event listeners are reloaded when the auto features are reloaded. - - - -* DONE **Get new block model working** - * Start to enable and test various functions - * Add in Custom Items Integration - * Code Integration for CI - Key to specific version due to api changes - * Pull in custom blocks from CI API - * Place blocks with CI api - * Not sure how block break would work with CI api? - * Setup sellall to work with CI api - - - -DONE: - Block constraint error when there are no blocks spawned when applying min to add more... - - if rangeHigh and rangeLow are zero, or the same, then need to set the high and low values. - - May need to even set them when there are only a few? - - maybe rangeHigh and rangeLow should be the actual limits, and not the high and low range of where those blocks actually spawned? Right now it's actual spawned blocks, but if either, or both are 5000 blocks from the true limit, then the range of actual adjustments is artificially limited and narrowed. - - Maybe add 2 new fields: rangeHighLimit and rangeLowLimit that is the actual boundaries? These could be used to help normal spawning? - - -* DONE: On prison support submit mines, include /mines info a all? - -* DONE: To all headers that are displayed in prison commands, show the prison's version to the far right. - - -* CANNOT REPRODUCDE: The command /mines delete does not appear to be working - User error? - - -* DONE: Add an *all* for mine names under blockEvent add: - - -* DONE: ladder commands - - - -* DONE: On default ladder, at top rank, if prestige is enabled, then show a message that can be configured. - - -* DONE: Add hunger to auto features calculations - - -* DONE: /prison placeholders list - group by placeholder type. - - -* DONE: Placeholders for items in hand: name, - - -* DONE: try out the new event priority code. if it works, apply it to all classes - - Player Cache possibilities: - * DONE: blocks per mine? - * DONE: time mining per mine? - - -* DONE: Issue with placeholders bars and rankup costs... - - -* DONE: prison should "scan" offline players upon startup and auto add anyone not already hooked up. This will help reduce a lot of questions and make the first experience with prison smoother.... - - -* DONE: Bug: placeholders are not working correctly when player is offline... - - Example with the bar graph placeholders. - - -- blockEvent - - DONE: simplify add - use common defaults - can change features with the other commands - - DONE: Add a target block name - - Not an issue: "Use of placeholders is failing %prison_ is failing on %p" Turned out they were trying to use %player% instead of {player}. - - - - -Completed for v3.2.9: - - -* DONE: BlockEvents - add block filters - tested successfully - -* DONE: decay: Add a util function to respawn the block that was mined... use it with blockEvents. - -* DONE: Ladder commands: - -* DONE: Delete by line number: - - -* **Commands - Enhancement** -DONE: Be able to select rank and mine commands for edit and deletion, or even moving, with line numbers. - - -* **Rank Commands - Edit and delete** -DONE: Add line numbers and enable the ability to edit and delete by line number. - - -* **Ladder commands - global for all ranks in that ladder** -DONE: Add new placeholders for ladder commands to be able to have generic ladder commands that will apply and be ran for all ranks. May be able to eliminate the need for most rank commands. - - - - -**For v3.2.8 Release - - Preparing for Java 16** - - - * DONE: Update Gradle to most recent release - - - * On going: Review other dependencies and update them too, if possible. - - - * DONE: Update development environment, and system to support Java 16 - - - * DONE: Update XSeries to support the new block types. Updated to v8.0.0 and then v8.1.0. - - - * DONE: Enable the new block model - 73.5% are currently using v1.16.x so with the new 1.17 more people will be expecting the new blocks. - - - * DONE: Auto Refresh for language files when version detects new update is available and if auto update is enabled for that language file. - - - * DONE: In /prison version, if auto features are disabled, show NO details. - - - * DONE: Confirm duplicates on BlockBreakEvents makes sense. Fixed the BlockBreakEvents by making sure they all had their own classes so they could be identified as to what they really are. This cleaned up a lot, and also eliminated one set of duplicates too. - - - * Works: This was not an issue. Ranks info raw tag is not showing the editing formats... The rank I saw this on did not have any formatting. - - - * DONE: Fortune on all blocks is not working... - - - * DONE: Hook up java version on /prison version's plugin listings - - - * DONE: Issue with nms with SpigotPlayer... does not work with 1.17. - - Disabled when fails. No longer produces stack traces. - - -**Other additions and changes:** - - -* **Prestige Options** - - DONE: Reset money on prestige - boolean option - - DONE: Prevent reset of default ladder on prestiging. - - DONE: rankmax - keep applying rankups until run out of funds - - -- DONE: Update /prison autofeatures to include new settings. - - -- DONE: Could make /prison autofeatures reload happen. Alias: /prison reload autofeatures - - -- DONE * Mines TP warmup - - - -- DONE: * Issue with removing a BlockEvent by clicking on the remove link. It converts all of the & to the raw code. - - `/mines blockEvent remove` now uses line numbers so this is no longer an issue. - - -- DONE - Used load delays - Rare condition caused by FAWEs where prison loads before CMI even though it all configured to do so otherwise. - - May be able to provide a way to force the ranks module loading so that way it can just "assume" everything is working. - - Force the loading of Ranks module if there is a failure. Found that FAWEs is screwing up the loading sequence of prison when dealing with CMI, and as such, ranks are failing to load since CMI loads after prison. Setting softdepend for all of these do not help. - - -DONE * Add `/prison debug` targets so specific kinds of debug messages can be turned on and off so it does not flood the console with tons of irrelevant messages. - - -DONE * replace ranks with mine related commands with ranks. - - can eliminate permissions on /mtp and mine accessperms. - - -DONE * Add system stats to `/prison version` - - - - -DONE: If starting up prison and there are 0 ranks and 0 mines, then submit a delayed job that will run in 10 seconds to print out a message to console on how to run `/ranks autoConfigure` for quick setup... include link to the online docs. - - -DONE: rank commands - remove by line number - - DONE: Same for mine commands - - - - - -* **Works fine: Bug in /ranks autoConfigure??: Confirmed everything is OK... No bugs** -An admin must have messed up mine A since blocks were gone and other settings were not correct. They could have ran `/ranks autoConfigure force` after creating mine a manually. - - - -* **Rework rank permissions to eliminate need to put perms in rank commands** - - **NOTE: This was a fail!!** - - This did not work because: - 1. You cannot access group perms through bukkit - 2. You cannot create new group perms through vault - 3. It's not possible to easily check perms through vault - - This has been made obsolete with the use of Access by Rank !! -- Enhance the PermissionIntegration abstract class to also work with group perms. -- Add to ranks two new fields: permissions and permissionGroups. Save and load. -- Add a new boolean field to ranks: usePermissions. Save and load. -- Add support for these perms within rank commands -- Rewrite rankups to use these perms when ranking up, promote, demote, and also for prestiges - - - - - -
- - - -* **NOTICE - About Prison, Java 16, and Minecraft 1.17** - -Prison is all about providing the best experience for your server environment.In order to look toward the future, so we can continue to provide the best possible experience, we have to set limits on what we can actually provide support on. We are currently entering a challenging period of time where we will have to make some difficult decisions to help ensure the best possible future for Prison. - -Minecraft 1.17 is scheduled to be released on June 8th, 2021. The release of 1.17 brings with it some major changes that will have significant ripples throughout the minecraft server community, mostly due to the heavy dependency upon Java 1.8 for many years. This ultimately means there are a lot of unknowns that we will have to work through and there will be situations that were unexpected. - -One major change in our support statement is that Prison, as of right now, will only *officially* support Spigot v1.8.8 (10.9% usage), v1.12 (10.9% usage), and v1.16.5 (73.5% usage). These three versions of Spigot represents 95.3% of all servers using the Prison plugin. This does not include any server that has disabled the bstats, which is one reason why you should keep that enabled so you can be represented in our stats and our plans for the future. - -Note: The follow up versions in descending order of usage are: v1.14.4 (1.6% usage), v1.13.2 (1.2% usage), v1.15.2 (1.2% usage), and v1.11.2 (0.9% usage). No other versions are recorded by bStats. - -But please keep in mind, as with our official stance of only supporting Spigot, we will also *provide* as-needed support for Paper and other Spigot compatible platforms. We want you to have the flexibility to use the platform that best suites your needs. We just will not pre-test on those platforms, but we will try to address any issues that are brought to our attention. The non-supported versions of Spigot falls under this same limitation of support: we will not pre-test for the non-supported versions, but if you are using them and find issues, we will work with you to resolve them. The actual impact of dropping support for 1.9, 1.10, 1.11, 1.13, 1.14, and 1.15 should have no impact on quality for those releases of Spigot, but it will free up a lot of time spent on testing. - - -Some initial testing with running a prison server using Java 16: -* Spigot v1.8.8 will startup and run. But there are major failures with missing classes that are critical for the core bukkit and Java components to work properly. It is doubtful a fix will ever be provided. -* It has been noted that bukkit/spigot 1.8 through 1.11 will not work with Java 11 and later. -* Spigot v1.12.2 compiled with Java 1.8 appears to work perfectly well with Java 16 running on the server. -* Spigot v1.16.5 compiled with Java 1.8 appears to work perfectly well with Java 16 running on the server. - - -I have not tried to compile anything with Java 16 since I need to first update the Prison build environment to support it. But these are tests that will be explored in the very near future so as to get a better understanding on what we can expect from the build process. - - -In the last few days, I've updated gradle to the latest release so it will support Java 16. Other resources have been updated too. More work will be done over the next week or two to prepare for MC 1.17 and Java 16. - - -NOTE: At this time, I think there will have to be two builds. One with Java 1.8 for Spigot versions 1.8 through 1.16.5. Then another build with Java 16 that will support Spigot 1.12 through 17. This will give admins the flexibility to choose the version of Java to run on their servers that they are most comfortable with. Initially, these builds will be automated, but initially they may be a manual process. - - - -**Prison v3.2.8 will be targeted to support Java 16, and hopefully, Minecraft v1.17 too.** - - - -Java 1.8 and Java 11 have a built-in javascript engine. Java 16 does not. -This plugin provides support, and compatibility, with javascript processing. -Other plugins that use javascript, such as papi, would have to be compiled -to work with this plugin. -https://polymart.org/resource/jsengine.1095 - - - -
diff --git a/docs/prison_changelogs.md b/docs/prison_changelogs.md index b4f658b2f..2a221dcc9 100644 --- a/docs/prison_changelogs.md +++ b/docs/prison_changelogs.md @@ -1,8 +1,19 @@ [Prison Documents - Table of Contents](prison_docs_000_toc.md) -## Prison Build Logs for v3.3.x +## Prison Change Logs for v3.3.x -## Build logs + +## Known Issues + +These are internal notes that may initially record ideas and issues. They may not +reflect the final actions taken as expressed in the change logs below, so these +may be insightful in to some of the evolutionary processes. + +* [Known Issues - Open](knownissues_v3.2.x.md) +* [Known Issues - Resolved](knownissues_v3.2.x_resolved.md) + + +## Change logs These build logs represent the work that has been going on within prison. diff --git a/docs/prison_docs_000_toc.md b/docs/prison_docs_000_toc.md index b9b9c3e19..2221917bd 100644 --- a/docs/prison_docs_000_toc.md +++ b/docs/prison_docs_000_toc.md @@ -9,7 +9,9 @@ * **[Prison README](prison_readme.md)** High level information, plus how to use with gradle builds. * **[Prison License](prison_license.md)** GNU General Public License * **[Prison Change logs](prison_changelogs.md)** Detailed changes to prison. -* **[Prison Known Issues](knownissues_v3.3.x.md)** Known Issues and To Do's. +* **[Prison Known Issues - Open](knownissues_v3.3.x.md)** Known Issues and To Do's. +* **[Prison Known Issues - Resolved](knownissues_v3.3.x_resolved.md)** Resolved Known Issues and To Do's. + * **[Prison Discord Server](https://discord.gg/DCJ3j6r)** Get help here. @@ -27,12 +29,12 @@
-# Prison Supports Spigot 1.8 through Spigot 1.19.x -# Prison Supports Java 1.8 though Java 19 +# Prison Supports Spigot 1.8 through Spigot 1.20.x+ +# Prison Supports Java 1.8 though Java 20+ # Prison is created for the Spigot Platform, and works on other platforms based upon Spigot -Prison supports Spigot 1.19.x, along with Java 17 and 18. At this time there hasn't been any reports of incompatibilities. Since prison is using a library to support the correct blocks for the version of the server that you are running, we are limited to when updates are released for that library. Luckily they have had a couple of releases and we have applied them to the latest alpha releases. So if you are wanting to maximize the new Spigot 1.19 experience, please upgrade to the latest alpha release as found on our discord server in the #alpha channel. +Prison supports Spigot 1.20.x, along with Java 1.8 through Java 20. At this time there hasn't been any reports of incompatibilities. Since prison is using a library to support the correct blocks for the version of the server that you are running, we are limited to when updates are released for that library. Luckily they have had a couple of releases and we have applied them to the latest alpha releases. So if you are wanting to maximize the new Spigot 1.20 experience, please upgrade to the latest alpha release as found on our discord server in the #alpha channel. ### Newer features and updates in Prison: From 6106d8a24af46992c7101793b5bb9f8681073499 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 8 Jul 2023 16:17:50 -0400 Subject: [PATCH 72/75] Doc updates for the latest alpha.15 release. --- docs/changelog_v3.3.x.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 7fd0ab352..dd6c7d63b 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -17,7 +17,14 @@ These change logs represent the work that has been going on within prison. # 3.3.0-alpha.15 2023-07-07 -**2023-07-07 v3.3.0-alpha.15 Released** + +* **2023-07-07 v3.3.0-alpha.15 Released** + + +* **Update the known issues doc...** + + +* **Doc updates for the latest alpha.15 release.** * **Added comments to the prison-spigot/build.gradle configs to add more descriptive comments.** From e0b1790b76852209a050ec2e33c3394fb435235f Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 8 Jul 2023 16:18:15 -0400 Subject: [PATCH 73/75] Doc updates for the latest alpha.15 release. --- docs/knownissues_v3.3.x_resolved.md | 1345 +++++++++++++++++++++++++++ 1 file changed, 1345 insertions(+) create mode 100644 docs/knownissues_v3.3.x_resolved.md diff --git a/docs/knownissues_v3.3.x_resolved.md b/docs/knownissues_v3.3.x_resolved.md new file mode 100644 index 000000000..445498899 --- /dev/null +++ b/docs/knownissues_v3.3.x_resolved.md @@ -0,0 +1,1345 @@ +[Prison Documents - Table of Contents](prison_docs_000_toc.md) + +# Prison Known Issues and To Do's - Completed listings + +These have been marked as completed over the last few years, and encompasses many different versions. The original known issues doc was over 1500 lines so they are being moved to here to shorten that document + +- - - + +These known issues are an informal list of concerns and bugs. Also includes some wish-list items too. + +These are notes for personal references. These are not intended to explain anything useful, but they do track some issues and perspectives that may not be fully expressed in the change logs because initial impressions may not turn out to be the actual problem or the final course of changes and enhancements. + + +
+ + + + + +DONE - permission for prestiges not working correctly +Rayne — Today at 9:52 AM +hey @RoyalBlueRanger, so someone is trying to prestige and they can't? +there's no errors or anything and they don't get a message it worked for me when i was op +Rayne — Today at 10:52 AM +So it turns out that the ranks.rankup.prestige permission works but not the ranks.user +- NOTE: Fixed some issues with prestiges and perms. But mostly was an issue with the help not properly explaining how important the perms are. Also added a new feature to turn off the need for the presetige perms so all players can use it without the perms; they may still need to have ranks.user enabled. + + +DONE - budderman18 reports: +Budderman18 — 06/21/2023 11:56 AM +If your server runs any plugin using java 19 or higher (java 18 might be the case as well), prison won't be able to startup +- NOTE: Updated NBT-api for v1.20.1. Found out Prison's use of NBT-api was setup wrong which caused conflicts. Now working the way it should. + + + +- DONE: change BLOCKEVENTS to use MONITOR priority - PrinceHatem + +- DONE: add option to allow AIR when at MONITOR priority - PrinceHatem + - issue with when a break is canceled on RevEn such as when durability is zero. + +- DONE - Add a command usage count to commands. Then a simple report to list what commands were used, along with total command count of active commands. + + +- DONE - Expand upon the config.yml command lockout so that if the player does not have access to a command, then suppress that command from all players, including command listings. Not all commands will be able to reject access due to the nature of the commands (all access to everyone) and/or the use of alt-perms (programmatic evaluation to the commands). - Josh-65 + + + + +DONE: > noza3 — 2023-06-29 at 1:09 PM +> Thanks royal blue but i’ve already fixed it. Only problem I was facing was using /mtp {minename} after creating the mines, which would say this is a virtual mine blah blah, but madog told me to do a restart which fixed the issue, so I created all of my mines, set them up properly, then restarted the server and all of the /mtp {minename} works now. Also the portal at my spawn that allows people to jump into and go to their mine works, now that I use the player command /mtp with the portal. Thanks for the help +- NOTE: could not reproduce this issue. + + + +- DONE - fix gui ranks to remove italics from the rank names. This may be the gui ranks and/or the gui prestiges. - Bryton + Cannot reproduce - No italics are being added by prison. + Changed the player gui for ranks and mines so it does not add anything extra. Can now fully control all of the lore. + + +- DONE: Gui prestiges - option to remove the gui prestige button. Not sure if any of the options in the config.sys really supports that. - Bryton + + + +- Prestige - needs improvements + DONE: rewrote the prestige handling to exist in the ranks module. Everything is handled properly now. The GUI is passed the correct lore so no rankup logic is in the gui anymore. Prechecks are now enabled too. + - DONE: Confirmation does not perform any prechecks to confirm if the player can even prestige + - DONE: Confirmation does not reflect prestige settins. It always shows that rank and balance will be reset, even if that is disabled. + - DONE: It's not clear how to confirm via chat + + +- bStats: + - DONE: Remove Plugins & Prison Ladders + - DONE: Add: modules, Economy (integrations), Perms (integrations), Placeholder (intg) + - DONE: Add: Language + - Eliminate zero counts (don't report) + - DONE: validate that plugins listed in other reports are being removed from plugins a-z. + - DONE: Removed the a-z listings of plugins. + + + + +DONE - TEST: Add nbt support to gui menus. Issue with rankup not getting the correct ladder name. + - Partially added and is working. Expand to other menu options, which will be time consuming. + + +- DONE?: Archive old players - budderman18 + - archive all player files to a zip. Remove the originals. If player logs back on, then restore the archives. Prevent startup from adding these players back. + - Archiving players in topN - this may address the archive needs. Part of the issue was related to performance calculations upon startup, which the new topn does address. + + +-> DONE: Hook in to quests - Only on block break events so may not work as expected? + + + +- DONE: prison commands if using ; for multi-commands, and if a space follows ; then it's not working. + + +- DONE: The command `/rankupmax` needs to be fixed - redonthehead + - DONE: `/rankupmax`, or `/rankupmax default` is fine, but replaced getting the next rank with the new code so it works better. + - DONE: `/rankupmax prestiges` is the same as `/prestige` and `/rankup prestiges`. Change so it will go through the default ladder, then prestige, then repeat if enough money. + + +- NOT AN ISSUE: In the GUI menu, the config setting: Enchantment_effect_current_rank is off by 1. If D rank it shows E being unlocked. - CITYJD + - Looking at the code where this is used (player ranks and prestiges), the intention of this setting is to highlight the player's next rank. So the settings name is wrong... It should be `Enchantment_effect_next_rank: true` + - Locate docs that covers this topic and make a note explaing what this is for and why the settings name is wrong. + + + +- DONE: Add `*all*` to `/mines set notification` - CITYJD + - Fixed a few other commands too to provide applying the command to all mines. + + + +- DONE: Force sellall before prestiges - kikiisyourfriend + +- DONE: Auto-Forced-Rankups and prestiges when the player has enough money. Kikiisyourfriend + - a new autoFeatures entry + +- DONE: Enable Access to prior mines - kikiisyourfriend + - disable to prevent going back to prior rank mines. + - See `prison-mines.access-to-prior-mines` in config.yml + + +- DONE: prison_rank__linked_mines_rankname prison_r_lm_rankname provide a placeholder for the mine's tags. B0mer + + +- DONE: Mines tp: option to list all available mines per rank? Thaysa + + +- DONE: Option to skip applying the rank cost multiplier to a specific ladder. + + + +. DONE: Use of placeholders in gui mines is not working correctly - PassBl + - Trying to use: - '&7Test Cost P1: &3%prison_rank__player_cost_formatted_p1%' + - Using deluxe menus - may not be sending player info with placeholders? + - Fixed: complex new calculations for `prison_rank__player_cost` calculations. + + +- DONE: Mine Bomb Name and tags not showing color - Thaysa + - Works with 1.8.8 + - Fails with 1.18.2 - colors are fine in GUIs and commands + + +- DONE: Modified the `/mine blockEvent` commands to auto show the existing rows if only the mine name is entered for the command. It will show the list of rows, then the user can select it, then continue entering the rest of the command. There has been a lot of confusion on how to work with the blockEvent rows since it was not obvious they had to first "list" the blockEvents for that mine. + + +- DONE: If prison cannot hook in to the economy, prison should see if CMI is a plugin on the server, then it should try to enable the delayed startup for CMI. Kind of a forced-auto-enable if CMI is detected. + + +- DONE: Mine bombs - If at rank d and in mine w and I set off a mine bomb, it will not break any blocks, but it will lock them and prevent others at that rank from breaking them. - redonthehead + - player should not be able to "lock" blocks + - DONE: Player should not be able to drop a mine bomb in a mine they don't have access to + + +- DONE: command `/ranks topn` - does not appear to be sorting by prestiges first - redonthehead + - Fixed? Force sort when using the command each time. + - When player's rankup, should probably force a sort. + - The sorting should be somewhat low cost, since if players are in the same position, it short-circuits the sorting so there is less processing. Ie.. if nothing is sorted, it's only one quick pass. If only one player changes, then it's only moving that player. + + - DONE: Issue with topn Rank-Score. When player is at top of default ladder and has not prestiged yet. + - Rank-score looks like it's just their money balance? + + +- DONE: Sellall enablement - needs to be in module.yml, but must enable it in config.yml? + - bug in alpha.12? + + +- DONE: A placeholder in PLAYER that will show the next tag for both default and prestige. - surawesome + - but only show next prestige if on last rank in default. Default will show first rank. + - {prison_rankup_linked_rank_tag} <- [p]\\[d] + - {prison_rankup_linked_rank_tag_prestiges} {prison_rankup_linked_rank_tag_default} + +- DONE: Top block and top tokens - Phoung Nguyen + + +- DONE: When placing a mine, it spams resets while it's setting up the liner and the primary mine. May be an issue with zero block resets and having zero block counts remaining. May want to initially set the block counts to something like 1, then after the mine is done being laid out, then reset it. When it's in "tracer" mode, no blocks exist that can be broken, so a value of 1 cannot be decreased.i + + + +- DONE: percent is not being filtered from `/mines blockevent percent` and is causing errors in the formatting of the number. Percent is also not showing the list of events to get the rows... + + +- Mine Bomb Issues + - DONE: Not dropping blocks + - DONE: give bombs only works with lower case... camel case not working + - DONE: with a stack of 2 oof bombs, setting off one removes both. + - The is happening when the bomb is so large that it breaks the durability on the pseudo tool, which then removes whatever is in the player's hand when it breaks the item. + - DONE: color names for bombs do not work - xGeorge26 + - DONE: Control Y adjustment when setting the bomb. Defaults to -1. + - DONE: armorstand appears in animation when using color coded bomb name? - xGeorge26 + - DONE: Update to include more colorful names.. + - DONE: Provide a "count down" placeholder function within the armor stand bomb name?? + +- DONE: Need to externalize the time defaults... like Mine x will reset in x seconds from now. 1 seconds. - ShockCharge + +- DONE: Six - air count needs to be asynch'd since it is causing server not to respond for more than 10 seconds upon startup. + - Most mines are greater than 120,000 blocks. + + + +- DONE reload is doing NPE when blockconverters are not setup and disabled. + +- DONE mine gui - add custom lore to the configs + - DONE: can now use either `{mineName}` or `{mineTag}` and title is now rankTag too. fix using the mine tag and not mine name + +* FIXED: GUI Ladders - Perms are not checked so anyone can run these GUIs. But other than viewing the ladders, they cannot run successfully the /rankup ladder command. + + +- FIXED: autosell not working. McPingvin + + +- FIXED: Sellall signs not working when variant is other than oak. BOmer + +- DONE: placeholders are not using the time units as the mine notifications are using. Therefore, they are continuing to use english units. Need to fix the placeholders. One is `prison_mines_timeleft_formatted_Mine`. kstance + + +- DONE: add support for NBTs - mine bombs - ClumbsyIsNotReal + - having problems formatting mine bomb lore with current restrictions since it prevents bombs from working. + + +- DONE: placeholders - show next rank is skipping p1 when no p is assigned to player. xGeorge26 + + +- DONE: Many errors when prison hits a standard potion. - jamo + + +- DONE: autofeatures BLOCKEVENT priority - check for full inventory and perform sellall - Ryankayz + + +- DONE: Rankup - Still not working correctly. + - DONE: takes money but does not rank them up? + - DONE: rank changes does not alter the list of players at the ranks + + +- DONE: Top-n: hookup rank-score and penalty. + - Placeholders - hookup placeholders to support top=n players. +- DONE: Top-n balance calculations using essentials - 2 mins 31 secs - Budderman18 + - DONE: move to async thread on startup - high priority +- Top-n - phuong Nguyen +- CustomItems drops - harold +- DONE: Sellall - custom blocks/items and items that have been renamed - harold & RomainD +- DONE: sellall - no sell renamed items - RomainD +- DONE: mine bombs - fortune not using the mine bomb's pick with fortune.. always zero - RomainD + - debug is showing fortune 0 +- DONE: CustomItems - not doing drops, even when drops are set - harold +- DONE: CustomItems - Not block counting custom blocks +- DONE: Upgrade bStats to v3.0.0 +- auto features - normal drops may not be happening. May be using auto pickup code. + + + +* DONE: The function isUnbreakable could return a null for the SpigotBlock/PrisonBlock. Change it so the primary check for that function is location, then block is optional. This is failing because the bukkit block cannot be mapped to a XMaterial which should not be a factor. XMaterial will be null for custom blocks. + + +- (done ??) Placeholder bar is reversed. As the player earns more money, it shrinks instead of grows. - harold + - prison_rankup_cost_bar_default + + + +* Mine bombs: + - DONE: prison reload bombs + - DONE: validate mine bombs when initially loading... + - bomb name cannot have spaces or color formatting + - initial validation added + +* DONE: Works for me. HiPriority: Inventory full not producing any messages. alexaille + + +* DONE: HiPriority: NPCs are generating a lot of errors. Real_Ganster + - Citizens running command `mines` as player +` Prison | VaultEconomyWrapper.getBalance(): Error: Cannot get economy for player vote so returning a value of 0. Failed to get an bukkit offline player.` + - https://pastebin.com/JusySWDs + + +* DONE: HiPriority: Add a event priority of BLOCKEVENTS which only does the block events and counts. + +- DONE: **Fixed issues with vault economy and withdrawing from a player's balance.** +It now also reports any errors that may be returned. + + + +- DONE: placeholder for player blocks mined. artic1409 + - maybe use **prison_player_total_blocks__blockname** + +- DONE: update placeholderAPI with prison's updated placeholders + +- DONE: prison support submit are only sending to console, not the user if they are in game + +- DONE: When a mine reset time is disabled... it cancels/stops a /mines reset *all* + + +- DONE: when rank tag = none - was showing "null" for placeholder + +- DONE: work on getting CustomItems working in mines again + +- DONE: remove this warning message: no longer used. + [18:58:51 INFO](info): | Prison | Cannot initialize NMS components - ClassNotFoundException - NMS is not functional - net.minecraft.server.v1_18_R1.EntityPlayer + +- DONE: RankPlayer addBalance cache for default currency +- RankPlayer addBalance cache for custom currency - still needed! + + + - DONE: You cannot afford the rankup is using a NBSP for the thousand separator. Using Prison v3.2.11, Java 16, and spigot 1.16.5. Cannot reproduce. Was a server hosting config issue, but not sure why it only impacted that one message. + + + - DONE: SELLALL has huge performance issues! It takes 2.3 ms to autosell, and full auto features block handling is 4.2 ms!! Serious performance issue with sellall, and autosell is bypassing the command handler too! + - added 'autosellTiming:' stats to auto features autosell to track actual sell time using nano-seconds... initial tests show there maybe significant performance issues. + - autosell in auto features causing lag? Flaco21 + - Issue with autosell causing lag? + - DONE: see RankPlayer addBalance cache - 1250 times improvement! + + +- DONE: admin gui - allows them to bypass No Economy safeguards. + + +* DONE: Add commands to list shop prices in console. Currently sellall is 100% gui so cannot be used offline. + + +- DONE: lapis lazuli is not auto selling + + +- DONE: Upon startup the first time, broadcast to everyone that they should use /ranks autoConfigure. + - Broadcast failed ranks too. + +- DONE: update CMI delayed loading docs... they are "backwards" + + + - DONE: No economy error message not showing + - works on delayed startup + - Fails when not delayed - gui ranks was registering on top of ranks warning + +- DONE: /ranks autoConfigure - review setup and maybe enable skip resets and tweak some notification settings. + + + + +# TODO Items for v3.2.11-alpha.13 + + + +**Tasks needed for the v3.2.11 release:** +* Review some documentation and udpate... especially with the luckperms. +* Finalize the event listeners to use only one event (was three, now two, but reduce down to one). +* Review placeholders +* Try to hook up a top-n command - may be too complex and may need to be pushed over to the next release +* Review Mine Bombs and see if there are some simple updates +* Backpacks - may need to push over to next version +* GUI menus - Add the new GUI Tools to more of the GUI menus to simplify some of the commands? + + + +* test Mine placements and resizing. Something does not look correct with tracer and liners. + + + +* create a command placeholder that will be able to add a delay between submitting commands. Have it based upon ms.. and have it setup to be used when more than one command is combined with others. + + +* Command cooldowns - ranks - use config file to customize on a per command basis. Modify the prison command handler to manage cooldows as a new attribte to the commands. + + +* Mine Bombs: identify bombs... new way. +See SelectionManager... Prison wand uses the whole items stack to identify a wand, instead of just one small part, such as name or lore. Well, actually, its only the display name and material... no lore. + + +* Add Mine Regions - Similar to mines in a way, where they will allow players to have access to the region, have mine effects (outside of a mine)... and mine effects would also be tied to these too. + + +* Placing mines could triggers many resets... also placing mines may not clear all blocks. + + +* DONE: command handler - Ignore commands in certain worlds + + +* DONE: Player Cache - Make sure the cache is loadable otherwise a new instance may be created that could wipe out the existing data. + - All player loads block... they do not submit a task anymore. + - ~block for all loads - currently it may return a null and load via async~ + - (no) Track file last saved date and if they don't match, then create a backup of the file version and don't delete it. + + +* GUI Menu Tools + - Page prior and page next + - Current page + - Go Back button + - Background colored panes when no options + - Current version is not tied to configs... future options... + -- Hook up to more gui menus + + +* DONE: Add a base class for the mine bomb configs... + - DONE: Add a version so as to be able to auto refresh the formats + + +* New documentation - Madog's knowledge + - look for pins + + +* Add mine effects. See conversation with Madog. + - Use PlayerCache and existing utils. + - Simple to implement some features, including flying in a mine. + + +**List for v3.2.11 release:** + + +* DONE: Players need to be restructured. Move rank player object, or at least most of the core, to the core project so as to reduce the number of player types. + +* Cache player + - cache player's balance - Hmm... may need to put it in RankPlayer + - cache player's ranks... only prestiges, default + +* Top-n ranks + - total blocks mined + - total tokens earned (or currently has) + - balance + - highest rank: prestiges, default, balance + - most online time, or most mining time (which will probably be better) + + +* DONE: FIXED: Issue with blocks. Explosions are creating "untouchable" blocks that cannot be included in other explosions. + - My observations were with multiple explosions leaving rings that are within the the radius of an explosion + - I could break the blocks. + - jamo said that the pillars that were created on his server could not be broke + + + +* Review placeholders - add and test placeholders that are tied to playerCache stats + +* Mine Bombs - Finish + - Add sound and particle effects + - Other features? + - Make sure the bomb is set within a mine. Do not allow it to be placed outside of a mine. + - DONE: When exploding large bombs with block decay, there is a chance that you can get the first block in the decay as part of the drops. + - DONE: Check to make sure the block broke is the one in the target block. If not, then ignore. + - make sure the block is not "locked" + + +* Add a top 10 listing commands + - Top player on server (rank / ladder) + - Top player per mine? + - Top Player per Blocks + - Top Player per time + +* Add Block & Time requirements for rankups + - Upon rankup, player will get a new "object" that would track rankup progress + - Would record current blocks and time for that rank, which is needed for when they + prestige. The rankup Progress won't change until they rankup and it will be reset. + It's used to subtract from current stats to get "progress". + +* BackPacks & Vaults & Warehouses - rewrite + - Add PlayerCache support with integrated backpack data object to track details + - Create new gradle module for backpacks and other items. Call it something like Accessories. + - Remove hooks in the spigot module except for the code to read existing old backpacks to migrate contents. + - Backpacks are able to have pickup and sell used against them. + - Vaults are protected from pickup and sell - Have to manually move items in and out to main inventory in order to sell them. Max size limit is a double chest. + - Backpacks can be protected from pickup and sell via command, which can be used to charge players. + - Warehouses are not normal player inventory/chests. They are virtual containers for items and blocks. + - Warehouses have slots, where each slot is one item. A slot can have a dynamic amount of items it can store. The player can buy more slots in their warehouse and increase the capacity of each slot. + - Warehouses - have formula to calculate costs of slots and capacity, where prices increase on both depending upon number of slots, and total capacity size of warehouse. + - Warehouses - Initial capacity of 5 slots, each at 100 to 200 capacity. + - Should vaults be tied to a physical location, such a server-wide "bank"? If so, then players has to physically go there to access their vaults. Same with warehouses. A defined bank or warehouse would be similar to a mine in such it would be 3d and access would work anywhere in there. Or a given mine could be designated as a bank or mine. So like for example, mine c could be the bank so a player would have to rank up to C to access it. Then a vault could be tied to a third tier prestige or something (but those don't have physical locations, but could make it mine a) or create a new mine that is empty, then link that new mine to that prestige rank so players have access to it. + + + + + + +* Mine reset messages: Have setting to control by percent remaining in the mine. + + +* Save files do not include the block type prefix. Such as used with CustomItems. +Not sure if it needs to? Need to test and confirm if working correctly. World coordinates would be wrong if missing. + + + + +- Not sure why the following would be needed: +* Auto Features Settings : Create an API object that has the auto features settings listed. Basically this would serve as a simple cache with a life span of about 10 seconds. So if a player is mining hundreds of blocks within 10 seconds, odds are these settings will not be changing... both server config settings, and the player's permissions. Can provide helper classes that will a simple check of all these details, such as passing tool in hand to check perms for auto pickup settings for the server, the player's perms and lore on the tool. ... as an example. +- Store in the player cache object, but make transient. Refresh every 10 to 15 seconds.. maybe even 30? +- Add to the auto features event so its available there +- Change function parameters to use the event and this new object as parameters... reduces number of parms... + + + + + +* Multi-language - Unable to create a custom language file that is not within the prison jar. It's been reported by Ingrosso that cannot create a new language file that does not match a file within the jar? + + +* BlockEvent processing queue - submit blockEvents to a job queue to run in another async thread... the individual commands would have to run in a sync thread. + - This will release the block break thread faster and won't contribute to lag. + + + + +* DONE: https://github.com/PrisonTeam/Prison/issues/222 + DecimalFormat not being used correctly in saving mine data so if different Locale is used, other than EN US, then parsing the saved file can result in a failure. + - MineBlockEvent is an example of where this was a problem + - The offending sections were corrected and should now work + + +* Add option to /ranks to rename a rank. Tag too? + + + + +# Start on mine bombs + + 1. Select size of bomb. Configuration. + 1a. DONE: Identify items to use as bombs + 1b. DONE: Bomb size + 1c. DONE: Bomb explosion pattern. Currently only sphere, but could include other shapes. + 2. DONE: Select list of blocks that will be effected by bomb explosion + 3. Throw bomb, or place bomb... start processing count down. + 4. Pre-fire effects: sound & particles (low priority) + 5. fire event + 6. Post-fire effects: sound & particles (low priority) + 7. Hook up prison's event handler for prison's explosion event + + + + +* DONE: Modified /ranks list to provide this feature + - Maybe provide a /rankcost command? Show current player rank costs with rank cost multipliers applied + - /rankcost + - Optional ranks can be provided as parameters and it will adjust the calculations. + - Example: /rankcost RoyalBlueRanger A p5 + * will show the rank costs based upon rank A and p5, no matter the players current ranks + - Will allow players to better understand what rankup costs will be if they prestige twice or 10 times. + + + +# **Mine Valuation Score** - **MVS** + - Calculate an estimated value for a mine based upon an inventory full. + - **Total Blocks** = 2,304 = 9 x 4 x 64 + - For each block, it's percent chance will be multiplied by the **Total Blocks** to get the number used in valuation. + - **BVS** = **Block Valuation Score** will be calculated by how many blocks are represented, times the block's value in /SELLALL + - **MVS** = **Rank Cost** divided by sum of all **Block Valuation Scores** + - Use block chances to determine amounts of each block. Ignore total stack sizes. + - Calculate how many inventory fulls it will take to reach the next rankup cost. + - This is a difficult calculation since it is based upon another rank's cost + - This will give a score value on Mine Valuation. + - MVS 1.0 or less indicates seriously easy and unbalanced. + - MVS 20.0 would be normalish range + - MVS 50.0 or higher would be considered extreme + - Prestiges Valuations should be calculated on the highest rank of the default ladder. + -Pickaxe enchantments, such as eff and fortune, will have a huge impact on how fast a player can rankup, but the Mine Valuation cannot take that in to consideration. + + +### others + +* placeholder for total block counts and other playercache stats + +* Include sellall costs in block lists + + + + +# **Possible bugs/issues:** + +* Test BlockEvent perms... they appear like they don't work. + +* If ranks module fails due to no economy, try to make that a little more obvious. + +* If no ranks are defined and the placeholders are attempted to be used, it is causing some errors. No economy plugin so Ranks did not load. {prison_rank_tag} was causing an error with /prison placeholder test. "Server: Invalid json. Unterminated escape sequence..." +The ranks module did not load due to no economy. + +* Sometimes Player Ranks lores placeholders from placeholderAPI aren't working, +it's unknown why it's happening. + +* Auto features - disable lore by default - Maybe provide finer grained control on lore features? + + + +# **Document updates needed:** + +1. Document how to use Ladder Rank Cost Multipliers + +2. Document that to get TE explosions to work, you must also create WG regions in the mine. + - may be able to bypass with creative use of Access by Ranks (have prison directly fire the BlockBreakEvents within TE's functions?) + +3. BlockEvent docs need to be updated to reflect recent changes (select by number). + +4. Review commands listed in TOC. Remove obsolete commands (some ladder commands were removed). + + + +* Top Lists - Command based + - Top ranked players by server + - Top ranked players by mine + - Top ranked players by blocks? + + + +* Add a `*all*` for mine name on remove mines blockEvents. + + +- hybrid placeholder graphs - hybars + - super impose text in the graph and have it still be colored correctly. + - text can be centered, such as the percentage that is feeding the bar + - For wider bars, the title could be left justified, and the percentage right justified + + + +* mine groups + - Have global sharing of BlockEvents + - groups cannot be in more than one world + - all mines must be a part of a group + + +* Eliminate the following message from logging an error, but just keep a note in the code: + - Cannot initialize NMS components - ClassNotFoundException - NMS is not functional - net.minecraft.server.v1_17_R1.EntityPlayer + - This does not appear to have much of an impact at this time. + + + +* add all commands to the server.yml file. spigot 1.17.1 is getting fussy. + + +* Conversion tool to import SuperiorPrison users: + - rank is based upon perms `permission.mine.A` and they keep former rank perms. + - No prestiges + - able to reset ranks so conversion can be ran multiple times. + - Unable to really do this due to offline players not having access to the perms. As such, and also due to the need ceasing to exist, this has been put on the back burner. + + +* extended fortune : Apply fortune to all blocks that bukkit does not apply them to. + - Maybe do this through a list instead of blindly applying fortune to all blocks with a qty of 1? Some fortune calculations will result in a qty of one. + +* hook up alternative processing to have prison force the running of another plugin if a setting is enabled. This way prison can "control" how it processes the "left-overs". + + +* prison command handler: + - Add command cooldowns - time in ticks - And cooldownTypes: server, player + + +* Player Cache: + * DONE: Money earned per minute with placeholders + * Add placeholders for blocks counts + * Add placeholders for time onlines + * DONE: Add time mining: per mine + * Tracking by items such as mines or ranks, where the player's status can be reset, presents some problems. Such as the block counts need to be reset for those items, but yet, we need to store them for historical purposes too. So if someone prestiges 10 times, then there will be 10 different times through mine/rank A. If block counts become a requirement for rankups, which it will, then the block counts for that mine must be reset back to zero. So there must be a "current" and "historical" tracking. + - Online stats: + - track which players are online... may need to get the active player list every minute? freq could be configurable. + - track location of player... if the player has not moved in over x-ticks, then mark them as afk. distance traveled is an important aspect... so afk machines may keep them moving in a 1 block radius. Might be able to see if a player is being pushed by water or pistons? + + + + + +* When adding block stats.... add player online stats. + - add events that run, similar to blockEvents, but maybe call them statsEvents? + - So after so many blocks are mined... or so many minutes a player is online, run a command + + + +* Enable mine sweeper when auto features is disabled. Not sure if this is still needed? + + + + +* Add support for BOSS BAR when holding pick axe. Maybe setup placeholders in the config.yml? +- Example would be showing the bar and percent to next rank. + + +* Add mine notifications by Rank + - I forget what this is.... + + +* Prestiges: Rewrite and enhance so as to make it "automatic" without the need to create ranks +* Externalize the mines module on multi-lang +* Add top-n rankings for mines and maybe other ratings +* Add block break counts to players + + + +* Issue with decay functions or at least it shows the problem exists. Enable a decay such as obby or rainbow, then test to confirm it works. Then enchant a tool (increase it's eff). Then test again and it does not. This was seen happening while OP'd. May not be related to decays, but it appears as if enchanting causes the pick to bypass prison? +- Was able to reproduce this at a later time + + + +* Add optional block counts to level up. So if money and block counts are used, then both have to be satisfied. +If only one, then only one of those would be used. +- DONE: Count only the block mined and not the results of fortune. It will be easier to control how much mining a player does by ruling out the results of fortune... after all, it's "Blocks Broken" and not "Blocks Received". + + +- Virtual Inventory Items from mining... With the player object, not only keep track of blocks mined, but have a virtual inventory to track what they have collected. + - Hooked up to sellall + - Have max limits and commands to increase and decrease the total inventory size... could have both "slots" and max stack size per slots. So that way the players can buy, or rank up those components, just like normal backpacks? + - Will prevent players from trading and cheating... + + + + +* Add support for mineTinker +https://www.spigotmc.org/resources/minetinker-50-modifiers-tools-and-armor.58940/ + + + + + + +* Plugin exception handling has problems + - This is a very rare condition that it happens, but when it does, the global trapping of Prison errors produces a stack trace that is missing details. Off hand it is not known where that code is. Need to look in to it and fix it. + + + + + +* Auto Features + - DONE: Add a reload for them. + - Enable alt fortune calculations as a fall through backup calculation if no fortune is provided for the given block + + +* /ranks autoConfigure: + * Show percent breakdown of blocks + * Option to name all mines: list of mines. Permit non A, B, C naming. + * list world guard commands to protect the world (would then have functional world) + + + + +* Add a message count to the `/prison debug` features where it will only print a specific number of messages before turning off the logging for those targets. + + + +* Support for Personal Mines: + - World support - main mines & Personal mines + + +* World support: Only have prison active in the worlds specified? + - World-main-mines: + - World-personal-mines: + +* Or have mine groups where you can specify one world for a given group. + + +* world specific exclusions: + - Have a world list that will shutdown prison commands when issued in that world: + - command handler should ignore those worlds + - chat handler should ignore those worlds + + + + +* Ranks have been converted to have all messages moved to files: +* UTF-8 support. + - If UTF-8 characters do not work, then they must be converted with a tool similar to this website: + - http://www.pinyin.info/tools/converter/chars2uninumbers.html + + + + +* Fix per rank progress bars. This includes adding a new placeholder series since you will have to include the rank name in the placeholder. Current ladder placeholders are based upon the player's current rank only. + + + +* BlockEvents - Action based upon blocks broken, not a percent chance. + - Based upon total count of blocks broken. Example, after a player breaks 1,000 blocks, then fire a BlockEvent. + + + + +* global virtual mine: To apply mine commands & blockEvents to all other mines. + + + +* possible change to /prison version all to include errors during startup. Errors would need to be captchured. + + + +* To `/ranks autoFeatures` add warnings at the completion identifying that the user must create any needed groups. + - Note that WG global region needs to have the flag `passthrough deny` set. + + + + +Personal mines. Work in conjunction with a plot world? +- sellable and so would be the features with various upgrades +- Create a new module based upon Mines with new features to support player interactions and upgrades. + + + + + +- /prison utils mining + - Add XP direct and ORBs + + + + +Auto features not working outside of the mines. +- Will not support auto features outside of the mines directly.... too many issues. +- Maybe be enabled and working now? +- This caused issues and may have been disabled. + + + +- Add new placeholders: + - Top-n - Blocks mined for mines + - Top-n - Most active mines (based upon blocks mined) + - Update papi's wiki + - Track stats on placeholders? Could be useful in tracking down expensive stats. + + +- Top Listings + - Ranks & Prestiges + - Individual Ranks + - Mine base + - placeholders - dynamic - position in list + - How to dynamically keep this in memory, without lag or delays? + - Timer to track updates to player's balance so it's not always performing updates + - Sort order: + - Ladder, Rank, percent, name + - Penalty for going over 100%? + - Encourage ranking up instead of sitting at one rank to dominate. + - if > 100% - Take excess and get % of rankup cost and divide by 10, then subtract. + - if rankup cost is 1 million and player has 2 M, then they will have a calculated rank score of 90.00. + - if cost is 1 M and they have 3 M then it will score them at 80.00 + + +- Provide a generic placeholder that can have the value supplied through the placeholder. + + + +- DONE: Add blocks mined for players + + + + +- Review the chat hander in the spigot module. It was rewritten a few weeks ago to fix some issues and to optimize how things are handled. The issue is that the new code (way of handling things) needs to be extended to other areas. So review the SpigotPlaceholders class and see how it can be updated. Then end result will be less code and less potential issues. + + + +- Optimize the handling of chat placeholder. They will always be the same for the whole server, so cache the PlaceholderKeys that are used. + - Partially done. The chat handler was updated, but the change could be pushed in to other existing code to improve the flexibility and resolve some of the weaknesses that may exist. + + + + + +Future Block Constraints: + - GradientBottom - The block has a greater chance to spawn near the bottom of the mine. + - GradientTop - The block has a greater chance to spawn near the top of the mine. + + + + +Maybe: Have an alt block list for mines were blocks that are not actually + defined in that mine included there. This is so air and other blocks that don't find hits can be included with the counts. Needed for when blocks are changed so it does not lose change status? + + + + + + +- auto features + - custom list of blocks for fortune + + + +- Issue with /ranks demote and refunding player. + If the current rank has a custom currency and the player is demoted with a refund, + the refund is credited to the wrong currency + - This will be easier to fix once currencies are fixed + + + + +* **Custom block issues** +- If CustomItems is loaded successfully but yet not using new block model, show error message +- Show a message at startup indicating that the new block model is enabled or not enabled + + + +* **Prestige Options** + - Auto Prestige - server setting or player setting? + - prestigemax - keep applying prestiges until run out of funds + - Eliminate prestige ranks - (optional) + * Would need ladder commands + * Need to define an upper limit of how many + * tags may have a placeholder: `&7[&3P&a{p_level}&7]` + * Have a base cost of prestige: example 100,000,000 + * Have a cost multiplier for ranks: example: 10% more expensive each rank with each prestige + * Have a cost multiplier for prestiging: example: 20% more expensive each prestige + * Have a cost multiplier for /sellall: Example: 0.005% (1/2 increase in sale price) or -0.015% (1.5% decrease in sale price to make it even more difficult per prestige) + * Have a list of permissions and permission groups + * The above settings are pretty general and would apply to all generated prestige levels, but to allow for customizations, then ladder ranks, perms and perm groups could be setup to accept a level parameter to be applied at a specific level. Tags set at a given level could also be applied to higher levels until another tag takes it place. + + + +- Prestiges max - if at max show 100% or Max, etc... Maybe set "max" on a placeholder attribute? + + +- Add a prestiges config option to auto add a zero rank entry for prestige ranks. + + + + + +* **Combine a few commands & Other short Notes:** + - DONE: Combine `/mines set rank` and `/mines set norank` + - Combine `/mines set notificationPerm` with `/mines set notification`. Add an option to enable perms. Allow the perm to be changed? Maybe even use as a default the same permission that is used in `/ranks autoConfigure`. + - Combine `/mines set zeroBlockResetDelay` with `/mines set resetThreshold` + + - Store the permission a mine uses so it can reused elsewhere (know what it is so it can be used). + - move `/mines playerinventory` to `/prison player showInventory` + - Add alias `/prison player info` on `/ranks player` + - Add alias `/prison player list` on `/ranks players` + + + + +* **Value estimates for a mine** +We know what blocks are in the mine and the percentages. If people equally mine all blocks (some only go for the more valuable ones if they can) then we can produce a formula that can tell you how many estimated inventory fulls it would take to reach the rankup cost. That could be a really awesome "validation" tool to make sure one or two ranks are not messed up with either being too easy or too difficult. Will need hooks in to auto manager tools to calculate fortune and what results from block breaks. Could be complex. +`/mines value info` show breakdown of a mine's defined ores and what it would take to reach /rankup +`/mines value list` show a listing of all mines with the key details: value per inventory full, how many inventory fulls to rankup. + + + + + + + + +* **Update config.yml when changes are detected** +Preserving the current settings, replace the out of date config.yml file with the latest that is stored within the jar. Updating the settings as it goes. + + + + + + +Enable zero block counts for parent mines. +if 100% block type of IGNORE, then after reset do an full mine air count so zero block reset works. :) + + + + +* **When creating a new mine, register that mine with the placeholders** +Might be easier to just reregister all mines? Not sure if that will work? +Right now, if a mine is added, in order for it to show up in the placeholders, you would have to restart the server so all the placeholders are reregistered. + * * maybe just automatically run reset when vital elements change? * * + + + +* **Redesign the save files to eliminate the magic numbers*** +Most of the save files within prison, for players, ranks, and ladders, are +using magic numbers which is highly prone to errors and is considered +very dangerous. Also prison would benefit from a redesign in file layout +to improve efficiencies in loading and saving, not to mention greatly reduce +the complexities within the actual prison code, which in turn will help +eliminate possible bugs too and give tighter code. + + + +Offers for translation: + Italian : Gabryca + Greek : NerdTastic + German: DeadlyKill ?? Did not ask, but a possibility? + French: LeBonnetRouge + Portuguese: 1Pedro ? + + + +
+ + +# Features recently added for v3.2.11 + + + + + + + + + + +* DONE: New update to combine block processing results in many block.getDrops() being combined. Since they are combined, the extended fortune calculations may not work properly since it does not know how many original blocks were included. +- May need to have an intermediate object to better collect original blocks, drops, and targetBlocks. It can include some of the more basics that are not tracked, such as original block count to better calculate the fortunes. + + + +* DONE: Rewrite the `/prison utils titles` to use XSeries' title commands. XSeries only supports 1.9+ so I still need to support 1.8.8 directly within prison. + + + +* DONE: Common messaging framework so if hundreds of messages are sent, only one is displayed. Eliminate the duplicates. + + + + +* DONE: Revert a mine to a virtual mine. Maybe with the command: `/mines set area *virtual*`. Backup the mine's data file before updating and saving. + + +* DONE: the command /mines reset *all* is not working correctly. Could be an issue with the chaining not submitting the next reset since this is all done through async processes right now. + + +* DONE: Add a few more options to auto features for auto sell, such on full inventory. This was removed recently to stabilize some of the new code. + - Just refined what was already there. + + + + +* DONE: Concurrent modification error on the MineTargetPrisonBlock when resetting the mine. + tech.mcprison.prison.spigot.game.SpigotWorld.setBlocksSynchronously() (146). + Serialize Id the mine resets and provide a locking mechanism that will prevent auto features from being processed when it goes in to a reset mode. Also when in a reset mode, prevent another reset from being submitted so they cannot run concurrently or back to back. Maybe attach a cooldown to the resets too, such as 10 seconds would be long enough to prevent a runaway chained reaction. + - DONE: Create an object such as a MineStateToken that will hold the state of the mine reset (in progress, mineable, stable, usable, locked, etc... not sure proper terminology right now... or how many states), with a serial number that will be incremented on each reset. + - (on hold) Do not perform a clear on the collection of MineTargetPrisonBlocks within the mine. Just replace the collection with a new collection and let the garbage collection handle reclaiming all resources. Carefully review for possible memory leaks. May be a good idea to hold on to that collection and submit a task that runs in about 30 seconds to perform a clear on the collection to release the resources. This may be important since the target blocks contains references to the stats blocks and may not be GC'd automatically. May want to null those refs first too. + MineReset.clearMineTargetPrisonBlocks() (1799) + +* DONE: PlayerCache Time per Mine stats - not recording correctly. + +* DONE: new auto features autosell should place items in inventory that have no sell value. Items that cannot be auto sold. + + + + + +# Features recently added for v3.2.10 + + +# TODOs for v3.2.10 release: + +1. DONE: Final testing of ladder rank multipliers +2. DONE: /ranks ladder moveRank not working +3. DONE: Forced global refresh of rank multipliers when a ladder multiplier is changed. + - Should be simple + - Run as async task + - DONE: Force update when updating a ladder's multiplier - all players + - DONE: Force update when changing ranks - only targeted player +4. DONE: Add ladder base cost multiplier to /ranks autoConfigure. Start with a simple 10%. + - Include message that it's enabled and how to change it or disable it: + - /ranks ladder rankCostMultiplier prestiges 0 +5. Add to /ranks player the detail information on rank cost multipliers +6. DONE: For '/ranks autoConfigure' add an alias to '/prison autoConfigure' + +7. DONE: Change /ranks list so if non-op it does not show all the extra details. A simplified list for plain players. + +8. DONE: Liners: Some are only for later releases and do not work with 1.8.8. So need to setup something to restrict the liners that are not functional for the older releases of spigot. + +9. DONE: Hook up Prison's Explosion event. + + +### Others + +* DONE: Add a rank cost multiplier to ladders. Sum all active ranks a player has to get the total multiplier to use for rank costs. +* DONE: Fix the "next rank" value with PlayerRanks.... needs to recalc with the new rank. +* DONE: When a ladder's rate cost multiplier is changed, need to recalculate all player's multipliers. Setup a task? + + + +* DONE: /ranks ladder moveRank did not work to move from one ladder to another + +* DONE: When adding a new rank or mine, auto reload all placeholders so they pick up the new entry. + + + + + +# Features recently added since v3.2.9 + + + +* DONE: Enable and disable confirmations for prestiges + - DONE: Put in config.yml under the existing: prestiges. settings. + - DONE: Move the GUI confirm to the same group of prestiges. settings. + + + Player Cache possibilities? + * DONE: money earned per mine? + + +* DONE: Make ranks more expensive on each prestige.... + + +* NOT-AN-ISSUE: If automanager is turned off, and /prison reload automanager is ran, it will reload the settings, but the event listeners are only registered upon server startup. So if that condition happens... should display a warning indicating the server must be restarted. +- NOT-AN-ISSUE: Add a warning about event priority changes needing a server restart: +-- NOTE: these are no longer an issue since event listeners are reloaded when the auto features are reloaded. + + + +* DONE **Get new block model working** + * Start to enable and test various functions + * Add in Custom Items Integration + * Code Integration for CI - Key to specific version due to api changes + * Pull in custom blocks from CI API + * Place blocks with CI api + * Not sure how block break would work with CI api? + * Setup sellall to work with CI api + + + +DONE: - Block constraint error when there are no blocks spawned when applying min to add more... + - if rangeHigh and rangeLow are zero, or the same, then need to set the high and low values. + - May need to even set them when there are only a few? + - maybe rangeHigh and rangeLow should be the actual limits, and not the high and low range of where those blocks actually spawned? Right now it's actual spawned blocks, but if either, or both are 5000 blocks from the true limit, then the range of actual adjustments is artificially limited and narrowed. + - Maybe add 2 new fields: rangeHighLimit and rangeLowLimit that is the actual boundaries? These could be used to help normal spawning? + + +* DONE: On prison support submit mines, include /mines info a all? + +* DONE: To all headers that are displayed in prison commands, show the prison's version to the far right. + + +* CANNOT REPRODUCDE: The command /mines delete does not appear to be working - User error? + + +* DONE: Add an *all* for mine names under blockEvent add: + + +* DONE: ladder commands + + + +* DONE: On default ladder, at top rank, if prestige is enabled, then show a message that can be configured. + + +* DONE: Add hunger to auto features calculations + + +* DONE: /prison placeholders list - group by placeholder type. + + +* DONE: Placeholders for items in hand: name, + + +* DONE: try out the new event priority code. if it works, apply it to all classes + + Player Cache possibilities: + * DONE: blocks per mine? + * DONE: time mining per mine? + + +* DONE: Issue with placeholders bars and rankup costs... + + +* DONE: prison should "scan" offline players upon startup and auto add anyone not already hooked up. This will help reduce a lot of questions and make the first experience with prison smoother.... + + +* DONE: Bug: placeholders are not working correctly when player is offline... + - Example with the bar graph placeholders. + + +- blockEvent + - DONE: simplify add - use common defaults - can change features with the other commands + - DONE: Add a target block name + - Not an issue: "Use of placeholders is failing %prison_ is failing on %p" Turned out they were trying to use %player% instead of {player}. + + + + +Completed for v3.2.9: + + +* DONE: BlockEvents - add block filters - tested successfully + +* DONE: decay: Add a util function to respawn the block that was mined... use it with blockEvents. + +* DONE: Ladder commands: + +* DONE: Delete by line number: + + +* **Commands - Enhancement** +DONE: Be able to select rank and mine commands for edit and deletion, or even moving, with line numbers. + + +* **Rank Commands - Edit and delete** +DONE: Add line numbers and enable the ability to edit and delete by line number. + + +* **Ladder commands - global for all ranks in that ladder** +DONE: Add new placeholders for ladder commands to be able to have generic ladder commands that will apply and be ran for all ranks. May be able to eliminate the need for most rank commands. + + + + +**For v3.2.8 Release - - Preparing for Java 16** + + + * DONE: Update Gradle to most recent release + + + * On going: Review other dependencies and update them too, if possible. + + + * DONE: Update development environment, and system to support Java 16 + + + * DONE: Update XSeries to support the new block types. Updated to v8.0.0 and then v8.1.0. + + + * DONE: Enable the new block model - 73.5% are currently using v1.16.x so with the new 1.17 more people will be expecting the new blocks. + + + * DONE: Auto Refresh for language files when version detects new update is available and if auto update is enabled for that language file. + + + * DONE: In /prison version, if auto features are disabled, show NO details. + + + * DONE: Confirm duplicates on BlockBreakEvents makes sense. Fixed the BlockBreakEvents by making sure they all had their own classes so they could be identified as to what they really are. This cleaned up a lot, and also eliminated one set of duplicates too. + + + * Works: This was not an issue. Ranks info raw tag is not showing the editing formats... The rank I saw this on did not have any formatting. + + + * DONE: Fortune on all blocks is not working... + + + * DONE: Hook up java version on /prison version's plugin listings + + + * DONE: Issue with nms with SpigotPlayer... does not work with 1.17. + - Disabled when fails. No longer produces stack traces. + + +**Other additions and changes:** + + +* **Prestige Options** + - DONE: Reset money on prestige - boolean option + - DONE: Prevent reset of default ladder on prestiging. + - DONE: rankmax - keep applying rankups until run out of funds + + +- DONE: Update /prison autofeatures to include new settings. + + +- DONE: Could make /prison autofeatures reload happen. Alias: /prison reload autofeatures + + +- DONE * Mines TP warmup + + + +- DONE: * Issue with removing a BlockEvent by clicking on the remove link. It converts all of the & to the raw code. + - `/mines blockEvent remove` now uses line numbers so this is no longer an issue. + + +- DONE - Used load delays - Rare condition caused by FAWEs where prison loads before CMI even though it all configured to do so otherwise. + - May be able to provide a way to force the ranks module loading so that way it can just "assume" everything is working. + - Force the loading of Ranks module if there is a failure. Found that FAWEs is screwing up the loading sequence of prison when dealing with CMI, and as such, ranks are failing to load since CMI loads after prison. Setting softdepend for all of these do not help. + + +DONE * Add `/prison debug` targets so specific kinds of debug messages can be turned on and off so it does not flood the console with tons of irrelevant messages. + + +DONE * replace ranks with mine related commands with ranks. + - can eliminate permissions on /mtp and mine accessperms. + + +DONE * Add system stats to `/prison version` + + + + +DONE: If starting up prison and there are 0 ranks and 0 mines, then submit a delayed job that will run in 10 seconds to print out a message to console on how to run `/ranks autoConfigure` for quick setup... include link to the online docs. + + +DONE: rank commands - remove by line number + - DONE: Same for mine commands + + + + + +* **Works fine: Bug in /ranks autoConfigure??: Confirmed everything is OK... No bugs** +An admin must have messed up mine A since blocks were gone and other settings were not correct. They could have ran `/ranks autoConfigure force` after creating mine a manually. + + + +* **Rework rank permissions to eliminate need to put perms in rank commands** + - **NOTE: This was a fail!!** + - This did not work because: + 1. You cannot access group perms through bukkit + 2. You cannot create new group perms through vault + 3. It's not possible to easily check perms through vault + - This has been made obsolete with the use of Access by Rank !! +- Enhance the PermissionIntegration abstract class to also work with group perms. +- Add to ranks two new fields: permissions and permissionGroups. Save and load. +- Add a new boolean field to ranks: usePermissions. Save and load. +- Add support for these perms within rank commands +- Rewrite rankups to use these perms when ranking up, promote, demote, and also for prestiges + + + + + +
+ + + +* **NOTICE - About Prison, Java 16, and Minecraft 1.17** + +Prison is all about providing the best experience for your server environment.In order to look toward the future, so we can continue to provide the best possible experience, we have to set limits on what we can actually provide support on. We are currently entering a challenging period of time where we will have to make some difficult decisions to help ensure the best possible future for Prison. + +Minecraft 1.17 is scheduled to be released on June 8th, 2021. The release of 1.17 brings with it some major changes that will have significant ripples throughout the minecraft server community, mostly due to the heavy dependency upon Java 1.8 for many years. This ultimately means there are a lot of unknowns that we will have to work through and there will be situations that were unexpected. + +One major change in our support statement is that Prison, as of right now, will only *officially* support Spigot v1.8.8 (10.9% usage), v1.12 (10.9% usage), and v1.16.5 (73.5% usage). These three versions of Spigot represents 95.3% of all servers using the Prison plugin. This does not include any server that has disabled the bstats, which is one reason why you should keep that enabled so you can be represented in our stats and our plans for the future. + +Note: The follow up versions in descending order of usage are: v1.14.4 (1.6% usage), v1.13.2 (1.2% usage), v1.15.2 (1.2% usage), and v1.11.2 (0.9% usage). No other versions are recorded by bStats. + +But please keep in mind, as with our official stance of only supporting Spigot, we will also *provide* as-needed support for Paper and other Spigot compatible platforms. We want you to have the flexibility to use the platform that best suites your needs. We just will not pre-test on those platforms, but we will try to address any issues that are brought to our attention. The non-supported versions of Spigot falls under this same limitation of support: we will not pre-test for the non-supported versions, but if you are using them and find issues, we will work with you to resolve them. The actual impact of dropping support for 1.9, 1.10, 1.11, 1.13, 1.14, and 1.15 should have no impact on quality for those releases of Spigot, but it will free up a lot of time spent on testing. + + +Some initial testing with running a prison server using Java 16: +* Spigot v1.8.8 will startup and run. But there are major failures with missing classes that are critical for the core bukkit and Java components to work properly. It is doubtful a fix will ever be provided. +* It has been noted that bukkit/spigot 1.8 through 1.11 will not work with Java 11 and later. +* Spigot v1.12.2 compiled with Java 1.8 appears to work perfectly well with Java 16 running on the server. +* Spigot v1.16.5 compiled with Java 1.8 appears to work perfectly well with Java 16 running on the server. + + +I have not tried to compile anything with Java 16 since I need to first update the Prison build environment to support it. But these are tests that will be explored in the very near future so as to get a better understanding on what we can expect from the build process. + + +In the last few days, I've updated gradle to the latest release so it will support Java 16. Other resources have been updated too. More work will be done over the next week or two to prepare for MC 1.17 and Java 16. + + +NOTE: At this time, I think there will have to be two builds. One with Java 1.8 for Spigot versions 1.8 through 1.16.5. Then another build with Java 16 that will support Spigot 1.12 through 17. This will give admins the flexibility to choose the version of Java to run on their servers that they are most comfortable with. Initially, these builds will be automated, but initially they may be a manual process. + + + +**Prison v3.2.8 will be targeted to support Java 16, and hopefully, Minecraft v1.17 too.** + + + +Java 1.8 and Java 11 have a built-in javascript engine. Java 16 does not. +This plugin provides support, and compatibility, with javascript processing. +Other plugins that use javascript, such as papi, would have to be compiled +to work with this plugin. +https://polymart.org/resource/jsengine.1095 + + + + + + +
+ + + From be0c0879788e14d0d0a7ebb70b7236d4e93f988f Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 8 Jul 2023 16:34:22 -0400 Subject: [PATCH 74/75] There was a markdown conversion issue with how the time code was setup since it was trying to treat it as a footnote, which caused issues. --- docs/knownissues_v3.3.x_resolved.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/knownissues_v3.3.x_resolved.md b/docs/knownissues_v3.3.x_resolved.md index 445498899..265be5843 100644 --- a/docs/knownissues_v3.3.x_resolved.md +++ b/docs/knownissues_v3.3.x_resolved.md @@ -295,7 +295,7 @@ It now also reports any errors that may be returned. - DONE: work on getting CustomItems working in mines again - DONE: remove this warning message: no longer used. - [18:58:51 INFO](info): | Prison | Cannot initialize NMS components - ClassNotFoundException - NMS is not functional - net.minecraft.server.v1_18_R1.EntityPlayer + 18:58:51 INFO: | Prison | Cannot initialize NMS components - ClassNotFoundException - NMS is not functional - net.minecraft.server.v1_18_R1.EntityPlayer - DONE: RankPlayer addBalance cache for default currency - RankPlayer addBalance cache for custom currency - still needed! From ffdf60225d19b6c53e29038eac2b5a493c65a06f Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 8 Jul 2023 16:46:49 -0400 Subject: [PATCH 75/75] This doc was failing to generate github docs due to issues with non utf-8 characters. Changed them to dashes. Not sure what caused these characters to become non-compliant. --- docs/changelog_v3.3.x.md | 4 ++++ docs/knownissues_v3.3.x_resolved.md | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index dd6c7d63b..837761593 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -21,6 +21,10 @@ These change logs represent the work that has been going on within prison. * **2023-07-07 v3.3.0-alpha.15 Released** +* **This doc was failing to generate github docs due to issues with non utf-8 characters.** +Changed them to dashes. Not sure what caused these characters to become non-compliant. + + * **Update the known issues doc...** diff --git a/docs/knownissues_v3.3.x_resolved.md b/docs/knownissues_v3.3.x_resolved.md index 265be5843..4cd3b9557 100644 --- a/docs/knownissues_v3.3.x_resolved.md +++ b/docs/knownissues_v3.3.x_resolved.md @@ -18,16 +18,16 @@ These are notes for personal references. These are not intended to explain anyt DONE - permission for prestiges not working correctly -Rayne — Today at 9:52 AM +Rayne - Today at 9:52 AM hey @RoyalBlueRanger, so someone is trying to prestige and they can't? there's no errors or anything and they don't get a message it worked for me when i was op -Rayne — Today at 10:52 AM +Rayne - Today at 10:52 AM So it turns out that the ranks.rankup.prestige permission works but not the ranks.user - NOTE: Fixed some issues with prestiges and perms. But mostly was an issue with the help not properly explaining how important the perms are. Also added a new feature to turn off the need for the presetige perms so all players can use it without the perms; they may still need to have ranks.user enabled. DONE - budderman18 reports: -Budderman18 — 06/21/2023 11:56 AM +Budderman18 - 06/21/2023 11:56 AM If your server runs any plugin using java 19 or higher (java 18 might be the case as well), prison won't be able to startup - NOTE: Updated NBT-api for v1.20.1. Found out Prison's use of NBT-api was setup wrong which caused conflicts. Now working the way it should. @@ -46,8 +46,8 @@ If your server runs any plugin using java 19 or higher (java 18 might be the cas -DONE: > noza3 — 2023-06-29 at 1:09 PM -> Thanks royal blue but i’ve already fixed it. Only problem I was facing was using /mtp {minename} after creating the mines, which would say this is a virtual mine blah blah, but madog told me to do a restart which fixed the issue, so I created all of my mines, set them up properly, then restarted the server and all of the /mtp {minename} works now. Also the portal at my spawn that allows people to jump into and go to their mine works, now that I use the player command /mtp with the portal. Thanks for the help +DONE: > noza3 - 2023-06-29 at 1:09 PM +> Thanks royal blue but i've already fixed it. Only problem I was facing was using /mtp {minename} after creating the mines, which would say this is a virtual mine blah blah, but madog told me to do a restart which fixed the issue, so I created all of my mines, set them up properly, then restarted the server and all of the /mtp {minename} works now. Also the portal at my spawn that allows people to jump into and go to their mine works, now that I use the player command /mtp with the portal. Thanks for the help - NOTE: could not reproduce this issue.