diff --git a/changelog_v3.2.x.md b/changelog_v3.2.x.md index ec3982327..b72a3c3e1 100644 --- a/changelog_v3.2.x.md +++ b/changelog_v3.2.x.md @@ -8,6 +8,717 @@ is going on in each build so you have a better idea if it may be something that you need. +## tag v3.2.2-alpha.14 - 2020-11-21 + + +* **v3.2.2-alpha.14 - 2020-11-21** +Bump version... preparing for v3.2.2 bug fix. + + +* **Refactored where the commands that are outside of the modules are registered.** +They are now registered within the function where the modules are registered to allow the related commands to either be registered or not, based upon the modules. +Refactored how some of the commands/configs are setup to be more flexible, or to better follow the standards of how prison has been instantiating them (ListenersPrisonManager). + + +* **Split out the gui ranks and gui mines commands** from the main spigot gui commands. This allows them to be enabled on their own, or more importantly, prevent them from being registered if the modules are not loaded. + + + +* **Changes to the gui commands to prevent console from running a few gui commands.** +Also remove the alias of "prisonmanager" for "gui". +It was reported that when a non-admin tried to use /mines that it was giving the error message associated with /gui. Cannot see a direct relationship there, but hard linked /mines to /gui mines by calling the function directly instead of resubmitting the command. Not sure if this fixes the issue, but I was unable to reproduce it. + + +* **Minor changes** +Add more to the BaseCommands and start to hook them up. Fix usage of getting the current economy. + + +* **To prevent prestige related commands from being registered with bukkit**, +pulled prestige related commands in to their own command class and then conditionally register them if prestiges are enabled. Cleaned up a few other things such as remove use of deprecated functions and +moving the implementation of isPrisonConfig to SpigotPrison to simplify a few things and eliminate duplication. + + +* **Fixed a problem with bukkit on a paper v1.16.4 server where the Bukkit.getOfflinePlayers() was returning either a null player, or a player had a name that was null.** + + +* **v3.2.2-alpha.13 - 2020-11-15** + + +* **Updates to the GUI: many.** +Moving configs to a common package to better manage them, or to prepare to merge them in the future. Many other fixes and enhancements. + + +* **Updated the SpigotMineBlockPercentageGUI to include a Close button and to show the selected block top and center.** +Also provided links back to the block list gui. Setup the parameters to return back by setting the font color to black so it is visible that they exist as the players hover. + + +* **Fixed issue with GUI block list.** +Using a combination of XMaterial and ItemStacks, its able to display the viewable blocks. Added Prior button to go back to prior page. Got the Next page button working (it was incorrectly just blindly deleting the first two characters of the button name; changed it to strip color so it is not destructive. Setup this page to be able to return to it from other pages. Confirmed that this works with spigot v1.8.8 and spigot v1.16.3. + + +* **Fix issue with GUI not being able to display red or lime stained glass panes** +due to use of material instead of ItemStacks. This applies to mc v1.8 through mc v1.12 and they display as plain glass panes (no colors). + + +* **Added a SpigotPrison function to strip all colors from text.** +Needed in the GUI to hide extra parameters. + + +* **GUI direct support for ItemStacks when creating buttons for mc v1.8 through mc v1.12. ** +With the use of magic numbers with Minecraft versions less than 1.13 the use of Materail to create ItemStacks fails to get the correct type if magic numbers are involved. Created a new createButton function to work directly with item stacks so the proper blocks can be used with mc v1.8 through v1.12. + + +* **Additions to PrisonBlock handlers to provide more utility functions** +and to solve a few complex challenges. Removed NULL_BLOCK from the valid block lists. + + +* **Found function names that started with capital letters and changed them to lower case.** +Function names should never be capitalized since that would imply they are classes, or similar objects, and not functions. + + +* **Compile error with the removal of the prison core gui...** +Removal of this code was forgotten when removing the prison core gui code. Not sure how that passed the compiler before committing to git? + + +* **cleaned up unused imports in the gui code; were causing compile warnings.** + + +* **New feature! Hooked the prison GUI up to the new prison command manager.** +Assigned aliases so as to preserve backwards compatibility with admins who are used to the prisonmanager command. +The /prisonmanager command has been replaced with just /gui. Tested and appears to be working well. Can do /gui mines, /gui ranks, /gui prestige, /gui prestiges. + + +* **Added /mtp as an alias to /mines tp.** + + +* **New GUI config system** +- It's an improvement. Has many code changes +- Deleted the GuiListener.java class, only SpigotPlatform was using it so nothing should break. + + +* **New Feature! Tab complete is now functional with prison's command handler.** +When typing in prison related commands, you can now press tab to complete the typing for you if there was only one option available, or it will fill in common letters until you need to make a choice. Also typing in a command pressing space then tab shows all available options. In game is slightly different that in console, where in game show a ghosting of the command where you are typing so tabbing will select that option. +Works on spigot 1.8 through 1.16.x. Also works in console. Functional with aliases too. + + +* **New Feature! Command Aliases!** +Add the complexities of supporting aliases in the prison command handler. Each command can have one or more aliases mapped to almost any level of paths. +This also includes a rich support of the sub-command and help listings to better identify which commands are aliases and also what aliases are available. There is room for enhancements that will be added soon. + + +* **v3.2.2-alpha.12 - 2020-11-10** + + +* **removed the trailing &f from the rank tag** +This was within the new feature /ranks autoConfigure. It was reported that there were issues within the plugin Scoreboard-r by RienBijl that data was being truncated and lost. Looking in to the issue it was found that there was a stray &f at the end of a tag. It had no impact, but it was removed anyway since it does nothing. It was determined that the scoreboard-r plugin is buggy and was causing errors. + + +* **New Feature: Now provides the capture of the actual label that a command is registered with Bukkit when there is a conflict.** The prison Command Handler now uses the registered label when displaying any of the sub commands or list of all registered root commands. This will allow the users to know what commands they actually have to enter to get them to work, instead of guessing when there is a conflict. + + +* **Improve block matching for pre mc v1.13.0** +For the 1.8.x material types in prison, there exists different states with the data value that could result in block types that are unknown. Some of it may be orientation or degree of flowing water, or even wetness of soil. I've seen it with leaves of different shades, or even with logs. +The idea here to fix this issue is not so much that we don't know the block type as much as it shouldn't matter the slight variations in the data field. Therefore if we fail to match on the id and data, then go off of the material name. That's a good fallback. + + +* **Bug fix: Fix incorrect display of no other mines near for /mines whereami** +If the player was standing in a mine and there are no other mines around, it used to show the mine they are in, plus say there are no other mines within 150 blocks. +Now it will not show the "no other mines in 150 blocks" message. + + +* **Mines Blocks GUI Fix** + + +* **Bug Fix: Found a bug in the command registration code** that could result in failing to properly register commands. This would have been an issue if there were upper case letters in a command, since all commands are converted to lowercase when added, but when checking to see if a subcommand was already processed (ie... the "set" in the following two commands: /mines set tag, /mines set resetTime). The symptoms would be missing commands at runtime. I actually have seen this failure in the past, and realized that all commands should be entered as lowercase due to this error. Now it should work correctly. + + +* **Clarify the role of a CommandHandler field that is used in a situation of when there is a command collision.** + + +* **Fix typo: In the /mines command add function, a & was placed one character to the right of where it should have been.** + + +* **Added an unregister all for the commands and hooked it up on the plugin's onDisable.** + + +* **Fixed issue with dropping of inventory.** +Had a ! where it shouldn't have been and forgot to hook up the new messageId variable so the warning can change. +I'm not so sure about messaging this way, using the action bar, but don't want to flood chat with a ton of messages either. Would have to put a limiter on the chat messages? + + +* **Fixed an index out of range issue in the gui.** +Was 45 when should have been 44. + + +* **New Feature: Added XP calculations to the block break (auto pickup) function** +which can be disabled. Give the option to drop the xp as orbs (default) or give it directly to the player with no orbs. + + +* **It was realized that dropItemsIfInventoryIsFull was not hooked up.** +Hooked it up. + + +* **Update some docs and added a few screen prints.** +Updates to a few documents to reflect some of the more recent updates to prison. + + +* **Updates to the IntegrationManager** so the variable is more consistent and especially the message for WorldGuard integration is clear that it is not an error that it is not yet active. + + +* **Change the command /prison alerts so they can be ran from the console** since it made no sense why the console was locked out from using them. +Slight changed the information for /prison gui that shows that it could be preferred to configure the autofeatures. + + +* **Changed the perms to lower case, specifically the mine/rank name. Should have been lower case.** + + +* **Had the wrong block name for dark_oak_planks (thought I fixed that already).** + + +* **v3.2.2-alpha.11 - 2020-10-29** + + +* **For /ranks autoConfigure: Almost forgot to add the removal of the mines.tp. when demoting a player.** + + +* **Added a new feature: can now set the area of a mine based upon location of your feet.** +This allows you to create a virtual mine, then set its location where you're standing or flying, then you can resize it. This bypasses the need of having to use a wand to create a mine or define it's size and location and allows it to be defined in mid air or in a void world where you cannot click on any blocks. + + +* **Fix the report on how many blocks are in a new mine.** It was reporting on surface area and not block count. +Fixed an issue with world being saved correctly. When a virtual mine was converted to a real mine, the world and world name were not always being updated. Fixed it by not only being more aggressive when setting the Bounds, but also when saving the mine. + + +* **Reenable the compatibility cache on block mapping.** +This eliminates related failures to map blocks, which will prevent wasted time continuously looking them up. + + +* **A few more tweaks to the block types to fix missing block from a pattern.** + + +* **Added the ability to add the "force" option to the /mines set liner command.** +Normally the command only adds the liner if there is not air so that the mine's liner does not extend above the ground level, and it ends at ground level. +Force is intended to cause the liner to work in a void area where all there is only air. Otherwise you would have to place blocks on the outside to "trick" the liner to work. + + +* **Fixed the block names for the new liner patterns.** +I accidentally added them based upon actual block names and not what is mapped to the prison block names or the new block types which are keyed to XMaterials. This fixed them. + + +* **Added a compatibility reference to help map it to XMaterials.** +Jungle_planks + + +* **Enhance the ranks auto configure by adding support for GroupManager permission plugin.** +Also added the remove permission of the next higher rank so as to support demotions. + + +* **Added three new patterns to the MineLinerBuilder.** + + +* **Minor code improvements for the player GUI and this should also fix the null value.** + + +* **The gui was trying to pass null strings to this format function.** +If the parameter value is null, then just return an empty String, otherwise try to format it. + + +* **Simplify the error message if a player does not have access to tp to a mine** +they should not be seeing anything pertaining to perms. + + +* **Hooking up more of the prison's mines commands to properly, and fully, use the new prison block model.** +The new PrisonBlocks are now being validated against the dynamic list of valid blocks that are available on the server that is running prison. So within the block search, as one example, it will only show valid blocks that can be used; the old block model would show all possible blocks within prison, some of which may not have been blocks. + + +* **Enhancements for Prison's new block model** +Enhance the PrisonBlock to use block instead of mineable for better consistency with bukkit and spigot use of blocks. Also set block name to be always lower case for easier searches. +PrisonBlockTypes has been enhanced to be able to search for blocks by name. This is using a b-tree for quicker retrieval instead of loop though all available blocks. +When valid blocks are added to PrisonBlockTypes (the valid blocks that exist on that server) they are have their isValid and isBlock values set to true. Also now using XMaterial names for better long term consistency that will not change if the admins upgrade or down grade their servers. + + +* **Hook PrisonBlockTypes up to the Prison object.** +This will load a list of new block types at server startup that have been validated against the version of minecraft that is running. This will ensure that the only blocks that the player will see listed in block searches, as one example, will be blocks they can actually use. This is highly dynamic based upon the server and not the complier. +This is preparing for the use of the new block model by giving access to valid blocks within many of the /mine related commands. + + +* **Remove more of the Items related code** which has not been used for awhile. ItemManager and troubleshooters related to that. + + +* **Reenabled the caching of null values when translating from one material type to another.** +This prevents looking up a failed code many times and only allows one error message to be logged to the console. + + +* **v3.2.2-alpha.10 - 2020-10-26** +Version bump due to the significance of the last bug fix. + + +* **Major bug fix: Eliminated the in prison caching of players.** +This collection was not able to deal with players reconnecting to the server, which would give them new player objects. The issue was that prison would have an obsolete (zombie) copy of the player and their inventory. So if any operations would be performed on the inventory, such as giving a selection wand, it would be placed in the orphaned object and the player would never get it. The only way to "fix" this issue would be to restart the server and then it would fail once they would log out and reconnect. +This was confirmed a problem with 1.9.2, 1.13.4, 1.15.2, and 1.16.3. It was not an issue with spigot v1.8.8. This did not impact players retrieved from events. +This fixes the issue by removing prison caching of the players. Now all instances of the players being used within prison are now live bukkit objects. +I suspect this issue has been within prison for a long time. Not sure why no one reported it before, or if they did, it was not clear how to reproduce this issue and the ones reporting it may not have been able to provide enough information to reproduce it. The way it is reproducable is to login, get a /mines wand or have prison interact with the player's inventory, then log out and then back in. Then /mines wand will fail to place it in the real player's inventory. It will only go in to the prison cache. + + +* **v3.2.2-alpha.9e - 2020-10-26** + +* **Bug fix: When a world is not available upon startup** it will try to set the boundaries for the mine. In doing so, it will try to extract the correct world to enable it and to remove the virtual status if it was set. If the world has not yet been loaded (ie... if you're using multiverse) then this was causing an error for that mine. This now will only mark the mine as disabled and allow the multiverse plugin to trigger the completion of the mine loading event for that mine (as it has been doing before virtual mines were added). +If a mine has the boundaries set and if it was disabled or virtual, then make it a real mine. Have checks to ensure the world is available, if not, then disable the mine. + + +* **v3.2.2-alpha.9d - 2020-10-26** + +* **New feature: Dump player's inventory to console** +This is useful to check status of various prison related functions. +One area that this maybe useful with some players reporting that they are getting a Prison Selection Wand, but it's not showing up in their inventory, although inspection of their inventory is showing they are getting it. + + +* **v3.2.2-alpha.9c - 2020-10-26** + + +* **Fix to GUIs and Close button conflict** +Fix to Mines GUI lore issues for Virtual Mines + + +* **v3.2.2-alpha.9b - 2020-10-26** + + +* **Fixes issue with not enabling a virtual mines** +when the area is set with the command: /mines set area help + + +* **Fixes to some blocks and use of XMaterial for STAINED_GLASS** +This allows for multi-version support since material names have changed at 1.13. This supports 1.8 through 1.16 now. This fixes an exception for versions less than 1.13. + + +* **Fixes to config, now you'll not see any "§" but only "&"** +There might be some strings that won't translate that, If you spot them (like lores with an & instead of color), please report it. This fixes an issue for some user's environment not being able to properly translate the `§` when generating the GUI config files and language files. Basically the file's UTF-8 encoding was being treated as ASCII and that character was being converted to a hex value that could not be translated back to something usable. + + +* **v3.2.2-alpha.9a - 2020-10-26** + + +* **Enable OPs to tp players even from console.** +Also if the player who is running the command is the same as the name being passed as a parameter, then allow it. + + +* **v3.2.2-alpha.9 - 2020-10-26** + + +* **Added the ability to move a mine but am not enabling it.** +It is not behaving as well as it should. The tracer is being left behind when it shouldn't. +Other adjustments to the sizing and liner functions have been made too. + + +* **Adjustments to getting the MineLinerBuilder working.** +These here are minor changes that makes a few aspects work slightly better. + + +* **Change the way the caching is working on block mappings.** +Removed the caching of no-hits on block conversions. Normally recording the no-hit conditions will result in significant performance improvements, but removed them for now to make sure they are not causing issues. Will have to reenable them (rewrite the code) in the future. + + +* **Provided more detailed reports on missing block types** +from spigot mapping to prison's old block types. Some of these will be needed until we can get the new block model fully functional. + + +* **Added a few new block types for v1.13.** +The major one that fixed some significant issues was GRASS_BLOCK since it used to be named GRASS in older versions of minecraft, but now GRASS is just the plant. +Also added 18 new log types for v1.13 and newer. + +* **Removed traces of the enableMineTracer within the Platform object.** + + +* **More improvements to the /mines set size and the /mines set liner commands.** +Added ladders to the liner, and also added repair to undo the liner based upon the surrounding blocks. Appears to be working well for spigot 1.8.8. + + +* **Rank Tags modified to accept spaces** +To match the capabilities of the Mine Tag, the rank tag was adjusted to allow spaces. The command /ranks set tag was also changed to remove the tag if desired. Also changed the /ranks create command to accept spaces in the tag name too. + + +* **v3.2.2-alpha.8 - 2020-10-22** + + +* **New Feature: Now able to line a mine based upon the selection of edges and patterns.** +This feature helps players to get up and running their prison a lot faster. +Many additional patterns can be added in the future. Supports 2d patterns that are from 1x1 to any larger size. + + +* **Bug fix? Needed to add TokenEnchant to the softdepend** +to prevent a java.lang.NoClassDefFoundError with the class com/vk2gpz/vklib/logging/ColorConsoleLogger. +Not really sure if I can call this a Prison bug since it appears to originate from within the TE API code base. But this works around their potential short comings. + + +* **Bug fix! Trying to format an already formatted item... oof!!** +This had everything to do with formatted currency amounts in placeholders. + + +* **Disabled the loading of the /items.csv file** +since that is obsolete and not working anymore. The items.csv file has been removed from the project since people were thinking they can just modify that file to add custom blocks. Nope... + + +* **Add logging to count how many blaze rods the player has before and after issuing the /mines wand command.** +there have been a few reports that it does not work, but I cannot reproduce the error. So this is step one in confirming if they actually get the blaze rod or not. +One possibility could be that another plugin is canceling the event so the player never gets the blaze rod. + + +* **v3.2.2-alpha.7b - 2020-10-21** + + +* **Temp pulled alpha.7** Someone said the were getting a lot of errors with this release. Hence the past two fixes. + + +* **Fix potential issue where the user tries to use a % % as escape characters when they should be using { } instead.** +It was causing a failure when trying to redisplay the text as for the % was trying to be used as a placeholder when fed through the String.format command. + + +* **New feature: /mines set size** +Can now adjust the mine size by specifying the edge and adjustment amount. Edges are top, bottom, north, south, east, west, and walls. +When adjusting the size, it automatically goes in to tracer mode so the mine's dimensions are easily seen. + + +* **v3.2.2-alpha.7 - 2020-10-21** + + +* **Created the code to add blocks to virtual mines when they are being generated with the /ranks autoConfigure command.** +Blocks are setup in a List with the least valuable to the most valuable. Then it's a sliding window of selecting blocks from the lowest mine to the highest ranked mine. The percentage per blocks are 5, 10, 20, 20, 20, 25 where the most valuable are least represented. + + +* **Added a few new blocks to prison's old block model.** +These are actually duplicates of what already exists, but these are instead named to mirror XMaterial names. The reason for this is to ensure consistency between the two block models used for testing. +Removed the items.csv document since it is not being used anymore and will only cause confusion if admins think they can add new blocks through that file. + + + +* **Added some internal reporting of the data contents.** +Most of this will be used with logging in the /ranks autoConfigure and also jUnit testing. + + +* **Error logging needs to throw these stack traces** since thats really the only way to get the details we need to fix the problem. +A throw was eliminated, but needs to be added back. + + +* **New Feature: Added 12 new placeholders including aliases.** +Added formatted placeholders for player's costs. Added a new placeholder for player balance. +Created a PlaceholdersUtil class to perform some common functions, such as formatting an amount to include a metric prefix. + + +* **tag v3.2.2-alpha.6a - 2020-10-19** + +* **Fix issue with mine name** +that is related to virtual mines if not creating a virtual mine. An extra space was added to the end of the mine name which was triggering an error message about spaces in mine names. + + +* **Add a second perm to allow mines.tp.** +to be added to each rank that is auto generated. +will provide support soon for EssentialsX warp... + + +* **New Feature: Allow the user to specify the material name in the GUI config files to use for a mine's block type.** +The material names are based upon XMaterial for consistancy throughout all versions of spigot/minecraft. +The format is: Options.Mines.MaterialType. + + + +* **New feature: produce a warning when the first parameter of any prison command is not a CommandSender.** +Parameters using Player has been causing stack traces under different circumstances because the prison command handler ALWAYS passes a CommandSender object as the first parameter, therefore that is the type it needs to be to prevent a method type mismatch exception. The new changes will provide a warning when starting prison; it should ideally be caught at compile time but it can't. + + + +* **tag v3.2.2-alpha.6 - 2020-10-19** Bump the version due to significant changes. +It needs more testing prior to being released to the alpha channel. + + +* **Bug fix: prevent the config files for gui and it's messages from loading from the file every single time it is accessed.** +And they were accessed everywhere, and for one message, even three to four times just to generate one message. +This should improve performance significantly for the gui overall. + + +* **Provide a way to get the counts of a given ModuleElementType.** +Allows for access in modules that don't have direct access to other modules. + + +* **Wrapping up changes on virtual mines** +Fixes issues with virtual mines. Allows full configurations of virtual mines except for setting the area and spawn point. + + +* **Bug Fix: Found the wrong parameter was being used on a few commands** +Fixes some hard to find problems where the wrong parameter was being supplied to the commands. It would work most of the time, but under some conditions it would fail. Was using a parameter of Player instead of CommandSender. + + +* **Added a logCore feature that does not try to translate colors...** +this helps to bypass exceptions if an exception is trapped. +Added a dump when parameters on messages are not properly paired. This will be critical when all messages will be externalized and subject to users messing up the formatting placeholders. + + +* **New feature! Auto generate Ranks and Mines!!** +This is based upon the work of Gabryaca, but I reproduced it to be a part of the RanksCommand and gave it the capability of generating virtual mines too! +This is actually a starting point of what it can become. I not only added the creation of mines, but I also hooked it up to link the mines and ranks together as it generates them. + + +* **Added a new command to the Platform... This allows the creation of a Rank or Mine based upon a ModuleElement.** +That has major impact on added flexibility, and could lead to an automation of generating mines and ranks. + + +* **Storing the rank commands within the PrisonRanks class.** +The allows internal access to the commands so they can be used internally too. Will be used for automation purposes. + + +* **Linked the various mine and rank commands to their respective managers** +so they can be easily accessed programmatically now. + + + +* **New Feature! Virtual Mines!** +Now able to create virtual mines. A virtual mine does not exist yet since it has no location, but you can configure all of the options first before setting the area with /prison set area. +This is phase 1 of this new feature. Not fully tested yet. +The intention is that when you auto configure all your ranks, it will also auto configure all your mines to go with those ranks. Then you can go back and set the mine's area as you build them. + + +* **Links the rank command commands to the rank commands so they can be used together.** +Setup createRank to return a boolean to indicate if the rank was successfully created. This will allow programmatic internal use of createRank to automate more features such as rank configurations. + + +* **Add mine commands to add ranks to mines, and to remove ranks from mines.** + + + +* **Added mines and ranks to the /mines info and /ranks info commands.** + + + +* **Added to the platform the ability to link mines with ranks.** +Individual ranks or mines cannot perform this action, but going through the platform can. + + + +* **New Feature! Added _/ranks setup_ and _/prisonmanager setup ranks_ commands.** +Now you can setup your default ranks in the default ladder with a command without +adding them manually for the first time, this command will add all Ranks from A to Z +and their rankupCommands executing the command that your permissions manager uses to add +a permission to the player to access to the `/mines tp ` command, the mineName +given by the permission have this format `mines.tp.` so you should make your Mines +with the same name of the rank, you can edit the `mines.tp.` for to another you want, like +`essentials.warps.` in the _guiconfig.yml_. +The supported permissions managers for now are: +- Ultra Permissions +- LuckPerms +- PermissionsEX +- zPermissions +- PowerfulPerms + + +## tag v3.2.2-alpha.5 - 2020-10-13 + + +* **New Feature!! Added new 20 new blocks to the old block model.** + v1.10.x: structure_block, magma_block, bone_block + v1.11.x: shulker_box - plus the 16 other colors that are available. + + +* **Bug fix: Prevent a NPE when no rank is assigned to the mine.** + + +* **v3.2.2-alpha.5c - 2020-10-13** Important bug fix. Need to bump alpha version soon. + + +* **New Features! Added 48 v1.12 blocks and 44 v1.13 blocks!** +V1.12 blocks: 16 colored glazed terracotta, 16 colored concrete, 16 colored concrete powder. +v1.13 blocks: 10 coral types, 10 coral block types, 10 coral fan types, and 10 coral wall fan types, cave_air, void_air, blue_ice, and bubble_column. + + + +* **Upgrade XSeries from v7.2.1 to v7.5.4** + + +* **New Feature!! Added the first Prison API components** +Started to add some api end points to make it easier to access some basic internals +without having to figure out how to conform to prison's restrictions. + + +* **Continuing work on linking mines and ranks...** +Mines and ranks are now being linked together upon server startup. +Not finished. There are still items to be added, like the mine and rank commands to work with adding and removing ranks and mines. + + + +* **v3.2.2-alpha.5 - 2020-10-11** + + +* **Cleaned up and standardized log levels.** +Added PLAIN for use with mine resets, and DEBUG too. Eliminated redundancies. + + +* **tag v3.2.2-alpha.4 - 2020-10-08** +Had to bump this to alpha.4 due to the new mine sortOrder being set to -1 if +the value is not found in the save files! This may cause users to panic. + + +* **New Feature: Initial work in linking Mines and Ranks.** +This is just the initial framework for the final product. Ranks have not been modified yet. + + +* **New Feature: New Feature: Add a warning if PlugMan is detected.** +It notifies the user that prison will not behave well and can be corrupted if PlugMan tries to reload it. +Also states we are not responsible for any corruption, nor are we obligated to help recover from said corruption. + + +* **New Feature: Added ability to send the ChatDisplay object directly to console log.** + + +* **New Feature: Added /ranks ladder moveRank** +since most people don't realize they can remove a rank from a ladder (it is not deleted) and then add it back in to another place within the same ladder, or another ladder. +This new feature just calls /ranks ladder remove and then /ranks ladder addRank. Simplifies the process and makes it clear to the user that the option is there. + + +* **Eliminated the listing of placeholders from /prison version** +since it was getting to be a really long list. +Provided a reminder on where to find the placeholders. + + +* **BUG FIX!! Found that the default value on mine sortOrder was being set to -1 instead of zero.** +This will suppress all the mines, but nothing will be lost. This value will be set upon initial +loading of the mines if they did not have that value set previously. + + +* **v3.2.2-alpha.3 - 2020-10-07** +Bump to v3.2.2-alpha.3 due to significant update to the Vault integration. +Have not heard anyone else has had issues, so may hold off on releasing v3.2.2 for a few days to add more updates. + + + +* **Bug fix: Had to make changes to which functions Vault is using based upon Vault's version.** +It appears like formerly deprecated functions have been disabled and does nothing now. +Made changes to inspect the version of vault that is being used, then properly target the correct function so it works properly with all versions of vault, including pre v1.4.0. +This bug fix is potentially a critical bug fix and may warrant publishing Prison release v3.2.2 to take care of this issue. + + +* **New feature: Added the player's current balance on the command /ranks player.** + + + +* **Bug fix: Found that the wrong amount was being refunded to the player when doing a /ranks demote with a player_refund.** +Works now, and the log entries are also correct. + + +* **Space missing in the display of the default rank for the command /ranks list.** + + +* **Bug Fix: A config file was being loaded many times to build one gui page.** +Moved the config to a class variable so it would only be loaded once. +This reduced the opening of a 39 mine GUI from 5.5 seconds down to 6 milliseconds for the offending function call. + + +* **v3.2.2-alpha.2 - 2020-10-06** + + +* **Updated the sorting of mines to simplify the sorting.** +Now the sort types either include or exclude the mines. There are no sort types that include all mines. But the function that performs the sorting based upon the sort type returns a collection that contains the included mines (sortOrder >= 0) and also a second collection that contains the excluded mines (sortOrder == -1). +The returned object, PrisonSortableResults, has helper functions to simplify integration in to the /mines list command. +The /mines list command now shows how many mines are included and excluded in that listing, and identifies what the other sort types will display the suppressed mines. + + + +* **New Feature: Setup the complex sorting on mines.** +Mines can now be assigned a sort order, with even suppressing mines from being included in the output. +Mines list can now be sorted in six different orders: alpha, active, and now sortOrder (user defined order), all of which suppresses mines with a -1 for the sort orders. Plus those but with including the suppressed mines. +The default being sortOrder, but if no mines have been configured, then they all will have a sortOrder == 0, and then all will be sorted alphabetically within that grouping. +Changed the prison's GUI to display mines in the sortOrder, with suppression of the -1 sortOrder values. +Added a junit test to test the generated sorting orders since they can be rather complex and should be tested at compile time that they are correct. +Note: In adding this new sorting, found where the bug was where the actual internal sort order was being altered. This is no longer the case and is fixed. + + +* **New Feature: Added Mine Tag Names and 8 new placeholders to support them.** +This is required for the future changes to support linking mines and ranks. + + +* **New Feature: Rename Mines. Bug Fix: Delete Mines.** +You can now rename mines. +This also fixes an issue with not being able to delete a mine: It deletes successfully, but is still active in memory. + + +* **Prison_v3.2.2-alpha.1d.jar - 2020-10-01** + + +* **Bug fix: change how /ranks list works with perms.** +Should allow all players to use this command since no-perm players can use /ranks and that just redirects to this command. +Removed admin features unless player has the ranks.list perm or they are op. The admin features are links to other internal commands. + + + +* **Potential bug fix if a config option does not exist** +Reformatted so the code will have a better chance of fitting on the screen without a bunch of horizontal scrolling... +plus got rid of a few instances of Objects.requireNonNull() which throws exceptions, which are not being caught. Which is also the wrong behavior to what we need here... if those configs are null, then instead of throwing exceptions, just move on to the next conditional in the if chain. +Should probably never use Objects.requireNonNull since it will crash prison and prevent intended functionality. This should probably be removed from elsewhere. + + + +* **New feature: Gui Languages Support** +New languages folder containing the GUI and future languages files so players can edit them or contribute to make a new +one with translations to download and put there, then you can select it by editing in the `config.yml` the `default-language:` +to the language of your area, this's also related to the file language name, +for example the name of the GUI messages file should be `GUI-en_US.yml` by default, so if you translate to another language +(for example italian) you should rename a new file to `GUI-it_IT.yml` and edit in the config.yml the string +`default-language: en_US` to `default-language: it_IT`, if you select a language file missing in the folder or invalid, +it'll be generated anyway using the default config as the model so it won't break the plugin, then you can translate it +later or edit the config to the correct one. + + +* **Prison_v3.2.2-alpha.1c - 2020-10-10** + + +* **Found an inconsistency in how the ranks are dealing with the document engine.** +Mines do not throw exceptions, but they were within ranks, which is not needed. + + +* **New feature: added some new 1.14 and 1.15 blocks** +Added some more new blocks since some of the 1.16 blocks appear to work in most circumstances. +Use at your own risk. +These blocks may not properly be spawned and may not be all blocks available for these versions. +v1.14 : BAMBOO, BAMBOO_SAPLING, BARREL, BELL, CAMPFIRE, CARTOGRAPHY_TABLE, COMOSTER, +FLETCHING_TABLE, GRINDSTONE, JIGSAW, LANTERN, LECTERN, LOOM, SCAFFOLDING, +SMITHING_TABLE, SMOKER, STONECUTTER, SWEET_BERRY_BUSH +v1.15 : BEE_NEST, BEEHIVE, HONEY_BLOCK, HONEYCOMB_BLOCK + + +* **Added a few v1.16 block types.** +Not sure if they will actually work. Obviously will never work with mc versions < 1.16. Use at own risk. +ANCIENT_DEBRIS CRYING_OBSIDIAN NETHER_GOLD_ORE BASALT POLISHED_BASALT +NETHERITE_BLOCK BLACKSTONE POLISHED_BLACKSTONE CHISELED_POLISHED_BLACKSTONE +NETHER_BRICKS RED_NETHER_BRICKS CRACKED_NETHER_BRICKS CHISELED_NETHER_BRICKS +CRIMSON_PLANKS WARPED_PLANKS STRIPPED_CRIMSON_HYPHAE +STRIPPED_WARPED_HYPHAE NETHER_WART_BLOCK WARPED_WART_BLOCK +LODESTONE QUARTZ_BRICKS RESPAWN_ANCHOR SHROOMLIGHT CAMPFIRE SOUL_CAMPFIRE +SOUL_LANTERN SOUL_TORCH SOUL_SOIL TARGET TWISTING_VINES WEAPING_VINES + + +* **Fix: Changed nether_brick to an item** + since this is an item and not a block. Added support so if it is found in a mine upon server startup, it will change it to a double_nether_brick_slab. + + +* **Prison_v3.2.2-alpha.1b - 2020-09-29** + + +* **Bug fix: Prison was allowing the material REDSTONE to be added to mines.** +This caused a failure during mine resets since that is not a valid block. That is redstone dust! +Fixed it so upon server startup, it will auto detect the use of this item in mines and convert it to REDSTONE_ORE. Thus the mine will work and won't disable the mine. +Also I changed the BlockType to Item so it's still there, but it cannot be presented as a block in the /mines block search tool. + + + + +* **Set new version to v3.2.2-alpha.1** 2020-09-27 + + +## tag v3.2.1 - 2020-09-27 + +* **New Release!! v3.2.1 published!!** +Bleeding was pulled in to master branch. And published to spigotmc.org too. :) + + + + ## tag v3.2.1-alpha.20 - 2020-09-27 diff --git a/docs/docs-commands/images/prison_docs_commands_01_01.png b/docs/docs-commands/images/prison_docs_commands_01_01.png new file mode 100644 index 000000000..152dcee5f Binary files /dev/null and b/docs/docs-commands/images/prison_docs_commands_01_01.png differ diff --git a/docs/docs-commands/images/prison_docs_commands_03_01.png b/docs/docs-commands/images/prison_docs_commands_03_01.png new file mode 100644 index 000000000..a83dc12b5 Binary files /dev/null and b/docs/docs-commands/images/prison_docs_commands_03_01.png differ diff --git a/docs/docs-commands/images/prison_docs_commands_05_01.png b/docs/docs-commands/images/prison_docs_commands_05_01.png new file mode 100644 index 000000000..f874dddc9 Binary files /dev/null and b/docs/docs-commands/images/prison_docs_commands_05_01.png differ diff --git a/docs/docs-commands/images/prison_docs_commands_05_02.png b/docs/docs-commands/images/prison_docs_commands_05_02.png new file mode 100644 index 000000000..e9e38ed96 Binary files /dev/null and b/docs/docs-commands/images/prison_docs_commands_05_02.png differ diff --git a/docs/docs-commands/images/prison_docs_commands_06_01.png b/docs/docs-commands/images/prison_docs_commands_06_01.png new file mode 100644 index 000000000..f5ca5f144 Binary files /dev/null and b/docs/docs-commands/images/prison_docs_commands_06_01.png differ diff --git a/docs/docs-commands/images/prison_docs_commands_09_01.png b/docs/docs-commands/images/prison_docs_commands_09_01.png new file mode 100644 index 000000000..f4179e60c Binary files /dev/null and b/docs/docs-commands/images/prison_docs_commands_09_01.png differ diff --git a/docs/docs-commands/images/prison_docs_commands_09_02.png b/docs/docs-commands/images/prison_docs_commands_09_02.png new file mode 100644 index 000000000..41d4d8d89 Binary files /dev/null and b/docs/docs-commands/images/prison_docs_commands_09_02.png differ diff --git a/docs/docs-commands/prison_docs_command_01_prison.md b/docs/docs-commands/prison_docs_command_01_prison.md new file mode 100644 index 000000000..b71b7ba44 --- /dev/null +++ b/docs/docs-commands/prison_docs_command_01_prison.md @@ -0,0 +1,38 @@ +### Prison Documentation +[Prison Documents - Table of Contents](../prison_docs_000_toc.md) + +## Description: + +`/prison`'s the Main core command, by executing it you'll get a list of all the subcommands. + +The command `/prison` also shows all of the other registered root commands that are used within prison, for example `/ranks` and `/mines`. + + +## Permission: + +- `prison.admin` + +## SubCommands: + +- [`/prison alerts`](prison_docs_command_02_prison_alerts.md) +- [`/prison autofeatures`](prison_docs_command_03_prison_autofeatures.md) +- [`/prison gui`](prison_docs_command_04_prison_gui.md) +- [`/prison modules`](prison_docs_command_05_prison_modules.md) +- [`/prison placeholders`](prison_docs_command_06_prison_placeholders.md) +- [`/prison reload`](prison_docs_command_07_prison_reload.md) +- [`/prison version`](prison_docs_command_09_prison_version.md) + +## How to use the command + +Execute: +`/prison` +and all the subcommands will be displayed, plus the other Prison root commands. + +Command Example + +### Command Format + +`/prison [Arguments]` + +**END of the command INFO** + diff --git a/docs/docs-commands/prison_docs_command_02_prison_alerts.md b/docs/docs-commands/prison_docs_command_02_prison_alerts.md new file mode 100644 index 000000000..5788ad6cd --- /dev/null +++ b/docs/docs-commands/prison_docs_command_02_prison_alerts.md @@ -0,0 +1,26 @@ +### Prison Documentation +[Prison Documents - Table of Contents](../prison_docs_000_toc.md) + +## Description: + +Prison Alerts: you can clear a Prison Alert or All of them. One of the most frequently seen alerts is the notification that an update is available. + +## Permission: + +- `prison.alerts` + +## SubCommands: + +- `/prison alerts clearall` clear all alerts +- `/prison alerts clear` clear an alert that is specifically yours. + +## How to use the command + +Execute `/prison alerts` followed by the *argument* you want, such as `clearall` or `clear` to use the command + + +### Command Format + +`/prison alerts ` + +**END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_03_prison_autofeatures.md b/docs/docs-commands/prison_docs_command_03_prison_autofeatures.md new file mode 100644 index 000000000..cab8fa9e2 --- /dev/null +++ b/docs/docs-commands/prison_docs_command_03_prison_autofeatures.md @@ -0,0 +1,34 @@ +### Prison Documentation +[Prison Documents - Table of Contents](../prison_docs_000_toc.md) + +## Description: + +Show a description of the AutoFeatures and some info about them. This command only provides information about how to use autofeatures and does not provide any customizations. + +**NOTE:** You need to enable the autofeatures within in the **config.yml** file first, then you can edit them from the `/prison gui` or the `plugins/Prison/autoFeaturesConfig.yml`. + +## Permissions: + +- `prison.admin` +- `prison.automanager` +- `prison.automanager.pickup` *(configurable)* +- `prison.automanager.smelt` *(configurable)* +- `prison.automanager.block` *(configurable)* + +You can customize the permission plugins that are marked as *(configurable)* through modification of the `plugins/Prison/autoFeaturesConfig.yml` file. + +## SubCommands: + +- `none` + +## How to use the command + +Just execute the command `/prison autofeatures` + +### Command Format + +`/prison autofeatures` + +Command Example + +**END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_4_prison_gui.md b/docs/docs-commands/prison_docs_command_04_prison_gui.md similarity index 69% rename from docs/docs-commands/prison_docs_command_4_prison_gui.md rename to docs/docs-commands/prison_docs_command_04_prison_gui.md index b3c5e18e1..30d5eef5e 100644 --- a/docs/docs-commands/prison_docs_command_4_prison_gui.md +++ b/docs/docs-commands/prison_docs_command_04_prison_gui.md @@ -1,9 +1,9 @@ -### Prison Documentation - **WORK-IN-PROGRESS** +### Prison Documentation [Prison Documents - Table of Contents](../prison_docs_000_toc.md) ## Description: -This command will open the `/prison gui` where an admin can manage a lot of things about prison on a GUI. +This command will open the `/prison gui` where an admin can manage Prison features. ## Permission: @@ -16,7 +16,7 @@ This command will open the `/prison gui` where an admin can manage a lot of thin ## How to use the command -Just execute the command himself `/prison gui` +Just execute the command `/prison gui` ### Command Format diff --git a/docs/docs-commands/prison_docs_command_05_prison_modules.md b/docs/docs-commands/prison_docs_command_05_prison_modules.md new file mode 100644 index 000000000..2efd4a13e --- /dev/null +++ b/docs/docs-commands/prison_docs_command_05_prison_modules.md @@ -0,0 +1,37 @@ +### Prison Documentation +[Prison Documents - Table of Contents](../prison_docs_000_toc.md) + +## Description: + +The Prison Modules command will list all modules and their current status. Modules cannot be enabled or disabled through this command. You would have to make manual changes to the configuration file `plugins/Prison/modules.yml`. + +## Permission: + +- `prison.modules` +- `prison.admin` + +## SubCommands: + +- `none` + +## How to use the command + +Just execute the command `/prison modules` + +### Command Format + +`/prison modules` + + +Example of `/prison modules` ran within the console: + +Command Example + + +Example of `plugins/Prison/modules.yml`: +Command Example + + + + +**END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_06_prison_placeholders.md b/docs/docs-commands/prison_docs_command_06_prison_placeholders.md new file mode 100644 index 000000000..daa24b6e8 --- /dev/null +++ b/docs/docs-commands/prison_docs_command_06_prison_placeholders.md @@ -0,0 +1,41 @@ +### Prison Documentation +[Prison Documents - Table of Contents](../prison_docs_000_toc.md) + +## Description: + +Show a list of Prison Placeholders available. + + +## Permission: + +- `prison.placeholder` + +## SubCommands: + +- `/prison placeholders list help` Shows a list of placeholders, including aliases. +- `/prison placeholders list` +- `/prison placeholders reload` Reload placeholders and register them. +- `/prison placeholders search help` Search for placeholders. +- `/prison placeholders search [playerName] [pageNumber] [patterns]` + - `playerName` is optional and is used for player related placeholders to fill in active details + - The search results can contain hundreds of results, so paging allows you to control what results are shown. + - The `patterns` can be multiple words or fragments. If more than one pattern is used, then all patterns must exist within a placeholder to be included in the result set. +- `/prison placeholders test help` Test a placeholder +- `/prison placeholders test [text]` + + +Command Example + + +## How to use the command + +Use the `/prison placeholders`. + + +### Command Format + +`/prison placeholders` + +See above subcommands for their use. + +**END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_07_prison_reload.md b/docs/docs-commands/prison_docs_command_07_prison_reload.md new file mode 100644 index 000000000..b04b1125c --- /dev/null +++ b/docs/docs-commands/prison_docs_command_07_prison_reload.md @@ -0,0 +1,32 @@ +### Prison Documentation +[Prison Documents - Table of Contents](../prison_docs_000_toc.md) + +## Description: + +Prison, on a whole, is unable to be reloaded. It is always safest to restart the server under most situations, otherwise corruption may occur. + +That said, placeholders are currently the only exception to that "rule". By issuing the command `\prison reload placeholders` it will regenerate the placeholder mappings and reregister with any of the active placeholder plugins that prison is integrated with, such as PlaceholderAPI. Reloading the placeholders is safe to run at any time. + +A couple of examples when you would need to use the reload command for placeholders: + * Added, changed the name of, or removed any mines or ranks + * Reloaded a placeholder plugin, which wipes out all of prison's registered plugins. + +## Permissions: + +- `prison.admin` +- `prison.reload` +- `prison.placeholder` + +## SubCommands: + +- `/prison reload placeholders` Regenerates all the placeholder mappings and reregisters them with the supported placeholder plugins. + +## How to use the command + +Use the command `/prison reload` for the list of subcommands. + +### Command Format + +`/prison reload` + +**END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_09_prison_version.md b/docs/docs-commands/prison_docs_command_09_prison_version.md new file mode 100644 index 000000000..49fa7fdf6 --- /dev/null +++ b/docs/docs-commands/prison_docs_command_09_prison_version.md @@ -0,0 +1,40 @@ +### Prison Documentation +[Prison Documents - Table of Contents](../prison_docs_000_toc.md) + +## Description: + +Displays detailed information about Prison, especially about the versions of Prison, the platform (ie... Spigot, Paper, etc), and even the other plugins that are active. + +This view also includes detailed information on how prison is configured and what components and commands are active. + +This detailed information is very useful for debugging purposes if there are any issues with the environment. At server startup this information is included along with even more detailed information. If you are needing to get additional help with your prison environment, it is important to provide the other startup information too. + +## Permission: + +- `prison.admin` + +## SubCommands: + +- `none` + +## How to use the command + +Run the command: `/prison version` + +This is an example of the `/prison version` command. + +Command Example + +Upon startup of your server, there is additional important information that is displayed that could be very helpful in diagnosing any issues you may have with your server, or Prison itself. This is an example of what it could look like. + +Notice there are a few errors listed, since my test server has been setup with errors on purpose so as to ensure these error reporting features are functional. For example one rank has been setup with a currency that no longer exist, there are two ranks that are not associated with any ladders, and there is a block type that was detected that is not supported. + +Command Example + + + +### Command Format + +`/prison version` + +**END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_10_sellall.md b/docs/docs-commands/prison_docs_command_10_sellall.md index 91a56da7a..147767660 100644 --- a/docs/docs-commands/prison_docs_command_10_sellall.md +++ b/docs/docs-commands/prison_docs_command_10_sellall.md @@ -1,4 +1,4 @@ -### Prison Documentation - **WORK-IN-PROGRESS** +### Prison Documentation [Prison Documents - Table of Contents](../prison_docs_000_toc.md) ## Description: diff --git a/docs/docs-commands/prison_docs_command_11_ranks.md b/docs/docs-commands/prison_docs_command_11_ranks.md index fe26d7c61..44825ac57 100644 --- a/docs/docs-commands/prison_docs_command_11_ranks.md +++ b/docs/docs-commands/prison_docs_command_11_ranks.md @@ -3,21 +3,33 @@ ## Description: -Short description of the command will be here +Main Prison Ranks command which will show all the subcommands to admins and open a GUI to players. + +## Permissions: + +- `ranks.admin` If you want to see the commands list then add it to yourself, you can still see the Player GUI for Ranks with another command: `/prisonmanager ranks`. ## SubCommands: -- List -- Of -- Sub -- Commands -- With -- Short -- Description +- [/ranks command](prison_docs_command_12_ranks_command.md) +- [/ranks create \[rankName\] \[cost\] \[ladder\] \[tag\] ](prison_docs_command_13_ranks_create.md) +- [/ranks delete \[rankName\] ](prison_docs_command_14_ranks_delete.md) +- [/ranks demote \[playerName\] \[ladder\] \[chargePlayers\] ](prison_docs_command_15_ranks_demote.md) +- [/ranks info \[rankName\] ](prison_docs_command_16_ranks_info.md) +- [/ranks ladder](prison_docs_command_17_ranks_ladder_info.md) +- [/ranks list \[ladderName\] ](prison_docs_command_18_ranks_list.md) +- [/ranks players \[ladderName\] \[action\] ](prison_docs_command_19_ranks_players.md) +- [/ranks player \[player\] ](prison_docs_command_20_ranks_player.md) +- [/ranks promote \[playerName\] \[ladder\] \[chargePlayers\] ](prison_docs_command_21_ranks_promote.md) +- [/ranks set](prison_docs_command_22_ranks_set.md) ## How to use the command + +Execute the command himself to get a list of commands like in the example: `/ranks`. +This will also open a GUI to players showing a list of the ranks, you can enable or disable this in the config.yml. + ### Command Format -`/prison` +`/ranks Optional-Ladder` **END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_12_ranks_command.md b/docs/docs-commands/prison_docs_command_12_ranks_command.md index 1e798a48b..75a572b4d 100644 --- a/docs/docs-commands/prison_docs_command_12_ranks_command.md +++ b/docs/docs-commands/prison_docs_command_12_ranks_command.md @@ -1,24 +1,29 @@ -### Prison Documentation - **WORK-IN-PROGRESS** +### Prison Documentation [Prison Documents - Table of Contents](../prison_docs_000_toc.md) ## Description: -Short description of the command will be here +Add a command which will be executed when the player rankup to the rank with the command assigned. + +## Permissions: + +- `ranks.admin` ## SubCommands: -- List -- Of -- Sub -- Commands -- With -- Short -- Description +- `/ranks command add` +- `/ranks command list` +- `/ranks command remove` ## How to use the command +Execute the command himself, and you'll get a list of the subcommands, like in the example: `/ranks command`. +- `/ranks command add [rankName] [command]` will add a rankupCommand to a rank. +- `/ranks command list [rankname]` will show a list of rankupCommands in a rank. +- `/ranks command remove [rankName] [command]` will remove the rankupCommand from the rank. + ### Command Format -`/prison` +`/ranks command ` **END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_13_ranks_create.md b/docs/docs-commands/prison_docs_command_13_ranks_create.md index 1e798a48b..6eaca8997 100644 --- a/docs/docs-commands/prison_docs_command_13_ranks_create.md +++ b/docs/docs-commands/prison_docs_command_13_ranks_create.md @@ -1,24 +1,27 @@ -### Prison Documentation - **WORK-IN-PROGRESS** +### Prison Documentation [Prison Documents - Table of Contents](../prison_docs_000_toc.md) ## Description: -Short description of the command will be here +Create a rank. + +## Permissions: + +- `ranks.create` ## SubCommands: -- List -- Of -- Sub -- Commands -- With -- Short -- Description +- none ## How to use the command +Execute the command himself following the format like in the example: + +- `/ranks create [rankName] [cost] [ladder] [tag]` +- `/ranks create A 100 default &3[&1A&3]&f` + ### Command Format -`/prison` +`/ranks create [rankName] [cost] [ladder] [tag]` **END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_14_ranks_delete.md b/docs/docs-commands/prison_docs_command_14_ranks_delete.md index 1e798a48b..6e425656c 100644 --- a/docs/docs-commands/prison_docs_command_14_ranks_delete.md +++ b/docs/docs-commands/prison_docs_command_14_ranks_delete.md @@ -1,24 +1,27 @@ -### Prison Documentation - **WORK-IN-PROGRESS** +### Prison Documentation [Prison Documents - Table of Contents](../prison_docs_000_toc.md) ## Description: -Short description of the command will be here +Delete a rank. + +## Permissions: + +- `ranks.delete` ## SubCommands: -- List -- Of -- Sub -- Commands -- With -- Short -- Description +- none ## How to use the command +Execute the command himself like in the example to delete a rank: + +- `/ranks delete [rankName]` +- `/ranks delete A` + ### Command Format -`/prison` +`/ranks delete [rankName]` **END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_15_ranks_demote.md b/docs/docs-commands/prison_docs_command_15_ranks_demote.md index 1e798a48b..4d4500786 100644 --- a/docs/docs-commands/prison_docs_command_15_ranks_demote.md +++ b/docs/docs-commands/prison_docs_command_15_ranks_demote.md @@ -1,24 +1,37 @@ -### Prison Documentation - **WORK-IN-PROGRESS** +### Prison Documentation [Prison Documents - Table of Contents](../prison_docs_000_toc.md) ## Description: -Short description of the command will be here +Demote a player of a rank depending on the ladder you want. + +## Permissions: + +- `ranks.demote` ## SubCommands: -- List -- Of -- Sub -- Commands -- With -- Short -- Description +- none ## How to use the command +Execute the command himself following the format shown in the example to demote a player: + +- `/ranks demote [playerName] [ladder] [chargePlayers]` +- `/ranks demote GABRYCA default` + +_"Hope you'll never get demoted_ + +_As this is usually common_ + +_and in life you'll see only promotions_ + +_as time goes on"_ + +**- GABRYCA** + ### Command Format -`/prison` +`/ranks demote [playerName] [ladder] [chargePlayers]` **END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_16_ranks_info.md b/docs/docs-commands/prison_docs_command_16_ranks_info.md index 1e798a48b..932f95536 100644 --- a/docs/docs-commands/prison_docs_command_16_ranks_info.md +++ b/docs/docs-commands/prison_docs_command_16_ranks_info.md @@ -1,24 +1,28 @@ -### Prison Documentation - **WORK-IN-PROGRESS** +### Prison Documentation [Prison Documents - Table of Contents](../prison_docs_000_toc.md) ## Description: -Short description of the command will be here +Get info about a rank. + +## Permissions: + +- `ranks.info` +- `ranks.admin` ## SubCommands: -- List -- Of -- Sub -- Commands -- With -- Short -- Description +- none ## How to use the command +Execute the command like in the example following the format: + +- `/ranks info [rankName]` +- `/ranks info A` + ### Command Format -`/prison` +`/ranks info [rankName]` **END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_17_ranks_ladder_info.md b/docs/docs-commands/prison_docs_command_17_ranks_ladder_info.md index 1e798a48b..f30d106be 100644 --- a/docs/docs-commands/prison_docs_command_17_ranks_ladder_info.md +++ b/docs/docs-commands/prison_docs_command_17_ranks_ladder_info.md @@ -1,24 +1,36 @@ -### Prison Documentation - **WORK-IN-PROGRESS** +### Prison Documentation [Prison Documents - Table of Contents](../prison_docs_000_toc.md) ## Description: -Short description of the command will be here +Edit a rank on the ladder side, like moving it from a ladder to another or also **manage ladders.** + +## Permissions: + +- `ranks.admin` ## SubCommands: -- List -- Of -- Sub -- Commands -- With -- Short -- Description +- `/ranks ladder addrank [ladderName] [rankName] [position]` +- `/ranks ladder create [ladderName]` +- `/ranks ladder delete [ladderName]` +- `/ranks ladder delrank [ladderName] [rankName]` +- `/ranks ladder listranks [ladderName]` +- `/ranks ladder list` ## How to use the command +Execute the command or its variables like in the examples: + +- `/ranks ladder addranks default A 1` This will move the Ranks A from whatever it's to the default ladder as the first rank. +- `/ranks ladder create coolLadder` This will create a ladder named "coolLadder". +- `/ranks ladder delete coolLadder` This will delete the ladder named "coolLadder" if found. +- `/ranks ladder delrank default A` Delete a rank from the specified ladder. +- `/ranks ladder listranks default` Shows a list of ranks of the "default" in the example. +- `/ranks ladder list` Shows a list of ladders. + ### Command Format -`/prison` +`/ranks ladder ` **END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_18_ranks_list.md b/docs/docs-commands/prison_docs_command_18_ranks_list.md index 1e798a48b..8ee7c82bb 100644 --- a/docs/docs-commands/prison_docs_command_18_ranks_list.md +++ b/docs/docs-commands/prison_docs_command_18_ranks_list.md @@ -1,24 +1,24 @@ -### Prison Documentation - **WORK-IN-PROGRESS** +### Prison Documentation [Prison Documents - Table of Contents](../prison_docs_000_toc.md) ## Description: -Short description of the command will be here +Shows a list of ranks. + +## Permissions: + +- `ranks.list` ## SubCommands: -- List -- Of -- Sub -- Commands -- With -- Short -- Description +- none ## How to use the command +Execute the command itself and add the ladder name you want to see, like in the example: `/ranks list default`. + ### Command Format -`/prison` +`/ranks list [ladderName]` **END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_19_ranks_players.md b/docs/docs-commands/prison_docs_command_19_ranks_players.md index 1e798a48b..393b88f2d 100644 --- a/docs/docs-commands/prison_docs_command_19_ranks_players.md +++ b/docs/docs-commands/prison_docs_command_19_ranks_players.md @@ -1,24 +1,31 @@ -### Prison Documentation - **WORK-IN-PROGRESS** +### Prison Documentation [Prison Documents - Table of Contents](../prison_docs_000_toc.md) ## Description: -Short description of the command will be here +Shows all ranks with player counts. + +## Permission: + +- `ranks.admin` ## SubCommands: -- List -- Of -- Sub -- Commands -- With -- Short -- Description +- none ## How to use the command +Execute the command itself and add the arguments you want, like in the examples: + +- `/ranks players all all` +Will show everything. +- `/ranks players default all` +Will show everything of the default ladder. +- `/ranks players default players` +Will show the default ladder players info. + ### Command Format -`/prison` +`/ranks players [ladderName] [action]` **END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_1_prison.md b/docs/docs-commands/prison_docs_command_1_prison.md deleted file mode 100644 index eb09501a5..000000000 --- a/docs/docs-commands/prison_docs_command_1_prison.md +++ /dev/null @@ -1,36 +0,0 @@ -### Prison Documentation - **WORK-IN-PROGRESS** -[Prison Documents - Table of Contents](../prison_docs_000_toc.md) - -## Description: - -/Prison's the Main core command, by executing it you'll get a list of all the subcommands. - -**NOTE:** You can get some info about ALL subcommands or commands by adding the argument `help` at the end of it, for example `/prison help`. - -## Permission: - -- `prison.admin` - -## SubCommands: - -- [`/prison alerts`](prison_docs_command_2_prison_alerts.md) -- [`/prison autofeatures`](prison_docs_command_3_prison_autofeatures.md) -- [`/prison gui`](prison_docs_command_4_prison_gui.md) -- [`/prison modules`](prison_docs_command_5_prison_modules.md) -- [`/prison placeholders`](prison_docs_command_6_prison_placeholders.md) -- [`/prison reload`](prison_docs_command_7_prison_reload.md) -- [`/prison troubleshoot [name]`](prison_docs_command_8_troubleshoot.md) -- [`/prison version`](prison_docs_command_9_prison_version.md) - -## How to use the command - -Execute: -`/prison` -and all the subcommands will show up - -### Command Format - -`/prison [Arguments]` - -**END of the command INFO** - diff --git a/docs/docs-commands/prison_docs_command_20_ranks_player.md b/docs/docs-commands/prison_docs_command_20_ranks_player.md index 1e798a48b..e4b3c4b99 100644 --- a/docs/docs-commands/prison_docs_command_20_ranks_player.md +++ b/docs/docs-commands/prison_docs_command_20_ranks_player.md @@ -1,24 +1,24 @@ -### Prison Documentation - **WORK-IN-PROGRESS** +### Prison Documentation [Prison Documents - Table of Contents](../prison_docs_000_toc.md) ## Description: -Short description of the command will be here +Shows a player their rank. + +## Permission: + +- `ranks.admin` ## SubCommands: -- List -- Of -- Sub -- Commands -- With -- Short -- Description +- none ## How to use the command +Execute the command itself adding the player Name like in the example: `/ranks player GABRYCA`. + ### Command Format -`/prison` +`/ranks player [playerName]` **END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_21_ranks_promote.md b/docs/docs-commands/prison_docs_command_21_ranks_promote.md index 1e798a48b..dd55d0938 100644 --- a/docs/docs-commands/prison_docs_command_21_ranks_promote.md +++ b/docs/docs-commands/prison_docs_command_21_ranks_promote.md @@ -1,24 +1,30 @@ -### Prison Documentation - **WORK-IN-PROGRESS** +### Prison Documentation [Prison Documents - Table of Contents](../prison_docs_000_toc.md) ## Description: -Short description of the command will be here +Promotes a player to the next rank. + +## Permission: + +- `ranks.promote` ## SubCommands: -- List -- Of -- Sub -- Commands -- With -- Short -- Description +- none ## How to use the command +Execute the command itself adding the player Name, ladder to promote and if needed make him pay (forcing the player) to Rankup/Promote like in the example: + +- `/ranks promote GABRYCA default no_charge` +Won't charge the player to Rankup + +- `/ranks promote GABRYCA default 1000` +Will charge the player of the amount specified to Rankup, 1000 in the example + ### Command Format -`/prison` +`/ranks promote [playerName] [ladder] [chargePlayers]` **END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_22_ranks_set.md b/docs/docs-commands/prison_docs_command_22_ranks_set.md index 1e798a48b..1efec8f54 100644 --- a/docs/docs-commands/prison_docs_command_22_ranks_set.md +++ b/docs/docs-commands/prison_docs_command_22_ranks_set.md @@ -3,22 +3,34 @@ ## Description: -Short description of the command will be here +Manages a rank or player. + +## Permissions: + +- `ranks.admin` ## SubCommands: -- List -- Of -- Sub -- Commands -- With -- Short -- Description +- `/ranks set cost [rankName] [cost]` +- `/ranks set currency [rankName] [currency]` +- `/ranks set rank [playerName] [rankName] [ladder]` +- `/ranks set tag [rankName] [tag]` ## How to use the command +Execute the command with the arguments you want like in the examples: + +- `/ranks set cost A 100` +Set the price of the rank A to 100. +- `/ranks set currency A GemsEconomy` +Will set the currency plugin for the rank to GemsEconomy. +- `/ranks set rank GABRYCA Z default` +Set a player rank to the specifies ranks of the ladder, like in the example "GABRYCA" will get the Rank Z in the default ladder. +- `/ranks set tag A &8[&3A&8]&f` +Set a Rank tag to the specified one, like in the example the Rank tag of A will be replaced with `&8[&3A&8]&f` + ### Command Format -`/prison` +`/ranks set [argument]` **END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_2_prison_alerts.md b/docs/docs-commands/prison_docs_command_2_prison_alerts.md deleted file mode 100644 index c104725ef..000000000 --- a/docs/docs-commands/prison_docs_command_2_prison_alerts.md +++ /dev/null @@ -1,28 +0,0 @@ -### Prison Documentation - **WORK-IN-PROGRESS** -[Prison Documents - Table of Contents](../prison_docs_000_toc.md) - -## Description: - -Prison Alerts, you can clear a Prison Alert or All of them - -## Permission: - -- `prison.alerts` - -## SubCommands: - -- `/prison alerts clearall` clear all alerts -- `/prison alerts clear` clear an alert - -## How to use the command - -Execute `/prison alerts` followed by the `argument` you want, such as `clearall` or `clear` to use the command - -**NOTE:** -You can't use this command from the console! - -### Command Format - -`/prison alerts ` - -**END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_3_prison_autofeatures.md b/docs/docs-commands/prison_docs_command_3_prison_autofeatures.md deleted file mode 100644 index b596503a0..000000000 --- a/docs/docs-commands/prison_docs_command_3_prison_autofeatures.md +++ /dev/null @@ -1,30 +0,0 @@ -### Prison Documentation - **WORK-IN-PROGRESS** -[Prison Documents - Table of Contents](../prison_docs_000_toc.md) - -## Description: - -Show a description of the AutoFeatures and some info about them. - -**NOTE:** You should enable in the **config.yml** the autofeatures first, then you can edit them from the `/prison gui` or the `autoFeaturesConfig.yml`. - -## Permissions: - -- `prison.admin` -- `prison.automanager` -- `prison.automanager.pickup` -- `prison.automanager.smelt` -- `prison.automanager.block` - -## SubCommands: - -- `none` - -## How to use the command - -Just execute the command himself `/prison autofeatures` - -### Command Format - -`/prison autofeatures` - -**END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_9_prison_version.md b/docs/docs-commands/prison_docs_command_41_mines_rename.md similarity index 55% rename from docs/docs-commands/prison_docs_command_9_prison_version.md rename to docs/docs-commands/prison_docs_command_41_mines_rename.md index a3559038a..1e798a48b 100644 --- a/docs/docs-commands/prison_docs_command_9_prison_version.md +++ b/docs/docs-commands/prison_docs_command_41_mines_rename.md @@ -3,22 +3,22 @@ ## Description: -Show many infos about prison and also some placeholders - -## Permission: - -- `prison admin` +Short description of the command will be here ## SubCommands: -- `none` +- List +- Of +- Sub +- Commands +- With +- Short +- Description ## How to use the command -Run the command himself to use this, example: `/prison version` - ### Command Format -`/prison version` +`/prison` **END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_42_ranks_autoconfigure.md b/docs/docs-commands/prison_docs_command_42_ranks_autoconfigure.md new file mode 100644 index 000000000..293c2421e --- /dev/null +++ b/docs/docs-commands/prison_docs_command_42_ranks_autoconfigure.md @@ -0,0 +1,67 @@ +### Prison Documentation - **WORK-IN-PROGRESS** +[Prison Documents - Table of Contents](../prison_docs_000_toc.md) + +## Permission: + +- `ranks.set` + +## Description: + +This command is only available when you first run Prison on your sever. It cannot be used if you already setup any ranks or mines because this could potentially cause conflicts. + +This new feature will provide a fast way to configure most of the core features of Prison, and it may be the preferred way to setup a new server. + + +Features provided: + - Setup all basic Ranks in the **default** ladder ranging from Rank **A** to Rank **Z**. + - Setup basic Rank Commands. Provides granting of permissions to that Rank (`mines.` and `mines.tp.`) and removing the ranks of the next higher rank so `/ranks demote` will work properly. + - Setup all mines, as virtual mines, from **A** to **Z**. + - Links all mines to the rank of the same name. + - Setup all blocks for all mines, using a list of blocks of increasing values. Mine A would have the lowest values of blocks, and mine Z would have the greatest value of blocks. All of these can be customized. + + +Once this command is ran, these setting can be used as is, or they can be farther customized to suite any need. + +The only requirement to creating a functional prison is to convert all of the virtual mines to physical mines. This is accomplished through the command `/mines set area `. + +Other simple tools to help customize the mines, are as follows: + + - `/mines set size ` This allows you to resize a mine without having to reselect it's area. + - `/mines set liner ` Wraps your mine with a patterned liner and inserts ladders along the edges. There are a number of different patterns to choose from, with more being added in the near future. + + + +## SubCommands: + +- `/ranks autoConfigure full` Full setup +- `/ranks autoConfigure mines` Mines setup +- `/ranks autoConfigrue ranks` Ranks setup + +## How to use the command + +Execute the command itself with the argument you want, like in the examples below: + +- `/ranks autoConfigure full` Full setup +- `/ranks autoConfigure mines` Mines setup +- `/ranks autoConfigrue ranks` Ranks setup + +In these cases, for ranks the default starting Price will be 50000 and the Multiplier for each Rank (how much a Rank +will be more expensive than the previous one)'s of 1.5. + +An example with custom values's this one, remember to add the whole `price=x` and `mult=x` tag: + +- `/ranks autoConfigure full price=1000 mult=1.5` + +You can execute the command without args, like in this example: + +- `/ranks autoConfigure` + +It'll use default values like if you're using: + +- `/ranks autoConfigure full price=50000 mult=1.5` + +### Command Format + +`/ranks autoConfigure ` + +**END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_5_prison_modules.md b/docs/docs-commands/prison_docs_command_5_prison_modules.md deleted file mode 100644 index 2af0ae379..000000000 --- a/docs/docs-commands/prison_docs_command_5_prison_modules.md +++ /dev/null @@ -1,25 +0,0 @@ -### Prison Documentation - **WORK-IN-PROGRESS** -[Prison Documents - Table of Contents](../prison_docs_000_toc.md) - -## Description: - -Prison Modules command, will show a "status" for modules, like enabled or disabled. - -## Permission: - -- `prison.modules` -- `prison.admin` - -## SubCommands: - -- `none` - -## How to use the command - -Just execute the command himself `/prison modules` - -### Command Format - -`/prison modules` - -**END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_6_prison_placeholders.md b/docs/docs-commands/prison_docs_command_6_prison_placeholders.md deleted file mode 100644 index 246dd184e..000000000 --- a/docs/docs-commands/prison_docs_command_6_prison_placeholders.md +++ /dev/null @@ -1,27 +0,0 @@ -### Prison Documentation - **WORK-IN-PROGRESS** -[Prison Documents - Table of Contents](../prison_docs_000_toc.md) - -## Description: - -Show a list of Prison Placeholders available at the moment you execute the command in the place you're. - -## Permission: - -- `prison.placeholder` - -## SubCommands: - -- `/prison placeholders list` Show a list of placeholders -- `/prison placeholders reload` Reload placeholders -- `/prison placeholders search [playerName] [pageNumber] [patterns]` Search placeholders for a player -- `/prison placeholders test [text]` Test a placeholder - -## How to use the command - -Execute `/prison placeholders` and add the `argument` you want at the end of it. - -### Command Format - -`/prison placeholders ` - -**END of the command INFO** \ No newline at end of file diff --git a/docs/docs-commands/prison_docs_command_7_prison_reload.md b/docs/docs-commands/prison_docs_command_7_prison_reload.md deleted file mode 100644 index a6971b3d0..000000000 --- a/docs/docs-commands/prison_docs_command_7_prison_reload.md +++ /dev/null @@ -1,26 +0,0 @@ -### Prison Documentation - **WORK-IN-PROGRESS** -[Prison Documents - Table of Contents](../prison_docs_000_toc.md) - -## Description: - -Reload the Prison Plugin -> Show a list of reload commands for the plugin. - -## Permissions: - -- `prison.admin` -- `prison.reload` -- `prison.placeholder` - -## SubCommands: - -- `/prison reload placeholders` - -## How to use the command - -Execute `/prison reload` and add the argument you want at the end of it, for example `/prison reload placeholders` - -### Command Format - -`/prison reload ` - -**END of the command INFO** \ No newline at end of file diff --git a/docs/images/prison_docs_101_setting_up_mines_04.png b/docs/images/prison_docs_101_setting_up_mines_04.png index 86d70cec4..9ef30d619 100644 Binary files a/docs/images/prison_docs_101_setting_up_mines_04.png and b/docs/images/prison_docs_101_setting_up_mines_04.png differ diff --git a/docs/images/prison_docs_310_guide_placeholders_1.png b/docs/images/prison_docs_310_guide_placeholders_1.png index 4dd6faf79..8372b4f35 100644 Binary files a/docs/images/prison_docs_310_guide_placeholders_1.png and b/docs/images/prison_docs_310_guide_placeholders_1.png differ diff --git a/docs/images/prison_docs_310_guide_placeholders_2.png b/docs/images/prison_docs_310_guide_placeholders_2.png index 1d360d2a7..af24a4c3c 100644 Binary files a/docs/images/prison_docs_310_guide_placeholders_2.png and b/docs/images/prison_docs_310_guide_placeholders_2.png differ diff --git a/docs/images/prison_docs_310_guide_placeholders_2b.png b/docs/images/prison_docs_310_guide_placeholders_2b.png new file mode 100644 index 000000000..2b8495f43 Binary files /dev/null and b/docs/images/prison_docs_310_guide_placeholders_2b.png differ diff --git a/docs/images/prison_docs_310_guide_placeholders_3.png b/docs/images/prison_docs_310_guide_placeholders_3.png index 73155190a..85dacc0b4 100644 Binary files a/docs/images/prison_docs_310_guide_placeholders_3.png and b/docs/images/prison_docs_310_guide_placeholders_3.png differ diff --git a/docs/images/prison_docs_310_guide_placeholders_3b.png b/docs/images/prison_docs_310_guide_placeholders_3b.png new file mode 100644 index 000000000..b10f237af Binary files /dev/null and b/docs/images/prison_docs_310_guide_placeholders_3b.png differ diff --git a/docs/images/prison_docs_310_guide_placeholders_4b.png b/docs/images/prison_docs_310_guide_placeholders_4b.png new file mode 100644 index 000000000..e99820cfc Binary files /dev/null and b/docs/images/prison_docs_310_guide_placeholders_4b.png differ diff --git a/docs/images/prison_docs_310_guide_placeholders_6.png b/docs/images/prison_docs_310_guide_placeholders_6.png new file mode 100644 index 000000000..d0c42d017 Binary files /dev/null and b/docs/images/prison_docs_310_guide_placeholders_6.png differ diff --git a/docs/prison_docs_000_toc.md b/docs/prison_docs_000_toc.md index 0ff5444c0..49c995574 100644 --- a/docs/prison_docs_000_toc.md +++ b/docs/prison_docs_000_toc.md @@ -17,7 +17,19 @@
+# New! Prison Fast Start + +Prison now has a new set of features that can help you get up and running faster than ever! `/ranks autoConfigure`. It can auto create your ranks and virtual mines, A through Z, it will link the mines to the ranks, setup the basic rank commands to provide basic access permissions for your players, and assign blocks of increasing values to all mines. All you need to do is to use the command `/mines set area` on all mines to make them physical mines. Plus there are a new features to help provide the finishing touches in almost no time. + - `/ranks autoConfigure` + - `/mines set area help` + - `/mines set tracer help` + - `/mines set size help` + - `/mines set liner help` + + Documentation pertaining to the use of the auto configuration will be coming soon. + +
# Table of Contents for this Document @@ -40,57 +52,58 @@ **PRISON COMMANDS:** -(Work-In-Progress) - -- [/prison](docs-commands/prison_docs_command_1_prison.md) -- [/prison alerts](docs-commands/prison_docs_command_2_prison_alerts.md) -- [/prison autofeatures](docs-commands/prison_docs_command_3_prison_autofeatures.md) -- [/prison gui](docs-commands/prison_docs_command_4_prison_gui.md) -- [/prison modules](docs-commands/prison_docs_command_5_prison_modules.md) -- [/prison placeholders](docs-commands/prison_docs_command_6_prison_placeholders.md) -- [/prison reload](docs-commands/prison_docs_command_7_prison_reload.md) -- [/prison version](docs-commands/prison_docs_command_9_prison_version.md) - - -**RANKS COMMANDS: _Guidebook TO-DO_** (Work-In-Progress) - -- [/ranks \[ladder\] ](docs-commands/prison_docs_command_11_ranks.md) -- [/ranks command](docs-commands/prison_docs_command_12_ranks_command.md) -- [/ranks create \[rankName\] \[cost\] \[ladder\] \[tag\] ](docs-commands/prison_docs_command_13_ranks_create.md) -- [/ranks delete \[rankName\] ](docs-commands/prison_docs_command_14_ranks_delete.md) -- [/ranks demote \[playerName\] \[ladder\] \[chargePlayers\] ](docs-commands/prison_docs_command_15_ranks_demote.md) -- [/ranks info \[rankName\] ](docs-commands/prison_docs_command_16_ranks_info.md) -- [/ranks ladder](docs-commands/prison_docs_command_17_ranks_ladder_info.md) -- [/ranks list \[ladderName\] ](docs-commands/prison_docs_command_18_ranks_list.md) -- [/ranks players \[ladderName\] \[action\] ](docs-commands/prison_docs_command_19_ranks_players.md) -- [/ranks player \[player\] ](docs-commands/prison_docs_command_20_ranks_player.md) -- [/ranks promote \[playerName\] \[ladder\] \[chargePlayers\] ](docs-commands/prison_docs_command_21_ranks_promote.md) -- [/ranks set](docs-commands/prison_docs_command_22_ranks_set.md) + +- [/prison](docs-commands/prison_docs_command_01_prison.md) `prison.admin` +- [/prison alerts](docs-commands/prison_docs_command_02_prison_alerts.md) `prison.alerts` +- [/prison autofeatures](docs-commands/prison_docs_command_03_prison_autofeatures.md) `prison.admin` `prison.automanager` `prison.automanager.pickup` `prison.automanager.smelt` `prison.automanager.block` Plus custom permissions. +- [/prison gui](docs-commands/prison_docs_command_04_prison_gui.md) `prison.gui` +- [/prison modules](docs-commands/prison_docs_command_05_prison_modules.md) `prison.modules` +- [/prison placeholders](docs-commands/prison_docs_command_06_prison_placeholders.md) `prison.placeholder` +- [/prison reload](docs-commands/prison_docs_command_07_prison_reload.md) `prison.reload` +- [/prison version](docs-commands/prison_docs_command_09_prison_version.md) `prison.admin` + + +**RANKS COMMANDS**: + +- [/ranks autoConfigure \[arg\] \[startPrice\] \[multiplier\] ](docs-commands/prison_docs_command_42_ranks_autoconfigure.md) `ranks.set` +- [/ranks \[ladder\] ](docs-commands/prison_docs_command_11_ranks.md) `ranks.admin` +- [/ranks command](docs-commands/prison_docs_command_12_ranks_command.md) `prison.alerts` +- [/ranks create \[rankName\] \[cost\] \[ladder\] \[tag\] ](docs-commands/prison_docs_command_13_ranks_create.md) `ranks.create` +- [/ranks delete \[rankName\] ](docs-commands/prison_docs_command_14_ranks_delete.md) `ranks.delete` +- [/ranks demote \[playerName\] \[ladder\] \[chargePlayers\] ](docs-commands/prison_docs_command_15_ranks_demote.md) `ranks.demote` +- [/ranks info \[rankName\] ](docs-commands/prison_docs_command_16_ranks_info.md) `ranks.info` +- [/ranks ladder](docs-commands/prison_docs_command_17_ranks_ladder_info.md) `ranks.admin` +- [/ranks list \[ladderName\] ](docs-commands/prison_docs_command_18_ranks_list.md) `ranks.list` +- [/ranks players \[ladderName\] \[action\] ](docs-commands/prison_docs_command_19_ranks_players.md) `ranks.admin` +- [/ranks player \[player\] ](docs-commands/prison_docs_command_20_ranks_player.md) `ranks.admin` +- [/ranks promote \[playerName\] \[ladder\] \[chargePlayers\] ](docs-commands/prison_docs_command_21_ranks_promote.md) `ranks.promote` +- [/ranks set](docs-commands/prison_docs_command_22_ranks_set.md) `ranks.admin` **MINES COMMANDS: _Guidebook TO-DO_** (Work-In-Progress) -- [/mines](docs-commands/prison_docs_command_23_mines.md) -- [/mines block](docs-commands/prison_docs_command_24_mines_block.md) -- [/mines command](docs-commands/prison_docs_command_25_mines_command.md) -- [/mines create \[mineName\] ](docs-commands/prison_docs_command_26_mines_create.md) -- [/mines delete \[mineName\] \[confirm\] ](docs-commands/prison_docs_command_27_mines_delete.md) -- [/mines info \[mineName\] \[page\] ](docs-commands/prison_docs_command_28_mines_info.md) -- [/mines list \[page\] ](docs-commands/prison_docs_command_29_mines_list.md) -- [/mines reset \[mineName\] ](docs-commands/prison_docs_command_30_mines_reset.md) -- [/mines set](docs-commands/prison_docs_command_31_mines_set.md) -- [/mines stats](docs-commands/prison_docs_command_32_mines_stats.md) -- [/mines tp \[mineName\] ](docs-commands/prison_docs_command_33_mines_tp.md) -- [/mines wand](docs-commands/prison_docs_command_34_mines_wand.md) -- [/mines whereami](docs-commands/prison_docs_command_35_mines_whereami.md) +- [/mines](docs-commands/prison_docs_command_23_mines.md) `mines.admin` +- [/mines block](docs-commands/prison_docs_command_24_mines_block.md) `mines.admin` +- [/mines command](docs-commands/prison_docs_command_25_mines_command.md) `mines.admin` +- [/mines create \[mineName\] ](docs-commands/prison_docs_command_26_mines_create.md) `mines.create` +- [/mines delete \[mineName\] \[confirm\] ](docs-commands/prison_docs_command_27_mines_delete.md) `mines.delete` +- [/mines info \[mineName\] \[page\] ](docs-commands/prison_docs_command_28_mines_info.md) `mines.info` +- [/mines list \[page\] ](docs-commands/prison_docs_command_29_mines_list.md) `mines.list` +- [/mines rename \[page\] ](docs-commands/prison_docs_command_41_mines_rename.md) `mines.rename` +- [/mines reset \[mineName\] ](docs-commands/prison_docs_command_30_mines_reset.md) `mines.reset` +- [/mines set](docs-commands/prison_docs_command_31_mines_set.md) `mines.admin` +- [/mines stats](docs-commands/prison_docs_command_32_mines_stats.md) `mines.stats` +- [/mines tp \[mineName\] ](docs-commands/prison_docs_command_33_mines_tp.md) `mines.tp` `mines.tp.[mineName]` +- [/mines wand](docs-commands/prison_docs_command_34_mines_wand.md) `mines.wand` +- [/mines whereami](docs-commands/prison_docs_command_35_mines_whereami.md) `mines.whereami` **MORE COMMANDS: _Guidebook TO-DO_** (Work-In-Progress) -- [/sellall](docs-commands/prison_docs_command_10_sellall.md) -- [/prisonmanager](docs-commands/prison_docs_command_36_prisonmanager.md) -- [/prestiges](docs-commands/prison_docs_command_37_prestiges.md) -- [/prestige](docs-commands/prison_docs_command_38_prestige.md) -- [/rankupMax \[ladder\]](docs-commands/prison_docs_command_39_rankupmax.md) -- [/rankup \[ladder\]](docs-commands/prison_docs_command_40_rankup.md) +- [/sellall](docs-commands/prison_docs_command_10_sellall.md) `prison.admin` `none for GUI` +- [/prisonmanager](docs-commands/prison_docs_command_36_prisonmanager.md) `prison.admin for Admin GUI` `none for Players GUIs` +- [/prestiges](docs-commands/prison_docs_command_37_prestiges.md) `none` +- [/prestige](docs-commands/prison_docs_command_38_prestige.md) `ranks.user` `ranks.rankup.prestiges` +- [/rankupMax \[ladder\]](docs-commands/prison_docs_command_39_rankupmax.md) `ranks.user` `ranks.rankupmax` `ranks.rankupmax.[ladderName]` +- [/rankup \[ladder\]](docs-commands/prison_docs_command_40_rankup.md) `ranks.user` `ranks.rankup.[ladderName]` diff --git a/docs/prison_docs_101_setting_up_mines.md b/docs/prison_docs_101_setting_up_mines.md index acd380626..f1cddb4ef 100644 --- a/docs/prison_docs_101_setting_up_mines.md +++ b/docs/prison_docs_101_setting_up_mines.md @@ -4,7 +4,7 @@ ## Prison - Setting Up Mines -This document provides some highlights to how to setup mines. It is a work in progress so check back for more information. Initially it will cover the basics, but hopefully will expand to more advanced topics. +This document provides some highlights to how to setup mines. It is a work in progress so check back for more information.
@@ -19,6 +19,22 @@ Items to add to this document: * Use of **/mines list** * Use of **/mines reset** provide a little information about how it works in relationship to the other settings and commands. There are some internal things that happen and this will help clarify how the other settings are impacted. +
+ +# New! Prison Fast Start + +Prison now has a new set of features that can help you get up and running faster than ever! `/ranks autoConfigure`. It can auto create your ranks and virtual mines, A through Z, it will link the mines to the ranks, setup the basic rank commands to provide basic access permissions for your players, and assign blocks of increasing values to all mines. All you need to do is to use the command `/mines set area` on all mines to make them physical mines. Plus there are a new features to help provide the finishing touches in almost no time. + - `/ranks autoConfigure` + - `/mines set area help` + - `/mines set tracer help` + - `/mines set size help` + - `/mines set liner help` + +Documentation pertaining to the use of the auto configuration will be coming soon. + +Keep in mind that in order to use the command `/ranks autoConfigure` you cannot have any mines or ranks defined yet. So before you create a test mine, go ahead and run the auto configure so at least that is complete. + +
@@ -125,23 +141,37 @@ Some of the highlights of these commands are as follows: * `/mines delete` : Deletes a mine. You can always undelete a mine by going in to the server file system and rename the deleted mine, then restart the server. * `/mines info` : Very useful in viewing all information related to the mine. * `/mines list` : Displays all mines on your server. +* `/mines playerInventory` : Shows your current inventory in the console. Intended strictly for admins. +* `/mines rename` : Renames a mine. * `/mines reset` : Resets the mine. Forces a regeneration of all the blocks, even if the mine is in skip reset mode. * `/mines stats` : Toggles the display of stats that pertain to how long it takes to reset the mines. View /mines info or /mines list to see the stats. Use this command again to turn it off. * `/mines tp` : tp to a mine's spawn point, or the center of the mine if no spawn has been set. If players are given the permissions, they too can use this command. Use `/mines tp help` for a list of the perms. +* `/mines wand` : Gives you a Prison selection wand for defining you mine's area. Use prior to using the commands `/mines create` and `/mines set area`. The wand is no longer the only way to set a physical location, you can now use `/mines set area feet` to set a 1 x 1 x 1 region under your feet, which is great for when you're flying. You can then use `/mines set size` to increase the size. * `/mines whereami` : Shows you what mine you are in, or how far away you are from other mines in the area. If you have a lot of mines, it's easy to lose track of where you are, and this may help get your bearings. -* `/mines block add` : Add a new block type to a mine. It's easier to start off with block search and have it fill in the commands for you. +* `/mines block add` : Add a new block type to a mine. It's easier to start off with `/mines block search` and have it fill in the commands for you. * `/mines block remove` : Remove a block type from a mine. * `/mines block search` : Search for a block type based up on a search string. * `/mines block set` : Edit the block's percentage within the mine. A percent of zero will remove. If the block does not already exist, it will be added. (Can replace add and remove). -* `/mines set area` : Redefine the area of the mine. Careful, this can wipe out builds if set incorrectly. +* `/mines set area` : Redefine the area of the mine. Careful, this can wipe out builds if set incorrectly. This is a required command to set the area of the mine. A new feature is to use the current location of your feet to define a 1 x 1 x 1 region with `/mines set area feet`. Then you can use `/mines set size` to make it any size you want. +* `/mines set liner` : A quick way to wrap your mine with a 2D Pattern in 3D space. This command also will `repair` the area around a mine, and will effectively erase a liner. There are six directions that can be specified for change: `north`, `south`, `east`, `west`, `top`, and `bottom`. `walls` also is a shortcut for `north`, `south`, `east`, and `west`. The patterns available are listed by the command. There is even a `force` setting that will allow the mine to be wrapped when in air, since the wrappings normally needs blocks in contact with the mine so it is able to conform to the terrain. +* `/mines set move` is a new command that is not yet enabled. It is still in development, but will be active soon. This command will move a whole mine as a single unit, be it a few blocks or many (not recommended). +* `/mines set norank` : Disconnect the mine from a rank. +* `/mines set notificationPerm` : Enables or Disables notifications pertaining to mine resets to be seen only by players who have permission to that mine. The permissions used are `mines.notification.[mineName]` in all lower case. * `/mines set notification` : Can turn off the notifications on a per-mine basis. Or set the notification radius, or only notify players within the mine. This command cannot change the message. +* `/mines set rank` : Links a mine to a rank, otherwise there is no way within prison to identify which mines should be associated with a given rank. This is not yet needed, but it will be used in the near future with new features, or enhancements to existing features. +* `/mines set resetThreshold` : This allows you to set a percent remaining in the mine to use as a threshold for resets. For example if you set it to 20.5% then the mine will reset when it reaches 25.5% blocks remaining. When the mine resets, it will initiate the `zeroBlockResetDelay` functionality, of which it's not exactly "zero blocks" anymore. * `/mines set resetTime` : Changes the time between resets, as expressed in seconds. Applies to each mine independently. +* `/mines set resetPaging` : This is an advanced feature that can eliminate lag that might be experienced with the resetting of enormous large mines. A mine could be millions of blocks in size and without this setting it may take a few seconds, or longer to reset, and it could cause the ticks to fall far behind, even to the point of forcing a shutdown. This command instead will breakdown the mine's reset in to very small chunks that will prevent the TPS from slowing down, and it will allow other critical tasks to continue to run. The total length of time for the rest may be increased, but it will not hurt the server. Prison does not use async resets due to eventual corruption of the bukkit and spigot components. +* `/mines set size` : Allows you to resize a mine without redefining it with the prison selection wand. Just specify which direction to increase or decrease. It also uses the `/mines set liner repair` feature to fill in voids when reducing an edge. * `/mines set skipReset` : When enabled, can prevent a mine from resetting if it has no activity. Can set a threshold before the mine is reset, such as 80% will require 20% of the blocks be mined before being reset. Can also set a bypassLimit so that if the reset is skipped X number of times, it will force a reset anyway. +* `/mines set sortOrder` : Mines can be sorted for view within `/mines list` or the GUI. Setting the sortOrder allows you manually set the order in which the mines are listed. There is even the option to suppress (hide) mines from that list too by setting the sort order to a -1. * `/mines set spawn` : Sets the mines spawn point. Whatever you are looking at is what the players will be looking at when they tp to that spot. +* `/mines set tag` : Set a mine tag value that can be used with placeholders. +* `/mines set tracer` : Removes all blocks in a mine and replaces them with air, with the exception of the corners, of which are replace with pink_stained_glass. This function allows for easy viewing of the full mine without the blocks getting in the way. It also helps when setting the liner of the mine. Using `/mines reset` returns the mine to normal functionality, or it will reset on its own. * `/mines set zeroBlockResetDelay` : If the mine runs out of blocks, when enabled, it will force a manual reset after the specified delay. The delay can be zero for instant reset. Adding the term `help` to the end of any of the above listed commands will display additional information that is available for each command, including the parameters and also all permissions that are associated with the commands. @@ -211,6 +241,27 @@ Example of a mine reset including a sealantern. Notice that there is still 19.5 +
+ + +# Adjusting the Mine's Size and Setting the Liner + + +A few new features have been added to Prison to help make some adjustments to your mine. They are the following: + +``` +/mines set tracer help +/mines set size help +/mines set liner help +/mines set move help + +``` + +These three new commands are used together in various ways. The command `/mines set tracer` is used within the `/mines set size` and the `/mines set liner` commands. The `/mines set liner repair` is used within the `/mines set size` command to repair the areas that left as voids when resizing the mine. + +Note: The new command `/mines set move` is not yet enabled. It is still in development, but will be active soon. This command will move a whole mine as a single unit, be it a few blocks or many (not recommended). + +
@@ -245,6 +296,13 @@ In the example above, the notifications for that mine was set to only provide th ``` +

Notification Permissions Explained

+ +The command `/mines set notificationPerm` is able to control who is able to see the notification messages that are generated from a mine based upon permissions. This setting worked in conjunction with the other notification settings to fine tune the behavior even more so. + +This works by enabling the permission `mines.notification.[mineName]` to be checked when generating mine notification messages. To use this feature, enable the setting and then give the players that permission as they rankup. + +

Skip Reset Explained

@@ -268,6 +326,13 @@ If the reset delay is non-zero, the value is measured in seconds, with a valid v The bottom line is that this feature can force an earlier reset of the mine when it becomes totally empty of blocks. A delay may be needed, or desired, to reach your perfection for the mine. +

Reset Threshold Percentage Explained

+ +By using the command `/mines set resetThreshold` it is effectively able to shift when the mine resets. It does not delay when the mine resets, but instead it provides way to trigger a reset based upon a percentage of the mine that remains. It works in conjunction with Zero Block Reset Delay too, where instead of waiting until zero blocks remain, it then applies a percentage to change the reset level. + + + +
@@ -363,7 +428,17 @@ When you successfully delete a mine, it will remove it from memory and from load
-# The Mine Data Files +# Renaming Mines + +Mines can be renamed with the `/mines rename [mineName] [newName]` command. + +The ability to rename a mine will properly update all references to the mine. + + +
+ + +# The Mine Data Files - A Warning The mine data files (and also the ranks and ladders) are stored on the server's file system as a way to store each mine's configurations. These files are intended for internal use only and should never be manually modified. When undeleting mines, you may have to rename the files so they are used the next time the server is started, but you should not change the contents. diff --git a/docs/prison_docs_102_setting_up_ranks.md b/docs/prison_docs_102_setting_up_ranks.md index 573eec30c..4dfb58053 100644 --- a/docs/prison_docs_102_setting_up_ranks.md +++ b/docs/prison_docs_102_setting_up_ranks.md @@ -32,6 +32,23 @@ Prison also provides a number of Admin based commands to manage ranks and ladder
+# New! Prison Fast Start + +Prison now has a new set of features that can help you get up and running faster than ever! `/ranks autoConfigure`. It can auto create your ranks and virtual mines, A through Z, it will link the mines to the ranks, setup the basic rank commands to provide basic access permissions for your players, and assign blocks of increasing values to all mines. All you need to do is to use the command `/mines set area` on all mines to make them physical mines. Plus there are a new features to help provide the finishing touches in almost no time. + - `/ranks autoConfigure` + - `/mines set area help` + - `/mines set tracer help` + - `/mines set size help` + - `/mines set liner help` + +Documentation pertaining to the use of the auto configuration will be coming soon. + +Keep in mind that in order to use the command `/ranks autoConfigure` you cannot have any ranks or mines defined yet. So before you create a test rank, go ahead and run the auto configure so at least that is complete. + + +
+ + #Ranks There are many different ways you can setup your Prison server and ranks is just one small part of how you can customize everything. diff --git a/docs/prison_docs_310_guide_placeholders.md b/docs/prison_docs_310_guide_placeholders.md index 93290ab24..4ce44a9c0 100644 --- a/docs/prison_docs_310_guide_placeholders.md +++ b/docs/prison_docs_310_guide_placeholders.md @@ -17,6 +17,32 @@ On the surface they appear to be simple, but there are a lot of moving parts bel Add in to the mix, that different plugins deal with placeholders in slightly different ways, and you can wind up with a challenge to get them to work under different circumstances. +
+ +# Placeholder Types and Counts + +* **Rank Related:** 4 including aliases +* **Rankup Related:** 16 including aliases + + +* **Rank Ladder Related:** 4 including aliases **times** each ladder +* **Rankup Ladder Related:** 16 including aliases **times** each ladder + + +* **Player Balance Related:** 2 including aliases +* **Player Ladder Balance Related:** 2 including aliases **times** each ladder + + +* **Mine Related:** 28 including aliases **times** each mine +* **Mine Player Related:** 14 including aliases + + +**Total base Placeholders:** 86 including aliases + + +**Total if 26 Mines and 3 Ladders:** 836 placeholder including aliases (20 + 24*3 ladder + 2 + 28*26 mines + 14) + +
@@ -31,16 +57,20 @@ There is always more than one way to do things, and the same goes for having mor # Placeholder Theory for Prison -There are two major types of placeholders in prison: Player based and Mine based. +There are two major types of placeholders in prison: Player based and Mine based. With the most recent releases of prison, there have been hybrids added that are a combination of the two. For example there are now ladder based placeholder that allow targeting ranks on a specific ladder, instead of all ladders. Also there are player mine placeholders that report on the mine stats for the mine in which the player is physically located in. The player mine placeholders have no value when the player is not in a mine, and they will change as the player goes from mine to mine. + +There are also different types of data that are returned in placeholders. Text, numbers, formatted numbers, and bar graphs. -The player based placeholders can only report on the player that is initiating the command, or request. These placeholders pertain to the player's attributes, such as rank or next rank. Internally, all of these requests must include the player's UUID, which is why you cannot just add them to a sign, since the sign does not know any player's UUID. +The player based placeholders can only report on the player that is initiating the command, or request. These placeholders pertain to the player's attributes, such as rank, next rank, their balance, how more they need before reaching the next rank, and etc. Internally, all of these requests must include the player's UUID, which is why you cannot just add them to a sign, since the sign does not know any player's UUID. -There are actually two kinds of player based placeholders. Rank placeholders that returns all of the player's current attributes for all active ladders they are associated with. For example, if they are active on four ladders, then they will have four active ranks on four ladders with possible values. So it may look something like this: `[mod][Zeus][+2][B]`, of which the ladders could be mod, donor, prestige, and default. The thing to remember about player rank placeholders is that they may return more than one value, and you cannot control the order of the values (yet). +There are actually two major kinds of player based placeholders; a third type is "related" more to mines and not specifically to the player's ranks. Rank placeholders that returns all of the player's current attributes for all active ladders they are associated with. For example, if they are active on four ladders, then they will have four active ranks on four ladders with possible values. So it may look something like this: `[mod][Zeus][+2][B]`, of which the ladders could be mod, donor, prestige, and default. The thing to remember about player rank placeholders is that they may return more than one value, and you cannot control the order of the values. -The other player based placeholders are similar to the player rank placeholders, but are specific to a single ladder. This allows you to get single placeholder, and control the order of placeholders, at the expense of having to specify multiple placeholders. +The other player based placeholders, which complements the Rank Placeholders, are the ladder placeholders that narrows the ranks down to a specific ladder. So with our example above, if you only want the ranks from the *default* ladder, that is now possible. Also you can control the order they appear by ordering the ladder placeholders in a specific sequence. The Mine based placeholders provide details about mines, and the mine name becomes part of the placeholder name. Out of all of the possible mine based placeholders, each one is duplicated for each mine. So, in rough terms, if there are different mine placeholders and you have 40 mines, then prison will generate about 400 place holders: 40 mines x 10 placeholders each = 400 placeholders for prison. +The same applies to the ladder placeholders as the mine placeholders; for every ladder, there will be a specific placeholder that represents each ladder. + Prison has integrations for direct use of providing placeholder values to to the other plugins. Some of those other plugins request placeholder values using partial placeholder names. Therefore to improve performance and to prevent having to always reconstructing the full placeholder names, prison precomputes the fragments for all placeholders. Therefore, with our example of 40 mines and 10 placeholders, the actual internal number of placeholder combinations that prison will respond to is 800: 40 mines x 10 placeholders per mine x 2 for aliases = 800 placeholders for prison. Off hand this may sound bad, but Prison utilizes enumerations for identifying placeholders, so they may be objects, but they are lightweight and helps ensure placeholders align with the code at compile time. This not only provides better performance, and less memory consumption, but programming errors and typos are caught at compile time and not runtime, so they also provide for a more stable and reliable Prison environment. @@ -54,7 +84,7 @@ Also, internally, prison only responds to the placeholder name without the escap # Rank Command Placeholders -The Rank Commands recognize only two placeholders, but they are not considered part of the standard placeholders. There are also only two placeholders that are recognized and both are case sensitive, and must also include curly braces too. +The Rank Commands recognize only two placeholders, but they are not considered part of the standard placeholders. There are also only two placeholders that are recognized and both are case sensitive (must be lower case), and must also include curly braces too. * {player} * {player_uid} @@ -78,8 +108,13 @@ There are a few commands within prison that will allow you list placeholders, se * **/prison placeholders search** * **/prison placeholders test** +* **/prison placeholders reload** + +NOTE: the `/prison placeholders reload` command only reloads and registers the placeholders with the placeholder integrations. This would be required to enable placeholders on a new mine or new ranks or a new ladder that were added since the last server restart. Also if you reload another plugin, such as papi, you will need to reload the plugins, which just re-registers them. -* **/prison version** Provides the same placeholder listing as /prison placeholders list. + + +* **/prison version** No longer provides a list of placeholders since it's become too large. @@ -93,26 +128,46 @@ Example of placeholder command listings

Prison Placeholder Listings

Prison Placeholder Listing +Prison Placeholder Listing -Example of the list of placeholders that is available through **/prison version** and **/prison placeholders list**. Please note that this list may evolve as new placeholders are added. Use these commands to get the current listing that is available on your server. +Example of the list of placeholders that is available through **/prison placeholders list**. Please note that this list may evolve as new placeholders are added. Use these commands to get the current listing that is available on your server. -

Prison Placeholder Search with Two Search Patters

+

Prison Placeholder Search with Two Search Patterns

Prison Placeholder Search -This is an example of searching for placeholders using two search patterns: *temp5* and *format*. The term temp5 is the name of a mine and is an example of a the dynamic construction of placeholders, and that you can still perform a search with them. The search patters can be any String fragment found in either the placeholder, or it's alias. +This is an example of searching for placeholders using a player's name plus two search patterns: *temp5* and *format*. The term temp5 is the name of a mine and is an example of a the dynamic construction of placeholders, and that you can still perform a search with them. The search patterns can be any String fragment found in either the placeholder, or it's alias. If more than one search pattern is provided, then all patters must hit on the same placeholder to be included in the results. They behave as a logical AND relationship. +A player's is provided, but results do not include any player, rank, or ladder entries. This shows that if a player's name is provide, it is recognized as a player and will not prevent valid hits. + + +The following example shows what the command is like when specifying the player's name, a page numer for the results, and three search parameters: + +``` +/prison placeholders search RoyalCoffeeBeans 1 rankup cost default +``` + +This example shows the current placeholder values for that player, including an example of a bar graph. + +Prison Placeholder Search

Prison Placeholder Listings - All Placeholders

-Prison Placeholder Listing +Prison Placeholder Listing In this contrived example, since all placeholders begin with "prison", this search returns a listing of all placeholders. In this example, using the current Prison v3.2.1-alpha.13 release, it has generated 65 pages of results, at 6 placeholders per page which includes the alias. +The following shows an example of all placeholders that are active with Prison_v3.2.2-alpha.10.jar. It includes a total of 1,294 placeholders, on 108 pages. This is based upon 4 ladders, 13 ranks, and 41 mines. + + +Prison Placeholder Listing + + +

Prison Placeholder Listings

@@ -251,6 +306,7 @@ temp5: - 'Welcome to Prison Mine: temp5' - 'Reset Interval: {slowest}%prison_mines_interval_temp5% - {slowest}%prison_mines_interval_formatted_temp5%' - 'Reset Time Left: {medium}%prison_mines_timeleft_temp5% - {fast}%prison_mtlf_temp5%' + - 'Reset Time Left: {slowest}%prison_mines_timeleft_bar_temp5%' - 'Reset Count: {medium}%prison_mines_reset_count_temp5%' - 'Mine Size: {slowest}%prison_mines_size_temp5%' - 'Blocks Remaining: {slowest}%prison_mr_temp5% {slowest}%prison_mp_temp5%%' @@ -259,6 +315,10 @@ temp5: Notice that the prison placeholders are wrapped in the % % escape characters. The prefixed placeholders such as {slowest} and {fast} are for the plugin HolographicExtensions and they control how frequently the placeholders are refreshed. +This is an example of the above settings, including the bar graph. Notice that the bar graph's properties can be adjusted for both the characters that are used, and the total number of characters (width). See the configuration within the file `/plugins/Prison/config.yml`. +Prison Holographic Displays + + Once you update and save the database.yml file, you can have HolographicDisaplys reload from the files: ``` diff --git a/gradle.properties b/gradle.properties index 88361bce4..e98ec377c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ ## # This is actually the "correct" place to define the version for the project. ## # Used within build.gradle with ${project.version}. ## # Can be overridden on the command line: gradle -Pversion=3.2.1-alpha.3 -version=3.2.1-alpha.20 +version=3.2.2-alpha.14 ## org.gradle.warning.mode=(all,none,summary) org.gradle.warning.mode=all diff --git a/knownissues_v3.2.x.md b/knownissues_v3.2.x.md index 7b22aff0a..ee9ae611b 100644 --- a/knownissues_v3.2.x.md +++ b/knownissues_v3.2.x.md @@ -7,11 +7,66 @@ 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. -# To Do Items - During Beta v3.2.1 +# To Do Items - During Alpha v3.2.2 -* **Rename Mines** -Been a few requests to be able to rename mines. Since so much can go wrong with manually changing the files, this should be a reasonable new feature added before beta. +* **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 + + + +* **Combine a few commands & Other short Notes:** + - 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. + + + +* **Save the liner settings for each mine** +Currently is not saved and have to manually reissue each time. +Save all six faces and include pattern and if forced +Add command to regenerate, or reapply, the liners. +Add liner details to mines info + + + +* **DONE: Add numeric abbreviations on rank costs** + K, M, B, T, Q, etc... + New placeholder? Formatted? + https://en.wikipedia.org/wiki/Metric_prefix Use Prefix Symbol column. + + +* **ranks autoConfigure - Feature Ideas** +- option for using EssentialsX warps instead: essentials.warps. +- DONE: Generate default blocks for all mines. +- DONE: Add perms for /mines tp +- DONE: Perm names: mines.tp., mines. + + +* **Commands - Enhancement** +Be able to select rank and mine commands for edit and deletion, or even moving, with line numbers. + + +* **DONE: EXP with auto pickup** +For certain blocks such as coal, diamonds, other... provide xp... * **New Block Model - Implement in parallel** @@ -29,22 +84,10 @@ Implement and have a fully functional new block handling mechanism that operate -* **Rework commands within the spigot module so all user facing commands are routed through Prison's Command Interface** +* **DONE? Rework commands within the spigot module so all user facing commands are routed through Prison's Command Interface** Blue should work on this. - - - - * **Problem with rank removal from Ladders** -Create a new rank to the default ladder. Add a player to it. Then remove the rank from the ladder. - -The ladder no longer contains the rank. But the player is still associated with the rank, but yet ranks cannot contain players if they are not on a ladder. The commands expect a valid ladder name. Also there does not appear to be any checks and balances when ranks are moved from one ladder to the other since ranks have no idea what ladder they are in. - -This could cause major corruption if moving ranks between ladders, removing ranks from a ladder, and players being associated with those ranks. - -Create a "void" ladder and prevent ladders from being named: default, void, and prestige. When a rank is removed from a ladder, place it in to none and update all players that use that rank so the rank is still valid. Do not include void ladders in placeholders. - * **Update config.yml when changes are detected** @@ -292,6 +335,22 @@ I think those few integrations could really provide a huge bootstrap to getting # Features recently added: + + +* **DONE: Rename Mines** +Been a few requests to be able to rename mines. Since so much can go wrong with manually changing the files, this should be a reasonable new feature added before beta. + + + + * **Fixed: Problem with rank removal from Ladders** + This was fixed a few weeks ago. Parts of the code was rewritten when implementing the new mine sortOrder code. The bugs were found and fixed at that time. There is not a new ladder, but the concept of "none" as a ladder exists virtually. During prison startup all ladders and ranks are displayed within the prison startup details and none is always listed there. +- Create a new rank to the default ladder. Add a player to it. Then remove the rank from the ladder. +- The ladder no longer contains the rank. But the player is still associated with the rank, but yet ranks cannot contain players if they are not on a ladder. The commands expect a valid ladder name. Also there does not appear to be any checks and balances when ranks are moved from one ladder to the other since ranks have no idea what ladder they are in. +- This could cause major corruption if moving ranks between ladders, removing ranks from a ladder, and players being associated with those ranks. +- Create a "void" ladder and prevent ladders from being named: default, void, and prestige. When a rank is removed from a ladder, place it in to none and update all players that use that rank so the rank is still valid. Do not include void ladders in placeholders. + + + * **Done: Prestige references** Add the prestige command to the /prison version page; rework the commands layout. diff --git a/prison-core/src/main/java/tech/mcprison/prison/Prison.java b/prison-core/src/main/java/tech/mcprison/prison/Prison.java index 50b699c24..7287907b6 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/Prison.java +++ b/prison-core/src/main/java/tech/mcprison/prison/Prison.java @@ -25,9 +25,9 @@ import tech.mcprison.prison.alerts.Alerts; import tech.mcprison.prison.commands.CommandHandler; -import tech.mcprison.prison.error.Error; import tech.mcprison.prison.error.ErrorManager; import tech.mcprison.prison.integration.IntegrationManager; +import tech.mcprison.prison.internal.block.PrisonBlockTypes; import tech.mcprison.prison.internal.platform.Platform; import tech.mcprison.prison.localization.LocaleManager; import tech.mcprison.prison.modules.Module; @@ -37,9 +37,7 @@ import tech.mcprison.prison.selection.SelectionManager; import tech.mcprison.prison.store.Database; import tech.mcprison.prison.troubleshoot.TroubleshootManager; -import tech.mcprison.prison.troubleshoot.inbuilt.ItemTroubleshooter; import tech.mcprison.prison.util.EventExceptionHandler; -import tech.mcprison.prison.util.ItemManager; /** * Entry point for implementations.

An instance of Prison can be retrieved using the static @@ -81,11 +79,13 @@ public class Prison private SelectionManager selectionManager; private EventBus eventBus; private LocaleManager localeManager; - private ItemManager itemManager; +// private ItemManager itemManager; private ErrorManager errorManager; private TroubleshootManager troubleshootManager; private IntegrationManager integrationManager; private Database metaDatabase; + + private PrisonBlockTypes prisonBlockTypes; /** * Gets the current instance of this class.

An instance will always be available after @@ -133,6 +133,17 @@ public boolean init(Platform platform, String minecraftVersion) { this.prisonCommands = new PrisonCommand(); this.commandHandler.registerCommands(prisonCommands); + + + // Setup hooks in to the valid prison block types. This will be only + // the block types that have tested to be valid on the server that is + // running prison. This provides full compatibility to the admins that + // if a block is listed, then it's usable. No more guessing or finding + // out after the fact that a block that was used was invalid for + // their version of minecraft. + this.prisonBlockTypes = new PrisonBlockTypes(); + this.prisonBlockTypes.loadServerBlockTypes(); + long stopTime = System.currentTimeMillis(); @@ -206,19 +217,20 @@ private void initManagers() { this.selectionManager = new SelectionManager(); this.troubleshootManager = new TroubleshootManager(); this.integrationManager = new IntegrationManager(); + - try { - this.itemManager = new ItemManager(); - } catch (Exception e) { - this.errorManager.throwError(new Error( - "Error while loading items.csv. Try running /prison troubleshoot item_scan.") - .appendStackTrace("when loading items.csv", e)); - Output.get().logError("Try running /prison troubleshoot item_scan."); - } +// try { +// this.itemManager = new ItemManager(); +// } catch (Exception e) { +// this.errorManager.throwError(new Error( +// "Error while loading items.csv. Try running /prison troubleshoot item_scan.") +// .appendStackTrace("when loading items.csv", e)); +// Output.get().logError("Try running /prison troubleshoot item_scan."); +// } } private void registerInbuiltTroubleshooters() { - PrisonAPI.getTroubleshootManager().registerTroubleshooter(new ItemTroubleshooter()); +// PrisonAPI.getTroubleshootManager().registerTroubleshooter(new ItemTroubleshooter()); } private void scheduleAlertNagger() { @@ -335,12 +347,12 @@ public SelectionManager getSelectionManager() { return selectionManager; } - /** - * Returns the item manager, which manages the "friendly" names of items - */ - public ItemManager getItemManager() { - return itemManager; - } +// /** +// * Returns the item manager, which manages the "friendly" names of items +// */ +// public ItemManager getItemManager() { +// return itemManager; +// } /** * Returns the meta database, which is used to store data from within the core. @@ -363,4 +375,16 @@ public IntegrationManager getIntegrationManager() { return integrationManager; } + /** + * Setup hooks in to the valid prison block types. This will be only the + * block types that have tested to be valid on the server that is running + * prison. This provides full compatibility to the admins that if a block + * is listed, then it's usable. No more guessing or finding out after the + * fact that a block that was used was invalid for their version of minecraft. + */ + public PrisonBlockTypes getPrisonBlockTypes() { + return prisonBlockTypes; + } + + } diff --git a/prison-core/src/main/java/tech/mcprison/prison/PrisonAPI.java b/prison-core/src/main/java/tech/mcprison/prison/PrisonAPI.java index d04a3b099..74a09e64d 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/PrisonAPI.java +++ b/prison-core/src/main/java/tech/mcprison/prison/PrisonAPI.java @@ -11,7 +11,6 @@ import tech.mcprison.prison.commands.CommandHandler; import tech.mcprison.prison.commands.PluginCommand; -import tech.mcprison.prison.gui.GUI; import tech.mcprison.prison.integration.IntegrationManager; import tech.mcprison.prison.internal.Player; import tech.mcprison.prison.internal.Scheduler; @@ -22,7 +21,6 @@ import tech.mcprison.prison.modules.ModuleManager; import tech.mcprison.prison.store.Storage; import tech.mcprison.prison.troubleshoot.TroubleshootManager; -import tech.mcprison.prison.util.ItemManager; import tech.mcprison.prison.util.Location; /** @@ -45,9 +43,9 @@ public static EventBus getEventBus() { return Prison.get().getEventBus(); } - public static ItemManager getItemManager() { - return Prison.get().getItemManager(); - } +// public static ItemManager getItemManager() { +// return Prison.get().getItemManager(); +// } public static Optional getWorld(String name) { return Prison.get().getPlatform().getWorld(name); @@ -97,9 +95,9 @@ public static Scheduler getScheduler() { return Prison.get().getPlatform().getScheduler(); } - public static GUI createGUI(String title, int numRows) { - return Prison.get().getPlatform().createGUI(title, numRows); - } +// public static GUI createGUI(String title, int numRows) { +// return Prison.get().getPlatform().createGUI(title, numRows); +// } @Deprecated public static void toggleDoor(Location doorLocation) { Prison.get().getPlatform().toggleDoor(doorLocation); 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 24d31fd45..117ea07e1 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/PrisonCommand.java +++ b/prison-core/src/main/java/tech/mcprison/prison/PrisonCommand.java @@ -390,13 +390,19 @@ public void troubleshootListCommand(CommandSender sender) { onlyPlayers = false, permissions = "prison.placeholder") public void placeholdersTestCommand(CommandSender sender, @Wildcard(join=true) - @Arg(name = "text", description = "Placeholder text to test" ) String text ) { + @Arg(name = "text", + description = "Placeholder text to test using { } as escape characters" ) String text ) { ChatDisplay display = new ChatDisplay("Placeholder Test"); BulletedListComponent.BulletedListBuilder builder = new BulletedListComponent.BulletedListBuilder(); + if ( text.contains( "%" )) { + Output.get().logInfo( "&3You cannot use &7%%&3 as escape characters. Use &7{ }&3 instead." ); + return; + } + Player player = getPlayer( sender ); UUID playerUuid = (player == null ? null : player.getUUID()); String translated = Prison.get().getPlatform().getPlaceholders() @@ -643,7 +649,7 @@ public void autoFeaturesInformation(CommandSender sender) { display.text( "&7 Tool lore examples: Pickup, Pickup 7.13, Smelt 55, Block 75.123" ); display.text( "&a To configure modify plugin/Prison/autoFeaturesConfig.yml"); - display.text( "&a Or use &7/prison gui"); + display.text( "&a Or better yet, you can use the &7/prison gui"); List afs = AutoFeatures.permissions.getChildren(); StringBuilder sb = new StringBuilder(); diff --git a/prison-core/src/main/java/tech/mcprison/prison/alerts/AlertCommands.java b/prison-core/src/main/java/tech/mcprison/prison/alerts/AlertCommands.java index 450befa7b..3952ce63d 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/alerts/AlertCommands.java +++ b/prison-core/src/main/java/tech/mcprison/prison/alerts/AlertCommands.java @@ -1,16 +1,16 @@ package tech.mcprison.prison.alerts; +import java.util.ArrayList; +import java.util.List; + import tech.mcprison.prison.Prison; import tech.mcprison.prison.commands.Command; import tech.mcprison.prison.internal.CommandSender; import tech.mcprison.prison.internal.Player; -import tech.mcprison.prison.localization.Localizable; import tech.mcprison.prison.output.BulletedListComponent; import tech.mcprison.prison.output.ChatDisplay; import tech.mcprison.prison.output.Output; -import java.util.List; - /** * @author Faizaan A. Datoo */ @@ -20,39 +20,53 @@ public AlertCommands() { Prison.get().getCommandHandler().registerCommands(this); } - @Command(identifier = "prison alerts", description = "Lists your alerts.", permissions = "prison.alerts") + @Command(identifier = "prison alerts", description = "Lists your alerts.", + permissions = "prison.alerts", onlyPlayers = false ) public void prisonAlertsCommand(CommandSender sender) { - if (!(sender instanceof Player)) { - Prison.get().getLocaleManager().getLocalizable("cantAsConsole") - .sendTo(sender, Localizable.Level.ERROR); - return; - } - Player player = (Player) sender; +// if (!(sender instanceof Player)) { +// Prison.get().getLocaleManager().getLocalizable("cantAsConsole") +// .sendTo(sender, LogLevel.ERROR); +// return; +// } + + List alerts = new ArrayList<>(); - ChatDisplay display = new ChatDisplay("Alerts"); + ChatDisplay display = new ChatDisplay("Alerts"); - List alerts = Alerts.getInstance().getAlertsFor(player.getUUID()); - if (alerts.size() == 0) { - Output.get().sendInfo(player, "You have no alerts."); - return; + BulletedListComponent.BulletedListBuilder builder = + new BulletedListComponent.BulletedListBuilder(); + + + if ((sender instanceof Player)) { + Player player = (Player) sender; + + alerts = Alerts.getInstance().getAlertsFor(player.getUUID()); } - BulletedListComponent.BulletedListBuilder builder = - new BulletedListComponent.BulletedListBuilder(); alerts.forEach(alert -> builder.add(alert.message)); display.addComponent(builder.build()); - display.text("&8Type /prison alerts clear to clear your alerts."); - display.text("&8Type /prison alerts clearall to clear everyone's alerts."); - - display.send(player); + if (alerts.size() == 0) { + Output.get().sendInfo(sender, "There are no alerts."); + } + else { + + display.text("&8Type /prison alerts clear to clear your alerts."); + display.text("&8Type /prison alerts clearall to clear everyone's alerts."); + + display.send(sender); + } } - @Command(identifier = "prison alerts clear", description = "Clears your alerts.", permissions = "prison.alerts.clear") + @Command(identifier = "prison alerts clear", description = "Clears your alerts.", + permissions = "prison.alerts.clear", onlyPlayers = false ) public void prisonAlertsClearCommand(CommandSender sender) { if (!(sender instanceof Player)) { - Prison.get().getLocaleManager().getLocalizable("cantAsConsole") - .sendTo(sender, Localizable.Level.ERROR); + + // If console, then clear all since there is no "Player" to use: + prisonAlertsClearAllCommand( sender ); +// Prison.get().getLocaleManager().getLocalizable("cantAsConsole") +// .sendTo(sender, LogLevel.ERROR); return; } Player player = (Player) sender; @@ -67,17 +81,19 @@ public void prisonAlertsClearCommand(CommandSender sender) { Output.get().sendInfo(player, "Your alerts have been cleared."); } - @Command(identifier = "prison alerts clearall", description = "Clears the alerts for the whole server.", permissions = "prison.alerts.clear.all") + @Command(identifier = "prison alerts clearall", + description = "Clears the alerts for the whole server.", + permissions = "prison.alerts.clear.all", onlyPlayers = false ) public void prisonAlertsClearAllCommand(CommandSender sender) { - if (!(sender instanceof Player)) { - Prison.get().getLocaleManager().getLocalizable("cantAsConsole") - .sendTo(sender, Localizable.Level.ERROR); - return; - } - Player player = (Player) sender; +// if (!(sender instanceof Player)) { +// Prison.get().getLocaleManager().getLocalizable("cantAsConsole") +// .sendTo(sender, LogLevel.ERROR); +// return; +// } +// Player player = (Player) sender; Alerts.getInstance().clearAll(); - Output.get().sendInfo(player, "All alerts have been cleared."); + Output.get().sendInfo(sender, "All alerts have been cleared."); } } 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 6fb90d89a..67b8cd2a1 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 @@ -38,6 +38,9 @@ public enum AutoFeatures { isCalculateFortuneEnabled(general, true), isCalculateSilkEnabled(general, true), + isCalculateXPEnabled(general, true), + givePlayerXPAsOrbDrops(general, true), + dropItemsIfInventoryIsFull(general, true), playSoundIfInventoryIsFull(general, true), hologramIfInventoryIsFull(general, false), diff --git a/prison-core/src/main/java/tech/mcprison/prison/commands/BaseCommands.java b/prison-core/src/main/java/tech/mcprison/prison/commands/BaseCommands.java new file mode 100644 index 000000000..ea69d4cc7 --- /dev/null +++ b/prison-core/src/main/java/tech/mcprison/prison/commands/BaseCommands.java @@ -0,0 +1,82 @@ +package tech.mcprison.prison.commands; + +import java.util.Optional; + +import tech.mcprison.prison.Prison; +import tech.mcprison.prison.PrisonAPI; +import tech.mcprison.prison.integration.EconomyCurrencyIntegration; +import tech.mcprison.prison.integration.EconomyIntegration; +import tech.mcprison.prison.internal.CommandSender; +import tech.mcprison.prison.internal.Player; +import tech.mcprison.prison.output.Output; + +public abstract class BaseCommands +{ + private String cmdGroup; + + public BaseCommands( String cmdGroup ) { + this.cmdGroup = cmdGroup; + } + + public String getCmdGroup() { + return cmdGroup; + } + public void setCmdGroup( String cmdGroup ) { + this.cmdGroup = cmdGroup; + } + + + /** + *

Gets a player by name. If the player is not online, then try to get them from + * the offline player list. If not one is found, then return a null. + *

+ * + * @param sender + * @param playerName is optional, if not supplied, then sender will be used + * @return Player if found, or null. + */ + public Player getPlayer( CommandSender sender, String playerName ) { + Player result = null; + + playerName = playerName != null ? playerName : sender != null ? sender.getName() : null; + + //Output.get().logInfo("RanksCommands.getPlayer :: playerName = " + playerName ); + + if ( playerName != null ) { + Optional opt = Prison.get().getPlatform().getPlayer( playerName ); + if ( !opt.isPresent() ) { + opt = Prison.get().getPlatform().getOfflinePlayer( playerName ); + } + if ( opt.isPresent() ) { + result = opt.get(); + } + } + return result; + } + + public double getPlayerBalance( Player player ) { + + EconomyIntegration economy = PrisonAPI.getIntegrationManager().getEconomy(); + + return economy.getBalance( player ); + } + + public double getPlayerBalance( Player player, String currency ) { + + + EconomyCurrencyIntegration currencyEcon = PrisonAPI.getIntegrationManager() + .getEconomyForCurrency( currency ); + if ( currencyEcon == null ) { + // ERROR: currency is not supported + Output.get().logInfo( "The currency %s is not supported. Therefore there is no blance.", + currency ); + return 0; + } + else { + return currencyEcon.getBalance( player, currency ); + } + + } + + +} diff --git a/prison-core/src/main/java/tech/mcprison/prison/commands/Command.java b/prison-core/src/main/java/tech/mcprison/prison/commands/Command.java index 42174d4fa..2e0554598 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/commands/Command.java +++ b/prison-core/src/main/java/tech/mcprison/prison/commands/Command.java @@ -25,13 +25,15 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -@Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) public @interface Command { /** * The description of this command */ - String description() default ""; + public String description() default ""; /** * The identifier describes what command definition this will bind to. Spliced by spaces, you can @@ -41,21 +43,21 @@ * command by writing (if the root command does not choose an alias instead):
{@code /root * sub1 sub2}
*/ - String identifier(); + public String identifier(); /** * If this command can only be executed by players (default true).
If you turn this to false, * the first parameter in the method must be the {@link CommandSender} to avoid {@link * ClassCastException} */ - boolean onlyPlayers() default true; + public boolean onlyPlayers() default true; /** * The permissions to check if the user have before execution. If it is empty the command does not * require any permission.

If the user don't have one of the permissions, they will get an * error message stating that they do not have permission to use the command. */ - String[] permissions() default {}; + public String[] permissions() default {}; /** @@ -77,5 +79,16 @@ * was not available before. * */ - String[] altPermissions() default {}; + public String[] altPermissions() default {}; + + + /** + * The aliases field provides the ability to define one or more aliases to register a given + * command with Bukkit. + * + * @return + */ + public String[] aliases() default {}; + + } diff --git a/prison-core/src/main/java/tech/mcprison/prison/commands/CommandHandler.java b/prison-core/src/main/java/tech/mcprison/prison/commands/CommandHandler.java index bbf55a00f..8185b00a0 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/commands/CommandHandler.java +++ b/prison-core/src/main/java/tech/mcprison/prison/commands/CommandHandler.java @@ -18,28 +18,75 @@ package tech.mcprison.prison.commands; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.TreeSet; + import tech.mcprison.prison.Prison; -import tech.mcprison.prison.commands.handlers.*; +import tech.mcprison.prison.commands.handlers.BlockArgumentHandler; +import tech.mcprison.prison.commands.handlers.DoubleArgumentHandler; +import tech.mcprison.prison.commands.handlers.IntegerArgumentHandler; +import tech.mcprison.prison.commands.handlers.PlayerArgumentHandler; +import tech.mcprison.prison.commands.handlers.StringArgumentHandler; +import tech.mcprison.prison.commands.handlers.WorldArgumentHandler; import tech.mcprison.prison.internal.CommandSender; import tech.mcprison.prison.internal.Player; import tech.mcprison.prison.internal.World; -import tech.mcprison.prison.localization.Localizable; +import tech.mcprison.prison.output.LogLevel; +import tech.mcprison.prison.output.Output; import tech.mcprison.prison.util.BlockType; import tech.mcprison.prison.util.ChatColor; -import java.lang.reflect.Method; -import java.util.*; - public class CommandHandler { - // TODO unregisterCommands method, to fix argument duplication on module re-enable + public static final String COMMAND_PRIMARY_ROOT_COMMAND = "prison"; + public static final String COMMAND_FALLBACK_PREFIX = "prison"; + public static final String COMMAND_HELP_TEXT = "help"; + + + private Map registeredCommands; + private TreeSet allRegisteredCommands; + private Prison plugin; private Map, ArgumentHandler> argumentHandlers = new HashMap, ArgumentHandler>(); private Map rootCommands = new HashMap<>(); + +// private List commands = new ArrayList<>(); + + + private TabCompleaterData tabCompleaterData; + +// private String helpSuffix = "help"; + + public CommandHandler() { + this.plugin = Prison.get(); + + this.registeredCommands = new TreeMap<>(); + this.allRegisteredCommands = new TreeSet<>(); + + this.tabCompleaterData = new TabCompleaterData(); + + + registerArgumentHandler(String.class, new StringArgumentHandler()); + registerArgumentHandler(int.class, new IntegerArgumentHandler()); + registerArgumentHandler(double.class, new DoubleArgumentHandler()); + registerArgumentHandler(Player.class, new PlayerArgumentHandler()); + registerArgumentHandler(World.class, new WorldArgumentHandler()); + registerArgumentHandler(BlockType.class, new BlockArgumentHandler()); + } + + + + private PermissionHandler permissionHandler = (sender, permissions) -> { for (String perm : permissions) { if (!sender.hasPermission(perm)) { @@ -132,6 +179,29 @@ public String[] getHelpMessage(RegisteredCommand command) { } } + if ( command.getAliases() != null && command.getAliases().length > 0 ) { + + StringBuilder sb = new StringBuilder(); + + if ( command.getAliases() != null && command.getAliases().length > 0 ) { + for ( String perm : command.getAliases() ) { + if ( sb.length() > 0 ) { + sb.append( " " ); + } + sb.append( ChatColor.DARK_BLUE ).append( "[" ) + .append( ChatColor.AQUA ).append( perm ) + .append( ChatColor.DARK_BLUE ).append( "]" ); + } + } + + if ( sb.length() > 0 ) { + message.add(ChatColor.DARK_AQUA + "Aliases:"); + + sb.insert( 0, " " ); + message.add( sb.toString() ); + } + + } } List subcommands = command.getSuffixes(); @@ -143,10 +213,13 @@ public String[] getHelpMessage(RegisteredCommand command) { String subCmd = scommand.getUsage(); int subCmdSubCnt = scommand.getSuffixes().size(); + String subCommands = (subCmdSubCnt <= 1 ? "" : + ChatColor.DARK_AQUA + "(" + subCmdSubCnt + " Subcommands)"); + + String isAlias = scommand.isAlias() ? ChatColor.DARK_AQUA + " Alias" : ""; - subCommandSet.add(subCmd + (subCmdSubCnt <= 1 ? "" : - ChatColor.DARK_AQUA + " (" + subCmdSubCnt + - " Subcommands)")); + subCommandSet.add( + String.format( "%s %s %s", subCmd, subCommands, isAlias )); } for (String subCmd : subCommandSet) { @@ -154,37 +227,170 @@ public String[] getHelpMessage(RegisteredCommand command) { } } - if ( command.getLabel().equalsIgnoreCase( "prison" ) && rootCommands.size() > 1 ) { - message.add(ChatColor.DARK_AQUA + "Prison Root Commands:"); + if ( command.getLabel().equalsIgnoreCase( COMMAND_PRIMARY_ROOT_COMMAND ) && + rootCommands.size() > 1 ) { + + ArrayList rootCommandsMessages = buildHelpRootCommands(); + if ( rootCommandsMessages.size() > 1 ) { + message.addAll( rootCommandsMessages ); + } + + ArrayList aliasesMessages = buildHelpAliases(); + if ( aliasesMessages.size() > 1 ) { + message.addAll( aliasesMessages ); + } + } + + + return message.toArray(new String[0]); + } + + private ArrayList buildHelpRootCommands() { + ArrayList message = new ArrayList<>(); + + message.add(ChatColor.DARK_AQUA + "Root Commands:"); // Force a sorting by use of a TreeSet. Collections.sort() would not work. TreeSet rootCommandSet = new TreeSet<>(); // Try adding in all other root commands: - Set rootKeys = rootCommands.keySet(); + Set rootKeys = getRootCommands().keySet(); for ( PluginCommand rootKey : rootKeys ) { - String rootCmd = rootKey.getUsage(); + StringBuilder sbAliases = new StringBuilder(); + + // Do not list aliases: + if ( !(rootKey.getRegisteredCommand().isAlias() && rootKey.getRegisteredCommand().getParentOfAlias() != null) ) { +// String isAlias = rootKey.getRegisteredCommand().isAlias() ? ChatColor.DARK_AQUA + " Alias" : ""; +// if ( rootKey.getRegisteredCommand().getRegisteredAliases().size() > 0 ) { +// for ( RegisteredCommand alias : rootKey.getRegisteredCommand().getRegisteredAliases() ) { +// +// sbAliases.append( ChatColor.DARK_BLUE ).append( "[" ).append( ChatColor.AQUA ).append( "/" ) +// .append( getRootCommandRegisteredLabel(alias) ) +// .append( ChatColor.DARK_BLUE ).append( "] " ); +// } +// sbAliases.insert( 0, +// new StringBuilder().append( ChatColor.DARK_AQUA ). +// append( "Aliases: " ).append( ChatColor.AQUA )); +// } + String rootCmd = + String.format( "%s %s", + rootKey.getUsage(), sbAliases.toString() ); + rootCommandSet.add( rootCmd ); + } + } for (String rootCmd : rootCommandSet) { message.add(rootCmd); } + + return message; } + /** + * This builds a list of all the aliases that exist. + * + * @return + */ + private ArrayList buildHelpAliases() { + ArrayList message = new ArrayList<>(); + + message.add(ChatColor.DARK_AQUA + "Aliases:"); - return message.toArray(new String[0]); + // Force a sorting by use of a TreeSet. Collections.sort() would not work. + TreeSet aliasesSet = new TreeSet<>(); + + + for ( RegisteredCommand regCmd : getAllRegisteredCommands() ) { + buildHelpAliasMessage( regCmd, aliasesSet ); +// plugin.logDebug( "### CommandHandler.buildHelpAliases ### test: %s ", regCmd.toString() ); + } + + +// // Try adding in all other root commands: +// Set rootKeys = getRootCommands().keySet(); +// for ( PluginCommand rootKey : rootKeys ) { +// +// plugin.logDebug( "### CommandHandler.buildHelpAliases ### rootCommands: %s ", rootKey.toString() ); +// RegisteredCommand registeredCommand = rootKey.getRegisteredCommand(); +// +// buildHelpAliases( registeredCommand, aliasesSet ); +// } + + // Sorted results, add to the List: + for (String rootCmd : aliasesSet) { + message.add(rootCmd); + } + + return message; + } + +// private void buildHelpAliases( RegisteredCommand registeredCommand, TreeSet aliasesSet ) { +// buildHelpAliasMessage( registeredCommand, aliasesSet ); +// +// plugin.logDebug( "### CommandHandler.buildHelpAliases ### : %s ", registeredCommand.toString() ); +// +// for ( RegisteredCommand suffixRegCmd : registeredCommand.getSuffixes() ) { +// +// buildHelpAliases( suffixRegCmd, aliasesSet ); +// } +// +// } + + private void buildHelpAliasMessage( RegisteredCommand registeredCommand, TreeSet aliasesSet ) { + if ( registeredCommand.isAlias() && registeredCommand.getParentOfAlias() != null) { + + StringBuilder sbAliases = new StringBuilder(); + + sbAliases.append( ChatColor.DARK_BLUE ).append( "(" ).append( ChatColor.AQUA ) + .append( registeredCommand.getParentOfAlias().getUsage() ) + .append( ChatColor.DARK_BLUE ).append( ")" ); + + String rootCmd = + String.format( "%s %s", + registeredCommand.getUsage(), + sbAliases.toString() ); + + aliasesSet.add( rootCmd ); + } } - @Override public String getUsage(RegisteredCommand command) { + /** + *

If the registration of this command was not successful as the original + * label, it would have had the fallback prefix added until the command + * was unique. Therefore, use that registered label instead so the users + * will know what command they need to enter. + *

+ * + * @param label + * @param command + * @return + */ + private String getRootCommandRegisteredLabel(RegisteredCommand command ) { + String commandLabel = command.getLabel(); + if ( command instanceof RootCommand ) { + RootCommand rootCommand = (RootCommand) command; + if ( rootCommand.getBukkitCommand().getLabelRegistered() != null ) { + commandLabel = rootCommand.getBukkitCommand().getLabelRegistered(); + } + } + return commandLabel; + } + + @Override + public String getUsage(RegisteredCommand command) { StringBuilder usage = new StringBuilder(); - usage.append(command.getLabel()); + + String cmdLabel = getRootCommandRegisteredLabel( command ); + usage.append(cmdLabel); RegisteredCommand parent = command.getParent(); while (parent != null) { - usage.insert(0, parent.getLabel() + " "); + String label = getRootCommandRegisteredLabel( parent ); + usage.insert(0, label + " "); parent = parent.getParent(); } @@ -218,18 +424,6 @@ public String[] getHelpMessage(RegisteredCommand command) { } }; - private String helpSuffix = "help"; - - public CommandHandler() { - this.plugin = Prison.get(); - - registerArgumentHandler(String.class, new StringArgumentHandler()); - registerArgumentHandler(int.class, new IntegerArgumentHandler()); - registerArgumentHandler(double.class, new DoubleArgumentHandler()); - registerArgumentHandler(Player.class, new PlayerArgumentHandler()); - registerArgumentHandler(World.class, new WorldArgumentHandler()); - registerArgumentHandler(BlockType.class, new BlockArgumentHandler()); - } @SuppressWarnings("unchecked") public ArgumentHandler getArgumentHandler(Class clazz) { @@ -256,80 +450,181 @@ public void registerArgumentHandler(Class clazz, ArgumentHandler argHandler) { if (argumentHandlers.get(clazz) != null) { throw new IllegalArgumentException( - "The is already a ArgumentHandler bound to the class " + clazz.getName() + "."); + "There is already a ArgumentHandler bound to the class " + clazz.getName() + "."); } argHandler.handler = this; argumentHandlers.put(clazz, argHandler); } - public void registerCommands(Object commands) { - for (Method method : commands.getClass().getDeclaredMethods()) { + public void registerCommands(Object methodInstance) { + + // Keep a reference to the registered command object so it can be + // accessed in the future if needed for other uses. + getRegisteredCommands().put( methodInstance.getClass().getSimpleName(), methodInstance ); + + for (Method method : methodInstance.getClass().getDeclaredMethods()) { Command commandAnno = method.getAnnotation(Command.class); if (commandAnno == null) { continue; } - String[] identifiers = commandAnno.identifier().split(" "); + RegisteredCommand mainCommand = commandRegisterConfig( method, commandAnno, methodInstance ); + + if ( commandAnno.aliases() != null && commandAnno.aliases().length > 0 ) { + + for ( String alias : commandAnno.aliases() ) + { + RegisteredCommand aliasCommand = commandRegisterConfig( method, commandAnno, methodInstance, alias ); + + // Add the alias to the primary RegisteredCommand to track it's own aliases: + mainCommand.getRegisteredAliases().add( aliasCommand ); + aliasCommand.setParentOfAlias( mainCommand ); + } + + } + + } + } + + private RegisteredCommand commandRegisterConfig( Method method, Command commandAnno, Object methodInstance ) { + return commandRegisterConfig( method, commandAnno, methodInstance, null ); + } + + private RegisteredCommand commandRegisterConfig( Method method, Command commandAnno, Object methodInstance, String alias ) { + String[] identifiers = ( alias == null ? commandAnno.identifier() : alias).split(" "); + if (identifiers.length == 0) { throw new RegisterCommandMethodException(method, "Invalid identifiers"); } - Optional rootPcommandOptional = - plugin.getPlatform().getCommand(identifiers[0]); - PluginCommand rootPcommand; + String label = identifiers[0]; - if (!rootPcommandOptional.isPresent()) { - rootPcommand = new PluginCommand(identifiers[0], commandAnno.description(), - "/" + identifiers[0]); - plugin.getPlatform().registerCommand(rootPcommand); - } else { - rootPcommand = rootPcommandOptional.get(); - } + PluginCommand rootPluginCommand = plugin.getPlatform().getCommand(label).orElse( null ); - RegisteredCommand mainCommand = rootCommands - .computeIfAbsent(rootPcommand, k -> new RootCommand(rootPcommand, this)); + if ( rootPluginCommand == null ) { + rootPluginCommand = new PluginCommand(label, + commandAnno.description(), + "/" + label, + commandAnno.aliases() ); + plugin.getPlatform().registerCommand(rootPluginCommand); + } + + // If getRootCommands() does not contain the rootPCommand then add it: + if ( !getRootCommands().containsKey( rootPluginCommand ) ) { + RootCommand rootRegisteredCommand = new RootCommand( rootPluginCommand, this ); + rootRegisteredCommand.setAlias( alias != null ); + + // Must add all new RegisteredCommand objects to both getAllRegisteredCommands() and + // getTabCompleterData(). + getAllRegisteredCommands().add( rootRegisteredCommand ); + getTabCompleaterData().add( rootRegisteredCommand ); + + getRootCommands().put( rootPluginCommand, rootRegisteredCommand ); + } + + RegisteredCommand mainCommand = getRootCommands().get( rootPluginCommand ); + for (int i = 1; i < identifiers.length; i++) { String suffix = identifiers[i]; if (mainCommand.doesSuffixCommandExist(suffix)) { mainCommand = mainCommand.getSuffixCommand(suffix); } else { RegisteredCommand newCommand = new RegisteredCommand(suffix, this, mainCommand); + newCommand.setAlias( alias != null ); mainCommand.addSuffixCommand(suffix, newCommand); + + // Must add all new RegisteredCommand objects to both getAllRegisteredCommands() and + // getTabCompleterData(). + getAllRegisteredCommands().add( newCommand ); + getTabCompleaterData().add( newCommand ); + mainCommand = newCommand; } } - mainCommand.set(commands, method); - } - } + // Associate the last RegisteredCommand (mainCommand) with the rootPCommand since that is + // the leaf-node that will be tied to the registered command, especially with aliases: + rootPluginCommand.setRegisteredCommand( mainCommand ); + - public String getHelpSuffix() { - return helpSuffix; - } + // Validate that the first parameter, if it exists, is actually a CommandSender: + if ( method.getParameterCount() > 0 ) { + + // The first parameter "should" always be CommandSender or there will be difficult + // to trace failures at runtime: + Class cmdSender = method.getParameterTypes()[0]; + + if ( !cmdSender.getSimpleName().equalsIgnoreCase( "CommandSender") ) { + Output.get().logWarn( + String.format( + "Possible issue has been detected with " + + "registering a command where " + + "the first parameter is not a CommandSender: " + + "class = [%s] method = [%s] first parameter type = [%s]", + method.getDeclaringClass().getSimpleName(), method.getName(), + cmdSender.getSimpleName() + )); + } + + } + + mainCommand.set(methodInstance, method); + return mainCommand; + } - public void setHelpSuffix(String suffix) { - this.helpSuffix = suffix; - } public boolean onCommand(CommandSender sender, PluginCommand command, String label, - String[] args) { + String[] args) { + RootCommand rootCommand = rootCommands.get(command); if (rootCommand == null) { + Output.get().logError( "CommandHandler.onCommand(): " + command.getLabel() + + " : No root command found. " ); return false; } if (rootCommand.onlyPlayers() && !(sender instanceof Player)) { Prison.get().getLocaleManager().getLocalizable("cantAsConsole") - .sendTo(sender, Localizable.Level.ERROR); + .sendTo(sender, LogLevel.ERROR); return true; } + + else { - rootCommand.execute(sender, args); + rootCommand.execute(sender, args); + } + return true; } + + public Map getRegisteredCommands() { + return registeredCommands; + } + public void setRegisteredCommands( Map registeredCommands ) { + this.registeredCommands = registeredCommands; + } + + public TreeSet getAllRegisteredCommands() { + return allRegisteredCommands; + } + + public Map getRootCommands() { + return rootCommands; + } + public void setRootCommands( Map rootCommands ) { + this.rootCommands = rootCommands; + } + +// private List getCommands() { +// return commands; +// } + + public TabCompleaterData getTabCompleaterData() { + return tabCompleaterData; + } /* * ###Tab-Complete### diff --git a/prison-core/src/main/java/tech/mcprison/prison/commands/PluginCommand.java b/prison-core/src/main/java/tech/mcprison/prison/commands/PluginCommand.java index a559cad56..69a7f7a50 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/commands/PluginCommand.java +++ b/prison-core/src/main/java/tech/mcprison/prison/commands/PluginCommand.java @@ -18,23 +18,66 @@ package tech.mcprison.prison.commands; +import java.util.ArrayList; +import java.util.List; + /** * @author Faizaan A. Datoo */ public class PluginCommand { - private String label, description, usage; + private String label; + private String labelRegistered; + + private String description; + private String usage; + + private List aliases; + + private RegisteredCommand registeredCommand; - public PluginCommand(String label, String description, String usage) { + public PluginCommand(String label, String description, String usage, String[] aliases) { this.label = label; + this.labelRegistered = null; + this.description = description; this.usage = usage; + + this.aliases = new ArrayList<>(); + if ( aliases != null && aliases.length > 0 ) { + for ( String alyez : aliases ) { + this.aliases.add( alyez ); + } + } } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + + sb.append( getUsage() ) + .append( " alias: " ).append( getAliases().size() ) + .append( " hasRegCmd: " ).append( getRegisteredCommand() != null ); + + if ( getRegisteredCommand() != null ) { + sb.append( " (" ).append( getRegisteredCommand().getUsage() ).append( ")" ); + } + + return sb.toString(); + } + public String getLabel() { return label; } + public String getLabelRegistered() { + return labelRegistered; + } + public void setLabelRegistered( String labelRegistered ) { + this.labelRegistered = labelRegistered; + } + public String getDescription() { return description; } @@ -44,10 +87,22 @@ public void setDescription(String description) { } public String getUsage() { - return usage; + return getLabelRegistered() == null ? usage : "/" + getLabelRegistered(); } public void setUsage(String usage) { this.usage = usage; } + + public List getAliases() { + return aliases; + } + + public RegisteredCommand getRegisteredCommand() { + return registeredCommand; + } + public void setRegisteredCommand( RegisteredCommand registeredCommand ) { + this.registeredCommand = registeredCommand; + } + } diff --git a/prison-core/src/main/java/tech/mcprison/prison/commands/RegisteredCommand.java b/prison-core/src/main/java/tech/mcprison/prison/commands/RegisteredCommand.java index ab8b9cdd0..524f13d30 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/commands/RegisteredCommand.java +++ b/prison-core/src/main/java/tech/mcprison/prison/commands/RegisteredCommand.java @@ -18,53 +18,120 @@ package tech.mcprison.prison.commands; -import tech.mcprison.prison.Prison; -import tech.mcprison.prison.internal.CommandSender; -import tech.mcprison.prison.localization.Localizable; -import tech.mcprison.prison.output.Output; - import java.lang.annotation.Annotation; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import tech.mcprison.prison.Prison; +import tech.mcprison.prison.internal.CommandSender; +import tech.mcprison.prison.output.LogLevel; +import tech.mcprison.prison.output.Output; -public class RegisteredCommand { +public class RegisteredCommand + implements Comparable { private String label; + private CommandHandler handler; private RegisteredCommand parent; + private boolean alias = false; + + private String junitTest = null; + private String description; private String[] permissions; private String[] altPermissions; + private String[] aliases; + private List registeredAliases; + private RegisteredCommand parentOfAlias; + private boolean onlyPlayers; private Method method; private Object methodInstance; - private CommandHandler handler; private boolean set = false; private ArrayList methodArguments = new ArrayList(); private ArrayList arguments = new ArrayList(); - private ArrayList suffixes = new ArrayList(); - private ArrayList flags = new ArrayList(); + private WildcardArgument wildcard; + + private ArrayList flags = new ArrayList(); private Map flagsByName = new LinkedHashMap(); - private Map suffixesByName = - new HashMap(); - RegisteredCommand(String label, CommandHandler handler, RegisteredCommand parent) { + private ArrayList suffixes = new ArrayList(); + private Map suffixesByName = new HashMap(); + + + public RegisteredCommand(String label, CommandHandler handler, RegisteredCommand parent) { this.label = label; this.handler = handler; this.parent = parent; + + this.registeredAliases = new ArrayList<>(); } + /** + * For JUnit testing ONLY! Never use for anything else! + */ + private RegisteredCommand( String jUnitUsage ) { + + this.junitTest = jUnitUsage; + + this.label = "junitTest"; + this.handler = null; + this.parent = null; + + this.registeredAliases = new ArrayList<>(); + } + + protected static RegisteredCommand junitTest( String jUnitUsage ) { + RegisteredCommand results = new RegisteredCommand( jUnitUsage ); + + return results; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + + sb.append( getUsage() ) + .append( " isRoot: " ).append( this instanceof RootCommand ) + .append( " isAlias: " ).append( isAlias() ) + .append( " suffixCnt: " ).append( getSuffixes().size() ) + .append( " hasAliasParent: " ).append( getParentOfAlias() != null ); + + if ( getParentOfAlias() != null ) { + sb.append( " (" ).append( getParentOfAlias().getUsage() ).append( ")" ); + } + + return sb.toString(); + } + + /** + * The suffix is converted to all lowercase before adding to the map. + * + * @param suffix + * @param command + */ void addSuffixCommand(String suffix, RegisteredCommand command) { - suffixesByName.put(suffix.toLowerCase(), command); + suffixesByName.put( suffix.toLowerCase(), command); suffixes.add(command); } - + + /** + * The suffix is converted to all lowercase before checking to see if it exists in the map. + * + * @param suffix + * @return if the suffix exists + */ boolean doesSuffixCommandExist(String suffix) { - return suffixesByName.get(suffix) != null; + return suffixesByName.containsKey( suffix.toLowerCase() ); } public String getCompleteLabel() { @@ -75,7 +142,7 @@ public String getCompleteLabel() { void execute(CommandSender sender, String[] args) { if (!testPermission(sender)) { Prison.get().getLocaleManager().getLocalizable("noPermission") - .sendTo(sender, Localizable.Level.ERROR); + .sendTo(sender, LogLevel.ERROR); Output.get().logInfo( "&cLack of Permission Error: &7Player &3%s &7lacks permission to " + "run the command &3%s&7. Permissions needed: [&3%s&7]. Alt Permissions: [&3%s&7]", @@ -88,13 +155,19 @@ void execute(CommandSender sender, String[] args) { if (args.length > 0) { String suffixLabel = args[0].toLowerCase(); - if (suffixLabel.equals(handler.getHelpSuffix())) { + if (suffixLabel.equals( CommandHandler.COMMAND_HELP_TEXT )) { sendHelpMessage(sender); return; } RegisteredCommand command = suffixesByName.get(suffixLabel); if (command == null) { + +// Output.get().logError( "### #### RegisteredCommands.execute : 1 " + +// "if(command == null) :: args.length = " + +// (args == null ? "null" : args.length) + +// " args[0] == " + args[0]); + executeMethod(sender, args); } else { String[] nargs = new String[args.length - 1]; @@ -138,21 +211,43 @@ private void executeMethod(CommandSender sender, String[] args) { try { try { - method.invoke(methodInstance, resultArgs.toArray()); - } catch (InvocationTargetException e) { + method.invoke(getMethodInstance(), resultArgs.toArray()); + } + catch ( IllegalArgumentException | InvocationTargetException e) { if (e.getCause() instanceof CommandError) { CommandError ce = (CommandError) e.getCause(); Output.get().sendError(sender, ce.getColorizedMessage()); if (ce.showUsage()) { sender.sendMessage(getUsage()); } - } else { + } + else { + StringBuilder sb = new StringBuilder(); + + for ( Object arg : resultArgs ) { + sb.append( "[" ); + sb.append( arg.toString() ); + sb.append( "] " ); + } + + String message = "RegisteredCommand.executeMethod(): Invoke error: [" + + e.getMessage() + "] cause: [" + + (e.getCause() == null ? "" : e.getCause().getMessage()) + "] " + + " target instance: [methodName= " + + method.getName() + " parmCnt=" + method.getParameterCount() + " methodInstance=" + + getMethodInstance().getClass().getCanonicalName() + "] " + + "command arguments: " + sb.toString() + ; + Output.get().sendError( sender, message ); + + // Generally these errors are major and require program fixes, so throw + // the exception so the stacklist is logged. throw e; } } } catch (Exception e) { Prison.get().getLocaleManager().getLocalizable("internalErrorOccurred") - .sendTo(sender, Localizable.Level.ERROR); + .sendTo(sender, LogLevel.ERROR); e.printStackTrace(); } } @@ -192,6 +287,13 @@ public RegisteredCommand getParent() { return parent; } + public boolean isAlias() { + return alias; + } + public void setAlias( boolean alias ) { + this.alias = alias; + } + public String[] getPermissions() { return permissions; } @@ -200,6 +302,25 @@ public String[] getAltPermissions() { return altPermissions; } + public String[] getAliases() { + return aliases; + } + + public List getRegisteredAliases() { + return registeredAliases; + } + + public RegisteredCommand getParentOfAlias() { + return parentOfAlias; + } + public void setParentOfAlias( RegisteredCommand parentOfAlias ) { + this.parentOfAlias = parentOfAlias; + } + + private Object getMethodInstance() { + return methodInstance; + } + public RegisteredCommand getSuffixCommand(String suffix) { return suffixesByName.get(suffix); } @@ -209,7 +330,10 @@ public List getSuffixes() { } public String getUsage() { - return handler.getHelpHandler().getUsage(this); + return + junitTest == null ? + handler.getHelpHandler().getUsage(this) : + junitTest; } public WildcardArgument getWildcard() { @@ -241,6 +365,8 @@ void set(Object methodInstance, Method method) { this.description = command.description(); this.permissions = command.permissions(); this.altPermissions = command.altPermissions(); + this.aliases = command.aliases(); + this.onlyPlayers = command.onlyPlayers(); Class[] methodParameters = method.getParameterTypes(); @@ -367,4 +493,11 @@ public boolean testPermission(CommandSender sender) { return handler.getPermissionHandler().hasPermission(sender, permissions); } + + @Override + public int compareTo( RegisteredCommand arg0 ) + { + return getUsage().compareTo( arg0.getUsage() ); + } + } diff --git a/prison-core/src/main/java/tech/mcprison/prison/commands/TabCompleaterData.java b/prison-core/src/main/java/tech/mcprison/prison/commands/TabCompleaterData.java new file mode 100644 index 000000000..18a85a134 --- /dev/null +++ b/prison-core/src/main/java/tech/mcprison/prison/commands/TabCompleaterData.java @@ -0,0 +1,205 @@ +package tech.mcprison.prison.commands; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Set; +import java.util.TreeMap; + +public class TabCompleaterData +{ + private String name; + private TreeMap data; + + private boolean leafNode; + + public TabCompleaterData() { + this( "", null ); + + setLeafNode( false ); + } + private TabCompleaterData( String name, String[] args ) { + super(); + + this.name = name; + this.data = new TreeMap<>(); + + this.leafNode = ( args == null || args.length == 0 ); + + if ( !this.leafNode ) { + add( args ); + } + } + + /** + *

This must only be used internally to this class to ensure that the + * structure will be built correctly. + *

+ * + *

This will add the given usage String array to the current TabCompleterData + * object, creating a new node for ever array element in usage, or add to + * any existing one that is found. + *

+ * + *

If this function is to be called iteratively, then the first element of + * usage must be removed so it does not go in to an endless loop. The + * size of usage must decrease by one every time it is called. + *

+ * + * @param usage + */ + private void add( String... usage ) { + + if ( usage.length > 0 ) { + String name = usage[0]; + String key = name.toLowerCase(); + + String[] subArray = Arrays.copyOfRange( usage, 1, usage.length ); + + if ( !getData().containsKey( key ) ) { + TabCompleaterData tcd = new TabCompleaterData( name, subArray ); + getData().put( key, tcd ); + } + else { + getData().get( key ).add( subArray ); + } + } + + + } + + /** + *

Every time a RegisteredCommand is added to the allRegisteredCommands + * collection, it should also be added here too. This function will take the data + * that is within it and parse it out and store it in a hierarchical structure + * using b-trees. + *

+ * + *

Do not indirectly add any aliases to this function. Through the full and + * normal process, aliases will be assigned their own RegisteredCommand objects + * so you never have to artificially feed them to this function. + *

+ * + */ + public void add( RegisteredCommand registeredCommand ) { + String usageStr = registeredCommand.getUsage().replace( "/", "" ); + + String[] usage = usageStr.split( " " ); + + add( usage ); + +// if ( usage.length > 0 ) { +// String key = usage[0]; +// +// String[] subArray = Arrays.copyOfRange( usage, 1, usage.length ); +// +// if ( !getData().containsKey( key ) ) { +// TabCompleterData tcd = new TabCompleterData( key, subArray ); +// getData().put( key, tcd ); +// } +// else { +// getData().get( key ).add( subArray ); +// } +// } + + } + + /** + *

This function is to be used within the org.bukkit.command.Command.tabComplete() + * function to add lookup auto complete items to return. The alias and args should + * be unmodified from what bukkit supplies. This function will iteratively traverse + * all nodes and return the results. This should provide the best performance. + *

+ * + * @param alias + * @param args + * @return + */ + public List check( String alias, String... args ) { + List results = new ArrayList<>(); + + if ( alias != null ) { + if ( getData().containsKey( alias ) ) { + results.addAll( getData().get( alias.toLowerCase() ).check( args ) ); + } + + } + + + return results; + } + + + private List check( String... args ) { + List results = new ArrayList<>(); + + if ( args == null || args.length == 0 || + args.length == 1 && args[0].length() == 0 ) { + + // usage length of zero means return all children for this node. + // Must get each child's name: + Set keys = getData().keySet(); + for ( String key : keys ) { + results.add( getData().get( key ).getName() ); + } + + } + else if ( args.length > 1 +// || args.length == 1 && getData().containsKey( args[0] ) + ) { + + // if length is greater than 1 then that means that we need to + // traverse to the next level of depth if we have a hit for + // one of the data elements: + + String key = args[0].toLowerCase(); + + if ( getData().containsKey( key )) { + + String[] subArray = Arrays.copyOfRange( args, 1, args.length ); + + results.addAll( getData().get( key ).check( subArray ) ); + } + } + else { + // args length is one. See if anything either matches it, or + // begins with it. + + String prefix = args[0].toLowerCase(); + + Set keys = getData().keySet(); + for ( String key : keys ) { + if ( key.startsWith( prefix )) { + + results.add( getData().get( key ).getName() ); + } + } + } + + return results; + + } + + + public String getName() { + return name; + } + public void setName( String name ) { + this.name = name; + } + + public TreeMap getData() { + return data; + } + public void setData( TreeMap data ) { + this.data = data; + } + + public boolean isLeafNode() { + return leafNode; + } + public void setLeafNode( boolean leafNode ) { + this.leafNode = leafNode; + } + +} diff --git a/prison-core/src/main/java/tech/mcprison/prison/integration/IntegrationManager.java b/prison-core/src/main/java/tech/mcprison/prison/integration/IntegrationManager.java index ece757386..c55951826 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/integration/IntegrationManager.java +++ b/prison-core/src/main/java/tech/mcprison/prison/integration/IntegrationManager.java @@ -96,9 +96,11 @@ public enum PrisonPlaceHolders { prison_r(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS), prison_rt(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS), prison_rc(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS), + prison_rcf(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS), prison_rcp(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS), prison_rcb(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS), prison_rcr(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS), + prison_rcrf(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS), prison_rr(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS), prison_rrt(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS), @@ -106,9 +108,11 @@ public enum PrisonPlaceHolders { prison_rank(prison_r, PlaceHolderFlags.PLAYER), prison_rank_tag(prison_rt, PlaceHolderFlags.PLAYER), prison_rankup_cost(prison_rc, PlaceHolderFlags.PLAYER), + prison_rankup_cost_formatted(prison_rcf, PlaceHolderFlags.PLAYER), prison_rankup_cost_percent(prison_rcp, PlaceHolderFlags.PLAYER), prison_rankup_cost_bar(prison_rcb, PlaceHolderFlags.PLAYER), prison_rankup_cost_remaining(prison_rcr, PlaceHolderFlags.PLAYER), + prison_rankup_cost_remaining_formatted(prison_rcrf, PlaceHolderFlags.PLAYER), prison_rankup_rank(prison_rr, PlaceHolderFlags.PLAYER), prison_rankup_rank_tag(prison_rrt, PlaceHolderFlags.PLAYER), @@ -117,9 +121,11 @@ public enum PrisonPlaceHolders { prison_r_laddername(PlaceHolderFlags.LADDERS, PlaceHolderFlags.ALIAS), prison_rt_laddername(PlaceHolderFlags.LADDERS, PlaceHolderFlags.ALIAS), prison_rc_laddername(PlaceHolderFlags.LADDERS, PlaceHolderFlags.ALIAS), + prison_rcf_laddername(PlaceHolderFlags.LADDERS, PlaceHolderFlags.ALIAS), prison_rcp_laddername(PlaceHolderFlags.LADDERS, PlaceHolderFlags.ALIAS), prison_rcb_laddername(PlaceHolderFlags.LADDERS, PlaceHolderFlags.ALIAS), prison_rcr_laddername(PlaceHolderFlags.LADDERS, PlaceHolderFlags.ALIAS), + prison_rcrf_laddername(PlaceHolderFlags.LADDERS, PlaceHolderFlags.ALIAS), prison_rr_laddername(PlaceHolderFlags.LADDERS, PlaceHolderFlags.ALIAS), prison_rrt_laddername(PlaceHolderFlags.LADDERS, PlaceHolderFlags.ALIAS), @@ -127,14 +133,28 @@ public enum PrisonPlaceHolders { prison_rank_laddername(prison_r_laddername, PlaceHolderFlags.LADDERS), prison_rank_tag_laddername(prison_rt_laddername, PlaceHolderFlags.LADDERS), prison_rankup_cost_laddername(prison_rc_laddername, PlaceHolderFlags.LADDERS), + prison_rankup_cost_formatted_laddername(prison_rcf_laddername, PlaceHolderFlags.LADDERS), prison_rankup_cost_percent_laddername(prison_rcp_laddername, PlaceHolderFlags.LADDERS), prison_rankup_cost_bar_laddername(prison_rcb_laddername, PlaceHolderFlags.LADDERS), prison_rankup_cost_remaining_laddername(prison_rcr_laddername, PlaceHolderFlags.LADDERS), + prison_rankup_cost_remaining_formatted_laddername(prison_rcrf_laddername, PlaceHolderFlags.LADDERS), prison_rankup_rank_laddername(prison_rr_laddername, PlaceHolderFlags.LADDERS), prison_rankup_rank_tag_laddername(prison_rrt_laddername, PlaceHolderFlags.LADDERS), + + + + // player + prison_pb(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS), + prison_player_balance(prison_pb, PlaceHolderFlags.PLAYER), + + prison_pb_laddername(prison_pb, PlaceHolderFlags.LADDERS), + prison_player_balance_laddername(prison_pb_laddername, PlaceHolderFlags.LADDERS), + // Mine aliases: + prison_mn_minename(PlaceHolderFlags.MINES, PlaceHolderFlags.ALIAS), + prison_mt_minename(PlaceHolderFlags.MINES, PlaceHolderFlags.ALIAS), prison_mi_minename(PlaceHolderFlags.MINES, PlaceHolderFlags.ALIAS), prison_mif_minename(PlaceHolderFlags.MINES, PlaceHolderFlags.ALIAS), prison_mtl_minename(PlaceHolderFlags.MINES, PlaceHolderFlags.ALIAS), @@ -152,6 +172,8 @@ public enum PrisonPlaceHolders { // reset_interval, reset_timeleft, blocks_size, blocks_remaining, blocks_percent // player_count // NOTE: Remove PrisonPlaceHolderFlags.SUPRESS when ready to be used: + prison_mines_name_minename(prison_mn_minename, PlaceHolderFlags.MINES), + prison_mines_tag_minename(prison_mt_minename, PlaceHolderFlags.MINES), prison_mines_interval_minename(prison_mi_minename, PlaceHolderFlags.MINES), prison_mines_interval_formatted_minename(prison_mif_minename, PlaceHolderFlags.MINES), prison_mines_timeleft_minename(prison_mtl_minename, PlaceHolderFlags.MINES), @@ -168,6 +190,8 @@ public enum PrisonPlaceHolders { // PlayerMine aliases: + prison_mn_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS), + prison_mt_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS), prison_mi_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS), prison_mif_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS), prison_mtl_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS), @@ -182,6 +206,8 @@ public enum PrisonPlaceHolders { prison_mrc_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS), + prison_mines_name_playermines(prison_mn_pm, PlaceHolderFlags.PLAYERMINES), + prison_mines_tag_playermines(prison_mt_pm, PlaceHolderFlags.PLAYERMINES), prison_mines_interval_playermines(prison_mi_pm, PlaceHolderFlags.PLAYERMINES), prison_mines_interval_formatted_playermines(prison_mif_pm, PlaceHolderFlags.PLAYERMINES), prison_mines_timeleft_playermines(prison_mtl_pm, PlaceHolderFlags.PLAYERMINES), @@ -543,6 +569,11 @@ public void register(Integration i) { } integrations.get(iType).add(i); } + + public EconomyIntegration getEconomy() { + return (EconomyIntegration) getForType(IntegrationType.ECONOMY) + .orElse( null ); + } public EconomyCurrencyIntegration getEconomyForCurrency(String currency) { EconomyCurrencyIntegration results = null; @@ -567,12 +598,12 @@ public EconomyCurrencyIntegration getEconomyForCurrency(String currency) { return results; } - public String getIntegrationDetails( IntegrationType intType ) { + public String getIntegrationDetails( IntegrationType integrationType ) { StringBuilder sb = new StringBuilder(); Set keys = integrations.keySet(); for ( IntegrationType key : keys ) { - if ( key == intType ) { + if ( key == integrationType ) { sb.append( key.name() ); sb.append( ": [" ); @@ -616,21 +647,30 @@ public String getIntegrationDetails( IntegrationType intType ) { public List getIntegrationComponents() { List results = new ArrayList<>(); - for ( IntegrationType integType : IntegrationType.values() ) + for ( IntegrationType integrationType : IntegrationType.values() ) { - results.add( new TextComponent( String.format( "&7Integration Type: &3%s", integType.name() ) )); + results.add( new TextComponent( String.format( "&7Integration Type: &3%s", integrationType.name() ) )); // Generates the placeholder list for the /prison version command, printing // two placeholders per line. - if ( integType == IntegrationType.PLACEHOLDER ) { - getPlaceholderTemplateList( results ); + if ( integrationType == IntegrationType.PLACEHOLDER ) { + results.add( new TextComponent( " &7To list all or search for placeholders see: " + + "&a/prison placeholders") ); +// getPlaceholderTemplateList( results ); } - List plugins = getAllForType( integType ); + List plugins = getAllForType( integrationType ); - if ( plugins == null || plugins.size() == 0 ) { + if ( integrationType == IntegrationType.WORLDGUARD && + (plugins == null || plugins.size() == 0 ) ) { + results.add( new TextComponent( " &e&oWorldGuard integration has not been added " + + "to Prison yet.&3 WorldGuard can still be used normally since this " + + "is not an error." )); + } + else if ( plugins == null || plugins.size() == 0 ) { results.add( new TextComponent( " &e&onone" )); - } else { + } + else { for ( Integration plugin : plugins ) { String pluginUrl = plugin.getPluginSourceURL(); String msg = String.format( " &a%s &7<%s&7> %s", plugin.getDisplayName(), @@ -647,7 +687,7 @@ public List getIntegrationComponents() { results.add( new TextComponent( " " + altInfo )); } - if ( integType == IntegrationType.ECONOMY && + if ( integrationType == IntegrationType.ECONOMY && plugin instanceof EconomyCurrencyIntegration ) { EconomyCurrencyIntegration econ = (EconomyCurrencyIntegration) plugin; 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 75a3afcf6..b803dfd00 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 @@ -117,4 +117,12 @@ public interface Player extends CommandSender, InventoryHolder { * is modified */ void updateInventory(); + + + /** + * Dumps the inventory contents of the player to the console. + * + */ + public void printDebugInventoryInformationToConsole(); + } 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 92c3793a4..04c40649d 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 @@ -67,6 +67,14 @@ public interface Block { public void setPrisonBlock( PrisonBlock prisonBlock ); + + /** + * This function will set the current BlockFace for the block. + * This is needed to properly set blocks such as ladders. + * + * @param blockFace + */ + public void setBlockFace( BlockFace blockFace ); /** diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/block/BlockFace.java b/prison-core/src/main/java/tech/mcprison/prison/internal/block/BlockFace.java index d3d38f4a6..cd71f48fe 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/block/BlockFace.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/block/BlockFace.java @@ -26,6 +26,32 @@ */ public enum BlockFace { - NORTH, SOUTH, EAST, WEST, TOP, BOTTOM + NORTH, SOUTH, EAST, WEST, TOP, BOTTOM, UP, DOWN; + + public BlockFace getOppositeFace() { + switch (this) { + case NORTH: + return SOUTH; + case SOUTH: + return NORTH; + case EAST: + return WEST; + case WEST: + return EAST; + case TOP: + return BOTTOM; + case BOTTOM: + return TOP; + case UP: + return DOWN; + case DOWN: + return UP; + default: + return NORTH; + + } + } + + } diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/block/PrisonBlock.java b/prison-core/src/main/java/tech/mcprison/prison/internal/block/PrisonBlock.java index c3e6cda54..d00ac9c7c 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/block/PrisonBlock.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/block/PrisonBlock.java @@ -1,32 +1,67 @@ package tech.mcprison.prison.internal.block; +import tech.mcprison.prison.internal.block.PrisonBlockTypes.InternalBlockTypes; + /** *

This class embodies the nature of the block and different behaviors, if - * they exist. + * they exist. The block name should be based upon the XMaterial name if + * possible to ensure correct mapping for different versions of spigot. *

* */ -public class PrisonBlock { +public class PrisonBlock + implements Comparable { + + public static PrisonBlock IGNORE; + public static PrisonBlock NULL_BLOCK; + private String blockName; private double chance; private boolean valid = true; - private boolean mineable = true; + private boolean block = true; private boolean legacyBlock = false; + static { + IGNORE = new PrisonBlock( InternalBlockTypes.IGNORE.name(), false ); + NULL_BLOCK = new PrisonBlock( InternalBlockTypes.NULL_BLOCK.name(), false ); + } + + /** + * The name of this block should be based upon the XMaterial name in all + * lower case. + * + * @param blockName + */ public PrisonBlock( String blockName ) { this( blockName, 0); } + public PrisonBlock( String blockName, boolean block ) { + this( blockName, 0); + this.block = block; + } + /** + * The block name will be set to all lower case for consistency when searching and mapping. + * + * @param blockName + * @param chance + */ public PrisonBlock( String blockName, double chance ) { super(); - this.blockName = blockName; + this.blockName = blockName.toLowerCase(); this.chance = chance; } + + @Override + public String toString() { + return getBlockName() + " " + Double.toString( getChance() ); + } + public String getBlockName() { return blockName; } @@ -48,11 +83,11 @@ public void setValid( boolean valid ) { this.valid = valid; } - public boolean isMineable() { - return mineable; + public boolean isBlock() { + return block; } - public void setMineable( boolean mineable ){ - this.mineable = mineable; + public void setBlock( boolean isBlock ){ + this.block = isBlock; } /** @@ -79,5 +114,31 @@ public boolean isLegacyBlock() { public void setLegacyBlock( boolean legacyBlock ) { this.legacyBlock = legacyBlock; } + + @Override + public boolean equals( Object block ) { + boolean results = false; + + if ( block != null && block instanceof PrisonBlock) { + results = getBlockName().equalsIgnoreCase( ((PrisonBlock) block).getBlockName() ); + } + + return results; + } + + @Override + public int compareTo( PrisonBlock block ) + { + int results = 0; + + if ( block == null ) { + results = 1; + } + else { + results = getBlockName().compareToIgnoreCase( block.getBlockName() ); + } + + return results; + } } diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/block/PrisonBlockTypes.java b/prison-core/src/main/java/tech/mcprison/prison/internal/block/PrisonBlockTypes.java index 3bcf90bbf..8e632784f 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/block/PrisonBlockTypes.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/block/PrisonBlockTypes.java @@ -2,6 +2,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.TreeMap; import tech.mcprison.prison.Prison; @@ -14,6 +15,7 @@ public class PrisonBlockTypes { private List blockTypes; + private TreeMap blockTypesByName; public enum InternalBlockTypes { IGNORE, @@ -25,6 +27,7 @@ public PrisonBlockTypes() { this.blockTypes = new ArrayList<>(); + this.blockTypesByName = new TreeMap<>(); } @@ -33,17 +36,15 @@ public void loadServerBlockTypes() { // First clear the blockTypes: getBlockTypes().clear(); - // Add in the internal block types and mark them as not mineable. - for ( InternalBlockTypes iBlockType : InternalBlockTypes.values() ) { - PrisonBlock block = new PrisonBlock( iBlockType.name() ); - block.setMineable( false ); - - getBlockTypes().add( block ); - } + getBlockTypes().add( PrisonBlock.IGNORE ); // Next using the server's platform, load all of the available blockTypes. Prison.get().getPlatform().getAllPlatformBlockTypes( getBlockTypes() ); - + + // Map all available blocks to the blockTypesByName map: + for ( PrisonBlock pb : getBlockTypes() ) { + getBlockTypesByName().put( pb.getBlockName().toLowerCase(), pb ); + } } public List getBlockTypes() { @@ -52,5 +53,12 @@ public List getBlockTypes() { public void setBlockTypes( List blockTypes ) { this.blockTypes = blockTypes; } + + public TreeMap getBlockTypesByName() { + return blockTypesByName; + } + public void setBlockTypesByName( TreeMap blockTypesByName ) { + this.blockTypesByName = blockTypesByName; + } } 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 4a4b8f4b7..37d98ca41 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 @@ -26,7 +26,6 @@ import tech.mcprison.prison.commands.PluginCommand; import tech.mcprison.prison.file.YamlFileIO; -import tech.mcprison.prison.gui.GUI; import tech.mcprison.prison.integration.Placeholders; import tech.mcprison.prison.internal.CommandSender; import tech.mcprison.prison.internal.Player; @@ -34,6 +33,8 @@ import tech.mcprison.prison.internal.World; import tech.mcprison.prison.internal.block.PrisonBlock; import tech.mcprison.prison.internal.scoreboard.ScoreboardManager; +import tech.mcprison.prison.modules.ModuleElement; +import tech.mcprison.prison.modules.ModuleElementType; import tech.mcprison.prison.output.ChatDisplay; import tech.mcprison.prison.store.Storage; import tech.mcprison.prison.util.Location; @@ -110,8 +111,12 @@ public interface Platform { * * @param command The command to unregister, without the preceding '/'. */ - void unregisterCommand(String command); + public void unregisterCommand(String command); + + public void unregisterAllCommands(); + + /** * Returns a list of all registered commands. */ @@ -142,9 +147,7 @@ public interface Platform { * * @param title The title of the GUI. * @param numRows The number of rows in the GUI; must be divisible by 9. - * @return The {@link GUI}, ready for use. */ - GUI createGUI(String title, int numRows); /** * If an iron door is open, this method closes it. @@ -160,8 +163,10 @@ public interface Platform { * @param message The message. May include color codes, amp-prefixed. * @param format The objects inserted via {@link String#format(String, Object...)}. */ - void log(String message, Object... format); + public void log(String message, Object... format); + public void logCore( String message ); + /** * Logs a debug message to the console if the user has debug messages enabled. * @@ -254,9 +259,27 @@ default Optional getCommand(String label) { public String getConfigString( String key ); + /** + *

This returns the boolean value that is associated with the key. + * It has to match on true to return a true value. If the key does + * not exist, then it returns a value of false. Default value is false. + *

+ * + * @param key + * @return + */ public boolean getConfigBooleanFalse( String key ); + /** + *

This returns the boolean value that is associated with the key. + * It has to match on true to return a true value, but if the key does + * not exist, then it returns a value of true. Default value is true. + *

+ * + * @param key + * @return + */ public boolean getConfigBooleanTrue( String key ); @@ -264,7 +287,21 @@ default Optional getCommand(String label) { public PrisonBlock getPrisonBlock( String blockName ); + + + public boolean linkModuleElements( ModuleElement sourceElement, ModuleElementType targetElementType, String name ); + + + public boolean unlinkModuleElements( ModuleElement elementA, ModuleElement elementB ); + + public ModuleElement createModuleElement( CommandSender sender, ModuleElementType elementType, String name, String tag ); + public int getModuleElementCount( ModuleElementType elementType ); + + + public void autoCreateMineBlockAssignment(); + + } diff --git a/prison-core/src/main/java/tech/mcprison/prison/localization/Localizable.java b/prison-core/src/main/java/tech/mcprison/prison/localization/Localizable.java index 9ee132f51..de59b1491 100755 --- a/prison-core/src/main/java/tech/mcprison/prison/localization/Localizable.java +++ b/prison-core/src/main/java/tech/mcprison/prison/localization/Localizable.java @@ -29,21 +29,23 @@ package tech.mcprison.prison.localization; +import java.util.Arrays; +import java.util.List; +import java.util.Properties; +import java.util.regex.Matcher; + import com.google.common.collect.Lists; + import tech.mcprison.prison.Prison; import tech.mcprison.prison.internal.CommandSender; import tech.mcprison.prison.internal.Player; import tech.mcprison.prison.internal.World; +import tech.mcprison.prison.output.LogLevel; import tech.mcprison.prison.output.Output; -import java.util.Arrays; -import java.util.List; -import java.util.Properties; -import java.util.regex.Matcher; - /** * Represents an object which has the potential to be localized in one of - * multiple languages and returned as a string. + * multiple configs and returned as a string. *

*

In the event that a {@link Localizable} cannot be localized with the given * parameters or in its parent {@link LocaleManager}'s default locale, it will @@ -290,19 +292,8 @@ public String localizeFor(CommandSender sender) { * @param level The message level to set this to. * @since 1.0 */ - public void sendTo(CommandSender sender, Level level) { - switch (level) { - case WARN: - Output.get().sendWarn(sender, localizeFor(sender)); - break; - case ERROR: - Output.get().sendError(sender, localizeFor(sender)); - break; - case INFO: - default: - Output.get().sendInfo(sender, localizeFor(sender)); - break; - } + public void sendTo(CommandSender sender, LogLevel level) { + Output.get().sendMessage(sender, localizeFor(sender), level); } /** @@ -316,10 +307,9 @@ public void sendTo(CommandSender sender, Level level) { * are included by default by the library.

* * @param sender The {@link CommandSender} to send this {@link Localizable} to - * @since 1.0 */ public void sendTo(CommandSender sender) { - sendTo(sender, Level.INFO); + sendTo(sender, LogLevel.PLAIN); } /** @@ -362,8 +352,9 @@ private String fromNullableString(String nullable) { return nullable != null ? nullable : ""; } - public enum Level { - INFO, WARN, ERROR - } + // Use LogLevel instead since they are the same: +// public enum Level { +// PLAIN, INFO, WARN, ERROR +// } } diff --git a/prison-core/src/main/java/tech/mcprison/prison/modules/ModuleElement.java b/prison-core/src/main/java/tech/mcprison/prison/modules/ModuleElement.java new file mode 100644 index 000000000..965c64cf2 --- /dev/null +++ b/prison-core/src/main/java/tech/mcprison/prison/modules/ModuleElement.java @@ -0,0 +1,26 @@ +package tech.mcprison.prison.modules; + +/** + *

This represents an element that is found within a module. It may be + * either a Mine, Rank, or even maybe a Ladder too. + *

+ * + *

The important factor here is that this can allow one module's elements + * to be referenced within another module without having to include that + * module for compiling. The key is to include the core components required + * for the basic references. + *

+ * + */ +public interface ModuleElement { + + // private transient final ModuleElementType elementType; + public ModuleElementType getModuleElementType(); + + public int getId(); + + public String getName(); + + public String getTag(); + +} diff --git a/prison-core/src/main/java/tech/mcprison/prison/modules/ModuleElementType.java b/prison-core/src/main/java/tech/mcprison/prison/modules/ModuleElementType.java new file mode 100644 index 000000000..c0b5cb61b --- /dev/null +++ b/prison-core/src/main/java/tech/mcprison/prison/modules/ModuleElementType.java @@ -0,0 +1,22 @@ +package tech.mcprison.prison.modules; + +public enum ModuleElementType { + + MINE, + RANK, + LADDER; + + public static ModuleElementType fromString( String value ) + { + ModuleElementType results = null; + + for ( ModuleElementType meType : values() ) { + if ( meType.name().equals( value ) ) { + results = meType; + break; + } + } + return results; + } + +} diff --git a/prison-core/src/main/java/tech/mcprison/prison/output/ChatDisplay.java b/prison-core/src/main/java/tech/mcprison/prison/output/ChatDisplay.java index 8d3bc8e72..ba5cdb17e 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/output/ChatDisplay.java +++ b/prison-core/src/main/java/tech/mcprison/prison/output/ChatDisplay.java @@ -81,5 +81,11 @@ public void toLog(LogLevel logLevel) { Output.get().log( component.text(), logLevel ); } } + + public void sendtoOutputLogInfo() { + for (DisplayComponent component : displayComponents) { + Output.get().logInfo( component.text() ); + } + } } diff --git a/prison-core/src/main/java/tech/mcprison/prison/output/LogLevel.java b/prison-core/src/main/java/tech/mcprison/prison/output/LogLevel.java index 6b8c6fc68..e8d3540fa 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/output/LogLevel.java +++ b/prison-core/src/main/java/tech/mcprison/prison/output/LogLevel.java @@ -24,15 +24,23 @@ * @author Dylan M. Perks */ public enum LogLevel { + + /** No prefix */ + PLAIN, /** * Information severity. */ - INFO, /** + INFO, + /** * Warning severity. */ - WARNING, /** + WARNING, + /** * Error severity. */ - ERROR + ERROR, + + /** Debug */ + DEBUG; } diff --git a/prison-core/src/main/java/tech/mcprison/prison/output/Output.java b/prison-core/src/main/java/tech/mcprison/prison/output/Output.java index 690cb0040..71f92a1f7 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/output/Output.java +++ b/prison-core/src/main/java/tech/mcprison/prison/output/Output.java @@ -19,6 +19,7 @@ package tech.mcprison.prison.output; import java.util.Arrays; +import java.util.MissingFormatArgumentException; import tech.mcprison.prison.Prison; import tech.mcprison.prison.internal.CommandSender; @@ -33,10 +34,12 @@ public class Output { // Fields private static Output instance; - public String PREFIX_TEMPLATE = "&8| %s &8|"; - public String INFO_PREFIX = gen("&3Info") + " &7"; - public String WARNING_PREFIX = gen("&6Warning") + " &7"; - public String ERROR_PREFIX = gen("&cError") + " &7"; + + private String PREFIX_TEMPLATE = "&8| %s &8| &7"; + public String INFO_PREFIX = gen("Info"); + public String WARNING_PREFIX = gen("Warning"); + public String ERROR_PREFIX = gen("Error"); + public String DEBUG_PREFIX = gen("Debug"); // Constructor @@ -53,11 +56,67 @@ public static Output get() { return instance; } + + /** + * Need standardization on this. + * + * @param level + * @return + */ + private String getLogPrefix( LogLevel level) { + String prefix = null; + + switch ( level ) + { + case INFO: + prefix = INFO_PREFIX; + break; + case WARNING: + prefix = WARNING_PREFIX; + break; + case ERROR: + prefix = ERROR_PREFIX; + break; + case DEBUG: + prefix = DEBUG_PREFIX; + break; + + case PLAIN: + default: + prefix = ""; + break; + } + return getLogColorCode(level) + prefix; + } + + private String getLogColorCode( LogLevel level) { + String colorCode = null; + + switch ( level ) + { + case INFO: + colorCode = "&f"; + break; + case WARNING: + colorCode = "&6"; + break; + case ERROR: + colorCode = "&c"; + break; + case DEBUG: + colorCode = "&9"; + break; + + case PLAIN: + default: + colorCode = ""; + break; + } + return colorCode; + } + public String format(String message, LogLevel level, Object... args) { - String prefix = level == LogLevel.INFO ? - INFO_PREFIX : - level == LogLevel.WARNING ? WARNING_PREFIX : ERROR_PREFIX; - return prefix + String.format(message, args); + return getLogPrefix(level) + String.format(message, args); } /** @@ -67,9 +126,29 @@ public void log(String message, LogLevel level, Object... args) { if ( Prison.get() == null || Prison.get().getPlatform() == null ) { System.err.println("Prison: Output.log Logger failure: " + message ); } else { - Prison.get().getPlatform().log(gen("&3Prison") + " " + (level == LogLevel.INFO ? - "&f" : - level == LogLevel.WARNING ? "&6" : "&c") + String.format(message, args)); + try { + Prison.get().getPlatform().log( + gen("&3Prison") + " " + + getLogColorCode(level) + + String.format(message, args)); + } + catch ( MissingFormatArgumentException e ) + { + StringBuilder sb = new StringBuilder(); + + for ( Object arg : args ) { + sb.append( "[" ); + sb.append( arg ); + sb.append( "] " ); + } + + Prison.get().getPlatform().logCore( + gen("&3Prison") + " " + + getLogColorCode(LogLevel.ERROR) + + "Failure to generate log message due to incorrect number of parameters: [" + + e.getMessage() + "] :: Original raw message [" + message + "] " + + "Arguments: " + sb.toString() ); + } } } @@ -116,10 +195,11 @@ public void logError(String message, Throwable... throwable) { * Send a message to a {@link CommandSender} */ public void sendMessage(CommandSender sender, String message, LogLevel level, Object... args) { - String prefix = level == LogLevel.INFO ? - INFO_PREFIX : - level == LogLevel.WARNING ? WARNING_PREFIX : ERROR_PREFIX; - sender.sendMessage(prefix + String.format(message, args)); + sender.sendMessage(getLogPrefix(level) + String.format(message, args)); + } + + public void send(CommandSender sender, String message, Object... args) { + sendMessage(sender, message, LogLevel.PLAIN, args); } /** @@ -129,7 +209,7 @@ public void sendMessage(CommandSender sender, String message, LogLevel level, Ob * @param message The message to send. This may include color codes, but the default is grey. */ public void sendInfo(CommandSender sender, String message, Object... args) { - sender.sendMessage(INFO_PREFIX + String.format(message, args)); + sendMessage(sender, message, LogLevel.INFO, args); } /** @@ -139,7 +219,7 @@ public void sendInfo(CommandSender sender, String message, Object... args) { * @param message The message to send. This may include color codes, but the default is grey. */ public void sendWarn(CommandSender sender, String message, Object... args) { - sender.sendMessage(WARNING_PREFIX + String.format(message, args)); + sendMessage(sender, message, LogLevel.WARNING, args); } /** @@ -149,12 +229,12 @@ public void sendWarn(CommandSender sender, String message, Object... args) { * @param message The message to send. This may include color codes, but the default is grey. */ public void sendError(CommandSender sender, String message, Object... args) { - sender.sendMessage(ERROR_PREFIX + String.format(message, args)); + sendMessage(sender, message, LogLevel.ERROR, args); } // Private methods - public String gen(String name) { + private String gen(String name) { return String.format(PREFIX_TEMPLATE, name); } diff --git a/prison-core/src/main/java/tech/mcprison/prison/selection/SelectionManager.java b/prison-core/src/main/java/tech/mcprison/prison/selection/SelectionManager.java index 048e435b3..0db9fce0d 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/selection/SelectionManager.java +++ b/prison-core/src/main/java/tech/mcprison/prison/selection/SelectionManager.java @@ -18,13 +18,15 @@ package tech.mcprison.prison.selection; +import java.util.HashMap; +import java.util.Map; + import tech.mcprison.prison.internal.ItemStack; import tech.mcprison.prison.internal.Player; +import tech.mcprison.prison.internal.inventory.Inventory; +import tech.mcprison.prison.output.Output; import tech.mcprison.prison.util.BlockType; -import java.util.HashMap; -import java.util.Map; - /** * @author Faizaan A. Datoo */ @@ -47,8 +49,31 @@ public SelectionManager() { * @param player The {@link Player} to give the selection tool to */ public void bestowSelectionTool(Player player) { + int countBefore = selectionWandCount( player ); + player.give(SELECTION_TOOL); + + int countAfter = selectionWandCount( player ); + + Output.get().logInfo( "Prison selection wand (blaze_rod) was given to player %s. " + + "Count before command: %d. Count after command: %d. ", + player.getName(), countBefore, countAfter ); } + + private int selectionWandCount( Player player) { + int count = 0; + Inventory inv = player.getInventory(); + + for (ItemStack is : inv.getItems()) { + if ( is != null && + // is.getName().toLowerCase().contains( "selection wand" ) && + // is.getDisplayName().toLowerCase().contains( "selection wand" ) && + is.getMaterial() == BlockType.BLAZE_ROD ) { + count += is.getAmount(); + } + } + return count; + } public Selection getSelection(Player player) { if (!selectionMap.containsKey(player.getName())) { diff --git a/prison-core/src/main/java/tech/mcprison/prison/troubleshoot/inbuilt/ItemTroubleshooter.java b/prison-core/src/main/java/tech/mcprison/prison/troubleshoot/inbuilt/ItemTroubleshooter.java index 67dbd9d01..d11e77076 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/troubleshoot/inbuilt/ItemTroubleshooter.java +++ b/prison-core/src/main/java/tech/mcprison/prison/troubleshoot/inbuilt/ItemTroubleshooter.java @@ -1,48 +1,42 @@ package tech.mcprison.prison.troubleshoot.inbuilt; -import tech.mcprison.prison.PrisonAPI; -import tech.mcprison.prison.internal.CommandSender; -import tech.mcprison.prison.troubleshoot.TroubleshootResult; -import tech.mcprison.prison.troubleshoot.Troubleshooter; -import tech.mcprison.prison.util.ItemManager; - -import java.io.File; - /** * Inbuilt troubleshooter to scan the 'items.csv' file to ensure it's valid. * * @author Faizaan A. Datoo */ -public class ItemTroubleshooter extends Troubleshooter { - - public ItemTroubleshooter() { - super("item_scan", "Run this if you have trouble with the items.csv file."); - } - - @Override public TroubleshootResult invoke(CommandSender invoker) { - - // Let's do our own test of initializing the ItemManager. - try { - ItemManager ourManager = new ItemManager(); - ourManager.getItems(); - } catch (Exception e) { - // OK, so something's wrong - // Let's try deleting the file and telling the user to relaunch. - - File itemsCsv = new File(PrisonAPI.getPluginDirectory(), "items.csv"); - boolean deleted = itemsCsv.delete(); - if (deleted) { - return new TroubleshootResult(TroubleshootResult.Result.USER_ACTION, - "We've found a problem with your items.csv file. We deleted it so that a new and non-corrupted one is generated. Please restart your server for the changes to take effect."); - } else { - // We can only hot delete on *NIX systems. - return new TroubleshootResult(TroubleshootResult.Result.FAILURE, - "We've found a problem with your items.csv file. We tried deleting it, but it could not be successfully deleted. Please stop your server, delete '/plugins/Prison/items.csv', and start your server again."); - } - } - - // Nothing is wrong. - return new TroubleshootResult(TroubleshootResult.Result.SUCCESS, - "No problems were found with your item manager or items.csv file."); - } +public class ItemTroubleshooter +// extends Troubleshooter + { + +// public ItemTroubleshooter() { +// super("item_scan", "Run this if you have trouble with the items.csv file."); +// } +// +// @Override public TroubleshootResult invoke(CommandSender invoker) { +// +// // Let's do our own test of initializing the ItemManager. +// try { +// ItemManager ourManager = new ItemManager(); +// ourManager.getItems(); +// } catch (Exception e) { +// // OK, so something's wrong +// // Let's try deleting the file and telling the user to relaunch. +// +// File itemsCsv = new File(PrisonAPI.getPluginDirectory(), "items.csv"); +// boolean deleted = itemsCsv.delete(); +// if (deleted) { +// return new TroubleshootResult(TroubleshootResult.Result.USER_ACTION, +// "We've found a problem with your items.csv file. We deleted it so that a new and non-corrupted one is generated. Please restart your server for the changes to take effect."); +// } else { +// // We can only hot delete on *NIX systems. +// return new TroubleshootResult(TroubleshootResult.Result.FAILURE, +// "We've found a problem with your items.csv file. We tried deleting it, but it could not be successfully deleted. Please stop your server, delete '/plugins/Prison/items.csv', and start your server again."); +// } +// } +// +// // Nothing is wrong. +// return new TroubleshootResult(TroubleshootResult.Result.SUCCESS, +// "No problems were found with your item manager or items.csv file."); +// } } diff --git a/prison-core/src/main/java/tech/mcprison/prison/util/BlockType.java b/prison-core/src/main/java/tech/mcprison/prison/util/BlockType.java index f5538f0f1..a64284978 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/util/BlockType.java +++ b/prison-core/src/main/java/tech/mcprison/prison/util/BlockType.java @@ -19,13 +19,7 @@ package tech.mcprison.prison.util; import java.util.ArrayList; -import java.util.Collection; import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import tech.mcprison.prison.Prison; /** @@ -103,7 +97,10 @@ public enum BlockType { POLISHED_DIORITE( 1, "minecraft:stone", 4, MaterialType.BLOCK ), ANDESITE( 1, "minecraft:stone", 5, MaterialType.BLOCK ), POLISHED_ANDESITE( 1, "minecraft:stone", 6, MaterialType.BLOCK ), + GRASS( 2, "minecraft:grass", 0, MaterialType.BLOCK ), + GRASS_BLOCK( 2, "minecraft:grass_block", 0, MaterialType.BLOCK ), + DIRT( 3, "minecraft:dirt", 0, MaterialType.BLOCK ), COARSE_DIRT( 3, "minecraft:dirt", 1, MaterialType.BLOCK ), PODZOL( 3, "minecraft:dirt", 2, MaterialType.BLOCK ), @@ -126,7 +123,20 @@ public enum BlockType { FLOWING_WATER( 8, "minecraft:flowing_water", 0, MaterialType.BLOCK, "WATER" ), - STILL_WATER( 9, "minecraft:water", 0, MaterialType.BLOCK ), + STILL_WATER( 9, "minecraft:water", 0, MaterialType.BLOCK, "STATIONARY_WATER"), + + STATIONARY_WATER_01( 9, "minecraft:water", 1, MaterialType.BLOCK, "STATIONARY_WATER"), + STATIONARY_WATER_02( 9, "minecraft:water", 2, MaterialType.BLOCK, "STATIONARY_WATER"), + STATIONARY_WATER_03( 9, "minecraft:water", 3, MaterialType.BLOCK, "STATIONARY_WATER"), + STATIONARY_WATER_04( 9, "minecraft:water", 4, MaterialType.BLOCK, "STATIONARY_WATER"), + STATIONARY_WATER_05( 9, "minecraft:water", 5, MaterialType.BLOCK, "STATIONARY_WATER"), + STATIONARY_WATER_06( 9, "minecraft:water", 6, MaterialType.BLOCK, "STATIONARY_WATER"), + STATIONARY_WATER_07( 9, "minecraft:water", 7, MaterialType.BLOCK, "STATIONARY_WATER"), + STATIONARY_WATER_08( 9, "minecraft:water", 8, MaterialType.BLOCK, "STATIONARY_WATER"), + STATIONARY_WATER_09( 9, "minecraft:water", 9, MaterialType.BLOCK, "STATIONARY_WATER"), + STATIONARY_WATER_10( 9, "minecraft:water", 10, MaterialType.BLOCK, "STATIONARY_WATER"), + + FLOWING_LAVA( 10, "minecraft:flowing_lava", 0, MaterialType.BLOCK, "LAVA" ), STILL_LAVA( 11, "minecraft:lava", 0, MaterialType.BLOCK ), @@ -140,7 +150,7 @@ public enum BlockType { OAK_WOOD( 17, "minecraft:log", 0, MaterialType.BLOCK ), SPRUCE_WOOD( 17, "minecraft:log", 1, MaterialType.BLOCK ), BIRCH_WOOD( 17, "minecraft:log", 2, MaterialType.BLOCK ), - JUNGLE_WOOD( 17, "minecraft:log", 3, MaterialType.BLOCK ), + JUNGLE_WOOD( 17, "minecraft:log", 3, MaterialType.BLOCK, "jungle_planks" ), OAK_LEAVES( 18, "minecraft:leaves", 0, MaterialType.BLOCK ), SPRUCE_LEAVES( 18, "minecraft:leaves", 1, MaterialType.BLOCK ), @@ -151,8 +161,12 @@ public enum BlockType { WET_SPONGE( 19, "minecraft:sponge", 1, MaterialType.BLOCK ), GLASS( 20, "minecraft:glass", 0, MaterialType.BLOCK ), - LAPIS_LAZULI_ORE( 21, "minecraft:lapis_ore", 0, MaterialType.BLOCK ), - LAPIS_LAZULI_BLOCK( 22, "minecraft:lapis_block", 0, MaterialType.BLOCK ), + + LAPIS_ORE( 21, "minecraft:lapis_ore", 0, MaterialType.BLOCK, "LAPIS_LAZULI_ORE" ), + LAPIS_LAZULI_ORE( 21, "minecraft:lapis_ore", 0, MaterialType.BLOCK ), // obsolete... + + LAPIS_BLOCK( 22, "minecraft:lapis_block", 0, MaterialType.BLOCK, "LAPIS_LAZULI_BLOCK" ), + LAPIS_LAZULI_BLOCK( 22, "minecraft:lapis_block", 0, MaterialType.BLOCK ), // obsolete... DISPENSER( 23, "minecraft:dispenser", 0, MaterialType.BLOCK ), SANDSTONE( 24, "minecraft:sandstone", 0, MaterialType.BLOCK ), @@ -214,7 +228,9 @@ public enum BlockType { BRICKS( 45, "minecraft:brick_block", 0, MaterialType.BLOCK ), TNT( 46, "minecraft:tnt", 0, MaterialType.BLOCK ), BOOKSHELF( 47, "minecraft:bookshelf", 0, MaterialType.BLOCK ), - MOSS_STONE( 48, "minecraft:mossy_cobblestone", 0, MaterialType.BLOCK, "MOSSY_COBBLESTONE" ), + + MOSSY_COBBLESTONE( 48, "minecraft:mossy_cobblestone", 0, MaterialType.BLOCK, "MOSSY_COBBLESTONE" ), + MOSS_STONE( 48, "minecraft:mossy_cobblestone", 0, MaterialType.BLOCK, "MOSSY_COBBLESTONE", "MOSS_STONE" ), OBSIDIAN( 49, "minecraft:obsidian", 0, MaterialType.BLOCK ), TORCH( 50, "minecraft:torch", 0, MaterialType.BLOCK ), @@ -318,19 +334,19 @@ public enum BlockType { BRICK_STAIRS( 108, "minecraft:brick_stairs", 0, MaterialType.BLOCK ), STONE_BRICK_STAIRS( 109, "minecraft:stone_brick_stairs", 0, MaterialType.BLOCK ), MYCELIUM( 110, "minecraft:mycelium", 0, MaterialType.BLOCK ), - LILY_PAD( 111, "minecraft:waterlily", 0, MaterialType.BLOCK ), + LILY_PAD( 111, "minecraft:waterlily", 0, MaterialType.ITEM ), - NETHER_BRICK( 112, "minecraft:nether_brick", 0, MaterialType.BLOCK ), + NETHER_BRICK( 112, "minecraft:nether_brick", 0, MaterialType.ITEM ), NETHER_BRICK_FENCE( 113, "minecraft:nether_brick_fence", 0, MaterialType.BLOCK ), NETHER_BRICK_STAIRS( 114, "minecraft:nether_brick_stairs", 0, MaterialType.BLOCK ), - NETHER_WART( 115, "minecraft:nether_wart", 0, MaterialType.BLOCK ), + NETHER_WART( 115, "minecraft:nether_wart", 0, MaterialType.ITEM ), ENCHANTMENT_TABLE( 116, "minecraft:enchanting_table", 0, MaterialType.BLOCK ), BREWING_STAND( 117, "minecraft:brewing_stand", 0, MaterialType.BLOCK ), CAULDRON( 118, "minecraft:cauldron", 0, MaterialType.BLOCK), END_PORTAL( 119, "minecraft:end_portal", 0 ), END_PORTAL_FRAME( 120, "minecraft:end_portal_frame", 0, MaterialType.BLOCK ), END_STONE( 121, "minecraft:end_stone", 0, MaterialType.BLOCK ), - DRAGON_EGG( 122, "minecraft:dragon_egg", 0, MaterialType.BLOCK ), + DRAGON_EGG( 122, "minecraft:dragon_egg", 0, MaterialType.ITEM ), REDSTONE_LAMP_INACTIVE( 123, "minecraft:redstone_lamp", 0, MaterialType.BLOCK, "REDSTONE_LAMP_OFF" ), REDSTONE_LAMP_ACTIVE( 124, "minecraft:lit_redstone_lamp", 0, MaterialType.BLOCK, "REDSTONE_LAMP", "REDSTONE_LAMP_ON" ), @@ -447,7 +463,10 @@ public enum BlockType { RED_CARPET( 171, "minecraft:carpet", 14, MaterialType.BLOCK ), BLACK_CARPET( 171, "minecraft:carpet", 15, MaterialType.BLOCK ), HARDENED_CLAY( 172, "minecraft:hardened_clay", 0, MaterialType.BLOCK, "TERRACOTTA", "HARD_CLAY" ), - BLOCK_OF_COAL( 173, "minecraft:coal_block", 0, MaterialType.BLOCK ), + + COAL_BLOCK( 173, "minecraft:coal_block", 0, MaterialType.BLOCK, "BLOCK_OF_COAL" ), + BLOCK_OF_COAL( 173, "minecraft:coal_block", 0, MaterialType.BLOCK ), // obsolete... + PACKED_ICE( 174, "minecraft:packed_ice", 0, MaterialType.BLOCK ), SUNFLOWER( 175, "minecraft:double_plant", 0, MaterialType.BLOCK ), LILAC( 175, "minecraft:double_plant", 1, MaterialType.BLOCK ), @@ -573,7 +592,7 @@ public enum BlockType { MINECART( 328, "minecraft:minecart", 0 ), SADDLE( 329, "minecraft:saddle", 0 ), IRON_DOOR( 330, "minecraft:iron_door", 0, MaterialType.BLOCK ), - REDSTONE( 331, "minecraft:redstone", 0, MaterialType.BLOCK ), + REDSTONE( 331, "minecraft:redstone", 0, MaterialType.ITEM ), SNOWBALL( 332, "minecraft:snowball", 0 ), OAK_BOAT( 333, "minecraft:boat", 0 ), LEATHER( 334, "minecraft:leather", 0 ), @@ -704,7 +723,7 @@ public enum BlockType { FIREWORK_STAR( 402, "minecraft:firework_charge", 0 ), ENCHANTED_BOOK( 403, "minecraft:enchanted_book", 0 ), REDSTONE_COMPARATOR( 404, "minecraft:comparator", 0, MaterialType.BLOCK ), - NETHER_BRICK_ITEM( 405, "minecraft:netherbrick", 0, MaterialType.BLOCK ), + NETHER_BRICK_ITEM( 405, "minecraft:netherbrick", 0, MaterialType.ITEM ), NETHER_QUARTZ( 406, "minecraft:quartz", 0 ), MINECART_WITH_TNT( 407, "minecraft:tnt_minecart", 0 ), MINECART_WITH_HOPPER( 408, "minecraft:hopper_minecart", 0 ), @@ -761,31 +780,281 @@ public enum BlockType { WAIT_DISC( 2267, "minecraft:record_wait", 0 ), -// Testing to see if we can inject 1.13 block types: :( nope... does not work. -// Commenting out for now, will revisit later. -// -// AIR_113( "air", MaterialType.BLOCK, MaterialVersion.v1_13 ), -// -// QUARTZ_113( "quartz", MaterialType.BLOCK, MaterialVersion.v1_13 ), -// NETHER_QUARTZ_ORE_113( "nether_quartz_ore", MaterialType.BLOCK, MaterialVersion.v1_13 ), -// QUARTZ_BLOCK_113( "quartz_block", MaterialType.BLOCK, MaterialVersion.v1_13 ), -// CHISELED_QUARTZ_BLOCK_113( "chiseled_quartz_block", MaterialType.BLOCK, MaterialVersion.v1_13 ), -// QUARTZ_PILLAR_113( "quartz_pillar", MaterialType.BLOCK, MaterialVersion.v1_13 ), -// QUARTZ_SLAB_113( "quartz_slab", MaterialType.BLOCK, MaterialVersion.v1_13 ), -// SMOOTH_QUARTZ_113( "smooth_quartz", MaterialType.BLOCK, MaterialVersion.v1_13 ), -// -// OAK_LOG_113( "oak_log", MaterialType.BLOCK, MaterialVersion.v1_13 ), -// SPRUCE_LOG_113( "spruce_log", MaterialType.BLOCK, MaterialVersion.v1_13 ), -// BIRCH_LOG_113( "birch_log", MaterialType.BLOCK, MaterialVersion.v1_13 ), -// JUNGLE_LOG_113( "jungle_log", MaterialType.BLOCK, MaterialVersion.v1_13 ), -// -// OAK_WOOD_113( "oak_wood", MaterialType.BLOCK, MaterialVersion.v1_13 ), -// SPRUCE_WOOD_113( "spruce_wood", MaterialType.BLOCK, MaterialVersion.v1_13 ), -// BIRCH_WOOD_113( "birch_wood", MaterialType.BLOCK, MaterialVersion.v1_13 ), -// JUNGLE_WOOD_113( "jungle_wood", MaterialType.BLOCK, MaterialVersion.v1_13 ), -// + // Minecraft v1.10.x blocks: + + STRUCTURE_VOID( "minecraft:structure_void", MaterialType.BLOCK, MaterialVersion.v1_10 ), + MAGMA_BLOCK( "minecraft:magma_block", MaterialType.BLOCK, MaterialVersion.v1_10 ), + BONE_BLOCK( "minecraft:bone_block", MaterialType.BLOCK, MaterialVersion.v1_10 ), + + + // Minecraft v1.11.x blocks: + + SHULKER_BOX( "minecraft:shulker_box", MaterialType.BLOCK, MaterialVersion.v1_11 ), + + WHITE_SHULKER_BOX( "minecraft:white_shulker_box", MaterialType.BLOCK, MaterialVersion.v1_11 ), + ORANGE_SHULKER_BOX( "minecraft:orange_shulker_box", MaterialType.BLOCK, MaterialVersion.v1_11 ), + MAGENTA_SHULKER_BOX( "minecraft:magenta_shulker_box", MaterialType.BLOCK, MaterialVersion.v1_11 ), + LIGHT_BLUE_SHULKER_BOX( "minecraft:light_blue_shulker_box", MaterialType.BLOCK, MaterialVersion.v1_11 ), + YELLOW_SHULKER_BOX( "minecraft:yellow_shulker_box", MaterialType.BLOCK, MaterialVersion.v1_11 ), + + LIME_SHULKER_BOX( "minecraft:lime_shulker_box", MaterialType.BLOCK, MaterialVersion.v1_11 ), + PINK_SHULKER_BOX( "minecraft:pink_shulker_box", MaterialType.BLOCK, MaterialVersion.v1_11 ), + GRAY_SHULKER_BOX( "minecraft:gray_shulker_box", MaterialType.BLOCK, MaterialVersion.v1_11 ), + LIGHT_GRAY_SHULKER_BOX( "minecraft:light_gray_shulker_box", MaterialType.BLOCK, MaterialVersion.v1_11 ), + CYAN_SHULKER_BOX( "minecraft:cyan_shulker_box", MaterialType.BLOCK, MaterialVersion.v1_11 ), + + PURPLE_SHULKER_BOX( "minecraft:purple_shulker_box", MaterialType.BLOCK, MaterialVersion.v1_11 ), + BLUE_SHULKER_BOX( "minecraft:blue_shulker_box", MaterialType.BLOCK, MaterialVersion.v1_11 ), + BROWN_SHULKER_BOX( "minecraft:brown_shulker_box", MaterialType.BLOCK, MaterialVersion.v1_11 ), + GREEN_SHULKER_BOX( "minecraft:green_shulker_box", MaterialType.BLOCK, MaterialVersion.v1_11 ), + RED_SHULKER_BOX( "minecraft:red_shulker_box", MaterialType.BLOCK, MaterialVersion.v1_11 ), + BLACK_SHULKER_BOX( "minecraft:black_shulker_box", MaterialType.BLOCK, MaterialVersion.v1_11 ), + + + + // Minecraft v1.12.x blocks: + + WHITE_GLAZED_TERRACOTTA( "minecraft:white_glazed_terracotta", MaterialType.BLOCK, MaterialVersion.v1_12 ), + ORANGE_GLAZED_TERRACOTTA( "minecraft:orange_glazed_terracotta", MaterialType.BLOCK, MaterialVersion.v1_12 ), + MAGENTA_GLAZED_TERRACOTTA( "minecraft:magenta_glazed_terracotta", MaterialType.BLOCK, MaterialVersion.v1_12 ), + LIGHT_BLUE_GLAZED_TERRACOTTA( "minecraft:light_blue_glazed_terracotta", MaterialType.BLOCK, MaterialVersion.v1_12 ), + YELLOW_GLAZED_TERRACOTTA( "minecraft:yellow_glazed_terracotta", MaterialType.BLOCK, MaterialVersion.v1_12 ), + + LIME_GLAZED_TERRACOTTA( "minecraft:lime_glazed_terracotta", MaterialType.BLOCK, MaterialVersion.v1_12 ), + PINK_GLAZED_TERRACOTTA( "minecraft:pink_glazed_terracotta", MaterialType.BLOCK, MaterialVersion.v1_12 ), + GRAY_GLAZED_TERRACOTTA( "minecraft:gray_glazed_terracotta", MaterialType.BLOCK, MaterialVersion.v1_12 ), + LIGHT_GRAY_GLAZED_TERRACOTTA( "minecraft:light_gray_glazed_terracotta", MaterialType.BLOCK, MaterialVersion.v1_12 ), + CYAN_GLAZED_TERRACOTTA( "minecraft:cyan_glazed_terracotta", MaterialType.BLOCK, MaterialVersion.v1_12 ), + + PURPLE_GLAZED_TERRACOTTA( "minecraft:purple_glazed_terracotta", MaterialType.BLOCK, MaterialVersion.v1_12 ), + BLUE_GLAZED_TERRACOTTA( "minecraft:blue_glazed_terracotta", MaterialType.BLOCK, MaterialVersion.v1_12 ), + BROWN_GLAZED_TERRACOTTA( "minecraft:brown_glazed_terracotta", MaterialType.BLOCK, MaterialVersion.v1_12 ), + GREEN_GLAZED_TERRACOTTA( "minecraft:green_glazed_terracotta", MaterialType.BLOCK, MaterialVersion.v1_12 ), + RED_GLAZED_TERRACOTTA( "minecraft:red_glazed_terracotta", MaterialType.BLOCK, MaterialVersion.v1_12 ), + BLACK_GLAZED_TERRACOTTA( "minecraft:black_glazed_terracotta", MaterialType.BLOCK, MaterialVersion.v1_12 ), + WHITE_CONCRETE( "minecraft:white_concrete", MaterialType.BLOCK, MaterialVersion.v1_12 ), + ORANGE_CONCRETE( "minecraft:orange_concrete", MaterialType.BLOCK, MaterialVersion.v1_12 ), + MAGENTA_CONCRETE( "minecraft:magenta_concrete", MaterialType.BLOCK, MaterialVersion.v1_12 ), + LIGHT_BLUE_CONCRETE( "minecraft:light_blue_concrete", MaterialType.BLOCK, MaterialVersion.v1_12 ), + YELLOW_CONCRETE( "minecraft:yellow_concrete", MaterialType.BLOCK, MaterialVersion.v1_12 ), + + LIME_CONCRETE( "minecraft:lime_concrete", MaterialType.BLOCK, MaterialVersion.v1_12 ), + PINK_CONCRETE( "minecraft:pink_concrete", MaterialType.BLOCK, MaterialVersion.v1_12 ), + GRAY_CONCRETE( "minecraft:gray_concrete", MaterialType.BLOCK, MaterialVersion.v1_12 ), + LIGHT_GRAY_CONCRETE( "minecraft:light_gray_concrete", MaterialType.BLOCK, MaterialVersion.v1_12 ), + CYAN_CONCRETE( "minecraft:cyan_concrete", MaterialType.BLOCK, MaterialVersion.v1_12 ), + + PURPLE_CONCRETE( "minecraft:purple_concrete", MaterialType.BLOCK, MaterialVersion.v1_12 ), + BLUE_CONCRETE( "minecraft:blue_concrete", MaterialType.BLOCK, MaterialVersion.v1_12 ), + BROWN_CONCRETE( "minecraft:brown_concrete", MaterialType.BLOCK, MaterialVersion.v1_12 ), + GREEN_CONCRETE( "minecraft:green_concrete", MaterialType.BLOCK, MaterialVersion.v1_12 ), + RED_CONCRETE( "minecraft:red_concrete", MaterialType.BLOCK, MaterialVersion.v1_12 ), + BLACK_CONCRETE( "minecraft:black_concrete", MaterialType.BLOCK, MaterialVersion.v1_12 ), + + + WHITE_CONCRETE_POWDER( "minecraft:white_concrete_powder", MaterialType.BLOCK, MaterialVersion.v1_12 ), + ORANGE_CONCRETE_POWDER( "minecraft:orange_concrete_powder", MaterialType.BLOCK, MaterialVersion.v1_12 ), + MAGENTA_CONCRETE_POWDER( "minecraft:magenta_concrete_powder", MaterialType.BLOCK, MaterialVersion.v1_12 ), + LIGHT_BLUE_CONCRETE_POWDER( "minecraft:light_blue_concrete_powder", MaterialType.BLOCK, MaterialVersion.v1_12 ), + YELLOW_CONCRETE_POWDER( "minecraft:yellow_concrete_powder", MaterialType.BLOCK, MaterialVersion.v1_12 ), + + LIME_CONCRETE_POWDER( "minecraft:lime_concrete_powder", MaterialType.BLOCK, MaterialVersion.v1_12 ), + PINK_CONCRETE_POWDER( "minecraft:pink_concrete_powder", MaterialType.BLOCK, MaterialVersion.v1_12 ), + GRAY_CONCRETE_POWDER( "minecraft:gray_concrete_powder", MaterialType.BLOCK, MaterialVersion.v1_12 ), + LIGHT_GRAY_CONCRETE_POWDER( "minecraft:light_gray_concrete_powder", MaterialType.BLOCK, MaterialVersion.v1_12 ), + CYAN_CONCRETE_POWDER( "minecraft:cyan_concrete_powder", MaterialType.BLOCK, MaterialVersion.v1_12 ), + + PURPLE_CONCRETE_POWDER( "minecraft:purple_concrete_powder", MaterialType.BLOCK, MaterialVersion.v1_12 ), + BLUE_CONCRETE_POWDER( "minecraft:blue_concrete_powder", MaterialType.BLOCK, MaterialVersion.v1_12 ), + BROWN_CONCRETE_POWDER( "minecraft:brown_concrete_powder", MaterialType.BLOCK, MaterialVersion.v1_12 ), + GREEN_CONCRETE_POWDER( "minecraft:green_concrete_powder", MaterialType.BLOCK, MaterialVersion.v1_12 ), + RED_CONCRETE_POWDER( "minecraft:red_concrete_powder", MaterialType.BLOCK, MaterialVersion.v1_12 ), + BLACK_CONCRETE_POWDER( "minecraft:black_concrete_powder", MaterialType.BLOCK, MaterialVersion.v1_12 ), + + + + + // Minecraft v1.13.x blocks: + + CAVE_AIR( "minecraft:cave_air", MaterialType.BLOCK, MaterialVersion.v1_13 ), + VOID_AIR( "minecraft:void_air", MaterialType.BLOCK, MaterialVersion.v1_13 ), + + BLUE_ICE( "minecraft:blue_ice", MaterialType.BLOCK, MaterialVersion.v1_13 ), + BUBBLE_COLUMN( "minecraft:bubble_column", MaterialType.BLOCK, MaterialVersion.v1_13 ), + + TUBE_CORAL( "minecraft:tube_coral", MaterialType.BLOCK, MaterialVersion.v1_13 ), + BRAIN_CORAL( "minecraft:brain_coral", MaterialType.BLOCK, MaterialVersion.v1_13 ), + BUBBLE_CORAL( "minecraft:bubble_coral", MaterialType.BLOCK, MaterialVersion.v1_13 ), + FIRE_CORAL( "minecraft:fire_coral", MaterialType.BLOCK, MaterialVersion.v1_13 ), + HORN_CORAL( "minecraft:horn_coral", MaterialType.BLOCK, MaterialVersion.v1_13 ), + + DEAD_TUBE_CORAL( "minecraft:dead_tube_coral", MaterialType.BLOCK, MaterialVersion.v1_13 ), + DEAD_BRAIN_CORAL( "minecraft:dead_brain_coral", MaterialType.BLOCK, MaterialVersion.v1_13 ), + DEAD_BUBBLE_CORAL( "minecraft:dead_bubble_coral", MaterialType.BLOCK, MaterialVersion.v1_13 ), + DEAD_FIRE_CORAL( "minecraft:dead_fire_coral", MaterialType.BLOCK, MaterialVersion.v1_13 ), + DEAD_HORN_CORAL( "minecraft:dead_horn_coral", MaterialType.BLOCK, MaterialVersion.v1_13 ), + + + TUBE_CORAL_BLOCK( "minecraft:tube_coral_block", MaterialType.BLOCK, MaterialVersion.v1_13 ), + BRAIN_CORAL_BLOCK( "minecraft:brain_coral_block", MaterialType.BLOCK, MaterialVersion.v1_13 ), + BUBBLE_CORAL_BLOCK( "minecraft:bubble_coral_block", MaterialType.BLOCK, MaterialVersion.v1_13 ), + FIRE_CORAL_BLOCK( "minecraft:fire_coral_block", MaterialType.BLOCK, MaterialVersion.v1_13 ), + HORN_CORAL_BLOCK( "minecraft:horn_coral_block", MaterialType.BLOCK, MaterialVersion.v1_13 ), + + DEAD_TUBE_CORAL_BLOCK( "minecraft:dead_tube_coral_block", MaterialType.BLOCK, MaterialVersion.v1_13 ), + DEAD_BRAIN_CORAL_BLOCK( "minecraft:dead_brain_coral_block", MaterialType.BLOCK, MaterialVersion.v1_13 ), + DEAD_BUBBLE_CORAL_BLOCK( "minecraft:dead_bubble_coral_block", MaterialType.BLOCK, MaterialVersion.v1_13 ), + DEAD_FIRE_CORAL_BLOCK( "minecraft:dead_fire_coral_block", MaterialType.BLOCK, MaterialVersion.v1_13 ), + DEAD_HORN_CORAL_BLOCK( "minecraft:dead_horn_coral_block", MaterialType.BLOCK, MaterialVersion.v1_13 ), + + + TUBE_CORAL_FAN( "minecraft:tube_coral_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + BRAIN_CORAL_FAN( "minecraft:brain_coral_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + BUBBLE_CORAL_FAN( "minecraft:bubble_coral_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + FIRE_CORAL_FAN( "minecraft:fire_coral_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + HORN_CORAL_FAN( "minecraft:horn_coral_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + + DEAD_TUBE_CORAL_FAN( "minecraft:dead_tube_coral_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + DEAD_BRAIN_CORAL_FAN( "minecraft:dead_brain_coral_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + DEAD_BUBBLE_CORAL_FAN( "minecraft:dead_bubble_coral_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + DEAD_FIRE_CORAL_FAN( "minecraft:dead_fire_coral_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + DEAD_HORN_CORAL_FAN( "minecraft:dead_horn_coral_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + + + TUBE_CORAL_WALL_FAN( "minecraft:tube_coral_wall_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + BRAIN_CORAL_WALL_FAN( "minecraft:brain_coral_wall_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + BUBBLE_CORAL_WALL_FAN( "minecraft:bubble_coral_wall_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + FIRE_CORAL_WALL_FAN( "minecraft:fire_coral_wall_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + HORN_CORAL_WALL_FAN( "minecraft:horn_coral_wall_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + + DEAD_TUBE_CORAL_WALL_FAN( "minecraft:dead_tube_coral_wall_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + DEAD_BRAIN_CORAL_WALL_FAN( "minecraft:dead_brain_coral_wall_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + DEAD_BUBBLE_CORAL_WALL_FAN( "minecraft:dead_bubble_coral_wall_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + DEAD_FIRE_CORAL_WALL_FAN( "minecraft:dead_fire_coral_wall_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + DEAD_HORN_CORAL_WALL_FAN( "minecraft:dead_horn_coral_wall_fan", MaterialType.BLOCK, MaterialVersion.v1_13 ), + + + + + ACACIA_LOG( "minecraft:acacia_log", MaterialType.BLOCK, MaterialVersion.v1_13 ), + BIRCH_LOG( "minecraft:birch_log", MaterialType.BLOCK, MaterialVersion.v1_13 ), + DARK_OAK_LOG( "minecraft:dark_oak_log", MaterialType.BLOCK, MaterialVersion.v1_13 ), + JUNGLE_LOG( "minecraft:jungle_log", MaterialType.BLOCK, MaterialVersion.v1_13 ), + OAK_LOG( "minecraft:oak_log", MaterialType.BLOCK, MaterialVersion.v1_13 ), + SPRUCE_LOG( "minecraft:spruce_log", MaterialType.BLOCK, MaterialVersion.v1_13 ), + + + STRIPPED_ACACIA_LOG( "minecraft:stripped_acacia_log", MaterialType.BLOCK, MaterialVersion.v1_13 ), + STRIPPED_BIRCH_LOG( "minecraft:stripped_birch_log", MaterialType.BLOCK, MaterialVersion.v1_13 ), + STRIPPED_DARK_OAK_LOG( "minecraft:stripped_dark_oak_log", MaterialType.BLOCK, MaterialVersion.v1_13 ), + STRIPPED_JUNGLE_LOG( "minecraft:stripped_jungle_log", MaterialType.BLOCK, MaterialVersion.v1_13 ), + STRIPPED_OAK_LOG( "minecraft:stripped_oak_log", MaterialType.BLOCK, MaterialVersion.v1_13 ), + STRIPPED_SPRUCE_LOG( "minecraft:stripped_spruce_log", MaterialType.BLOCK, MaterialVersion.v1_13 ), + + STRIPPED_ACACIA_WOOD( "minecraft:stripped_acacia_wood", MaterialType.BLOCK, MaterialVersion.v1_13 ), + STRIPPED_BIRCH_WOOD( "minecraft:stripped_birch_wood", MaterialType.BLOCK, MaterialVersion.v1_13 ), + STRIPPED_DARK_OAK_WOOD( "minecraft:stripped_dark_oak_wood", MaterialType.BLOCK, MaterialVersion.v1_13 ), + STRIPPED_JUNGLE_WOOD( "minecraft:stripped_jungle_wood", MaterialType.BLOCK, MaterialVersion.v1_13 ), + STRIPPED_OAK_WOOD( "minecraft:stripped_oak_wood", MaterialType.BLOCK, MaterialVersion.v1_13 ), + STRIPPED_SPRUCE_WOOD( "minecraft:stripped_spruce_wood", MaterialType.BLOCK, MaterialVersion.v1_13 ), + + + + // Minecraft v1.14.x blocks: + BAMBOO( "minecraft:bamboo", MaterialType.BLOCK, MaterialVersion.v1_14 ), + BAMBOO_SAPLING( "minecraft:bamboo_sapling", MaterialType.BLOCK, MaterialVersion.v1_14 ), + + BARREL( "minecraft:barrel", MaterialType.BLOCK, MaterialVersion.v1_14 ), + BELL( "minecraft:bell", MaterialType.BLOCK, MaterialVersion.v1_14 ), + BLAST_FURNACE( "minecraft:blast_furnace", MaterialType.BLOCK, MaterialVersion.v1_14 ), + + CAMPFIRE( "minecraft:campfire", MaterialType.BLOCK, MaterialVersion.v1_14 ), + CARTOGRAPHY_TABLE( "minecraft:cartography_table", MaterialType.BLOCK, MaterialVersion.v1_14 ), + COMPOSTER( "minecraft:composter", MaterialType.BLOCK, MaterialVersion.v1_14 ), + FLETCHING_TABLE( "minecraft:fletching_table", MaterialType.BLOCK, MaterialVersion.v1_14 ), + //FLOWERS( "minecraft:bee_nest", MaterialType.BLOCK, MaterialVersion.v1_14 ), + GRINDSTONE( "minecraft:grindstone", MaterialType.BLOCK, MaterialVersion.v1_14 ), + JIGSAW( "minecraft:jigsaw", MaterialType.BLOCK, MaterialVersion.v1_14 ), + LANTERN( "minecraft:lantern", MaterialType.BLOCK, MaterialVersion.v1_14 ), + LECTERN( "minecraft:lectern", MaterialType.BLOCK, MaterialVersion.v1_14 ), + + LOOM( "minecraft:loom", MaterialType.BLOCK, MaterialVersion.v1_14 ), + // Already exists: NOTE_BLOCK( "minecraft:note_block", MaterialType.BLOCK, MaterialVersion.v1_14 ), + SCAFFOLDING( "minecraft:scaffolding", MaterialType.BLOCK, MaterialVersion.v1_14 ), + //SIGNS( "minecraft:bee_nest", MaterialType.BLOCK, MaterialVersion.v1_14 ), + //SLABS( "minecraft:bee_nest", MaterialType.BLOCK, MaterialVersion.v1_14 ), + SMITHING_TABLE( "minecraft:smithing_table", MaterialType.BLOCK, MaterialVersion.v1_14 ), + SMOKER( "minecraft:smoker", MaterialType.BLOCK, MaterialVersion.v1_14 ), + //STAIRS( "minecraft:bee_nest", MaterialType.BLOCK, MaterialVersion.v1_14 ), + STONECUTTER( "minecraft:stonecutter", MaterialType.BLOCK, MaterialVersion.v1_14 ), + SWEET_BERRY_BUSH( "minecraft:sweet_berry_bush", MaterialType.BLOCK, MaterialVersion.v1_14 ), + //WALLS( "minecraft:bee_nest", MaterialType.BLOCK, MaterialVersion.v1_14 ), + + + + + // Minecraft v1.15.x blocks: + BEE_NEST( "minecraft:bee_nest", MaterialType.BLOCK, MaterialVersion.v1_15 ), + BEEHIVE( "minecraft:beehive", MaterialType.BLOCK, MaterialVersion.v1_15 ), + HONEY_BLOCK( "minecraft:honey_block", MaterialType.BLOCK, MaterialVersion.v1_15 ), + HONEYCOMB_BLOCK( "minecraft:honeycomb_block", MaterialType.BLOCK, MaterialVersion.v1_15 ), + + + + // Minecraft v1.16.x blocks: + ANCIENT_DEBRIS( "minecraft:ancient_debris", MaterialType.BLOCK, MaterialVersion.v1_16 ), + CRYING_OBSIDIAN( "minecraft:crying_obsidian", MaterialType.BLOCK, MaterialVersion.v1_16 ), + NETHER_GOLD_ORE( "minecraft:nether_gold_ore", MaterialType.BLOCK, MaterialVersion.v1_16 ), + + + BASALT( "minecraft:basal", MaterialType.BLOCK, MaterialVersion.v1_16 ), + POLISHED_BASALT( "minecraft:polished_basalt", MaterialType.BLOCK, MaterialVersion.v1_16 ), + NETHERITE_BLOCK( "minecraft:netherite_block", MaterialType.BLOCK, MaterialVersion.v1_16 ), + + + BLACKSTONE( "minecraft:base_stone_blackstone", MaterialType.BLOCK, MaterialVersion.v1_16 ), + POLISHED_BLACKSTONE( "minecraft:polished_blackstone", MaterialType.BLOCK, MaterialVersion.v1_16 ), + CHISELED_POLISHED_BLACKSTONE( "minecraft:chiseled_polished_blackstone", MaterialType.BLOCK, MaterialVersion.v1_16 ), + + + NETHER_BRICKS( "minecraft:nether_bricks", MaterialType.BLOCK, MaterialVersion.v1_8 ), + RED_NETHER_BRICKS( "minecraft:red_nether_bricks", MaterialType.BLOCK, MaterialVersion.v1_10 ), + CRACKED_NETHER_BRICKS( "minecraft:cracked_nether_bricks", MaterialType.BLOCK, MaterialVersion.v1_16 ), + CHISELED_NETHER_BRICKS( "minecraft:chiseled_nether_bricks", MaterialType.BLOCK, MaterialVersion.v1_16 ), + + + CRIMSON_PLANKS( "minecraft:crimson_planks", MaterialType.BLOCK, MaterialVersion.v1_16 ), + WARPED_PLANKS( "minecraft:warped_planks", MaterialType.BLOCK, MaterialVersion.v1_16 ), + STRIPPED_CRIMSON_HYPHAE( "minecraft:stripped_crimson_hyphae", MaterialType.BLOCK, MaterialVersion.v1_16 ), + STRIPPED_WARPED_HYPHAE( "minecraft:stripped_warped_hyphae", MaterialType.BLOCK, MaterialVersion.v1_16 ), + NETHER_WART_BLOCK( "minecraft:nether_wart_block", MaterialType.BLOCK, MaterialVersion.v1_16 ), + WARPED_WART_BLOCK( "minecraft:warped_wart_block", MaterialType.BLOCK, MaterialVersion.v1_16 ), + + + LODESTONE( "minecraft:lodestone", MaterialType.BLOCK, MaterialVersion.v1_16 ), + QUARTZ_BRICKS( "minecraft:quartz_bricks", MaterialType.BLOCK, MaterialVersion.v1_16 ), + RESPAWN_ANCHOR( "minecraft:respawn_anchor", MaterialType.BLOCK, MaterialVersion.v1_16 ), + + + SHROOMLIGHT( "minecraft:shroomlight", MaterialType.BLOCK, MaterialVersion.v1_16 ), + SOUL_CAMPFIRE( "minecraft:soul_campfire", MaterialType.BLOCK, MaterialVersion.v1_16 ), + + + SOUL_LANTERN( "minecraft:soul_lantern", MaterialType.BLOCK, MaterialVersion.v1_16 ), + SOUL_TORCH( "minecraft:soul_torch", MaterialType.BLOCK, MaterialVersion.v1_16 ), + SOUL_SOIL( "minecraft:soul_soil", MaterialType.BLOCK, MaterialVersion.v1_16 ), + TARGET( "minecraft:target", MaterialType.BLOCK, MaterialVersion.v1_16 ), + + + TWISTING_VINES( "minecraft:twisting_vines", MaterialType.BLOCK, MaterialVersion.v1_16 ), + WEAPING_VINES( "minecraft:weaping_vines", MaterialType.BLOCK, MaterialVersion.v1_16 ), + + + + + ; // @formatter:on @@ -890,6 +1159,15 @@ public static BlockType getBlock(int legacyId, short data) { return null; } + /** + * This is just an alias for getBlock() which checks for matches in + * many robust ways with numerous fall backs to ensure the best matching. + * @param key + * @return + */ + public static BlockType fromString( String key ) { + return getBlock( key ); + } /** *

Must search first on block name since the block id has potential for duplicates which * will corrupt the block list for the mine. If at all possible, only search by the block name. @@ -931,17 +1209,17 @@ private static BlockType getBlockById(String id) { return getBlockWithData(Integer.parseInt(id.split(":")[0]), Short.parseShort(id.split(":")[1])); } - Prison prison = Prison.get(); - if ( prison != null && prison.getItemManager() != null ) { - Set>> entrySet = prison.getItemManager().getItems().entrySet(); - for (Map.Entry> entry : entrySet) { - if (entry.getValue().contains(id.toLowerCase())) { - return entry.getKey(); - } - } - - return getBlockByName(id); - } +// Prison prison = Prison.get(); +// if ( prison != null && prison.getItemManager() != null ) { +// Set>> entrySet = prison.getItemManager().getItems().entrySet(); +// for (Map.Entry> entry : entrySet) { +// if (entry.getValue().contains(id.toLowerCase())) { +// return entry.getKey(); +// } +// } +// +// return getBlockByName(id); +// } return null; } 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 65128dbda..d4204e1bb 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 @@ -36,7 +36,77 @@ public class Bounds { private final int totalBlockCount; + + public enum Edges { + top, + bottom, + north, + south, + east, + west, + + walls; + + public static Edges fromString( String edge ) { + Edges results = null; + + if ( edge != null && edge.trim().length() > 0 ) { + for ( Edges e : values() ) { + if ( e.name().equalsIgnoreCase( edge.trim() )) { + results = e; + } + } + } + + return results; + } + + public Edges oppositeEdge() { + return oppositeEdge(this); + } + + public static Edges oppositeEdge( Edges edge ) { + Edges results = null; + + switch ( edge ) + { + case top: + results = bottom; + break; + + case bottom: + results = top; + break; + + case north: + results = south; + break; + + case south: + results = north; + break; + + case east: + results = west; + break; + + case west: + results = east; + break; + + default: + results = edge; + break; + } + + + return results; + } + } + + public Bounds(Location min, Location max) { + this.min = min; this.max = max; @@ -69,6 +139,148 @@ public Bounds(Location min, Location max) { (getxBlockMax() - getxBlockMin() + 1) * (getzBlockMax() - getzBlockMin() + 1); } + + + /** + *

This constructor takes an existing Bounds and applies adjustments + * as specified with the combination of edge and amount. + *

+ * + *

This applies adjustments to prevent maxs from being less than the mins, + * and vice-a-versa. It also prevents y from going out of bounds too. + *

+ * + * @param bounds + * @param edge + * @param amount + */ + public Bounds( Bounds bounds, Edges edge, int amount ) { + + int xMin = bounds.getxBlockMin(); + int xMax = bounds.getxBlockMax(); + + int yMin = bounds.getyBlockMin(); + int yMax = bounds.getyBlockMax(); + + int zMin = bounds.getzBlockMin(); + int zMax = bounds.getzBlockMax(); + + switch ( edge ) + { + case top: + yMax += amount; + if ( yMax < yMin ) { + yMax = yMin; + } + if ( yMax > 255 ) { + yMax = 255; + } + break; + + case bottom: + yMin -= amount; + if ( yMin > yMax ) { + yMin = yMax; + } + if ( yMin < 0 ) { + yMin = 0; + } + break; + + case north: + zMin -= amount; + if ( zMin > zMax ) { + zMin = zMax; + } + break; + + case south: + zMax += amount; + if ( zMax < zMin ) { + zMax = zMin; + } + break; + + case east: + xMax += amount; + if ( xMax < xMin ) { + xMax = xMin; + } + break; + + case west: + xMin -= amount; + if ( xMin > xMax ) { + xMin = xMax; + } + break; + + case walls: + + int zAvg = (zMax + zMin) / 2; + + zMax += amount; + zMin -= amount; + + if ( zMax < zMin ) { + zMax = zAvg; + zMin = zAvg; + } + + int xAvg = (xMax + xMin) / 2; + + xMax += amount; + xMin -= amount; + + if ( xMax < xMin ) { + xMax = xAvg; + xMin = xAvg; + } + break; + + default: + break; + } + + + + Location min = new Location( bounds.getMin().getWorld(), xMin, yMin, zMin ); + Location max = new Location( bounds.getMax().getWorld(), xMax, yMax, zMax ); + + + this.min = min; + this.max = max; + + this.xBlockMax = Math.max(min.getBlockX(), max.getBlockX()); + this.xBlockMin = Math.min(min.getBlockX(), max.getBlockX()); + + this.yBlockMax = Math.max(min.getBlockY(), max.getBlockY()); + this.yBlockMin = Math.min(min.getBlockY(), max.getBlockY()); + + this.zBlockMax = Math.max(min.getBlockZ(), max.getBlockZ()); + this.zBlockMin = Math.min(min.getBlockZ(), max.getBlockZ()); + + this.xMin = Math.min(min.getX(), max.getX()); + this.xMax = Math.max(min.getX(), max.getX()); + + this.yMin = Math.min(min.getY(), max.getY()); + this.yMax = Math.max(min.getY(), max.getY()); + + this.zMin = Math.min(min.getZ(), max.getZ()); + this.zMax = Math.max(min.getZ(), max.getZ()); + + double centerX = (xBlockMin + xBlockMax) / 2.0d; + double centerY = (yBlockMin + yBlockMax) / 2.0d; + double centerZ = (zBlockMin + zBlockMax) / 2.0d; + + this.center = new Location(this.min.getWorld(), centerX, centerY, centerZ ); + + this.totalBlockCount = + (getyBlockMax() - getyBlockMin() + 1) * + (getxBlockMax() - getxBlockMin() + 1) * + (getzBlockMax() - getzBlockMin() + 1); + } + public void setWorld( World world ) { if ( world != null ) { @@ -266,8 +478,7 @@ public Location getCenter() return result; } - public int getxBlockMin() - { + public int getxBlockMin() { return xBlockMin; } diff --git a/prison-core/src/main/java/tech/mcprison/prison/util/ItemManager.java b/prison-core/src/main/java/tech/mcprison/prison/util/ItemManager.java index ddd9b60fb..2d72b97aa 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/util/ItemManager.java +++ b/prison-core/src/main/java/tech/mcprison/prison/util/ItemManager.java @@ -18,16 +18,6 @@ package tech.mcprison.prison.util; -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.Multimap; -import tech.mcprison.prison.Prison; - -import java.io.*; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Collection; -import java.util.Map; - /** * This class takes care of the items.csv containing 8000+ different name combinations for blocks. * @@ -36,50 +26,60 @@ */ public class ItemManager { - private Multimap items; - - public ItemManager() throws Exception { - File file = new File(Prison.get().getDataFolder(), "/items.csv"); - items = ArrayListMultimap.create(); - - if (!file.exists()) { - try ( - // make sure the InputStream is properly closed. May not be 100% needed here: - InputStream inputStream = getClass().getResourceAsStream("/items.csv"); - ) - { - Files.copy(inputStream, Paths.get(file.getPath())); - } - catch (Exception e) { - throw new IOException("Error while copying items.csv from the jar resource to a " + - "file within the plugins directory:", e); - } - } - try ( - // Was a memory leak... always must be closed, so the try with resource ensures that it is: - BufferedReader in = new BufferedReader(new FileReader(file)); - ) - { - String inputLine; - - while ((inputLine = in.readLine()) != null) { - if (!inputLine.startsWith("#")) { - String[] array = inputLine.split(","); - String itemName = array[0]; - int id = Integer.parseInt(array[1]); - short data = Short.parseShort(array[2]); - items.put(BlockType.getBlockWithData(id, data), itemName.toLowerCase()); - } - } - - } - catch (Exception e) { - throw new IOException("Error while reading items.csv -- it's probably invalid", e); - } - } +// private Multimap items; - public Map> getItems() { - return items.asMap(); - } + + /** + * This has not been used for a while. Will need to provide an alternative way to + * add custom blocks. + * + * @throws Exception + */ +// @Deprecated +// public ItemManager() throws Exception { +// items = ArrayListMultimap.create(); +// /* +// File file = new File(Prison.get().getDataFolder(), "/items.csv"); +// +// if (!file.exists()) { +// try ( +// // make sure the InputStream is properly closed. May not be 100% needed here: +// InputStream inputStream = getClass().getResourceAsStream("/items.csv"); +// ) +// { +// Files.copy(inputStream, Paths.get(file.getPath())); +// } +// catch (Exception e) { +// throw new IOException("Error while copying items.csv from the jar resource to a " + +// "file within the plugins directory:", e); +// } +// } +// try ( +// // Was a memory leak... always must be closed, so the try with resource ensures that it is: +// BufferedReader in = new BufferedReader(new FileReader(file)); +// ) +// { +// String inputLine; +// +// while ((inputLine = in.readLine()) != null) { +// if (!inputLine.startsWith("#")) { +// String[] array = inputLine.split(","); +// String itemName = array[0]; +// int id = Integer.parseInt(array[1]); +// short data = Short.parseShort(array[2]); +// items.put(BlockType.getBlockWithData(id, data), itemName.toLowerCase()); +// } +// } +// +// } +// catch (Exception e) { +// throw new IOException("Error while reading items.csv -- it's probably invalid", e); +// } +// */ +// } +// +// public Map> getItems() { +// return items.asMap(); +// } } diff --git a/prison-core/src/main/java/tech/mcprison/prison/util/MaterialVersion.java b/prison-core/src/main/java/tech/mcprison/prison/util/MaterialVersion.java index 3c2dc4600..2374c5a27 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/util/MaterialVersion.java +++ b/prison-core/src/main/java/tech/mcprison/prison/util/MaterialVersion.java @@ -4,6 +4,15 @@ public enum MaterialVersion { v1_8, - v1_13 + v1_9, + v1_10, + + v1_11, + v1_12, + v1_13, + + v1_14, + v1_15, + v1_16 ; } diff --git a/prison-core/src/main/java/tech/mcprison/prison/util/PlaceholdersUtil.java b/prison-core/src/main/java/tech/mcprison/prison/util/PlaceholdersUtil.java new file mode 100644 index 000000000..bdf7df8d7 --- /dev/null +++ b/prison-core/src/main/java/tech/mcprison/prison/util/PlaceholdersUtil.java @@ -0,0 +1,81 @@ +package tech.mcprison.prison.util; + +import java.text.DecimalFormat; + +public class PlaceholdersUtil { + + public static final double TIME_SECOND = 1.0; + public static final double TIME_MINUTE = TIME_SECOND * 60.0; + public static final double TIME_HOUR = TIME_MINUTE * 60.0; + public static final double TIME_DAY = TIME_HOUR * 24.0; + + + public static String formattedTime( double time ) { + StringBuilder sb = new StringBuilder(); + + long days = (long)(time / TIME_DAY); + time -= (days * TIME_DAY); + if ( days > 0 ) { + sb.append( days ); + sb.append( "d " ); + } + + long hours = (long)(time / TIME_HOUR); + time -= (hours * TIME_HOUR); + if ( sb.length() > 0 || hours > 0 ) { + sb.append( hours ); + sb.append( "h " ); + } + + long mins = (long)(time / TIME_MINUTE); + time -= (mins * TIME_MINUTE); + if ( sb.length() > 0 || mins > 0 ) { + sb.append( mins ); + sb.append( "m " ); + } + + double secs = (double)(time / TIME_SECOND); + time -= (secs * TIME_SECOND); + DecimalFormat dFmt = new DecimalFormat("#0"); + sb.append( dFmt.format( secs )); + sb.append( "s " ); + + return sb.toString(); + } + + /** + * This is a simple a simple way to reduce down large numbers and apply a single digit + * suffix based upon metric prefixes. + * + * "", k, M, G, T, P, E, Z, Y + * + * Using: https://en.wikipedia.org/wiki/Metric_prefix + * + * @param amount + * @return + */ + public static String formattedSize( double amount ) { + StringBuilder unit = new StringBuilder(); + + DecimalFormat dFmt = new DecimalFormat("#,##0.00"); + + amount = divBy1000( amount, unit, " kMGTPEZY" ); + + String results = dFmt.format( amount ) + " " + unit.toString(); + + return results.trim(); + } + + private static double divBy1000( double amount, StringBuilder unit, String units ) { + if ( amount <= 1000.0 || units.length() == 1 ) { + unit.append( units.subSequence( 0, 1 ) ); + } + else { + // Div amount by 1000.0 and remove the first character of the units: + amount /= 1000.0; + units = units.substring( 1 ); + amount = divBy1000( amount, unit, units ); + } + return amount; + } +} diff --git a/prison-core/src/main/resources/items.csv b/prison-core/src/main/resources/items.csv deleted file mode 100644 index 21f566374..000000000 --- a/prison-core/src/main/resources/items.csv +++ /dev/null @@ -1,8501 +0,0 @@ -stone,1,0 -sstone,1,0 -smoothstone,1,0 -rock,1,0 -granite,1,1 -gstone,1,1 -polishedgranite,1,2 -pgranite,1,2 -pgstone,1,2 -polishedgstone,1,2 -diorite,1,3 -dstone,1,3 -polisheddiorite,1,4 -pdiorite,1,4 -pdstone,1,4 -polisheddstone,1,4 -andesite,1,5 -astone,1,5 -polishedandesite,1,6 -pandesite,1,6 -pastone,1,6 -grass,2,0 -greendirt,2,0 -greenearth,2,0 -greenland,2,0 -dirt,3,0 -earth,3,0 -land,3,0 -cdirt,3,1 -grasslessdirt,3,1 -grasslessearth,3,1 -grasslessland,3,1 -coarsedirt,3,1 -coarseland,3,1 -coarseearth,3,1 -podzol,3,2 -cobblestone,4,0 -cstone,4,0 -cobble,4,0 -wood,5,0 -plank,5,0 -woodenplank,5,0 -woodplank,5,0 -wplank,5,0 -plankwooden,5,0 -plankwood,5,0 -plankw,5,0 -oakplank,5,0 -oakwoodenplank,5,0 -oakwoodplank,5,0 -oakwplank,5,0 -oakplankwooden,5,0 -oakplankwood,5,0 -oakplankw,5,0 -oplank,5,0 -owoodenplank,5,0 -owoodplank,5,0 -owplank,5,0 -oplankwooden,5,0 -oplankwood,5,0 -oplankw,5,0 -pineplank,5,1 -pinewoodenplank,5,1 -pinewoodplank,5,1 -pinewplank,5,1 -pineplankwooden,5,1 -pineplankwood,5,1 -pineplankw,5,1 -pplank,5,1 -pwoodenplank,5,1 -pwoodplank,5,1 -pwplank,5,1 -pplankwooden,5,1 -pplankwood,5,1 -pplankw,5,1 -darkplank,5,1 -darkwoodenplank,5,1 -darkwoodplank,5,1 -darkwplank,5,1 -darkplankwooden,5,1 -darkplankwood,5,1 -darkplankw,5,1 -dplank,5,1 -dwoodenplank,5,1 -dwoodplank,5,1 -dwplank,5,1 -dplankwooden,5,1 -dplankwood,5,1 -dplankw,5,1 -spruceplank,5,1 -sprucewoodenplank,5,1 -sprucewoodplank,5,1 -sprucewplank,5,1 -spruceplankwooden,5,1 -spruceplankwood,5,1 -spruceplankw,5,1 -splank,5,1 -swoodenplank,5,1 -swoodplank,5,1 -swplank,5,1 -splankwooden,5,1 -splankwood,5,1 -splankw,5,1 -birchplank,5,2 -birchwoodenplank,5,2 -birchwoodplank,5,2 -birchwplank,5,2 -birchplankwooden,5,2 -birchplankwood,5,2 -birchplankw,5,2 -bplank,5,2 -bwoodenplank,5,2 -bwoodplank,5,2 -bwplank,5,2 -bplankwooden,5,2 -bplankwood,5,2 -bplankw,5,2 -lightplank,5,2 -lightwoodenplank,5,2 -lightwoodplank,5,2 -lightwplank,5,2 -lightplankwooden,5,2 -lightplankwood,5,2 -lightplankw,5,2 -lplank,5,2 -lwoodenplank,5,2 -lwoodplank,5,2 -lwplank,5,2 -lplankwooden,5,2 -lplankwood,5,2 -lplankw,5,2 -whiteplank,5,2 -whitewoodenplank,5,2 -whitewoodplank,5,2 -whitewplank,5,2 -whiteplankwooden,5,2 -whiteplankwood,5,2 -whiteplankw,5,2 -wwoodenplank,5,2 -wwoodplank,5,2 -wwplank,5,2 -wplankwooden,5,2 -wplankwood,5,2 -wplankw,5,2 -jungleplank,5,3 -junglewoodenplank,5,3 -junglewoodplank,5,3 -junglewplank,5,3 -jungleplankwooden,5,3 -jungleplankwood,5,3 -jungleplankw,5,3 -jplank,5,3 -jwoodenplank,5,3 -jwoodplank,5,3 -jwplank,5,3 -jplankwooden,5,3 -jplankwood,5,3 -jplankw,5,3 -forestplank,5,3 -forestwoodenplank,5,3 -forestwoodplank,5,3 -forestwplank,5,3 -forestplankwooden,5,3 -forestplankwood,5,3 -forestplankw,5,3 -fplank,5,3 -fwoodenplank,5,3 -fwoodplank,5,3 -fwplank,5,3 -fplankwooden,5,3 -fplankwood,5,3 -fplankw,5,3 -acaciaplank,5,4 -acaciawoodenplank,5,4 -acaciawoodplank,5,4 -acaciawplank,5,4 -acaciaplankwooden,5,4 -acaciaplankwood,5,4 -acaciaplankw,5,4 -aplank,5,4 -awoodenplank,5,4 -awoodplank,5,4 -awplank,5,4 -aplankwooden,5,4 -aplankwood,5,4 -aplankw,5,4 -darkoakplank,5,5 -darkoakwoodenplank,5,5 -darkoakwoodplank,5,5 -darkoakwplank,5,5 -darkoakplankwooden,5,5 -darkoakplankwood,5,5 -darkoakplankw,5,5 -doakplank,5,5 -doakwoodenplank,5,5 -doakwoodplank,5,5 -doakwplank,5,5 -doakplankwooden,5,5 -doakplankwood,5,5 -doakplankw,5,5 -doplank,5,5 -dowoodenplank,5,5 -dowoodplank,5,5 -dowplank,5,5 -doplankwooden,5,5 -doplankwood,5,5 -doplankw,5,5 -sapling,6,0 -treesapling,6,0 -logsapling,6,0 -trunksapling,6,0 -woodsapling,6,0 -oaktreesapling,6,0 -oaklogsapling,6,0 -oaktrunksapling,6,0 -oakwoodsapling,6,0 -osapling,6,0 -otreesapling,6,0 -ologsapling,6,0 -otrunksapling,6,0 -owoodsapling,6,0 -darksapling,6,1 -darktreesapling,6,1 -darklogsapling,6,1 -darktrunksapling,6,1 -darkwoodsapling,6,1 -sprucesapling,6,1 -sprucetreesapling,6,1 -sprucelogsapling,6,1 -sprucetrunksapling,6,1 -sprucewoodsapling,6,1 -pinesapling,6,1 -pinetreesapling,6,1 -pinelogsapling,6,1 -pinetrunksapling,6,1 -pinewoodsapling,6,1 -dsapling,6,1 -dtreesapling,6,1 -dlogsapling,6,1 -dtrunksapling,6,1 -dwoodsapling,6,1 -ssapling,6,1 -streesapling,6,1 -slogsapling,6,1 -strunksapling,6,1 -swoodsapling,6,1 -psapling,6,1 -ptreesapling,6,1 -plogsapling,6,1 -ptrunksapling,6,1 -pwoodsapling,6,1 -birchsapling,6,2 -birchtreesapling,6,2 -birchlogsapling,6,2 -birchtrunksapling,6,2 -birchwoodsapling,6,2 -lightsapling,6,2 -lighttreesapling,6,2 -lightlogsapling,6,2 -lighttrunksapling,6,2 -lightwoodsapling,6,2 -whitesapling,6,2 -whitetreesapling,6,2 -whitelogsapling,6,2 -whitetrunksapling,6,2 -whitewoodsapling,6,2 -bsapling,6,2 -btreesapling,6,2 -blogsapling,6,2 -btrunksapling,6,2 -bwoodsapling,6,2 -lsapling,6,2 -ltreesapling,6,2 -llogsapling,6,2 -ltrunksapling,6,2 -lwoodsapling,6,2 -wsapling,6,2 -wtreesapling,6,2 -wlogsapling,6,2 -wtrunksapling,6,2 -wwoodsapling,6,2 -junglesapling,6,3 -jungletreesapling,6,3 -junglelogsapling,6,3 -jungletrunksapling,6,3 -junglewoodsapling,6,3 -forestsapling,6,3 -foresttreesapling,6,3 -forestlogsapling,6,3 -foresttrunksapling,6,3 -forestwoodsapling,6,3 -jsapling,6,3 -jtreesapling,6,3 -jlogsapling,6,3 -jtrunksapling,6,3 -jwoodsapling,6,3 -fsapling,6,3 -ftreesapling,6,3 -flogsapling,6,3 -ftrunksapling,6,3 -fwoodsapling,6,3 -acaciasapling,6,4 -acaciatreesapling,6,4 -acacialogsapling,6,4 -acaciatrunksapling,6,4 -acaciawoodsapling,6,4 -asapling,6,4 -atreesapling,6,4 -alogsapling,6,4 -atrunksapling,6,4 -awoodsapling,6,4 -darkoaksapling,6,5 -darkoaktreesapling,6,5 -darkoaklogsapling,6,5 -darkoaktrunksapling,6,5 -darkoakwoodsapling,6,5 -doaksapling,6,5 -doaktreesapling,6,5 -doaklogsapling,6,5 -doaktrunksapling,6,5 -dosapling,6,5 -dowoodsapling,6,5 -dotreesapling,6,5 -dologsapling,6,5 -dotrunksapling,6,5 -bedrock,7,0 -oprock,7,0 -opblock,7,0 -adminblock,7,0 -adminrock,7,0 -adminium,7,0 -water,8,0 -stationarywater,9,0 -stillwater,9,0 -swater,9,0 -lava,10,0 -stationarylava,11,0 -stilllava,11,0 -slava,11,0 -sand,12,0 -redsand,12,1 -rsand,12,1 -gravel,13,0 -goldore,14,0 -oregold,14,0 -gore,14,0 -oreg,14,0 -ogold,14,0 -goldo,14,0 -ironore,15,0 -oreiron,15,0 -irono,15,0 -oiron,15,0 -steelore,15,0 -oresteel,15,0 -steelo,15,0 -osteel,15,0 -iore,15,0 -orei,15,0 -sore,15,0 -ores,15,0 -coalore,16,0 -orecoal,16,0 -coalo,16,0 -ocoal,16,0 -core,16,0 -tree,17,0 -log,17,0 -trunk,17,0 -oak,17,0 -oaktree,17,0 -oaklog,17,0 -oaktrunk,17,0 -oakwood,17,0 -otree,17,0 -olog,17,0 -otrunk,17,0 -owood,17,0 -pine,17,1 -pinetree,17,1 -pinelog,17,1 -pinetrunk,17,1 -pinewood,17,1 -darktree,17,1 -darklog,17,1 -darktrunk,17,1 -darkwood,17,1 -spruce,17,1 -sprucetree,17,1 -sprucelog,17,1 -sprucetrunk,17,1 -sprucewood,17,1 -dtree,17,1 -dlog,17,1 -dtrunk,17,1 -dwood,17,1 -stree,17,1 -slog,17,1 -strunk,17,1 -swood,17,1 -ptree,17,1 -plog,17,1 -ptrunk,17,1 -pwood,17,1 -birch,17,2 -birchtree,17,2 -birchlog,17,2 -birchtrunk,17,2 -birchwood,17,2 -whitetree,17,2 -whitelog,17,2 -whitetrunk,17,2 -whitewood,17,2 -lighttree,17,2 -lightlog,17,2 -lighttrunk,17,2 -lightwood,17,2 -btree,17,2 -blog,17,2 -btrunk,17,2 -bwood,17,2 -wtree,17,2 -wlog,17,2 -wtrunk,17,2 -wwood,17,2 -ltree,17,2 -llog,17,2 -ltrunk,17,2 -lwood,17,2 -jungletree,17,3 -junglelog,17,3 -jungletrunk,17,3 -junglewood,17,3 -jungle,17,3 -forest,17,3 -foresttree,17,3 -forestlog,17,3 -foresttrunk,17,3 -forestwood,17,3 -jtree,17,3 -jlog,17,3 -jtrunk,17,3 -jwood,17,3 -ftree,17,3 -flog,17,3 -ftrunk,17,3 -fwood,17,3 -leaves,18,0 -leaf,18,0 -treeleaves,18,0 -logleaves,18,0 -trunkleaves,18,0 -woodleaves,18,0 -oakleaves,18,0 -oakleaf,18,0 -oleaves,18,0 -oleaf,18,0 -oaktreeleaves,18,0 -oaklogleaves,18,0 -oaktrunkleaves,18,0 -oakwoodleaves,18,0 -otreeleaves,18,0 -ologleaves,18,0 -otrunkleaves,18,0 -owoodleaves,18,0 -treeleaf,18,0 -logleaf,18,0 -trunkleaf,18,0 -woodleaf,18,0 -oaktreeleaf,18,0 -oaklogleaf,18,0 -oaktrunkleaf,18,0 -oakwoodleaf,18,0 -otreeleaf,18,0 -ologleaf,18,0 -otrunkleaf,18,0 -owoodleaf,18,0 -pineleaves,18,1 -pineleaf,18,1 -pleaves,18,1 -pleaf,18,1 -pinetreeleaves,18,1 -pinelogleaves,18,1 -pinetrunkleaves,18,1 -pinewoodleaves,18,1 -ptreeleaves,18,1 -plogleaves,18,1 -ptrunkleaves,18,1 -pwoodleaves,18,1 -spruceleaves,18,1 -spruceleaf,18,1 -sleaves,18,1 -sleaf,18,1 -sprucetreeleaves,18,1 -sprucelogleaves,18,1 -sprucetrunkleaves,18,1 -sprucewoodleaves,18,1 -streeleaves,18,1 -slogleaves,18,1 -strunkleaves,18,1 -swoodleaves,18,1 -darkleaves,18,1 -darkleaf,18,1 -dleaves,18,1 -dleaf,18,1 -darktreeleaves,18,1 -darklogleaves,18,1 -darktrunkleaves,18,1 -darkwoodleaves,18,1 -dtreeleaves,18,1 -dlogleaves,18,1 -dtrunkleaves,18,1 -dwoodleaves,18,1 -sprucetreeleaf,18,1 -sprucelogleaf,18,1 -sprucetrunkleaf,18,1 -sprucewoodleaf,18,1 -streeleaf,18,1 -slogleaf,18,1 -strunkleaf,18,1 -swoodleaf,18,1 -pinetreeleaf,18,1 -pinelogleaf,18,1 -pinetrunkleaf,18,1 -pinewoodleaf,18,1 -ptreeleaf,18,1 -plogleaf,18,1 -ptrunkleaf,18,1 -pwoodleaf,18,1 -darktreeleaf,18,1 -darklogleaf,18,1 -darktrunkleaf,18,1 -darkwoodleaf,18,1 -dtreeleaf,18,1 -dlogleaf,18,1 -dtrunkleaf,18,1 -dwoodleaf,18,1 -birchleaves,18,2 -birchleaf,18,2 -bleaves,18,2 -bleaf,18,2 -birchtreeleaves,18,2 -birchlogleaves,18,2 -birchtrunkleaves,18,2 -birchwoodleaves,18,2 -btreeleaves,18,2 -blogleaves,18,2 -btrunkleaves,18,2 -bwoodleaves,18,2 -lightleaves,18,2 -lightleaf,18,2 -lleaves,18,2 -lleaf,18,2 -lighttreeleaves,18,2 -lightlogleaves,18,2 -lighttrunkleaves,18,2 -lightwoodleaves,18,2 -ltreeleaves,18,2 -llogleaves,18,2 -ltrunkleaves,18,2 -lwoodleaves,18,2 -whiteleaves,18,2 -whiteleaf,18,2 -wleaves,18,2 -wleaf,18,2 -whitetreeleaves,18,2 -whitelogleaves,18,2 -whitetrunkleaves,18,2 -whitewoodleaves,18,2 -wtreeleaves,18,2 -wlogleaves,18,2 -wtrunkleaves,18,2 -wwoodleaves,18,2 -birchtreeleaf,18,2 -birchlogleaf,18,2 -birchtrunkleaf,18,2 -birchwoodleaf,18,2 -btreeleaf,18,2 -blogleaf,18,2 -btrunkleaf,18,2 -bwoodleaf,18,2 -lighttreeleaf,18,2 -lightlogleaf,18,2 -lighttrunkleaf,18,2 -lightwoodleaf,18,2 -ltreeleaf,18,2 -llogleaf,18,2 -ltrunkleaf,18,2 -lwoodleaf,18,2 -whitetreeleaf,18,2 -whitelogleaf,18,2 -whitetrunkleaf,18,2 -whitewoodleaf,18,2 -wtreeleaf,18,2 -wlogleaf,18,2 -wtrunkleaf,18,2 -wwoodleaf,18,2 -jungleleaves,18,3 -jungleleaf,18,3 -jleaves,18,3 -jleaf,18,3 -jungletreeleaves,18,3 -junglelogleaves,18,3 -jungletrunkleaves,18,3 -junglewoodleaves,18,3 -jtreeleaves,18,3 -jlogleaves,18,3 -jtrunkleaves,18,3 -jwoodleaves,18,3 -forestleaves,18,3 -forestleaf,18,3 -fleaves,18,3 -fleaf,18,3 -foresttreeleaves,18,3 -forestlogleaves,18,3 -foresttrunkleaves,18,3 -forestwoodleaves,18,3 -ftreeleaves,18,3 -flogleaves,18,3 -ftrunkleaves,18,3 -fwoodleaves,18,3 -jungletreeleaf,18,3 -junglelogleaf,18,3 -jungletrunkleaf,18,3 -junglewoodleaf,18,3 -jtreeleaf,18,3 -jlogleaf,18,3 -jtrunkleaf,18,3 -jwoodleaf,18,3 -foresttreeleaf,18,3 -forestlogleaf,18,3 -foresttrunkleaf,18,3 -forestwoodleaf,18,3 -ftreeleaf,18,3 -flogleaf,18,3 -ftrunkleaf,18,3 -fwoodleaf,18,3 -sponge,19,0 -wetsponge,19,1 -glass,20,0 -blockglass,20,0 -glassblock,20,0 -lapislazuliore,21,0 -lapislazulio,21,0 -orelapislazuli,21,0 -olapislazuli,21,0 -lapisore,21,0 -lapiso,21,0 -orelapis,21,0 -olapis,21,0 -lore,21,0 -orel,21,0 -lapislazuliblock,22,0 -blocklapislazuli,22,0 -lapisblock,22,0 -blocklapis,22,0 -lblock,22,0 -blockl,22,0 -dispenser,23,0 -dispense,23,0 -sandstone,24,0 -sastone,24,0 -cpstone,24,1 -creepersandstone,24,1 -creepersastone,24,1 -creepsandstone,24,1 -creepsastone,24,1 -csandstone,24,1 -csastone,24,1 -hieroglyphicsandstone,24,1 -hieroglyphicsastone,24,1 -hieroglyphsandstone,24,1 -hieroglyphsastone,24,1 -hsandstone,24,1 -hsastone,24,1 -pyramidsandstone,24,1 -pyramidsastone,24,1 -psandstone,24,1 -psastone,24,1 -chiseledsandstone,24,1 -chiseledsastone,24,1 -chiselsandstone,24,1 -chiselsastone,24,1 -smstone,24,2 -smoothsandstone,24,2 -smoothsastone,24,2 -ssandstone,24,2 -smsastone,24,2 -ssastone,24,2 -noteblock,25,0 -musicblock,25,0 -nblock,25,0 -mblock,25,0 -poweredtrack,27,0 -poweredrails,27,0 -poweredrail,27,0 -boostertrack,27,0 -boosterrails,27,0 -boosterrail,27,0 -powertrack,27,0 -powerrails,27,0 -powerrail,27,0 -boosttrack,27,0 -boostrails,27,0 -boostrail,27,0 -ptrack,27,0 -prails,27,0 -prail,27,0 -btrack,27,0 -brails,27,0 -brail,27,0 -detectortrack,28,0 -detectorrails,28,0 -detectorrail,28,0 -detectingtrack,28,0 -detectingrails,28,0 -detectingrail,28,0 -detecttrack,28,0 -detectrails,28,0 -detectrail,28,0 -dtrack,28,0 -drails,28,0 -drail,28,0 -stickypistonbase,29,0 -stickypiston,29,0 -stickpistonbase,29,0 -stickpiston,29,0 -stickyp,29,0 -spistonbase,29,0 -spiston,29,0 -pistonstickybase,29,0 -pistonsticky,29,0 -pistonstickbase,29,0 -pistonstick,29,0 -pistonsbase,29,0 -pistons,29,0 -psticky,29,0 -pstick,29,0 -spiderweb,30,0 -cobweb,30,0 -sweb,30,0 -cweb,30,0 -web,30,0 -longgrass,31,1 -tallgrass,31,1 -wildgrass,31,1 -grasslong,31,1 -grasstall,31,1 -grasswild,31,1 -lgrass,31,1 -tgrass,31,1 -wgrass,31,1 -fern,31,2 -bush,31,2 -deadshrub,32,0 -dshrub,32,0 -deadbush,32,0 -dbush,32,0 -deadsapling,32,0 -piston,33,0 -pistonbase,33,0 -pistonblock,33,0 -whitewool,35,0 -whitecloth,35,0 -whitecotton,35,0 -wcloth,35,0 -wwool,35,0 -wcotton,35,0 -cloth,35,0 -wool,35,0 -cotton,35,0 -orangewool,35,1 -orangecloth,35,1 -orangecotton,35,1 -ocloth,35,1 -owool,35,1 -ocotton,35,1 -magentawool,35,2 -magentacloth,35,2 -magentacotton,35,2 -mcloth,35,2 -mwool,35,2 -mcotton,35,2 -lightbluewool,35,3 -lightbluecloth,35,3 -lightbluecotton,35,3 -lbluecloth,35,3 -lbluewool,35,3 -lbluecotton,35,3 -lightblucloth,35,3 -lightbluwool,35,3 -lightblucotton,35,3 -lblucloth,35,3 -lbluwool,35,3 -lblucotton,35,3 -lbcloth,35,3 -lbwool,35,3 -lbcotton,35,3 -yellowwool,35,4 -yellowcloth,35,4 -yellowcotton,35,4 -ycloth,35,4 -ywool,35,4 -ycotton,35,4 -lightgreenwool,35,5 -lightgreencloth,35,5 -lightgreencotton,35,5 -lgreencloth,35,5 -lgreenwool,35,5 -lgreencotton,35,5 -lightgrecloth,35,5 -lightgrewool,35,5 -lightgrecotton,35,5 -lgrecloth,35,5 -lgrewool,35,5 -lgrecotton,35,5 -limecloth,35,5 -limewool,35,5 -limecotton,35,5 -lcloth,35,5 -lwool,35,5 -lcotton,35,5 -pinkwool,35,6 -pinkcloth,35,6 -pinkcotton,35,6 -picloth,35,6 -piwool,35,6 -picotton,35,6 -darkgraywool,35,7 -darkgraycloth,35,7 -darkgraycotton,35,7 -darkgreywool,35,7 -darkgreycloth,35,7 -darkgreycotton,35,7 -dgraycloth,35,7 -dgraywool,35,7 -dgraycotton,35,7 -dgreycloth,35,7 -dgreywool,35,7 -dgreycotton,35,7 -darkgracloth,35,7 -darkgrawool,35,7 -darkgracotton,35,7 -dgracloth,35,7 -dgrawool,35,7 -dgracotton,35,7 -graycloth,35,7 -graywool,35,7 -graycotton,35,7 -greycloth,35,7 -greywool,35,7 -greycotton,35,7 -gracloth,35,7 -grawool,35,7 -gracotton,35,7 -lgwool,35,8 -lightgraywool,35,8 -lightgraycloth,35,8 -lightgraycotton,35,8 -lgraycloth,35,8 -lgraywool,35,8 -lgraycotton,35,8 -lightgreywool,35,8 -lightgreycloth,35,8 -lightgreycotton,35,8 -lgreycloth,35,8 -lgreywool,35,8 -lgreycotton,35,8 -lightgracloth,35,8 -lightgrawool,35,8 -lightgracotton,35,8 -lgracloth,35,8 -lgrawool,35,8 -lgracotton,35,8 -silvercloth,35,8 -silverwool,35,8 -silvercotton,35,8 -sicloth,35,8 -siawool,35,8 -siacotton,35,8 -cyanwool,35,9 -cyancloth,35,9 -cyancotton,35,9 -ccloth,35,9 -cwool,35,9 -ccotton,35,9 -purplewool,35,10 -purplecloth,35,10 -purplecotton,35,10 -pucloth,35,10 -puwool,35,10 -pucotton,35,10 -bluewool,35,11 -bluecloth,35,11 -bluecotton,35,11 -blucloth,35,11 -bluwool,35,11 -blucotton,35,11 -brownwool,35,12 -browncloth,35,12 -browncotton,35,12 -brocloth,35,12 -browool,35,12 -brocotton,35,12 -darkgreenwool,35,13 -darkgreencloth,35,13 -darkgreencotton,35,13 -dgreencloth,35,13 -dgreenwool,35,13 -dgreencotton,35,13 -greencloth,35,13 -greenwool,35,13 -greencotton,35,13 -darkgrecloth,35,13 -darkgrewool,35,13 -darkgrecotton,35,13 -dgrecloth,35,13 -dgrewool,35,13 -dgrecotton,35,13 -grecloth,35,13 -grewool,35,13 -grecotton,35,13 -redwool,35,14 -redcloth,35,14 -redcotton,35,14 -rcloth,35,14 -rwool,35,14 -rcotton,35,14 -blackwool,35,15 -blackcloth,35,15 -blackcotton,35,15 -blacloth,35,15 -blawool,35,15 -blacotton,35,15 -dandelion,37,0 -yellowdandelion,37,0 -ydandelion,37,0 -yellowflower,37,0 -yflower,37,0 -flower,37,0 -rose,38,0 -redrose,38,0 -rrose,38,0 -redflower,38,0 -rflower,38,0 -poppy,38,0 -redpoppy,38,0 -blueorchid,38,1 -cyanorchid,38,1 -lightblueorchid,38,1 -lblueorchid,38,1 -orchid,38,1 -allium,38,2 -magentaallium,38,2 -azurebluet,38,3 -whiteazurebluet,38,3 -abluet,38,3 -azureb,38,3 -houstonia,38,3 -redtulip,38,4 -tulipred,38,4 -rtulip,38,4 -tulipr,38,4 -orangetulip,38,5 -tuliporange,38,5 -otulip,38,5 -tulipo,38,5 -whitetulip,38,6 -tulipwhite,38,6 -wtulip,38,6 -tulipw,38,6 -pinktulip,38,7 -tulippink,38,7 -ptulip,38,7 -tulipp,38,7 -oxeye,38,8 -daisy,38,8 -oxeyedaisy,38,8 -daisyoxeye,38,8 -moondaisy,38,8 -daisymoon,38,8 -lightgrayoxeye,38,8 -lgrayoxeye,38,8 -lightgreyoxeye,38,8 -lgreyoxeye,38,8 -brownmushroom,39,0 -brownshroom,39,0 -brownmush,39,0 -bmushroom,39,0 -bshroom,39,0 -bmush,39,0 -redmushroom,40,0 -redshroom,40,0 -redmush,40,0 -rmushroom,40,0 -rshroom,40,0 -rmush,40,0 -goldblock,41,0 -blockgold,41,0 -gblock,41,0 -blockg,41,0 -ironblock,42,0 -steelblock,42,0 -blockiron,42,0 -blocksteel,42,0 -iblock,42,0 -stblock,42,0 -blocki,42,0 -blockst,42,0 -stonedoublestep,43,0 -stonedstep,43,0 -sdoublestep,43,0 -sdstep,43,0 -doublestonestep,43,0 -dstonestep,43,0 -doublesstep,43,0 -doublestep,43,0 -dstep,43,0 -stonedoubleslab,43,0 -stonedslab,43,0 -sdoubleslab,43,0 -sdslab,43,0 -doublestoneslab,43,0 -doublestoneslab2,181,0 -dstoneslab,43,0 -doublesslab,43,0 -doubleslab,43,0 -dslab,43,0 -stonedoublehalfblock,43,0 -stonedhalfblock,43,0 -sdoublehalfblock,43,0 -sdhalfblock,43,0 -doublestonehalfblock,43,0 -dstonehalfblock,43,0 -doubleshalfblock,43,0 -doublehalfblock,43,0 -dhalfblock,43,0 -sandstonedoublestep,43,1 -sandstonedstep,43,1 -sstonedoublestep,43,1 -sstonedstep,43,1 -ssdoublestep,43,1 -ssdstep,43,1 -doublesandstonestep,43,1 -dsandstonestep,43,1 -doublesstonestep,43,1 -dsstonestep,43,1 -doublessstep,43,1 -dsstep,43,1 -sandstonedoubleslab,43,1 -sandstonedslab,43,1 -sstonedoubleslab,43,1 -sstonedslab,43,1 -ssdoubleslab,43,1 -ssdslab,43,1 -doublesandstoneslab,43,1 -dsandstoneslab,43,1 -doublesstoneslab,43,1 -dsstoneslab,43,1 -doublessslab,43,1 -dsslab,43,1 -sandstonedoublehalfblock,43,1 -sandstonedhalfblock,43,1 -sstonedoublehalfblock,43,1 -sstonedhalfblock,43,1 -ssdoublehalfblock,43,1 -ssdhalfblock,43,1 -doublesandstonehalfblock,43,1 -dsandstonehalfblock,43,1 -doublesstonehalfblock,43,1 -dsstonehalfblock,43,1 -doublesshalfblock,43,1 -dsshalfblock,43,1 -plankstonedoublestep,43,2 -woodenstonedoublestep,43,2 -woodenstonedstep,43,2 -woodstonedoublestep,43,2 -woodstonedstep,43,2 -wstonedoublestep,43,2 -wstonedstep,43,2 -doublewoodenstonestep,43,2 -dwoodenstonestep,43,2 -doublewoodstonestep,43,2 -dwoodstonestep,43,2 -doublewstonestep,43,2 -dwstonestep,43,2 -woodenstonedoubleslab,43,2 -woodenstonedslab,43,2 -woodstonedoubleslab,43,2 -woodstonedslab,43,2 -wstonedoubleslab,43,2 -wstonedslab,43,2 -doublewoodenstoneslab,43,2 -dwoodenstoneslab,43,2 -doublewoodstoneslab,43,2 -dwoodstoneslab,43,2 -doublewstoneslab,43,2 -dwstoneslab,43,2 -woodenstonedoublehalfblock,43,2 -woodenstonedhalfblock,43,2 -woodstonedoublehalfblock,43,2 -woodstonedhalfblock,43,2 -wstonedoublehalfblock,43,2 -wstonedhalfblock,43,2 -doublewoodenstonehalfblock,43,2 -dwoodenstonehalfblock,43,2 -doublewoodstonehalfblock,43,2 -dwoodstonehalfblock,43,2 -doublewstonehalfblock,43,2 -dwstonehalfblock,43,2 -cobblestonedoublestep,43,3 -cobblestonedstep,43,3 -cobbledoublestep,43,3 -cobbledstep,43,3 -cstonedoublestep,43,3 -cstonedstep,43,3 -csdoublestep,43,3 -csdstep,43,3 -doublecobblestonestep,43,3 -dcobblestonestep,43,3 -doublecobblestep,43,3 -dcobblestep,43,3 -doublecstonestep,43,3 -dcstonestep,43,3 -doublecsstep,43,3 -dcsstep,43,3 -cobblestonedoubleslab,43,3 -cobblestonedslab,43,3 -cobbledoubleslab,43,3 -cobbledslab,43,3 -cstonedoubleslab,43,3 -cstonedslab,43,3 -csdoubleslab,43,3 -csdslab,43,3 -doublecobblestoneslab,43,3 -dcobblestoneslab,43,3 -doublecobbleslab,43,3 -dcobbleslab,43,3 -doublecstoneslab,43,3 -dcstoneslab,43,3 -doublecsslab,43,3 -dcsslab,43,3 -cobblestonedoublehalfblock,43,3 -cobblestonedhalfblock,43,3 -cobbledoublehalfblock,43,3 -cobbledhalfblock,43,3 -cstonedoublehalfblock,43,3 -cstonedhalfblock,43,3 -csdoublehalfblock,43,3 -csdhalfblock,43,3 -doublecobblestonehalfblock,43,3 -dcobblestonehalfblock,43,3 -doublecobblehalfblock,43,3 -dcobblehalfblock,43,3 -doublecstonehalfblock,43,3 -dcstonehalfblock,43,3 -doublecshalfblock,43,3 -dcshalfblock,43,3 -brickdoublestep,43,4 -brickdstep,43,4 -bdoublestep,43,4 -bdstep,43,4 -brickdoubleslab,43,4 -brickdslab,43,4 -bdoubleslab,43,4 -bdslab,43,4 -doublebrickstep,43,4 -dbrickstep,43,4 -doublebstep,43,4 -dbstep,43,4 -doublebrickslab,43,4 -dbrickslab,43,4 -doublebslab,43,4 -dbslab,43,4 -brickdoublehalfblock,43,4 -brickdhalfblock,43,4 -bdoublehalfblock,43,4 -bdhalfblock,43,4 -doublebrickhalfblock,43,4 -dbrickhalfblock,43,4 -doublebhalfblock,43,4 -dbhalfblock,43,4 -stonebrickdoublestep,43,5 -stonebrickdstep,43,5 -stonebdoublestep,43,5 -stonebdstep,43,5 -sbrickdoublestep,43,5 -sbrickdstep,43,5 -sbdoublestep,43,5 -sbdstep,43,5 -stonebrickdoubleslab,43,5 -stonebrickdslab,43,5 -stonebdoubleslab,43,5 -stonebdslab,43,5 -sbrickdoubleslab,43,5 -sbrickdslab,43,5 -sbdoubleslab,43,5 -sbdslab,43,5 -doublestonebrickstep,43,5 -dstonebrickstep,43,5 -doublestonebstep,43,5 -dstonebstep,43,5 -doublesbrickstep,43,5 -dsbrickstep,43,5 -doublesbstep,43,5 -dsbstep,43,5 -doublestonebrickslab,43,5 -dstonebrickslab,43,5 -doublestonebslab,43,5 -dstonebslab,43,5 -doublesbrickslab,43,5 -dsbrickdslab,43,5 -doublesbslab,43,5 -dsbslab,43,5 -stonebrickdoublehalfblock,43,5 -stonebrickdhalfblock,43,5 -stonebdoublehalfblock,43,5 -stonebdhalfblock,43,5 -sbrickdoublehalfblock,43,5 -sbrickdhalfblock,43,5 -sbdoublehalfblock,43,5 -sbdhalfblock,43,5 -doublestonebrickhalfblock,43,5 -dstonebrickhalfblock,43,5 -doublestonebhalfblock,43,5 -dstonebhalfblock,43,5 -doublesbrickhalfblock,43,5 -dsbrickhalfblock,43,5 -doublesbhalfblock,43,5 -dsbhalfblock,43,5 -netherbrickdoubleslab,43,6 -hellbrickdoubleslab,43,6 -nbrickdoubleslab,43,6 -hbrickdoubleslab,43,6 -netherdoubleslab,43,6 -helldoubleslab,43,6 -nbdoubleslab,43,6 -hbdoubleslab,43,6 -hdoubleslab,43,6 -ndoubleslab,43,6 -netherbrickdoublestep,43,6 -hellbrickdoublestep,43,6 -nbrickdoublestep,43,6 -hbrickdoublestep,43,6 -netherdoublestep,43,6 -helldoublestep,43,6 -nbdoublestep,43,6 -hbdoublestep,43,6 -ndoublestep,43,6 -hdoublestep,43,6 -netherbrickdoublehalfblock,43,6 -hellbrickdoublehalfblock,43,6 -nbrickdoublehalfblock,43,6 -hbrickdoublehalfblock,43,6 -netherdoublehalfblock,43,6 -helldoublehalfblock,43,6 -nbdoublehalfblock,43,6 -hbdoublehalfblock,43,6 -ndoublehalfblock,43,6 -hdoublehalfblock,43,6 -netherbrickdslab,43,6 -hellbrickdslab,43,6 -nbrickdslab,43,6 -hbrickdslab,43,6 -netherdslab,43,6 -helldslab,43,6 -nbdslab,43,6 -hbdslab,43,6 -hdslab,43,6 -ndslab,43,6 -netherbrickdstep,43,6 -hellbrickdstep,43,6 -nbrickdstep,43,6 -hbrickdstep,43,6 -netherdstep,43,6 -helldstep,43,6 -nbdstep,43,6 -hbdstep,43,6 -ndstep,43,6 -hdstep,43,6 -netherbrickdhalfblock,43,6 -hellbrickdhalfblock,43,6 -nbrickdhalfblock,43,6 -hbrickdhalfblock,43,6 -netherdhalfblock,43,6 -helldhalfblock,43,6 -nbdhalfblock,43,6 -hbdhalfblock,43,6 -ndhalfblock,43,6 -hdhalfblock,43,6 -doublenetherbrickslab,43,6 -doublehellbrickslab,43,6 -doublenbrickslab,43,6 -doublehbrickslab,43,6 -doublenetherslab,43,6 -doublehellslab,43,6 -doublenbslab,43,6 -doublehbslab,43,6 -doublehslab,43,6 -doublenslab,43,6 -doublenetherbrickstep,43,6 -doublehellbrickstep,43,6 -doublenbrickstep,43,6 -doublehbrickstep,43,6 -doublenetherstep,43,6 -doublehellstep,43,6 -doublenbstep,43,6 -doublehbstep,43,6 -doublenstep,43,6 -doublehstep,43,6 -doublenetherbrickhalfblock,43,6 -doublehellbrickhalfblock,43,6 -doublenbrickhalfblock,43,6 -doublehbrickhalfblock,43,6 -doublenetherhalfblock,43,6 -doublehellhalfblock,43,6 -doublenbhalfblock,43,6 -doublehbhalfblock,43,6 -doublenhalfblock,43,6 -doublehhalfblock,43,6 -dnetherbrickslab,43,6 -dhellbrickslab,43,6 -dnbrickslab,43,6 -dhbrickslab,43,6 -dnetherslab,43,6 -dhellslab,43,6 -dnbslab,43,6 -dhbslab,43,6 -dhslab,43,6 -dnslab,43,6 -dnetherbrickstep,43,6 -dhellbrickstep,43,6 -dnbrickstep,43,6 -dhbrickstep,43,6 -dnetherstep,43,6 -dhellstep,43,6 -dnbstep,43,6 -dhbstep,43,6 -dnstep,43,6 -dhstep,43,6 -dnetherbrickhalfblock,43,6 -dhellbrickhalfblock,43,6 -dnbrickhalfblock,43,6 -dhbrickhalfblock,43,6 -dnetherhalfblock,43,6 -dhellhalfblock,43,6 -dnbhalfblock,43,6 -dhbhalfblock,43,6 -dnhalfblock,43,6 -dhhalfblock,43,6 -netherquartzdoublestep,43,7 -hellquartzdoublestep,43,7 -deathquartzdoublestep,43,7 -nquartzdoublestep,43,7 -hquartzdoublestep,43,7 -dquartzdoublestep,43,7 -quartzdoublestep,43,7 -nqdoublestep,43,7 -hqdoublestep,43,7 -dqdoublestep,43,7 -qdoublestep,43,7 -netherquartzdoubleslab,43,7 -hellquartzdoubleslab,43,7 -deathquartzdoubleslab,43,7 -nquartzdoubleslab,43,7 -hquartzdoubleslab,43,7 -dquartzdoubleslab,43,7 -quartzdoubleslab,43,7 -nqdoubleslab,43,7 -hqdoubleslab,43,7 -dqdoubleslab,43,7 -qdoubleslab,43,7 -netherquartzdoublehalfblock,43,7 -hellquartzdoublehalfblock,43,7 -deathquartzdoublehalfblock,43,7 -nquartzdoublehalfblock,43,7 -hquartzdoublehalfblock,43,7 -dquartzdoublehalfblock,43,7 -quartzdoublehalfblock,43,7 -nqdoublehalfblock,43,7 -hqdoublehalfblock,43,7 -dqdoublehalfblock,43,7 -qdoublehalfblock,43,7 -netherquartzdslab,43,7 -hellquartzdslab,43,7 -deathquartzdslab,43,7 -nquartzdslab,43,7 -hquartzdslab,43,7 -dquartzdslab,43,7 -quartzdslab,43,7 -nqdslab,43,7 -hqdslab,43,7 -dqdslab,43,7 -qdslab,43,7 -netherquartzdstep,43,7 -hellquartzdstep,43,7 -deathquartzdstep,43,7 -nquartzdstep,43,7 -hquartzdstep,43,7 -dquartzdstep,43,7 -quartzdstep,43,7 -nqdstep,43,7 -hqdstep,43,7 -dqdstep,43,7 -qdstep,43,7 -netherquartzdhalfblock,43,7 -hellquartzdhalfblock,43,7 -deathquartzdhalfblock,43,7 -nquartzdhalfblock,43,7 -hquartzdhalfblock,43,7 -dquartzdhalfblock,43,7 -quartzdhalfblock,43,7 -nqdhalfblock,43,7 -hqdhalfblock,43,7 -dqdhalfblock,43,7 -qdhalfblock,43,7 -doublenetherquartzslab,43,7 -doublehellquartzslab,43,7 -doubledeathquartzslab,43,7 -doublenquartzslab,43,7 -doublehquartzslab,43,7 -doubledquartzslab,43,7 -doublequartzslab,43,7 -doublenqslab,43,7 -doublehqslab,43,7 -doubledqslab,43,7 -doubleqslab,43,7 -doublenetherquartzstep,43,7 -doublehellquartzstep,43,7 -doubledeathquartzstep,43,7 -doublenquartzstep,43,7 -doublehquartzstep,43,7 -doubledquartzstep,43,7 -doublequartzstep,43,7 -doublenqstep,43,7 -doublehqstep,43,7 -doubledqstep,43,7 -doubleqstep,43,7 -doublenetherquartzhalfblock,43,7 -doublehellquartzhalfblock,43,7 -doubledeathquartzhalfblock,43,7 -doublenquartzhalfblock,43,7 -doublehquartzhalfblock,43,7 -doubledquartzhalfblock,43,7 -doublequartzhalfblock,43,7 -doublenqhalfblock,43,7 -doublehqhalfblock,43,7 -doubledqhalfblock,43,7 -doubleqhalfblock,43,7 -dnetherquartzslab,43,7 -dhellquartzslab,43,7 -ddeathquartzslab,43,7 -dnquartzslab,43,7 -dhquartzslab,43,7 -ddquartzslab,43,7 -dnqslab,43,7 -dhqslab,43,7 -ddqslab,43,7 -dnetherquartzstep,43,7 -dhellquartzstep,43,7 -ddeathquartzstep,43,7 -dnquartzstep,43,7 -dhquartzstep,43,7 -ddquartzstep,43,7 -dnqstep,43,7 -dhqstep,43,7 -ddqstep,43,7 -dnetherquartzhalfblock,43,7 -dhellquartzhalfblock,43,7 -ddeathquartzhalfblock,43,7 -dnquartzhalfblock,43,7 -dhquartzhalfblock,43,7 -ddquartzhalfblock,43,7 -dnqhalfblock,43,7 -dhqhalfblock,43,7 -ddqhalfblock,43,7 -smoothstonedoubleslab,43,8 -smoothstonedoublestep,43,8 -smoothstonedoublehalfblock,43,8 -smoothstonedslab,43,8 -smoothstonedstep,43,8 -smoothstonedhalfblock,43,8 -doublesmoothstoneslab,43,8 -doublesmoothstonestep,43,8 -doublesmoothstonehalfblock,43,8 -dsmoothstoneslab,43,8 -dsmoothstonestep,43,8 -dsmoothstonehalfblock,43,8 -smoothsandstonedoubleslab,43,9 -ssandstonedoubleslab,43,9 -ssstonedoubleslab,43,9 -sssdoubleslab,43,9 -smoothsandstonedoublestep,43,9 -ssandstonedoublestep,43,9 -ssstonedoublestep,43,9 -sssdoublestep,43,9 -smoothsandstonedoublehalfblock,43,9 -ssandstonedoublehalfblock,43,9 -ssstonedoublehalfblock,43,9 -sssdoublehalfblock,43,9 -smoothsandstonedslab,43,9 -ssandstonedslab,43,9 -ssstonedslab,43,9 -sssdslab,43,9 -smoothsandstonedstep,43,9 -ssandstonedstep,43,9 -ssstonedstep,43,9 -sssdstep,43,9 -smoothsandstonedhalfblock,43,9 -ssandstonedhalfblock,43,9 -ssstonedhalfblock,43,9 -sssdhalfblock,43,9 -doublesmoothsandstoneslab,43,9 -doublessandstoneslab,43,9 -doublessstoneslab,43,9 -doublesssslab,43,9 -doublesmoothsandstonestep,43,9 -doublessandstonestep,43,9 -doublessstonestep,43,9 -doublesssstep,43,9 -doublesmoothsandstonehalfblock,43,9 -doublessandstonehalfblock,43,9 -doublessstonehalfblock,43,9 -doublessshalfblock,43,9 -dsmoothsandstoneslab,43,9 -dssandstoneslab,43,9 -dssstoneslab,43,9 -dsssslab,43,9 -dsmoothsandstonestep,43,9 -dssandstonestep,43,9 -dssstonestep,43,9 -dsssstep,43,9 -dsmoothsandstonehalfblock,43,9 -dssandstonehalfblock,43,9 -dssstonehalfblock,43,9 -dssshalfblock,43,9 -smoothstonestep,44,0 -stonestep,44,0 -sstep,44,0 -step,44,0 -smoothstoneslab,44,0 -stoneslab,44,0 -stoneslab2,182,0 -sslab,44,0 -slab,44,0 -smoothstonehalfblock,44,0 -stonehalfblock,44,0 -shalfblock,44,0 -halfblock,44,0 -sandstonestep,44,1 -sstonestep,44,1 -ssstep,44,1 -sandstoneslab,44,1 -sstoneslab,44,1 -ssslab,44,1 -sandstonehalfblock,44,1 -sstonehalfblock,44,1 -sshalfblock,44,1 -woodenstonestep,44,2 -woodstonestep,44,2 -wstonestep,44,2 -woodenstoneslab,44,2 -woodstoneslab,44,2 -wstoneslab,44,2 -woodenstonehalfblock,44,2 -woodstonehalfblock,44,2 -wstonehalfblock,44,2 -cobblestonestep,44,3 -cobblestep,44,3 -cstonestep,44,3 -csstep,44,3 -cobblestoneslab,44,3 -cobbleslab,44,3 -cstoneslab,44,3 -csslab,44,3 -cobblestonehalfblock,44,3 -cobblehalfblock,44,3 -cstonehalfblock,44,3 -cshalfblock,44,3 -brickstep,44,4 -bstep,44,4 -brickslab,44,4 -bslab,44,4 -brickhalfblock,44,4 -bhalfblock,44,4 -stonebrickstep,44,5 -stonebstep,44,5 -sbrickstep,44,5 -sbstep,44,5 -stonebrickslab,44,5 -stonebslab,44,5 -sbrickslab,44,5 -sbslab,44,5 -stonebrickhalfblock,44,5 -stonebhalfblock,44,5 -sbrickhalfblock,44,5 -sbhalfblock,44,5 -netherbrickslab,44,6 -hellbrickslab,44,6 -nbrickslab,44,6 -hbrickslab,44,6 -netherslab,44,6 -hellslab,44,6 -nbslab,44,6 -hbslab,44,6 -hslab,44,6 -nslab,44,6 -netherbrickstep,44,6 -hellbrickstep,44,6 -nbrickstep,44,6 -hbrickstep,44,6 -netherstep,44,6 -hellstep,44,6 -nbstep,44,6 -hbstep,44,6 -nstep,44,6 -hstep,44,6 -netherbrickhalfblock,44,6 -hellbrickhalfblock,44,6 -nbrickhalfblock,44,6 -hbrickhalfblock,44,6 -netherhalfblock,44,6 -hellhalfblock,44,6 -nbhalfblock,44,6 -hbhalfblock,44,6 -nhalfblock,44,6 -hhalfblock,44,6 -netherquartzstep,44,7 -hellquartzstep,44,7 -deathquartzstep,44,7 -nquartzstep,44,7 -hquartzstep,44,7 -dquartzstep,44,7 -quartzstep,44,7 -nqstep,44,7 -hqstep,44,7 -dqstep,44,7 -qstep,44,7 -netherquartzslab,44,7 -hellquartzslab,44,7 -deathquartzslab,44,7 -nquartzslab,44,7 -hquartzslab,44,7 -dquartzslab,44,7 -quartzslab,44,7 -nqslab,44,7 -hqslab,44,7 -dqslab,44,7 -qslab,44,7 -netherquartzhalfblock,44,7 -hellquartzhalfblock,44,7 -deathquartzhalfblock,44,7 -nquartzhalfblock,44,7 -hquartzhalfblock,44,7 -dquartzhalfblock,44,7 -quartzhalfblock,44,7 -nqhalfblock,44,7 -hqhalfblock,44,7 -dqhalfblock,44,7 -qhalfblock,44,7 -brickblock,45,0 -blockbrick,45,0 -bblock,45,0 -blockb,45,0 -tnt,46,0 -tntblock,46,0 -blocktnt,46,0 -bombblock,46,0 -blockbomb,46,0 -dynamiteblock,46,0 -blockdynamite,46,0 -bomb,46,0 -dynamite,46,0 -bshelf,47,0 -bookcase,47,0 -casebook,47,0 -bookshelf,47,0 -shelfbook,47,0 -bookblock,47,0 -blockbook,47,0 -mossycobblestone,48,0 -mosscobblestone,48,0 -mcobblestone,48,0 -mossycobble,48,0 -mosscobble,48,0 -mcobble,48,0 -mossstone,48,0 -mossystone,48,0 -mstone,48,0 -obsidian,49,0 -obsi,49,0 -obby,49,0 -torch,50,0 -burningstick,50,0 -burnstick,50,0 -fire,51,0 -flame,51,0 -flames,51,0 -mobspawner,52,0 -mobcage,52,0 -monsterspawner,52,0 -monstercage,52,0 -mspawner,52,0 -mcage,52,0 -spawner,52,0 -cage,52,0 -woodenstairs,53,0 -woodstairs,53,0 -wstairs,53,0 -woodenstair,53,0 -woodstair,53,0 -wstair,53,0 -chest,54,0 -container,54,0 -diamondore,56,0 -crystalore,56,0 -orediamond,56,0 -orecrystal,56,0 -dore,56,0 -ored,56,0 -diamondblock,57,0 -blockdiamond,57,0 -crystalblock,57,0 -blockcrystal,57,0 -dblock,57,0 -blockd,57,0 -workbench,58,0 -craftingbench,58,0 -crafterbench,58,0 -craftbench,58,0 -worktable,58,0 -craftingtable,58,0 -craftertable,58,0 -crafttable,58,0 -wbench,58,0 -cbench,58,0 -soil,60,0 -furnace,61,0 -litfurnace,62,0 -lfurnace,62,0 -burningfurnace,62,0 -burnfurnace,62,0 -bfurnace,62,0 -ladder,65,0 -minecarttrack,66,0 -minecartrails,66,0 -minecartrail,66,0 -mcarttrack,66,0 -mcartrails,66,0 -mcartrail,66,0 -mctrack,66,0 -mcrails,66,0 -mcrail,66,0 -track,66,0 -rails,66,0 -rail,66,0 -cobblestonestairs,67,0 -cstonestairs,67,0 -stonestairs,67,0 -cobblestairs,67,0 -csstairs,67,0 -sstairs,67,0 -cstairs,67,0 -cobblestonestair,67,0 -cstonestair,67,0 -stonestair,67,0 -cobblestair,67,0 -csstair,67,0 -sstair,67,0 -cstair,67,0 -lever,69,0 -stonepressureplate,70,0 -stonepressplate,70,0 -stonepplate,70,0 -stoneplate,70,0 -spressureplate,70,0 -spressplate,70,0 -spplate,70,0 -splate,70,0 -smoothstonepressureplate,70,0 -smoothstonepressplate,70,0 -smoothstonepplate,70,0 -smoothstoneplate,70,0 -sstonepressureplate,70,0 -sstonepressplate,70,0 -sstonepplate,70,0 -sstoneplate,70,0 -woodenpressureplate,72,0 -woodenpressplate,72,0 -woodenpplate,72,0 -woodenplate,72,0 -woodpressureplate,72,0 -woodpressplate,72,0 -woodpplate,72,0 -woodplate,72,0 -wpressureplate,72,0 -wpressplate,72,0 -wpplate,72,0 -wplate,72,0 -redstoneore,73,0 -redsore,73,0 -redore,73,0 -rstoneore,73,0 -rsore,73,0 -rore,73,0 -oreredstone,73,0 -orereds,73,0 -orered,73,0 -orerstone,73,0 -orers,73,0 -orer,73,0 -redstonetorch,76,0 -rstonetorch,76,0 -redstorch,76,0 -redtorch,76,0 -rstorch,76,0 -stonebutton,77,0 -smoothstonebutton,77,0 -sstonebutton,77,0 -sbutton,77,0 -button,77,0 -snowcover,78,0 -snowcovering,78,0 -scover,78,0 -ice,79,0 -frozenwater,79,0 -waterfrozen,79,0 -freezewater,79,0 -waterfreeze,79,0 -snowblock,80,0 -blocksnow,80,0 -sblock,80,0 -blocks,80,0 -cactus,81,0 -cactuses,81,0 -cacti,81,0 -clayblock,82,0 -blockclay,82,0 -cblock,82,0 -blockc,82,0 -jukebox,84,0 -jbox,84,0 -woodenfence,85,0 -fence,85,0 -woodfence,85,0 -wfence,85,0 -fencewooden,85,0 -fencewood,85,0 -fencew,85,0 -oakfence,85,0 -ofence,85,0 -pumpkin,86,0 -netherrack,87,0 -netherrock,87,0 -netherstone,87,0 -hellrack,87,0 -hellrock,87,0 -hellstone,87,0 -deathrack,87,0 -deathrock,87,0 -deathstone,87,0 -nrack,87,0 -nrock,87,0 -nstone,87,0 -hrack,87,0 -hrock,87,0 -hstone,87,0 -drack,87,0 -drock,87,0 -dstone,87,0 -soulsand,88,0 -slowsand,88,0 -slowmud,88,0 -ssand,88,0 -smud,88,0 -mud,88,0 -glowstone,89,0 -glowingstoneblock,89,0 -lightstoneblock,89,0 -glowstoneblock,89,0 -blockglowingstone,89,0 -blocklightstone,89,0 -blockglowstone,89,0 -glowingstone,89,0 -lightstone,89,0 -glowingblock,89,0 -lightblock,89,0 -glowblock,89,0 -lstone,89,0 -gstone,89,0 -portal,90,0 -jackolantern,91,0 -pumpkinlantern,91,0 -glowingpumpkin,91,0 -lightpumpkin,91,0 -jpumpkin,91,0 -plantren,91,0 -glowpumpkin,91,0 -gpumpkin,91,0 -lpumpkin,91,0 -lockedchest,95,0 -lockchest,95,0 -jokechest,95,0 -whiteglass,95,0 -whitesglass,95,0 -whitestainedglass,95,0 -wglass,95,0 -wsglass,95,0 -wstainedglass,95,0 -sglass,95,0 -stainedglass,95,0 -orangeglass,95,1 -orangesglass,95,1 -orangestainedglass,95,1 -oglass,95,1 -osglass,95,1 -ostainedglass,95,1 -magentaglass,95,2 -magentasglass,95,2 -magentastainedglass,95,2 -mglass,95,2 -msglass,95,2 -mstainedglass,95,2 -lightblueglass,95,3 -lightbluesglass,95,3 -lightbluestainedglass,95,3 -lblueglass,95,3 -lbluesglass,95,3 -lbluestainedglass,95,3 -lightbluglass,95,3 -lightblusglass,95,3 -lightblustainedglass,95,3 -lbluglass,95,3 -lblusglass,95,3 -lblustainedglass,95,3 -lbglass,95,3 -lbsglass,95,3 -lbstainedglass,95,3 -yellowglass,95,4 -yellowsglass,95,4 -yellowstainedglass,95,4 -yglass,95,4 -ysglass,95,4 -ystainedglass,95,4 -lightgreenglass,95,5 -lightgreensglass,95,5 -lightgreenstainedglass,95,5 -lgreenglass,95,5 -lgreensglass,95,5 -lgreenstainedglass,95,5 -lightgreglass,95,5 -lightgresglass,95,5 -lightgrestainedglass,95,5 -lgreglass,95,5 -lgresglass,95,5 -lgrestainedglass,95,5 -limeglass,95,5 -limesglass,95,5 -limestainedglass,95,5 -lglass,95,5 -lsglass,95,5 -lstainedglass,95,5 -pinkglass,95,6 -pinksglass,95,6 -pinkstainedglass,95,6 -piglass,95,6 -pisglass,95,6 -pistainedglass,95,6 -gyglass,95,7 -darkgrayglass,95,7 -darkgraysglass,95,7 -darkgraystainedglass,95,7 -dgrayglass,95,7 -dgraysglass,95,7 -dgraystainedglass,95,7 -darkgreyglass,95,7 -darkgreysglass,95,7 -darkgreystainedglass,95,7 -dgreyglass,95,7 -dgreysglass,95,7 -dgreystainedglass,95,7 -darkgraglass,95,7 -darkgrasglass,95,7 -darkgrastainedglass,95,7 -dgraglass,95,7 -dgrasglass,95,7 -dgrastainedglass,95,7 -grayglass,95,7 -graysglass,95,7 -graystainedglass,95,7 -greyglass,95,7 -greysglass,95,7 -greystainedglass,95,7 -graglass,95,7 -grasglass,95,7 -grastainedglass,95,7 -lgglass,95,8 -lightgrayglass,95,8 -lightgraysglass,95,8 -lightgraystainedglass,95,8 -lgrayglass,95,8 -lgraysglass,95,8 -lgraystainedglass,95,8 -lightgreyglass,95,8 -lightgreysglass,95,8 -lightgreystainedglass,95,8 -lgreyglass,95,8 -lgreysglass,95,8 -lgreystainedglass,95,8 -lightgraglass,95,8 -lightgrasglass,95,8 -lightgrastainedglass,95,8 -lgraglass,95,8 -lgrasglass,95,8 -lgrastainedglass,95,8 -silverglass,95,8 -silversglass,95,8 -silverstainedglass,95,8 -siglass,95,8 -siasglass,95,8 -siastainedglass,95,8 -cyanglass,95,9 -cyansglass,95,9 -cyanstainedglass,95,9 -cglass,95,9 -csglass,95,9 -cstainedglass,95,9 -purpleglass,95,10 -purplesglass,95,10 -purplestainedglass,95,10 -puglass,95,10 -pusglass,95,10 -pustainedglass,95,10 -blglass,95,11 -blueglass,95,11 -bluesglass,95,11 -bluestainedglass,95,11 -bluglass,95,11 -blusglass,95,11 -blustainedglass,95,11 -brglass,95,12 -brownglass,95,12 -brownsglass,95,12 -brownstainedglass,95,12 -broglass,95,12 -brosglass,95,12 -brostainedglass,95,12 -grglass,95,13 -darkgreenglass,95,13 -darkgreensglass,95,13 -darkgreenstainedglass,95,13 -dgreenglass,95,13 -dgreensglass,95,13 -dgreenstainedglass,95,13 -greenglass,95,13 -greensglass,95,13 -greenstainedglass,95,13 -darkgreglass,95,13 -darkgresglass,95,13 -darkgrestainedglass,95,13 -dgreglass,95,13 -dgresglass,95,13 -dgrestainedglass,95,13 -greglass,95,13 -gresglass,95,13 -grestainedglass,95,13 -redglass,95,14 -redsglass,95,14 -redstainedglass,95,14 -rglass,95,14 -rsglass,95,14 -rstainedglass,95,14 -bkglass,95,15 -blackglass,95,15 -blacksglass,95,15 -blackstainedglass,95,15 -blaglass,95,15 -blasglass,95,15 -blastainedglass,95,15 -trapdoor,96,0 -doortrap,96,0 -hatch,96,0 -tdoor,96,0 -doort,96,0 -trapd,96,0 -dtrap,96,0 -silverfish,97,0 -silverfishsmoothstone,97,0 -silverfishsstone,97,0 -sfishsmoothstone,97,0 -sfishsstone,97,0 -fishsmoothstone,97,0 -fishsstone,97,0 -sfsmoothstone,97,0 -sfsstone,97,0 -trapsmoothstone,97,0 -trapsstone,97,0 -monsteregg,97,0 -monstereggsmoothstone,97,0 -monstereggsstone,97,0 -meggsmoothstone,97,0 -meggsstone,97,0 -mesmoothstone,97,0 -messtone,97,0 -silverfishcobblestone,97,1 -silverfishcstone,97,1 -sfishcobblestone,97,1 -sfishcstone,97,1 -fishcobblestone,97,1 -fishcstone,97,1 -sfcobblestone,97,1 -sfcstone,97,1 -trapcobblestone,97,1 -trapcstone,97,1 -monstereggcobblestone,97,1 -monstereggcstone,97,1 -meggcobblestone,97,1 -meggcstone,97,1 -mecobblestone,97,1 -mecstone,97,1 -silverfishstonebrick,97,2 -silverfishsbrick,97,2 -sfishstonebrick,97,2 -sfishsbrick,97,2 -fishstonebrick,97,2 -fishsbrick,97,2 -sfstonebrick,97,2 -sfsbrick,97,2 -trapstonebrick,97,2 -trapsbrick,97,2 -monstereggstonebrick,97,2 -monstereggsbrick,97,2 -meggstonebrick,97,2 -meggsbrick,97,2 -mestonebrick,97,2 -mesbrick,97,2 -silverfishmossystonebrick,97,3 -silverfishmossstonebrick,97,3 -silverfishmstonebrick,97,3 -silverfishmsbrick,97,3 -sfishmossystonebrick,97,3 -sfishmossstonebrick,97,3 -sfishmstonebrick,97,3 -sfishmsbrick,97,3 -fishmossystonebrick,97,3 -fishmossstonebrick,97,3 -fishmstonebrick,97,3 -fishmsbrick,97,3 -sfmossystonebrick,97,3 -sfmossstonebrick,97,3 -sfmstonebrick,97,3 -sfmsbrick,97,3 -trapmossystonebrick,97,3 -trapmossstonebrick,97,3 -trapmstonebrick,97,3 -trapmsbrick,97,3 -monstereggmossystonebrick,97,3 -monstereggmossstonebrick,97,3 -monstereggmstonebrick,97,3 -monstereggmsbrick,97,3 -meggmossystonebrick,97,3 -meggmossstonebrick,97,3 -meggmstonebrick,97,3 -meggmsbrick,97,3 -memossystonebrick,97,3 -memossstonebrick,97,3 -memstonebrick,97,3 -memsbrick,97,3 -silverfishcrackedstonebrick,97,4 -silverfishcrackstonebrick,97,4 -silverfishcrstonebrick,97,4 -silverfishcrsbrick,97,4 -sfishcrackedstonebrick,97,4 -sfishcrackstonebrick,97,4 -sfishcrstonebrick,97,4 -sfishcrsbrick,97,4 -fishcrackedstonebrick,97,4 -fishcrackstonebrick,97,4 -fishcrstonebrick,97,4 -fishcrsbrick,97,4 -sfcrackedstonebrick,97,4 -sfcrackstonebrick,97,4 -sfcrstonebrick,97,4 -sfcrsbrick,97,4 -trapcrackedstonebrick,97,4 -trapcrackstonebrick,97,4 -trapcrstonebrick,97,4 -trapcrsbrick,97,4 -monstereggcrackedstonebrick,97,4 -monstereggcrackstonebrick,97,4 -monstereggcrstonebrick,97,4 -monstereggcrsbrick,97,4 -meggcrackedstonebrick,97,4 -meggcrackstonebrick,97,4 -meggcrstonebrick,97,4 -meggcrsbrick,97,4 -mecrackedstonebrick,97,4 -mecrackstonebrick,97,4 -mecrstonebrick,97,4 -mecrsbrick,97,4 -silverfishcirclestonebrick,97,5 -silverfishcistonebrick,97,5 -silverfishcisbrick,97,5 -sfishcirclestonebrick,97,5 -sfishcistonebrick,97,5 -sfishcisbrick,97,5 -fishcirclestonebrick,97,5 -fishcistonebrick,97,5 -fishcisbrick,97,5 -sfcirclestonebrick,97,5 -sfcistonebrick,97,5 -sfcisbrick,97,5 -trapcirclestonebrick,97,5 -trapcistonebrick,97,5 -trapcisbrick,97,5 -monstereggcirclestonebrick,97,5 -monstereggcistonebrick,97,5 -monstereggcisbrick,97,5 -meggcirclestonebrick,97,5 -meggcistonebrick,97,5 -meggcisbrick,97,5 -mecirclestonebrick,97,5 -mecistonebrick,97,5 -mecisbrick,97,5 -stonebrick,98,0 -stonebricks,98,0 -stonebrickblock,98,0 -stonebb,98,0 -sbrick,98,0 -mossystonebrick,98,1 -mossystonebricks,98,1 -mossystonebrickblock,98,1 -mossystonebb,98,1 -mossstonebrick,98,1 -mossstonebricks,98,1 -mossstonebrickblock,98,1 -mossstonebb,98,1 -mstonebrick,98,1 -mstonebricks,98,1 -mstonebrickblock,98,1 -mstonebb,98,1 -mosssbrick,98,1 -mosssbricks,98,1 -mosssbrickblock,98,1 -mosssbb,98,1 -msbrick,98,1 -msbricks,98,1 -msbrickblock,98,1 -csbrick,98,2 -crackedstone,98,2 -crackedstonebrick,98,2 -crackedstonebricks,98,2 -crackedstonebrickblock,98,2 -crackedstonebb,98,2 -crackstonebrick,98,2 -crackstonebricks,98,2 -crackstonebrickblock,98,2 -crackstonebb,98,2 -crstonebrick,98,2 -crstonebricks,98,2 -crstonebrickblock,98,2 -crstonebb,98,2 -cracksbrick,98,2 -cracksbricks,98,2 -cracksbrickblock,98,2 -cracksbb,98,2 -crsbrick,98,2 -crsbricks,98,2 -crsbrickblock,98,2 -crstone,98,3 -circlestone,98,3 -circlestonebrick,98,3 -circlestonebricks,98,3 -circlestonebrickblock,98,3 -circlestonebb,98,3 -cistonebrick,98,3 -cistonebricks,98,3 -cistonebrickblock,98,3 -cistonebb,98,3 -circlesbrick,98,3 -circlesbricks,98,3 -circlesbrickblock,98,3 -circlesbb,98,3 -cisbrick,98,3 -cisbricks,98,3 -cisbrickblock,98,3 -giantbrownmushroom,99,0 -hugebrownmushroom,99,0 -bigbrownmushroom,99,0 -gbrownmushroom,99,0 -hbrownmushroom,99,0 -bbrownmushroom,99,0 -giantbmushroom,99,0 -hugebmushroom,99,0 -bigbmushroom,99,0 -gbmushroom,99,0 -hbmushroom,99,0 -bbmushroom,99,0 -giantbrownmush,99,0 -hugebrownmush,99,0 -bigbrownmush,99,0 -gbrownmush,99,0 -hbrownmush,99,0 -bbrownmush,99,0 -giantbmush,99,0 -hugebmush,99,0 -bigbmush,99,0 -gbmush,99,0 -hbmush,99,0 -bbmush,99,0 -giantredmushroom,100,0 -hugeredmushroom,100,0 -bigredmushroom,100,0 -gredmushroom,100,0 -hredmushroom,100,0 -bredmushroom,100,0 -giantrmushroom,100,0 -hugermushroom,100,0 -bigrmushroom,100,0 -grmushroom,100,0 -hrmushroom,100,0 -brmushroom,100,0 -giantredmush,100,0 -hugeredmush,100,0 -bigredmush,100,0 -gredmush,100,0 -hredmush,100,0 -bredmush,100,0 -giantrmush,100,0 -hugermush,100,0 -bigrmush,100,0 -grmush,100,0 -hrmush,100,0 -brmush,100,0 -ironbars,101,0 -ironbarsb,101,0 -ironbarsblock,101,0 -ironfence,101,0 -metalbars,101,0 -metalbarsb,101,0 -metalbarsblock,101,0 -metalfence,101,0 -jailbars,101,0 -jailbarsb,101,0 -jailbarsblock,101,0 -jailfence,101,0 -mbars,101,0 -mbarsb,101,0 -mbarsblock,101,0 -mfence,101,0 -jbars,101,0 -jbarsb,101,0 -jbarsblock,101,0 -jfence,101,0 -ibars,101,0 -ibarsb,101,0 -ibarsblock,101,0 -ifence,101,0 -glasspane,102,0 -glassp,102,0 -paneglass,102,0 -pglass,102,0 -flatglass,102,0 -fglass,102,0 -skinnyglass,102,0 -glassflat,102,0 -glassf,102,0 -glassskinny,102,0 -glasss,102,0 -melon,103,0 -watermelon,103,0 -greenmelon,103,0 -melongreen,103,0 -melonblock,103,0 -watermelonblock,103,0 -greenmelonblock,103,0 -vines,106,0 -vine,106,0 -greenvines,106,0 -greenvine,106,0 -gardenvines,106,0 -gardenvine,106,0 -vinesgreen,106,0 -vinegreen,106,0 -vinesgarden,106,0 -vinegarden,106,0 -vinesg,106,0 -vineg,106,0 -gvines,106,0 -gvine,106,0 -woodgate,107,0 -woodenfencegate,107,0 -wfencegate,107,0 -woodfencegate,107,0 -woodengate,107,0 -wgate,107,0 -gate,107,0 -gardengate,107,0 -ggate,107,0 -fencegate,107,0 -fgate,107,0 -brickstairs,108,0 -redbrickstairs,108,0 -redbstairs,108,0 -rbrickstairs,108,0 -bstairs,108,0 -redstairs,108,0 -brickstair,108,0 -redbrickstair,108,0 -redbstair,108,0 -rbrickstair,108,0 -bstair,108,0 -redstair,108,0 -sbstair,109,0 -stonebrickstairs,109,0 -stonebstairs,109,0 -sbstairs,109,0 -cementbrickstairs,109,0 -cementstairs,109,0 -cementbstairs,109,0 -cbstairs,109,0 -greybrickstairs,109,0 -greybstairs,109,0 -greystairs,109,0 -mycelium,110,0 -purplegrass,110,0 -pinkgrass,110,0 -mycel,110,0 -swampgrass,110,0 -sgrass,110,0 -mushroomgrass,110,0 -mushgrass,110,0 -lilypad,111,0 -waterlily,111,0 -lily,111,0 -swamppad,111,0 -lpad,111,0 -wlily,111,0 -netherbrickblock,112,0 -hellbrickblock,112,0 -deathbrickblock,112,0 -nbrickblock,112,0 -hbrickblock,112,0 -dbrickblock,112,0 -netherbblock,112,0 -hellbblock,112,0 -deathbblock,112,0 -nbblock,112,0 -hbblock,112,0 -dbblock,112,0 -netherbrickfence,113,0 -hellbrickfence,113,0 -nbrickfence,113,0 -hbrickfence,113,0 -netherbfence,113,0 -hellbfence,113,0 -netherfence,113,0 -hellfence,113,0 -nbfence,113,0 -hbfence,113,0 -nfence,113,0 -hfence,113,0 -netherbrickstairs,114,0 -hellbrickstairs,114,0 -nbrickstairs,114,0 -hbrickstairs,114,0 -netherbstairs,114,0 -hellbstairs,114,0 -netherstairs,114,0 -hellstairs,114,0 -nbstairs,114,0 -hbstairs,114,0 -nstairs,114,0 -hstairs,114,0 -netherbrickstair,114,0 -hellbrickstair,114,0 -nbrickstair,114,0 -hbrickstair,114,0 -netherbstair,114,0 -hellbstair,114,0 -netherstair,114,0 -hellstair,114,0 -nbstair,114,0 -hbstair,114,0 -nstair,114,0 -hstair,114,0 -enchantmenttable,116,0 -enchantingtable,116,0 -enchanttable,116,0 -etable,116,0 -magicaltable,116,0 -magictable,116,0 -mtable,116,0 -enchantmentdesk,116,0 -enchantingdesk,116,0 -enchantdesk,116,0 -edesk,116,0 -magicaldesk,116,0 -magicdesk,116,0 -mdesk,116,0 -booktable,116,0 -bookdesk,116,0 -btable,116,0 -bdesk,116,0 -enderportal,119,0 -endergoo,119,0 -endgoo,119,0 -endportal,119,0 -egoo,119,0 -eportal,119,0 -enderportalframe,120,0 -endportalframe,120,0 -endgooframe,120,0 -endergooframe,120,0 -egooframe,120,0 -eportalframe,120,0 -enderframe,120,0 -endframe,120,0 -enderstone,121,0 -endstone,121,0 -endrock,121,0 -enderrock,121,0 -erock,121,0 -estone,121,0 -enderdragonegg,122,0 -endegg,122,0 -dragonegg,122,0 -degg,122,0 -bossegg,122,0 -begg,122,0 -redstonelamp,123,0 -redlamp,123,0 -rslamp,123,0 -woodendoublestep,125,0 -woodendstep,125,0 -wooddoublestep,125,0 -wooddstep,125,0 -wdoublestep,125,0 -wdstep,125,0 -doublewoodenstep,125,0 -dwoodenstep,125,0 -doublewoodstep,125,0 -dwoodstep,125,0 -doublewstep,125,0 -dwstep,125,0 -woodendoubleslab,125,0 -woodendslab,125,0 -wooddoubleslab,125,0 -wooddslab,125,0 -wdoubleslab,125,0 -wdslab,125,0 -doublewoodenslab,125,0 -dwoodenslab,125,0 -doublewoodslab,125,0 -dwoodslab,125,0 -doublewslab,125,0 -dwslab,125,0 -woodendoublehalfblock,125,0 -woodendhalfblock,125,0 -wooddoublehalfblock,125,0 -wooddhalfblock,125,0 -wdoublehalfblock,125,0 -wdhalfblock,125,0 -doublewoodenhalfblock,125,0 -dwoodenhalfblock,125,0 -doublewoodhalfblock,125,0 -dwoodhalfblock,125,0 -doublewhalfblock,125,0 -dwhalfblock,125,0 -oakwoodendoublehalfblock,125,0 -oakwoodendhalfblock,125,0 -oakwooddoublehalfblock,125,0 -oakwooddhalfblock,125,0 -oakwdoublehalfblock,125,0 -oakwdhalfblock,125,0 -oakdoublewoodenhalfblock,125,0 -oakdwoodenhalfblock,125,0 -oakdoublewoodhalfblock,125,0 -oakdwoodhalfblock,125,0 -oakdoublewhalfblock,125,0 -oakdwhalfblock,125,0 -oakdoublehalfblock,125,0 -oakdhalfblock,125,0 -odhalfblock,125,0 -oakwoodendoublestep,125,0 -oakwoodendstep,125,0 -oakwooddoublestep,125,0 -oakwooddstep,125,0 -oakwdoublestep,125,0 -oakwdstep,125,0 -oakdoublewoodenstep,125,0 -oakdwoodenstep,125,0 -oakdoublewoodstep,125,0 -oakdwoodstep,125,0 -oakdoublewstep,125,0 -oakdwstep,125,0 -oakdoublestep,125,0 -oakdstep,125,0 -odstep,125,0 -oakwoodendoubleslab,125,0 -oakwoodendslab,125,0 -oakwooddoubleslab,125,0 -oakwooddslab,125,0 -oakwdoubleslab,125,0 -oakwdslab,125,0 -oakdoublewoodenslab,125,0 -oakdwoodenslab,125,0 -oakdoublewoodslab,125,0 -oakdwoodslab,125,0 -oakdoublewslab,125,0 -oakdwslab,125,0 -oakdoubleslab,125,0 -oakdslab,125,0 -odslab,125,0 -sprucewoodendoublestep,125,1 -sprucewoodendstep,125,1 -sprucewooddoublestep,125,1 -sprucewooddstep,125,1 -sprucewdoublestep,125,1 -sprucewdstep,125,1 -sprucedoublewoodenstep,125,1 -sprucedwoodenstep,125,1 -sprucedoublewoodstep,125,1 -sprucedwoodstep,125,1 -sprucedoublewstep,125,1 -sprucedwstep,125,1 -sprucedoublestep,125,1 -sprucedstep,125,1 -sprucewoodendoubleslab,125,1 -sprucewoodendslab,125,1 -sprucewooddoubleslab,125,1 -sprucewooddslab,125,1 -sprucewdoubleslab,125,1 -sprucewdslab,125,1 -sprucedoublewoodenslab,125,1 -sprucedwoodenslab,125,1 -sprucedoublewoodslab,125,1 -sprucedwoodslab,125,1 -sprucedoublewslab,125,1 -sprucedwslab,125,1 -sprucedoubleslab,125,1 -sprucedslab,125,1 -sprucewoodendoublehalfblock,125,1 -sprucewoodendhalfblock,125,1 -sprucewooddoublehalfblock,125,1 -sprucewooddhalfblock,125,1 -sprucewdoublehalfblock,125,1 -sprucewdhalfblock,125,1 -sprucedoublewoodenhalfblock,125,1 -sprucedwoodenhalfblock,125,1 -sprucedoublewoodhalfblock,125,1 -sprucedwoodhalfblock,125,1 -sprucedoublewhalfblock,125,1 -sprucedwhalfblock,125,1 -sprucedoublehalfblock,125,1 -sprucedhalfblock,125,1 -darkwoodendoublestep,125,1 -darkwoodendstep,125,1 -darkwooddoublestep,125,1 -darkwooddstep,125,1 -darkwdoublestep,125,1 -darkwdstep,125,1 -darkdoublewoodenstep,125,1 -darkdwoodenstep,125,1 -darkdoublewoodstep,125,1 -darkdwoodstep,125,1 -darkdoublewstep,125,1 -darkdwstep,125,1 -darkdoublestep,125,1 -darkdstep,125,1 -ddstep,125,1 -darkwoodendoubleslab,125,1 -darkwoodendslab,125,1 -darkwooddoubleslab,125,1 -darkwooddslab,125,1 -darkwdoubleslab,125,1 -darkwdslab,125,1 -darkdoublewoodenslab,125,1 -darkdwoodenslab,125,1 -darkdoublewoodslab,125,1 -darkdwoodslab,125,1 -darkdoublewslab,125,1 -darkdwslab,125,1 -darkdoubleslab,125,1 -darkdslab,125,1 -ddslab,125,1 -darkwoodendoublehalfblock,125,1 -darkwoodendhalfblock,125,1 -darkwooddoublehalfblock,125,1 -darkwooddhalfblock,125,1 -darkwdoublehalfblock,125,1 -darkwdhalfblock,125,1 -darkdoublewoodenhalfblock,125,1 -darkdwoodenhalfblock,125,1 -darkdoublewoodhalfblock,125,1 -darkdwoodhalfblock,125,1 -darkdoublewhalfblock,125,1 -darkdwhalfblock,125,1 -darkdoublehalfblock,125,1 -darkdhalfblock,125,1 -ddhalfblock,125,1 -birchwoodendoublestep,125,2 -birchwoodendstep,125,2 -birchwooddoublestep,125,2 -birchwooddstep,125,2 -birchwdoublestep,125,2 -birchwdstep,125,2 -birchdoublewoodenstep,125,2 -birchdwoodenstep,125,2 -birchdoublewoodstep,125,2 -birchdwoodstep,125,2 -birchdoublewstep,125,2 -birchdwstep,125,2 -birchdoublestep,125,2 -birchdstep,125,2 -birchwoodendoubleslab,125,2 -birchwoodendslab,125,2 -birchwooddoubleslab,125,2 -birchwooddslab,125,2 -birchwdoubleslab,125,2 -birchwdslab,125,2 -birchdoublewoodenslab,125,2 -birchdwoodenslab,125,2 -birchdoublewoodslab,125,2 -birchdwoodslab,125,2 -birchdoublewslab,125,2 -birchdwslab,125,2 -birchdoubleslab,125,2 -birchdslab,125,2 -birchwoodendoublehalfblock,125,2 -birchwoodendhalfblock,125,2 -birchwooddoublehalfblock,125,2 -birchwooddhalfblock,125,2 -birchwdoublehalfblock,125,2 -birchwdhalfblock,125,2 -birchdoublewoodenhalfblock,125,2 -birchdwoodenhalfblock,125,2 -birchdoublewoodhalfblock,125,2 -birchdwoodhalfblock,125,2 -birchdoublewhalfblock,125,2 -birchdwhalfblock,125,2 -birchdoublehalfblock,125,2 -birchdhalfblock,125,2 -lightwoodendoublehalfblock,125,2 -lightwoodendhalfblock,125,2 -lightwooddoublehalfblock,125,2 -lightwooddhalfblock,125,2 -lightwdoublehalfblock,125,2 -lightwdhalfblock,125,2 -lightdoublewoodenhalfblock,125,2 -lightdwoodenhalfblock,125,2 -lightdoublewoodhalfblock,125,2 -lightdwoodhalfblock,125,2 -lightdoublewhalfblock,125,2 -lightdwhalfblock,125,2 -lightdoublehalfblock,125,2 -lightdhalfblock,125,2 -ldhalfblock,125,2 -lightwoodendoublestep,125,2 -lightwoodendstep,125,2 -lightwooddoublestep,125,2 -lightwooddstep,125,2 -lightwdoublestep,125,2 -lightwdstep,125,2 -lightdoublewoodenstep,125,2 -lightdwoodenstep,125,2 -lightdoublewoodstep,125,2 -lightdwoodstep,125,2 -lightdoublewstep,125,2 -lightdwstep,125,2 -lightdoublestep,125,2 -lightdstep,125,2 -ldstep,125,2 -lightwoodendoubleslab,125,2 -lightwoodendslab,125,2 -lightwooddoubleslab,125,2 -lightwooddslab,125,2 -lightwdoubleslab,125,2 -lightwdslab,125,2 -lightdoublewoodenslab,125,2 -lightdwoodenslab,125,2 -lightdoublewoodslab,125,2 -lightdwoodslab,125,2 -lightdoublewslab,125,2 -lightdwslab,125,2 -lightdoubleslab,125,2 -lightdslab,125,2 -ldslab,125,2 -junglewoodendoublestep,125,3 -junglewoodendstep,125,3 -junglewooddoublestep,125,3 -junglewooddstep,125,3 -junglewdoublestep,125,3 -junglewdstep,125,3 -jungledoublewoodenstep,125,3 -jungledwoodenstep,125,3 -jungledoublewoodstep,125,3 -jungledwoodstep,125,3 -jungledoublewstep,125,3 -jungledwstep,125,3 -jungledoublestep,125,3 -jungledstep,125,3 -jdstep,125,3 -junglewoodendoubleslab,125,3 -junglewoodendslab,125,3 -junglewooddoubleslab,125,3 -junglewooddslab,125,3 -junglewdoubleslab,125,3 -junglewdslab,125,3 -jungledoublewoodenslab,125,3 -jungledwoodenslab,125,3 -jungledoublewoodslab,125,3 -jungledwoodslab,125,3 -jungledoublewslab,125,3 -jungledwslab,125,3 -jungledoubleslab,125,3 -jungledslab,125,3 -jdslab,125,3 -junglewoodendoublehalfblock,125,3 -junglewoodendhalfblock,125,3 -junglewooddoublehalfblock,125,3 -junglewooddhalfblock,125,3 -junglewdoublehalfblock,125,3 -junglewdhalfblock,125,3 -jungledoublewoodenhalfblock,125,3 -jungledwoodenhalfblock,125,3 -jungledoublewoodhalfblock,125,3 -jungledwoodhalfblock,125,3 -jungledoublewhalfblock,125,3 -jungledwhalfblock,125,3 -jungledoublehalfblock,125,3 -jungledhalfblock,125,3 -jdhalfblock,125,3 -forestwoodendoublehalfblock,125,3 -forestwoodendhalfblock,125,3 -forestwooddoublehalfblock,125,3 -forestwooddhalfblock,125,3 -forestwdoublehalfblock,125,3 -forestwdhalfblock,125,3 -forestdoublewoodenhalfblock,125,3 -forestdwoodenhalfblock,125,3 -forestdoublewoodhalfblock,125,3 -forestdwoodhalfblock,125,3 -forestdoublewhalfblock,125,3 -forestdwhalfblock,125,3 -forestdoublehalfblock,125,3 -forestdhalfblock,125,3 -fdhalfblock,125,3 -forestwoodendoublestep,125,3 -forestwoodendstep,125,3 -forestwooddoublestep,125,3 -forestwooddstep,125,3 -forestwdoublestep,125,3 -forestwdstep,125,3 -forestdoublewoodenstep,125,3 -forestdwoodenstep,125,3 -forestdoublewoodstep,125,3 -forestdwoodstep,125,3 -forestdoublewstep,125,3 -forestdwstep,125,3 -forestdoublestep,125,3 -forestdstep,125,3 -fdstep,125,3 -forestwoodendoubleslab,125,3 -forestwoodendslab,125,3 -forestwooddoubleslab,125,3 -forestwooddslab,125,3 -forestwdoubleslab,125,3 -forestwdslab,125,3 -forestdoublewoodenslab,125,3 -forestdwoodenslab,125,3 -forestdoublewoodslab,125,3 -forestdwoodslab,125,3 -forestdoublewslab,125,3 -forestdwslab,125,3 -forestdoubleslab,125,3 -forestdslab,125,3 -fdslab,125,3 -acaciawoodendoublestep,125,4 -acaciawoodendstep,125,4 -acaciawooddoublestep,125,4 -acaciawooddstep,125,4 -acaciawdoublestep,125,4 -acaciawdstep,125,4 -acaciadoublewoodenstep,125,4 -acaciadwoodenstep,125,4 -acaciadoublewoodstep,125,4 -acaciadwoodstep,125,4 -acaciadoublewstep,125,4 -acaciadwstep,125,4 -acaciadoublestep,125,4 -acaciadstep,125,4 -adstep,125,4 -acaciawoodendoubleslab,125,4 -acaciawoodendslab,125,4 -acaciawooddoubleslab,125,4 -acaciawooddslab,125,4 -acaciawdoubleslab,125,4 -acaciawdslab,125,4 -acaciadoublewoodenslab,125,4 -acaciadwoodenslab,125,4 -acaciadoublewoodslab,125,4 -acaciadwoodslab,125,4 -acaciadoublewslab,125,4 -acaciadwslab,125,4 -acaciadoubleslab,125,4 -acaciadslab,125,4 -adslab,125,4 -acaciawoodendoublehalfblock,125,4 -acaciawoodendhalfblock,125,4 -acaciawooddoublehalfblock,125,4 -acaciawooddhalfblock,125,4 -acaciawdoublehalfblock,125,4 -acaciawdhalfblock,125,4 -acaciadoublewoodenhalfblock,125,4 -acaciadwoodenhalfblock,125,4 -acaciadoublewoodhalfblock,125,4 -acaciadwoodhalfblock,125,4 -acaciadoublewhalfblock,125,4 -acaciadwhalfblock,125,4 -acaciadoublehalfblock,125,4 -acaciadhalfblock,125,4 -adhalfblock,125,4 -darkoakwoodendoublehalfblock,125,5 -darkoakwoodendhalfblock,125,5 -darkoakwooddoublehalfblock,125,5 -darkoakwooddhalfblock,125,5 -darkoakwdoublehalfblock,125,5 -darkoakwdhalfblock,125,5 -darkoakdoublewoodenhalfblock,125,5 -darkoakdwoodenhalfblock,125,5 -darkoakdoublewoodhalfblock,125,5 -darkoakdwoodhalfblock,125,5 -darkoakdoublewhalfblock,125,5 -darkoakdwhalfblock,125,5 -darkoakdoublehalfblock,125,5 -darkoakdhalfblock,125,5 -dodhalfblock,125,5 -darkoakwoodendoublestep,125,5 -darkoakwoodendstep,125,5 -darkoakwooddoublestep,125,5 -darkoakwooddstep,125,5 -darkoakwdoublestep,125,5 -darkoakwdstep,125,5 -darkoakdoublewoodenstep,125,5 -darkoakdwoodenstep,125,5 -darkoakdoublewoodstep,125,5 -darkoakdwoodstep,125,5 -darkoakdoublewstep,125,5 -darkoakdwstep,125,5 -darkoakdoublestep,125,5 -darkoakdstep,125,5 -dodstep,125,5 -darkoakwoodendoubleslab,125,5 -darkoakwoodendslab,125,5 -darkoakwooddoubleslab,125,5 -darkoakwooddslab,125,5 -darkoakwdoubleslab,125,5 -darkoakwdslab,125,5 -darkoakdoublewoodenslab,125,5 -darkoakdwoodenslab,125,5 -darkoakdoublewoodslab,125,5 -darkoakdwoodslab,125,5 -darkoakdoublewslab,125,5 -darkoakdwslab,125,5 -darkoakdoubleslab,125,5 -darkoakdslab,125,5 -dodslab,125,5 -woodenstep,126,0 -woodstep,126,0 -wstep,126,0 -woodenslab,126,0 -woodslab,126,0 -wslab,126,0 -woodenhalfblock,126,0 -woodhalfblock,126,0 -whalfblock,126,0 -oakwoodenstep,126,0 -oakwoodstep,126,0 -oakwstep,126,0 -oakstep,126,0 -ostep,126,0 -oakwoodenslab,126,0 -oakwoodslab,126,0 -oakwslab,126,0 -oakslab,126,0 -oslab,126,0 -oakwoodenhalfblock,126,0 -oakwoodhalfblock,126,0 -oakwhalfblock,126,0 -oakhalfblock,126,0 -ohalfblock,126,0 -spslab,126,1 -spstep,126,1 -sprucewoodenstep,126,1 -sprucewoodstep,126,1 -sprucewstep,126,1 -sprucestep,126,1 -sprucewoodenslab,126,1 -sprucewoodslab,126,1 -sprucewslab,126,1 -spruceslab,126,1 -sprucewoodenhalfblock,126,1 -sprucewoodhalfblock,126,1 -sprucewhalfblock,126,1 -sprucehalfblock,126,1 -darkwoodenstep,126,1 -darkwoodstep,126,1 -darkwstep,126,1 -darkstep,126,1 -darkwoodenslab,126,1 -darkwoodslab,126,1 -darkwslab,126,1 -darkslab,126,1 -darkwoodenhalfblock,126,1 -darkwoodhalfblock,126,1 -darkwhalfblock,126,1 -darkhalfblock,126,1 -birchwoodenstep,126,2 -birchwoodstep,126,2 -birchwstep,126,2 -birchstep,126,2 -birchwoodenslab,126,2 -birchwoodslab,126,2 -birchwslab,126,2 -birchslab,126,2 -birchwoodenhalfblock,126,2 -birchwoodhalfblock,126,2 -birchwhalfblock,126,2 -birchhalfblock,126,2 -lightwoodenstep,126,2 -lightwoodstep,126,2 -lightwstep,126,2 -lightstep,126,2 -lstep,126,2 -lightwoodenslab,126,2 -lightwoodslab,126,2 -lightwslab,126,2 -lightslab,126,2 -lslab,126,2 -lightwoodenhalfblock,126,2 -lightwoodhalfblock,126,2 -lightwhalfblock,126,2 -lighthalfblock,126,2 -lhalfblock,126,2 -junglewoodenstep,126,3 -junglewoodstep,126,3 -junglewstep,126,3 -junglestep,126,3 -jstep,126,3 -junglewoodenslab,126,3 -junglewoodslab,126,3 -junglewslab,126,3 -jungleslab,126,3 -jslab,126,3 -junglewoodenhalfblock,126,3 -junglewoodhalfblock,126,3 -junglewhalfblock,126,3 -junglehalfblock,126,3 -jhalfblock,126,3 -forestwoodenstep,126,3 -forestwoodstep,126,3 -forestwstep,126,3 -foreststep,126,3 -fstep,126,3 -forestwoodenslab,126,3 -forestwoodslab,126,3 -forestwslab,126,3 -forestslab,126,3 -fslab,126,3 -forestwoodenhalfblock,126,3 -forestwoodhalfblock,126,3 -forestwhalfblock,126,3 -foresthalfblock,126,3 -fhalfblock,126,3 -acaciawoodenstep,126,4 -acaciawoodstep,126,4 -acaciawstep,126,4 -acaciastep,126,4 -astep,126,4 -acaciawoodenslab,126,4 -acaciawoodslab,126,4 -acaciawslab,126,4 -acaciaslab,126,4 -aslab,126,4 -acaciawoodenhalfblock,126,4 -acaciawoodhalfblock,126,4 -acaciawhalfblock,126,4 -acaciahalfblock,126,4 -ahalfblock,126,4 -darkoakwoodenstep,126,5 -darkoakwoodstep,126,5 -darkoakwstep,126,5 -darkoakstep,126,5 -dostep,126,5 -darkoakwoodenslab,126,5 -darkoakwoodslab,126,5 -darkoakwslab,126,5 -darkoakslab,126,5 -doslab,126,5 -darkoakwoodenhalfblock,126,5 -darkoakwoodhalfblock,126,5 -darkoakwhalfblock,126,5 -darkoakhalfblock,126,5 -dohalfblock,126,5 -cocoaplant,127,0 -cocoplant,127,0 -cplant,127,0 -cocoafruit,127,0 -cocofruit,127,0 -cfruit,127,0 -cocoapod,127,0 -cocopod,127,0 -cpod,127,0 -sandstonestairs,128,0 -sandstairs,128,0 -sandsstairs,128,0 -sstonestairs,128,0 -ssstairs,128,0 -sandstair,128,0 -sandstonestair,128,0 -sandsstair,128,0 -sstonestair,128,0 -ssstair,128,0 -emeraldore,129,0 -eore,129,0 -oreemerald,129,0 -oree,129,0 -enderchest,130,0 -endchest,130,0 -echest,130,0 -chestender,130,0 -chestend,130,0 -cheste,130,0 -endercontainer,130,0 -endcontainer,130,0 -econtainer,130,0 -tripwirehook,131,0 -tripwire,131,0 -trip,131,0 -tripwirelever,131,0 -triphook,131,0 -emeraldblock,133,0 -blockemerald,133,0 -eblock,133,0 -blocke,133,0 -sprucewoodenstairs,134,0 -sprucewoodstairs,134,0 -sprucewstairs,134,0 -sprucestairs,134,0 -darkwoodenstairs,134,0 -darkwoodstairs,134,0 -darkwstairs,134,0 -darkstairs,134,0 -dstairs,134,0 -sprucewoodenstair,134,0 -sprucewoodstair,134,0 -sprucewstair,134,0 -sprucestair,134,0 -darkwoodenstair,134,0 -darkwoodstair,134,0 -darkwstair,134,0 -darkstair,134,0 -dstair,134,0 -birchwoodenstairs,135,0 -birchwoodstairs,135,0 -birchwstairs,135,0 -birchstairs,135,0 -lightwoodenstairs,135,0 -lightwoodstairs,135,0 -lightwstairs,135,0 -lightstairs,135,0 -lstairs,135,0 -birchwoodenstair,135,0 -birchwoodstair,135,0 -birchwstair,135,0 -birchstair,135,0 -lightwoodenstair,135,0 -lightwoodstair,135,0 -lightwstair,135,0 -lightstair,135,0 -lstair,135,0 -junglewoodenstairs,136,0 -junglewoodstairs,136,0 -junglewstairs,136,0 -junglestairs,136,0 -jstairs,136,0 -forestwoodenstairs,136,0 -forestwoodstairs,136,0 -forestwstairs,136,0 -foreststairs,136,0 -fstairs,136,0 -junglewoodenstair,136,0 -junglewoodstair,136,0 -junglewstair,136,0 -junglestair,136,0 -jstair,136,0 -forestwoodenstair,136,0 -forestwoodstair,136,0 -forestwstair,136,0 -foreststair,136,0 -fstair,136,0 -commandblock,137,0 -blockcommand,137,0 -cmdblock,137,0 -blockcmd,137,0 -macroblock,137,0 -blockmacro,137,0 -beacon,138,0 -beaconblock,138,0 -cobblestonewall,139,0 -cstonewall,139,0 -cobblewall,139,0 -cobblestonefence,139,0 -cstonefence,139,0 -cobblefence,139,0 -cswall,139,0 -csfence,139,0 -cwall,139,0 -cfence,139,0 -mcswall,139,0 -mcsfence,139,0 -mcfence,139,0 -mcwall,139,1 -mosscobblestonewall,139,1 -mosscstonewall,139,1 -mosscobblewall,139,1 -mcobblestonewall,139,1 -mcstonewall,139,1 -mcobblewall,139,1 -mosscobblestonefence,139,1 -mosscstonefence,139,1 -mosscobblefence,139,1 -mcobblestonefence,139,1 -mcstonefence,139,1 -mcobblefence,139,1 -plantedcarrot,141,0 -plantcarrot,141,0 -carrots,141,0 -growingcarrot,141,0 -potatoplant,142,0 -potatoes,142,0 -plantedpotato,142,0 -plantpotato,142,0 -growingpotato,142,0 -woodenbutton,143,0 -woodenplankbutton,143,0 -woodplankbutton,143,0 -wplankbutton,143,0 -plankbutton,143,0 -woodbutton,143,0 -wbutton,143,0 -anvil,145,0 -slightlydamagedanvil,145,1 -slightdamageanvil,145,1 -damagedanvil,145,1 -verydamagedanvil,145,2 -trapchest,146,0 -trappedchest,146,0 -chesttrapped,146,0 -chesttrap,146,0 -goldpressureplate,147,0 -weightedgoldpressureplate,147,0 -weightgoldpressureplate,147,0 -wgoldpressureplate,147,0 -weightedgoldpressplate,147,0 -weightgoldpressplate,147,0 -wgoldpressplate,147,0 -goldpressplate,147,0 -weightedgoldpplate,147,0 -weightgoldpplate,147,0 -wgoldpplate,147,0 -goldpplate,147,0 -weightedgoldplate,147,0 -weightgoldplate,147,0 -wgoldplate,147,0 -goldplate,147,0 -weightedgpressureplate,147,0 -weightgpressureplate,147,0 -wgpressureplate,147,0 -gpressureplate,147,0 -weightedgpressplate,147,0 -weightgpressplate,147,0 -wgpressplate,147,0 -gpressplate,147,0 -weightedgpplate,147,0 -weightgpplate,147,0 -wgpplate,147,0 -gpplate,147,0 -weightedgplate,147,0 -weightgplate,147,0 -wgplate,147,0 -gplate,147,0 -ironpressureplate,148,0 -weightedironpressureplate,148,0 -weightironpressureplate,148,0 -wironpressureplate,148,0 -weightedironpressplate,148,0 -weightironpressplate,148,0 -wironpressplate,148,0 -ironpressplate,148,0 -weightedironpplate,148,0 -weightironpplate,148,0 -wironpplate,148,0 -ironpplate,148,0 -weightedironplate,148,0 -weightironplate,148,0 -wironplate,148,0 -ironplate,148,0 -weightedipressureplate,148,0 -weightipressureplate,148,0 -wipressureplate,148,0 -ipressureplate,148,0 -weightedipressplate,148,0 -weightipressplate,148,0 -wipressplate,148,0 -ipressplate,148,0 -weightedipplate,148,0 -weightipplate,148,0 -wipplate,148,0 -ipplate,148,0 -weightediplate,148,0 -weightiplate,148,0 -wiplate,148,0 -iplate,148,0 -daylightsensor,151,0 -daylightsense,151,0 -lightsensor,151,0 -lightsense,151,0 -daysensor,151,0 -daysense,151,0 -timesensor,151,0 -timesense,151,0 -redstoneblock,152,0 -rstoneblock,152,0 -redsblock,152,0 -rsblock,152,0 -blockredstone,152,0 -blockrstone,152,0 -blockreds,152,0 -blockrs,152,0 -netherquartzore,153,0 -hellquartzore,153,0 -deathquartzore,153,0 -nquartzore,153,0 -hquartzore,153,0 -dquartzore,153,0 -quartzore,153,0 -netherqore,153,0 -hellqore,153,0 -deathqore,153,0 -nqore,153,0 -hqore,153,0 -dqore,153,0 -qore,153,0 -hopper,154,0 -chestpuller,154,0 -chestpull,154,0 -cheststorer,154,0 -cheststore,154,0 -itempuller,154,0 -itempull,154,0 -itemstorer,154,0 -itemstore,154,0 -quartzblock,155,0 -netherquartzblock,155,0 -nqblock,155,0 -qblock,155,0 -chiseledquartzblock,155,1 -chiselquartzblock,155,1 -cquartzblock,155,1 -cqblock,155,1 -pillarquartzblock,155,2 -pquartzblock,155,2 -pqblock,155,2 -quartzstairs,156,0 -qstairs,156,0 -quartzstair,156,0 -qstair,156,0 -activatorrails,157,0 -activaterails,157,0 -triggerrails,157,0 -arails,157,0 -trails,157,0 -activatorrail,157,0 -activaterail,157,0 -triggerrail,157,0 -arail,157,0 -trail,157,0 -activatortrack,157,0 -activatetrack,157,0 -triggertrack,157,0 -atrack,157,0 -ttrack,157,0 -dropper,158,0 -drop,158,0 -chestdispenser,158,0 -chestdispense,158,0 -chestdropper,158,0 -chestdrop,158,0 -whiteclay,159,0 -whitesclay,159,0 -whitestainedclay,159,0 -wclay,159,0 -wsclay,159,0 -wstainedclay,159,0 -sclay,159,0 -stainedclay,159,0 -orangeclay,159,1 -orangesclay,159,1 -orangestainedclay,159,1 -oclay,159,1 -osclay,159,1 -ostainedclay,159,1 -magentaclay,159,2 -magentasclay,159,2 -magentastainedclay,159,2 -mclay,159,2 -msclay,159,2 -mstainedclay,159,2 -lightblueclay,159,3 -lightbluesclay,159,3 -lightbluestainedclay,159,3 -lblueclay,159,3 -lbluesclay,159,3 -lbluestainedclay,159,3 -lightbluclay,159,3 -lightblusclay,159,3 -lightblustainedclay,159,3 -lbluclay,159,3 -lblusclay,159,3 -lblustainedclay,159,3 -lbclay,159,3 -lbsclay,159,3 -lbstainedclay,159,3 -yellowclay,159,4 -yellowsclay,159,4 -yellowstainedclay,159,4 -yclay,159,4 -ysclay,159,4 -ystainedclay,159,4 -lightgreenclay,159,5 -lightgreensclay,159,5 -lightgreenstainedclay,159,5 -lgreenclay,159,5 -lgreensclay,159,5 -lgreenstainedclay,159,5 -lightgreclay,159,5 -lightgresclay,159,5 -lightgrestainedclay,159,5 -lgreclay,159,5 -lgresclay,159,5 -lgrestainedclay,159,5 -limeclay,159,5 -limesclay,159,5 -limestainedclay,159,5 -lclay,159,5 -lsclay,159,5 -lstainedclay,159,5 -pinkclay,159,6 -pinksclay,159,6 -pinkstainedclay,159,6 -piclay,159,6 -pisclay,159,6 -pistainedclay,159,6 -darkgrayclay,159,7 -darkgraysclay,159,7 -darkgraystainedclay,159,7 -dgrayclay,159,7 -dgraysclay,159,7 -dgraystainedclay,159,7 -darkgreyclay,159,7 -darkgreeysclay,159,7 -darkgreystainedclay,159,7 -dgreyclay,159,7 -dgreysclay,159,7 -dgreystainedclay,159,7 -darkgraclay,159,7 -darkgrasclay,159,7 -darkgrastainedclay,159,7 -dgraclay,159,7 -dgrasclay,159,7 -dgrastainedclay,159,7 -grayclay,159,7 -graysclay,159,7 -graystainedclay,159,7 -greyclay,159,7 -greysclay,159,7 -greystainedclay,159,7 -graclay,159,7 -grasclay,159,7 -grastainedclay,159,7 -lgclay,159,8 -lightgrayclay,159,8 -lightgraysclay,159,8 -lightgraystainedclay,159,8 -lgrayclay,159,8 -lgraysclay,159,8 -lgraystainedclay,159,8 -lightgreyclay,159,8 -lightgreysclay,159,8 -lightgreystainedclay,159,8 -lgreyclay,159,8 -lgreysclay,159,8 -lgreystainedclay,159,8 -lightgraclay,159,8 -lightgrasclay,159,8 -lightgrastainedclay,159,8 -lgraclay,159,8 -lgrasclay,159,8 -lgrastainedclay,159,8 -silverclay,159,8 -silversclay,159,8 -silverstainedclay,159,8 -siclay,159,8 -siasclay,159,8 -siastainedclay,159,8 -cyanclay,159,9 -cyansclay,159,9 -cyanstainedclay,159,9 -cclay,159,9 -csclay,159,9 -cstainedclay,159,9 -purpleclay,159,10 -purplesclay,159,10 -purplestainedclay,159,10 -puclay,159,10 -pusclay,159,10 -pustainedclay,159,10 -blueclay,159,11 -bluesclay,159,11 -bluestainedclay,159,11 -bluclay,159,11 -blusclay,159,11 -blustainedclay,159,11 -brownclay,159,12 -brownsclay,159,12 -brownstainedclay,159,12 -broclay,159,12 -brosclay,159,12 -brostainedclay,159,12 -darkgreenclay,159,13 -darkgreensclay,159,13 -darkgreenstainedclay,159,13 -dgreenclay,159,13 -dgreensclay,159,13 -dgreenstainedclay,159,13 -greenclay,159,13 -greensclay,159,13 -greenstainedclay,159,13 -darkgreclay,159,13 -darkgresclay,159,13 -darkgrestainedclay,159,13 -dgreclay,159,13 -dgresclay,159,13 -dgrestainedclay,159,13 -greclay,159,13 -gresclay,159,13 -grestainedclay,159,13 -redclay,159,14 -redsclay,159,14 -redstainedclay,159,14 -rclay,159,14 -rsclay,159,14 -rstainedclay,159,14 -blackclay,159,15 -blacksclay,159,15 -blackstainedclay,159,15 -blaclay,159,15 -blasclay,159,15 -blastainedclay,159,15 -wgpane,160,0 -whiteglasspane,160,0 -whitesglasspane,160,0 -whitestainedglasspane,160,0 -wglasspane,160,0 -wsglasspane,160,0 -wstainedglasspane,160,0 -sglasspane,160,0 -stainedglasspane,160,0 -ogpane,160,1 -orangeglasspane,160,1 -orangesglasspane,160,1 -orangestainedglasspane,160,1 -oglasspane,160,1 -osglasspane,160,1 -ostainedglasspane,160,1 -mgpane,160,2 -magentaglasspane,160,2 -magentasglasspane,160,2 -magentastainedglasspane,160,2 -mglasspane,160,2 -msglasspane,160,2 -mstainedglasspane,160,2 -lbpane,160,3 -lightblueglasspane,160,3 -lightbluesglasspane,160,3 -lightbluestainedglasspane,160,3 -lblueglasspane,160,3 -lbluesglasspane,160,3 -lbluestainedglasspane,160,3 -lightbluglasspane,160,3 -lightblusglasspane,160,3 -lightblustainedglasspane,160,3 -lbluglasspane,160,3 -lblusglasspane,160,3 -lblustainedglasspane,160,3 -lbglasspane,160,3 -lbsglasspane,160,3 -lbstainedglasspane,160,3 -ygpane,160,4 -yellowglasspane,160,4 -yellowsglasspane,160,4 -yellowstainedglasspane,160,4 -yglasspane,160,4 -ysglasspane,160,4 -ystainedglasspane,160,4 -lgrpane,160,5 -lightgreenglasspane,160,5 -lightgreensglasspane,160,5 -lightgreenstainedglasspane,160,5 -lgreenglasspane,160,5 -lgreensglasspane,160,5 -lgreenstainedglasspane,160,5 -lightgreglasspane,160,5 -lightgresglasspane,160,5 -lightgrestainedglasspane,160,5 -lgreglasspane,160,5 -lgresglasspane,160,5 -lgrestainedglasspane,160,5 -limeglasspane,160,5 -limesglasspane,160,5 -limestainedglasspane,160,5 -lglasspane,160,5 -lsglasspane,160,5 -lstainedglasspane,160,5 -pgpane,160,6 -pinkglasspane,160,6 -pinksglasspane,160,6 -pinkstainedglasspane,160,6 -piglasspane,160,6 -pisglasspane,160,6 -pistainedglasspane,160,6 -dgpane,160,7 -darkgrayglasspane,160,7 -darkgraysglasspane,160,7 -darkgraystainedglasspane,160,7 -dgrayglasspane,160,7 -dgraysglasspane,160,7 -dgraystainedglasspane,160,7 -darkgreyglasspane,160,7 -darkgreysglasspane,160,7 -darkgreystainedglasspane,160,7 -dgreyglasspane,160,7 -dgreysglasspane,160,7 -dgreystainedglasspane,160,7 -darkgraglasspane,160,7 -darkgrasglasspane,160,7 -darkgrastainedglasspane,160,7 -dgraglasspane,160,7 -dgrasglasspane,160,7 -dgrastainedglasspane,160,7 -grayglasspane,160,7 -graysglasspane,160,7 -graystainedglasspane,160,7 -greyglasspane,160,7 -greysglasspane,160,7 -greystainedglasspane,160,7 -graglasspane,160,7 -grasglasspane,160,7 -grastainedglasspane,160,7 -lgypane,160,8 -lightgrayglasspane,160,8 -lightgraysglasspane,160,8 -lightgraystainedglasspane,160,8 -lgrayglasspane,160,8 -lgraysglasspane,160,8 -lgraystainedglasspane,160,8 -lightgreyglasspane,160,8 -lightgreysglasspane,160,8 -lightgreystainedglasspane,160,8 -lgreyglasspane,160,8 -lgreysglasspane,160,8 -lgreystainedglasspane,160,8 -lightgraglasspane,160,8 -lightgrasglasspane,160,8 -lightgrastainedglasspane,160,8 -lgraglasspane,160,8 -lgrasglasspane,160,8 -lgrastainedglasspane,160,8 -silverglasspane,160,8 -silversglasspane,160,8 -silverstainedglasspane,160,8 -siglasspane,160,8 -siasglasspane,160,8 -siastainedglasspane,160,8 -cgpane,160,9 -cyanglasspane,160,9 -cyansglasspane,160,9 -cyanstainedglasspane,160,9 -cglasspane,160,9 -csglasspane,160,9 -cstainedglasspane,160,9 -prpane,160,10 -purpleglasspane,160,10 -purplesglasspane,160,10 -purplestainedglasspane,160,10 -puglasspane,160,10 -pusglasspane,160,10 -pustainedglasspane,160,10 -bgpane,160,11 -blueglasspane,160,11 -bluesglasspane,160,11 -bluestainedglasspane,160,11 -bluglasspane,160,11 -blusglasspane,160,11 -blustainedglasspane,160,11 -brgpane,160,12 -brownglasspane,160,12 -brownsglasspane,160,12 -brownstainedglasspane,160,12 -broglasspane,160,12 -brosglasspane,160,12 -brostainedglasspane,160,12 -dgrpane,160,13 -darkgreenglasspane,160,13 -darkgreensglasspane,160,13 -darkgreenstainedglasspane,160,13 -dgreenglasspane,160,13 -dgreensglasspane,160,13 -dgreenstainedglasspane,160,13 -greenglasspane,160,13 -greensglasspane,160,13 -greenstainedglasspane,160,13 -darkgreglasspane,160,13 -darkgresglasspane,160,13 -darkgrestainedglasspane,160,13 -dgreglasspane,160,13 -dgresglasspane,160,13 -dgrestainedglasspane,160,13 -greglasspane,160,13 -gresglasspane,160,13 -grestainedglasspane,160,13 -rgpane,160,14 -redglasspane,160,14 -redsglasspane,160,14 -redstainedglasspane,160,14 -rglasspane,160,14 -rsglasspane,160,14 -rstainedglasspane,160,14 -blgpane,160,15 -blackglasspane,160,15 -blacksglasspane,160,15 -blackstainedglasspane,160,15 -blaglasspane,160,15 -blasglasspane,160,15 -blastainedglasspane,160,15 -acacialeaves,161,0 -acaciatreeleaves,161,0 -acacialogleaves,161,0 -acaciatrunkleaves,161,0 -acaciawoodleaves,161,0 -aleaves,161,0 -atreeleaves,161,0 -alogleaves,161,0 -atrunkleaves,161,0 -awoodleaves,161,0 -acacialeave,161,0 -acaciatreeleave,161,0 -acacialogleave,161,0 -acaciatrunkleave,161,0 -acaciawoodleave,161,0 -aleave,161,0 -atreeleave,161,0 -alogleave,161,0 -atrunkleave,161,0 -awoodleave,161,0 -acaciatreeleaf,161,0 -acacialogleaf,161,0 -acaciatrunkleaf,161,0 -acaciawoodleaf,161,0 -aleaf,161,0 -atreeleaf,161,0 -alogleaf,161,0 -atrunkleaf,161,0 -awoodleaf,161,0 -darkoakleaves,161,1 -darkoaktreeleaves,161,1 -darkoaklogleaves,161,1 -darkoaktrunkleaves,161,1 -darkoakwoodleaves,161,1 -doakleaves,161,1 -doaktreeleaves,161,1 -doaklogleaves,161,1 -doaktrunkleaves,161,1 -doakwoodleaves,161,1 -doleaves,161,1 -dotreeleaves,161,1 -dologleaves,161,1 -dotrunkleaves,161,1 -dowoodleaves,161,1 -darkoakleave,161,1 -darkoaktreeleave,161,1 -darkoaklogleave,161,1 -darkoaktrunkleave,161,1 -darkoakwoodleave,161,1 -doakleave,161,1 -doaktreeleave,161,1 -doaklogleave,161,1 -doaktrunkleave,161,1 -doakwoodleave,161,1 -doleave,161,1 -dotreeleave,161,1 -dologleave,161,1 -dotrunkleave,161,1 -dowoodleave,161,1 -darkoaktreeleaf,161,1 -darkoaklogleaf,161,1 -darkoaktrunkleaf,161,1 -darkoakwoodleaf,161,1 -doakleaf,161,1 -doaktreeleaf,161,1 -doaklogleaf,161,1 -doaktrunkleaf,161,1 -doakwoodleaf,161,1 -doleaf,161,1 -dotreeleaf,161,1 -dologleaf,161,1 -dotrunkleaf,161,1 -dowoodleaf,161,1 -acacia,162,0 -acaciatree,162,0 -acacialog,162,0 -acaciatrunk,162,0 -acaciawood,162,0 -atree,162,0 -alog,162,0 -atrunk,162,0 -awood,162,0 -darkoak,162,1 -darkoaktree,162,1 -darkoaklog,162,1 -darkoaktrunk,162,1 -darkoakwood,162,1 -doak,162,1 -doaktree,162,1 -doaklog,162,1 -doaktrunk,162,1 -doakwood,162,1 -dotree,162,1 -dolog,162,1 -dotrunk,162,1 -dowood,162,1 -acaciawoodenstairs,163,0 -acaciawoodstairs,163,0 -acaciawstairs,163,0 -acaciastairs,163,0 -awoodenstairs,163,0 -awoodstairs,163,0 -awstairs,163,0 -astairs,163,0 -acaciawoodenstair,163,0 -acaciawoodstair,163,0 -acaciawstair,163,0 -acaciastair,163,0 -awoodenstair,163,0 -awoodstair,163,0 -awstair,163,0 -astair,163,0 -darkoakwoodenstairs,164,0 -darkoakwoodstairs,164,0 -darkoakwstairs,164,0 -darkoakstairs,164,0 -doakwoodenstairs,164,0 -doakwoodstairs,164,0 -doakwstairs,164,0 -doakstairs,164,0 -dowoodenstairs,164,0 -dowoodstairs,164,0 -dowstairs,164,0 -dostairs,164,0 -darkoakwoodenstair,164,0 -darkoakwoodstair,164,0 -darkoakwstair,164,0 -darkoakstair,164,0 -doakwoodenstair,164,0 -doakwoodstair,164,0 -doakwstair,164,0 -doakstair,164,0 -dowoodenstair,164,0 -dowoodstair,164,0 -dowstair,164,0 -dostair,164,0 -slime,165,0 -slimeblock,165,0 -barrier,166,0 -barrierblock,166,0 -irontrapdoor,167,0 -itrapdoor,167,0 -irondoortrap,167,0 -idoortrap,167,0 -pris,168,0 -prismarine,168,0 -prismarineblock,168,0 -pbrick,168,1 -prismarinebrick,168,1 -dpris,168,2 -darkprismarine,168,2 -lantern,169,0 -sealantern,169,0 -sealanternblock,169,0 -hay,170,0 -hayblock,170,0 -haybale,170,0 -baleofhay,170,0 -hayofbale,170,0 -whitecarpet,171,0 -whitefloor,171,0 -wcarpet,171,0 -wfloor,171,0 -carpet,171,0 -floor,171,0 -orangecarpet,171,1 -orangefloor,171,1 -ocarpet,171,1 -ofloor,171,1 -magentacarpet,171,2 -magentafloor,171,2 -mcarpet,171,2 -mfloor,171,2 -lightbluecarpet,171,3 -lightbluefloor,171,3 -lbluecarpet,171,3 -lbluefloor,171,3 -lbcarpet,171,3 -lbfloor,171,3 -lightblucarpet,171,3 -lightblufloor,171,3 -lblucarpet,171,3 -lblufloor,171,3 -yellowcarpet,171,4 -yellowfloor,171,4 -ycarpet,171,4 -yfloor,171,4 -lightgreencarpet,171,5 -lightgreenfloor,171,5 -lgreencarpet,171,5 -lgreenfloor,171,5 -lightgrecarpet,171,5 -lightgrefloor,171,5 -lgrecarpet,171,5 -lgrefloor,171,5 -limecarpet,171,5 -limefloor,171,5 -lcarpet,171,5 -lfloor,171,5 -pinkcarpet,171,6 -pinkfloor,171,6 -picarpet,171,6 -pifloor,171,6 -grfloor,171,7 -darkgraycarpet,171,7 -darkgrayfloor,171,7 -dgraycarpet,171,7 -dgrayfloor,171,7 -darkgreycarpet,171,7 -darkgreyfloor,171,7 -dgreycarpet,171,7 -dgreyfloor,171,7 -darkgracarpet,171,7 -darkgrafloor,171,7 -dgracarpet,171,7 -dgrafloor,171,7 -graycarpet,171,7 -grayfloor,171,7 -greycarpet,171,7 -greyfloor,171,7 -gracarpet,171,7 -grafloor,171,7 -lgfloor,171,8 -lightgraycarpet,171,8 -lightgrayfloor,171,8 -lgraycarpet,171,8 -lgrayfloor,171,8 -lightgreycarpet,171,8 -lightgreyfloor,171,8 -lgreycarpet,171,8 -lgreyfloor,171,8 -lightgracarpet,171,8 -lightgrafloor,171,8 -lgracarpet,171,8 -lgrafloor,171,8 -silvercarpet,171,8 -silverfloor,171,8 -sicarpet,171,8 -siafloor,171,8 -cyancarpet,171,9 -cyanfloor,171,9 -ccarpet,171,9 -cfloor,171,9 -purplecarpet,171,10 -purplefloor,171,10 -pucarpet,171,10 -pufloor,171,10 -blfloor,171,11 -bluecarpet,171,11 -bluefloor,171,11 -blucarpet,171,11 -blufloor,171,11 -brfloor,171,12 -browncarpet,171,12 -brownfloor,171,12 -brocarpet,171,12 -brofloor,171,12 -dgfloor,171,13 -darkgreencarpet,171,13 -darkgreenfloor,171,13 -dgreencarpet,171,13 -dgreenfloor,171,13 -greencarpet,171,13 -greenfloor,171,13 -darkgrecarpet,171,13 -darkgrefloor,171,13 -dgrecarpet,171,13 -dgrefloor,171,13 -grecarpet,171,13 -grefloor,171,13 -redcarpet,171,14 -redfloor,171,14 -rcarpet,171,14 -rfloor,171,14 -bkfloor,171,15 -blackcarpet,171,15 -blackfloor,171,15 -blacarpet,171,15 -blafloor,171,15 -hardenedclay,172,0 -hardclay,172,0 -hclay,172,0 -coalblock,173,0 -blockcoal,173,0 -coblock,173,0 -blockco,173,0 -coalb,173,0 -bcoal,173,0 -packedice,174,0 -packice,174,0 -solidice,174,0 -sunflower,175,0 -yellowsunflower,175,0 -lilac,175,1 -magentalilac,175,1 -syringa,175,1 -longtallgrass,175,2 -extratallgrass,175,2 -doubletallgrass,175,2 -largetallgrass,175,2 -longtgrass,175,2 -extratgrass,175,2 -doubletgrass,175,2 -largetgrass,175,2 -ltgrass,175,2 -etgrass,175,2 -dtgrass,175,2 -bigfern,175,3 -largefern,175,3 -doublefern,175,3 -bfern,175,3 -lfern,175,3 -dfern,175,3 -rosebush,175,4 -redrosebush,175,4 -peony,175,5 -pinkpeony,175,5 -paeonia,175,5 -inverteddaylightsensor,178,0 -daylightsensorinverted,178,0 -daylightdetectorinverted,178,0 -inverteddaylightdetector,178,0 -rsstone,179,0 -redsandstone,179,0 -crstone,179,1 -redsandstonechiseled,179,1 -chiseledredsandstone,179,1 -srstone,179,2 -redsandstonesmooth,179,2 -smoothredsandstone,179,2 -redsandstonestair,180,0 -redsandstonestairs,180,0 -rsstair,180,0 -stairredsandstone,180,0 -doubleredsandstoneslab,181,0 -doubleredsandstoneslabfull,181,8 -fullredsandstoneslab,181,8 -rsslab,182,0 -redsandstoneslab,182,0 -sprucefencegate,183,0 -sfencegate,183,0 -sgate,183,0 -sprucegate,183,0 -birchfencegate,184,0 -bfencegate,184,0 -bgate,184,0 -birchgate,184,0 -junglefencegate,185,0 -jfencegate,185,0 -jgate,185,0 -junglegate,185,0 -darkoakfencegate,186,0 -doakfencegate,186,0 -darkoakgate,186,0 -doakgate,186,0 -dogate,186,0 -acaciafencegate,187,0 -afencegate,187,0 -acaciagate,187,0 -agate,187,0 -sprucefence,188,0 -sfence,188,0 -birchfence,189,0 -bfence,189,0 -junglefence,190,0 -jfence,190,0 -darkoakfence,191,0 -dofence,191,0 -doakfence,191,0 -acaciafence,192,0 -afence,192,0 -magmablock,213,0 -blockmagma,213,0 -netherwartblock,214,0 -blocknetherwart,214,0 -rednetherbrick,215,0 -rednetherbrickblock,215,0 -blockrednetherbrick,215,0 -rednbblock,215,0 -blockrednb,215,0 -boneblock,216,0 -skeletonboneblock,216,0 -skeletonblock,216,0 -observer,218,0 -budblock,218,0 -bud,218,0 -shulkerbox,219,0 -whiteshulkerbox,219,0 -wshulkerbox,219,0 -whitechest,219,0 -wchest,219,0 -orangeshulkerbox,220,0 -oshulkerbox,220,0 -orangechest,220,0 -ochest,220,0 -magentashulkerbox,221,0 -magentachest,221,0 -mshulkerbox,221,0 -mchest,221,0 -mashulkerbox,221,0 -machest,221,0 -lightblueshulkerbox,222,0 -lightbluechest,222,0 -lblueshulkerbox,222,0 -lbluechest,222,0 -lbshulkerbox,222,0 -lbchest,222,0 -lblushulkerbox,222,0 -lightbluchest,222,0 -lbluchest,222,0 -yellowshulkerbox,223,0 -yshulkerbox,223,0 -yellowchest,223,0 -ychest,223,0 -limeshulkerbox,224,0 -lshulkerbox,224,0 -lgreenshulkerbox,224,0 -lgreshulkerbox,224,0 -limechest,224,0 -lgrechest,224,0 -lchest,224,0 -pinkshulkerbox,225,0 -pishulkerbox,225,0 -pinkchest,225,0 -pichest,225,0 -grayshulkerbox,226,0 -greyshulkerbox,226,0 -darkgrayshulkerbox,226,0 -darkgreyshulkerbox,226,0 -dgrayshulkerbox,226,0 -dgreyshulkerbox,226,0 -grashulkerbox,226,0 -greshulkerbox,226,0 -dgrashulkerbox,226,0 -dgreshulkerbox,226,0 -graychest,226,0 -greychest,226,0 -darkgraychest,226,0 -darkgreychest,226,0 -dgraychest,226,0 -dgreychest,226,0 -grachest,226,0 -darkgrachest,226,0 -dgrachest,226,0 -silvershulkerbox,227,0 -silverchest,227,0 -sishulkerbox,227,0 -sichest,227,0 -lgshulkerbox,227,0 -lgchest,227,0 -lightgrayshulkerbox,227,0 -lightgreyshulkerbox,227,0 -lightgraychest,227,0 -lightgreychest,227,0 -lightgrashulkerbox,227,0 -lightgreshulkerbox,227,0 -lightgrachest,227,0 -lightgrechest,227,0 -lgraychest,227,0 -lgreychest,227,0 -lgrachest,227,0 -lgrechest,227,0 -cyanshulkerbox,228,0 -cyanchest,228,0 -cshulkerbox,228,0 -cchest,228,0 -purpleshulkerbox,229,0 -purplechest,229,0 -pushulkerbox,229,0 -puchest,229,0 -blueshulkerbox,230,0 -bluechest,230,0 -blushulkerbox,230,0 -bluchest,230,0 -brownshulkerbox,231,0 -brownchest,231,0 -broshulkerbox,231,0 -brochest,231,0 -darkgreenshulkerbox,232,0 -darkgreenchest,232,0 -greenshulkerbox,232,0 -greenchest,232,0 -greenshulkerbox,232,0 -greenchest,232,0 -greshulkerbox,232,0 -grechest,232,0 -dgreshulkerbox,232,0 -dgrechest,232,0 -darkgreshulkerbox,232,0 -darkgrechest,232,0 -redshulkerbox,233,0 -rshulkerbox,233,0 -redchest,233,0 -rchest,233,0 -blackshulkerbox,234,0 -blashulkerbox,234,0 -blackchest,234,0 -blachest,234,0 -structureblock,255,0 -ironshovel,256,0 -ironspade,256,0 -ishovel,256,0 -ispade,256,0 -steelshovel,256,0 -steelspade,256,0 -ironpickaxe,257,0 -ironpick,257,0 -steelpickaxe,257,0 -steelpick,257,0 -ipickaxe,257,0 -ipick,257,0 -ironaxe,258,0 -iaxe,258,0 -steelaxe,258,0 -flintandsteel,259,0 -flintandiron,259,0 -flintandtinder,259,0 -flintnsteel,259,0 -flintniron,259,0 -flintntinder,259,0 -flintsteel,259,0 -flintiron,259,0 -flinttinder,259,0 -lighter,259,0 -apple,260,0 -normalapple,260,0 -redapple,260,0 -bow,261,0 -arrow,262,0 -coal,263,0 -charcoal,263,1 -ccoal,263,1 -diamond,264,0 -crystal,264,0 -ironingot,265,0 -ironbar,265,0 -ironi,265,0 -steelingot,265,0 -steelbar,265,0 -steeli,265,0 -iingot,265,0 -ibar,265,0 -ingotiron,265,0 -bariron,265,0 -iiron,265,0 -ingotsteel,265,0 -barsteel,265,0 -isteel,265,0 -ingoti,265,0 -bari,265,0 -ironnugget,452,0 -nuggeti,452,0 -inugget,452,0 -goldingot,266,0 -goldbar,266,0 -goldi,266,0 -gingot,266,0 -gbar,266,0 -ingotgold,266,0 -bargold,266,0 -igold,266,0 -ingotg,266,0 -barg,266,0 -ironsword,267,0 -steelsword,267,0 -isword,267,0 -woodensword,268,0 -woodsword,268,0 -wsword,268,0 -woodenshovel,269,0 -woodenspade,269,0 -woodshovel,269,0 -woodspade,269,0 -wshovel,269,0 -wspade,269,0 -woodenpickaxe,270,0 -woodenpick,270,0 -woodpickaxe,270,0 -woodpick,270,0 -wpickaxe,270,0 -wpick,270,0 -woodenaxe,271,0 -woodaxe,271,0 -waxe,271,0 -stonesword,272,0 -cobblestonesword,272,0 -cstonesword,272,0 -cssword,272,0 -ssword,272,0 -stoneshovel,273,0 -cobblestoneshovel,273,0 -cobblestonespade,273,0 -cstoneshovel,273,0 -cstonespade,273,0 -stonespade,273,0 -csshovel,273,0 -csspade,273,0 -sshovel,273,0 -sspade,273,0 -stonepickaxe,274,0 -cobblestonepickaxe,274,0 -cobblestonepick,274,0 -cstonepickaxe,274,0 -cstonepick,274,0 -stonepick,274,0 -cspickaxe,274,0 -cspick,274,0 -spickaxe,274,0 -spick,274,0 -stoneaxe,275,0 -cobblestoneaxe,275,0 -cstoneaxe,275,0 -csaxe,275,0 -saxe,275,0 -diamondsword,276,0 -crystalsword,276,0 -dsword,276,0 -diamondshovel,277,0 -diamondspade,277,0 -crystalshovel,277,0 -crystalspade,277,0 -dshovel,277,0 -dspade,277,0 -diamondpickaxe,278,0 -diamondpick,278,0 -crystalpickaxe,278,0 -crystalpick,278,0 -dpickaxe,278,0 -dpick,278,0 -diamondaxe,279,0 -crystalaxe,279,0 -daxe,279,0 -stick,280,0 -twig,280,0 -branch,280,0 -bowl,281,0 -woodenbowl,281,0 -woodbowl,281,0 -mushroomsoup,282,0 -mrsoup,282,0 -soup,282,0 -goldsword,283,0 -gsword,283,0 -goldshovel,284,0 -goldspade,284,0 -gshovel,284,0 -gspade,284,0 -goldpickaxe,285,0 -goldpick,285,0 -gpickaxe,285,0 -gpick,285,0 -goldaxe,286,0 -gaxe,286,0 -string,287,0 -thread,287,0 -feather,288,0 -gunpowder,289,0 -sulfur,289,0 -woodenhoe,290,0 -woodhoe,290,0 -whoe,290,0 -stonehoe,291,0 -cobblestonehoe,291,0 -cstonehoe,291,0 -cshoe,291,0 -shoe,291,0 -ironhoe,292,0 -steelhoe,292,0 -ihoe,292,0 -diamondhoe,293,0 -crystalhoe,293,0 -dhoe,293,0 -goldhoe,294,0 -ghoe,294,0 -seeds,295,0 -seed,295,0 -wheat,296,0 -crops,296,0 -crop,296,0 -bread,297,0 -leatherhelmet,298,0 -leatherhelm,298,0 -leatherhat,298,0 -leathercoif,298,0 -lhelmet,298,0 -lhelm,298,0 -lhat,298,0 -lcoif,298,0 -leatherchestplate,299,0 -leatherplatebody,299,0 -leatherplate,299,0 -leathershirt,299,0 -leathertunic,299,0 -lchestplate,299,0 -lplatebody,299,0 -lplate,299,0 -lshirt,299,0 -ltunic,299,0 -leatherleggings,300,0 -leatherlegs,300,0 -leatherpants,300,0 -lleggings,300,0 -llegs,300,0 -lpants,300,0 -leatherboots,301,0 -leathershoes,301,0 -lboots,301,0 -lshoes,301,0 -chainmailhelmet,302,0 -chainmailhelm,302,0 -chainmailhat,302,0 -chainmailcoif,302,0 -chainmhelmet,302,0 -chainmhelm,302,0 -chainmhat,302,0 -chainmcoif,302,0 -cmailhelmet,302,0 -cmailhelm,302,0 -cmailhat,302,0 -cmailcoif,302,0 -chainhelmet,302,0 -chainhelm,302,0 -chainhat,302,0 -chaincoif,302,0 -cmhelmet,302,0 -cmhelm,302,0 -cmhat,302,0 -cmcoif,302,0 -chainmailchestplate,303,0 -chainmailplatebody,303,0 -chainmailplate,303,0 -chainmailshirt,303,0 -chainmailtunic,303,0 -chainmchestplate,303,0 -chainmplatebody,303,0 -chainmplate,303,0 -chainmshirt,303,0 -chainmtunic,303,0 -cmailchestplate,303,0 -cmailplatebody,303,0 -cmailplate,303,0 -cmailshirt,303,0 -cmailtunic,303,0 -chainchestplate,303,0 -chainplatebody,303,0 -chainplate,303,0 -chainshirt,303,0 -chaintunic,303,0 -cmchestplate,303,0 -cmplatebody,303,0 -cmplate,303,0 -cmshirt,303,0 -cmtunic,303,0 -chainmailleggings,304,0 -chainmaillegs,304,0 -chainmailpants,304,0 -chainmleggings,304,0 -chainmlegs,304,0 -chainmpants,304,0 -cmailleggings,304,0 -cmaillegs,304,0 -cmailpants,304,0 -chainleggings,304,0 -chainlegs,304,0 -chainpants,304,0 -cmleggings,304,0 -cmlegs,304,0 -cmpants,304,0 -chainmailboots,305,0 -chainmailshoes,305,0 -chainmboots,305,0 -chainmshoes,305,0 -cmailboots,305,0 -cmailshoes,305,0 -chainboots,305,0 -chainshoes,305,0 -cmboots,305,0 -cmshoes,305,0 -ironhelmet,306,0 -ironhelm,306,0 -ironhat,306,0 -ironcoif,306,0 -ihelmet,306,0 -ihelm,306,0 -ihat,306,0 -icoif,306,0 -steelhelmet,306,0 -steelhelm,306,0 -steelhat,306,0 -steelcoif,306,0 -shelmet,306,0 -shelm,306,0 -shat,306,0 -scoif,306,0 -ironchestplate,307,0 -ironplatebody,307,0 -ironshirt,307,0 -irontunic,307,0 -ichestplate,307,0 -iplatebody,307,0 -ishirt,307,0 -itunic,307,0 -steelchestplate,307,0 -steelplatebody,307,0 -steelplate,307,0 -steelshirt,307,0 -steeltunic,307,0 -schestplate,307,0 -splatebody,307,0 -sshirt,307,0 -stunic,307,0 -ironleggings,308,0 -ironlegs,308,0 -ironpants,308,0 -ileggings,308,0 -ilegs,308,0 -ipants,308,0 -steelleggings,308,0 -steellegs,308,0 -steelpants,308,0 -sleggings,308,0 -slegs,308,0 -spants,308,0 -ironboots,309,0 -ironshoes,309,0 -iboots,309,0 -ishoes,309,0 -steelboots,309,0 -steelshoes,309,0 -sboots,309,0 -sshoes,309,0 -diamondhelmet,310,0 -diamondhelm,310,0 -diamondhat,310,0 -diamondcoif,310,0 -dhelmet,310,0 -dhelm,310,0 -dhat,310,0 -dcoif,310,0 -crystalhelmet,310,0 -crystalhelm,310,0 -crystalhat,310,0 -crystalcoif,310,0 -chelmet,310,0 -chelm,310,0 -chat,310,0 -ccoif,310,0 -diamondchestplate,311,0 -diamondplatebody,311,0 -diamondplate,311,0 -diamondshirt,311,0 -diamondtunic,311,0 -dchestplate,311,0 -dplatebody,311,0 -dplate,311,0 -dshirt,311,0 -dtunic,311,0 -crystalchestplate,311,0 -crystalplatebody,311,0 -crystalplate,311,0 -crystalshirt,311,0 -crystaltunic,311,0 -cchestplate,311,0 -cplatebody,311,0 -cplate,311,0 -cshirt,311,0 -ctunic,311,0 -diamondleggings,312,0 -diamondlegs,312,0 -diamondpants,312,0 -dleggings,312,0 -dlegs,312,0 -dpants,312,0 -crystalleggings,312,0 -crystallegs,312,0 -crystalpants,312,0 -cleggings,312,0 -clegs,312,0 -cpants,312,0 -diamondboots,313,0 -diamondshoes,313,0 -dboots,313,0 -dshoes,313,0 -crystalboots,313,0 -crystalshoes,313,0 -cboots,313,0 -cshoes,313,0 -goldhelmet,314,0 -goldhelm,314,0 -goldhat,314,0 -goldcoif,314,0 -ghelmet,314,0 -ghelm,314,0 -ghat,314,0 -gcoif,314,0 -goldchestplate,315,0 -goldplatebody,315,0 -goldshirt,315,0 -goldtunic,315,0 -gchestplate,315,0 -gplatebody,315,0 -gplateplate,315,0 -gshirt,315,0 -gtunic,315,0 -goldleggings,316,0 -goldlegs,316,0 -goldpants,316,0 -gleggings,316,0 -glegs,316,0 -gpants,316,0 -goldboots,317,0 -goldshoes,317,0 -gboots,317,0 -gshoes,317,0 -flint,318,0 -pork,319,0 -porkchop,319,0 -rawpork,319,0 -rpork,319,0 -rawporkchop,319,0 -rporkchop,319,0 -cookedpork,320,0 -grilledpork,320,0 -grillpork,320,0 -gpork,320,0 -cookpork,320,0 -cpork,320,0 -grilledporkchop,320,0 -grillporkchop,320,0 -gporkchop,320,0 -cookedporkchop,320,0 -cookporkchop,320,0 -cporkchop,320,0 -bacon,320,0 -painting,321,0 -picture,321,0 -goldenapple,322,0 -goldapple,322,0 -gapple,322,0 -enchantedgoldenapple,322,1 -enchantedgoldapple,322,1 -enchantedgapple,322,1 -supergoldenapple,322,1 -supergoldapple,322,1 -supergapple,322,1 -magicalgoldenapple,322,1 -magicalgoldapple,322,1 -magicalgapple,322,1 -magicgoldenapple,322,1 -magicgoldapple,322,1 -magicgapple,322,1 -egoldenapple,322,1 -egoldapple,322,1 -egapple,322,1 -sgoldenapple,322,1 -sgoldapple,322,1 -sgapple,322,1 -mgoldenapple,322,1 -mgoldapple,322,1 -mgapple,322,1 -sign,323,0 -woodendoor,324,0 -wooddoor,324,0 -wdoor,324,0 -door,324,0 -oakdoor,324,0 -odoor,324,0 -bucket,325,0 -bukkit,325,0 -waterbucket,326,0 -waterbukkit,326,0 -wbucket,326,0 -wbukkit,326,0 -magmabucket,327,0 -magmabukkit,327,0 -lavabucket,327,0 -lavabukkit,327,0 -lbucket,327,0 -lbukkit,327,0 -minecart,328,0 -mcart,328,0 -cart,328,0 -saddle,329,0 -irondoor,330,0 -idoor,330,0 -steeldoor,330,0 -sdoor,330,0 -dooriron,330,0 -doori,330,0 -doorsteel,330,0 -doors,330,0 -redstonedust,331,0 -redstone,331,0 -rstonedust,331,0 -rstone,331,0 -redsdust,331,0 -reddust,331,0 -rsdust,331,0 -rdust,331,0 -snow,332,0 -snowball,332,0 -snball,332,0 -sball,332,0 -boat,333,0 -leather,334,0 -cowhide,334,0 -hide,334,0 -milkbucket,335,0 -milkbukkit,335,0 -mbucket,335,0 -mbukkit,335,0 -claybrick,336,0 -brick,336,0 -redbrick,336,0 -rbrick,336,0 -clayball,337,0 -cball,337,0 -clay,337,0 -reeds,338,0 -reed,338,0 -sugarcane,338,0 -scane,338,0 -bamboo,338,0 -paper,339,0 -papyrus,339,0 -book,340,0 -slimeball,341,0 -slball,341,0 -chestminecart,342,0 -storageminecart,342,0 -storagemcart,342,0 -chestmcart,342,0 -storagecart,342,0 -chestcart,342,0 -sminecart,342,0 -cminecart,342,0 -smcart,342,0 -cmcart,342,0 -scart,342,0 -ccart,342,0 -furnaceminecart,343,0 -engineminecart,343,0 -poweredminecart,343,0 -powerminecart,343,0 -enginemcart,343,0 -poweredmcart,343,0 -powermcart,343,0 -furnacemcart,343,0 -enginecart,343,0 -poweredcart,343,0 -powercart,343,0 -furnacecart,343,0 -eminecart,343,0 -pminecart,343,0 -fminecart,343,0 -emcart,343,0 -pmcart,343,0 -fmcart,343,0 -ecart,343,0 -pcart,343,0 -fcart,343,0 -egg,344,0 -compass,345,0 -fishingrod,346,0 -fishrod,346,0 -frod,346,0 -rod,346,0 -watch,347,0 -goldwatch,347,0 -goldclock,347,0 -gwatch,347,0 -gclock,347,0 -clock,347,0 -glowstonedust,348,0 -glowingstonedust,348,0 -lightstonedust,348,0 -lbdust,348,0 -gbdust,348,0 -lsdust,348,0 -gsdust,348,0 -rawfish,349,0 -rafish,349,0 -fish,349,0 -rawsalmonfish,349,1 -rasalmonfish,349,1 -salmonfish,349,1 -rawsalmon,349,1 -rasalmon,349,1 -salmon,349,1 -sfish,349,1 -fishs,349,1 -rawclownfish,349,2 -raclownfish,349,2 -clownfish,349,2 -rawnemo,349,2 -ranemo,349,2 -nemo,349,2 -nemofish,349,2 -fishnemo,349,2 -clfish,349,2 -fishcl,349,2 -nfish,349,2 -fishn,349,2 -rawpufferfish,349,3 -rapufferfish,349,3 -pufferfish,349,3 -pufffish,349,3 -fishpuff,349,3 -pfish,349,3 -fishp,349,3 -cookedfish,350,0 -cookfish,350,0 -cfish,350,0 -grilledfish,350,0 -grillfish,350,0 -gfish,350,0 -roastedfish,350,0 -roastfish,350,0 -rofish,350,0 -cookedsalmonfish,350,1 -cooksalmonfish,350,1 -csalmonfish,350,1 -grilledsalmonfish,350,1 -grillsalmonfish,350,1 -gsalmonfish,350,1 -roastedsalmonfish,350,1 -roastsalmonfish,350,1 -rosalmonfish,350,1 -cookedsalmon,350,1 -cooksalmon,350,1 -csalmon,350,1 -grilledsalmon,350,1 -grillsalmon,350,1 -gsalmon,350,1 -roastedsalmon,350,1 -roastsalmon,350,1 -rosalmon,350,1 -dye,351,0 -inksack,351,0 -inksac,351,0 -isack,351,0 -isac,351,0 -sack,351,0 -sac,351,0 -blackinksack,351,0 -blackinksac,351,0 -blackisack,351,0 -blackisac,351,0 -blacksack,351,0 -blacksac,351,0 -inksackblack,351,0 -inksacblack,351,0 -isackblack,351,0 -isacblack,351,0 -sackblack,351,0 -sacblack,351,0 -blackinksackcolour,351,0 -blackinksaccolour,351,0 -blackisackcolour,351,0 -blackisaccolour,351,0 -blacksackcolour,351,0 -blacksaccolour,351,0 -inksackblackcolour,351,0 -inksacblackcolour,351,0 -isackblackcolour,351,0 -isacclackcolour,351,0 -sackblackcolour,351,0 -sacblackcolour,351,0 -blackinksackcolor,351,0 -blackinksaccolor,351,0 -blackisackcolor,351,0 -blackisaccolor,351,0 -blacksackcolor,351,0 -blacksaccolor,351,0 -inksackblackcolor,351,0 -inksacblackcolor,351,0 -isackblackcolor,351,0 -isacblackcolor,351,0 -sackblackcolor,351,0 -sacblackcolor,351,0 -blackinksackdye,351,0 -blackinksacdye,351,0 -blackisackdye,351,0 -blackisacdye,351,0 -blacksackdye,351,0 -blacksacdye,351,0 -inksackblackdye,351,0 -inksacblackdye,351,0 -isackblackdye,351,0 -isacclackdye,351,0 -sackblackdye,351,0 -sacblackdye,351,0 -blackcolor,351,0 -blackdye,351,0 -rosered,351,1 -roseredcolor,351,1 -roseredcolour,351,1 -rosereddye,351,1 -redrosecolor,351,1 -redrosecolour,351,1 -redrosedye,351,1 -redr,351,1 -redrcolor,351,1 -redrcolour,351,1 -redrdye,351,1 -redcolor,351,1 -redcolour,351,1 -reddye,351,1 -cactusgreen,351,2 -greencactus,351,2 -cactusgreencolour,351,2 -greencactuscolour,351,2 -cactusgreencolor,351,2 -greencactuscolor,351,2 -cactusgreendye,351,2 -greencactusdye,351,2 -greencolour,351,2 -greencolor,351,2 -greendye,351,2 -cocoabeans,351,3 -cocoabean,351,3 -cocobeans,351,3 -cocobean,351,3 -cbeans,351,3 -cbean,351,3 -beans,351,3 -bean,351,3 -browncocoabeans,351,3 -browncocoabean,351,3 -browncocobeans,351,3 -browncocobean,351,3 -browncbeans,351,3 -browncbean,351,3 -brownbeans,351,3 -brownbean,351,3 -brownb,351,3 -cocoabeanscolour,351,3 -cocoabeancolour,351,3 -cocobeanscolour,351,3 -cocobeancolour,351,3 -cbeanscolour,351,3 -cbeancolour,351,3 -beanscolour,351,3 -beancolour,351,3 -browncocoabeanscolour,351,3 -browncocoabeancolour,351,3 -browncocobeanscolour,351,3 -browncocobeancolour,351,3 -browncbeanscolour,351,3 -browncbeancolour,351,3 -brownbeanscolour,351,3 -brownbeancolour,351,3 -brownbcolour,351,3 -cocoabeanscolor,351,3 -cocoabeancolor,351,3 -cocobeanscolor,351,3 -cocobeancolor,351,3 -cbeanscolor,351,3 -cbeancolor,351,3 -beanscolor,351,3 -beancolor,351,3 -browncocoabeanscolor,351,3 -browncocoabeancolor,351,3 -browncocobeanscolor,351,3 -browncocobeancolor,351,3 -browncbeanscolor,351,3 -browncbeancolor,351,3 -brownbeanscolor,351,3 -brownbeancolor,351,3 -brownbcolor,351,3 -cocoabeansdye,351,3 -cocoabeandye,351,3 -cocobeansdye,351,3 -cocobeandye,351,3 -cbeansdye,351,3 -cbeandye,351,3 -beansdye,351,3 -beandye,351,3 -browncocoabeansdye,351,3 -browncocoabeandye,351,3 -browncocobeansdye,351,3 -browncocobeandye,351,3 -browncbeansdye,351,3 -browncbeandye,351,3 -brownbeansdye,351,3 -brownbeandye,351,3 -brownbdye,351,3 -browncolour,351,3 -browncolor,351,3 -browndye,351,3 -lapislazuli,351,4 -bluelapislazuli,351,4 -bluelapisl,351,4 -bluelapis,351,4 -bluel,351,4 -lapislazuliblue,351,4 -lapislblue,351,4 -lapisblue,351,4 -lapisl,351,4 -lapis,351,4 -bluelapislazulicolour,351,4 -bluelapislcolour,351,4 -bluelapiscolour,351,4 -lapislazulibluecolour,351,4 -lapislbluecolour,351,4 -lapisbluecolour,351,4 -lapislazulicolour,351,4 -lapislcolour,351,4 -lapiscolour,351,4 -bluelapislazulicolor,351,4 -bluelapislcolor,351,4 -bluelapiscolor,351,4 -lapislazulibluecolor,351,4 -lapislbluecolor,351,4 -lapisbluecolor,351,4 -lapislazulicolor,351,4 -lapislcolor,351,4 -lapiscolor,351,4 -bluelapislazulidye,351,4 -bluelapisldye,351,4 -bluelapisdye,351,4 -lapislazulibluedye,351,4 -lapislbluedye,351,4 -lapisbluedye,351,4 -lapislazulidye,351,4 -lapisldye,351,4 -lapisdye,351,4 -bluecolour,351,4 -bluecolor,351,4 -bluedye,351,4 -purpledye,351,5 -purplecolour,351,5 -purplecolor,351,5 -cyandye,351,6 -cyancolour,351,6 -cyancolor,351,6 -lightgraydye,351,7 -lightgraycolour,351,7 -lightgraycolor,351,7 -lgraycolour,351,7 -lgraycolor,351,7 -lgraydye,351,7 -lightgreydye,351,7 -lightgreycolour,351,7 -lightgreycolor,351,7 -lgreycolour,351,7 -lgreycolor,351,7 -lgreydye,351,7 -silvercolour,351,7 -silvercolor,351,7 -silverdye,351,7 -darkgraydye,351,8 -darkgraycolour,351,8 -darkgraycolor,351,8 -dgraycolour,351,8 -dgraycolor,351,8 -dgraydye,351,8 -graycolour,351,8 -graycolor,351,8 -graydye,351,8 -darkgreydye,351,8 -darkgreycolour,351,8 -darkgreycolor,351,8 -dgreycolour,351,8 -dgreycolor,351,8 -dgreydye,351,8 -greycolour,351,8 -greycolor,351,8 -greydye,351,8 -pinkdye,351,9 -pinkcolour,351,9 -pinkcolor,351,9 -limedye,351,10 -limecolour,351,10 -limecolor,351,10 -dandelionyellow,351,11 -dandelionyellowcolour,351,11 -dandelionyellowcolor,351,11 -dandelionyellowdye,351,11 -yellowdandelioncolour,351,11 -yellowdandelioncolor,351,11 -yellowdandeliondye,351,11 -yellowd,351,11 -yellowdcolour,351,11 -yellowdcolor,351,11 -yellowddye,351,11 -dyellow,351,11 -dyellowcolour,351,11 -dyellowcolor,351,11 -dyellowdye,351,11 -yellowcolour,351,11 -yellowcolor,351,11 -yellowdye,351,11 -lightbluecolour,351,12 -lightbluecolor,351,12 -lightbluedye,351,12 -lbluecolour,351,12 -lbluecolor,351,12 -lbluedye,351,12 -magentacolour,351,13 -magentacolor,351,13 -magentadye,351,13 -orangecolour,351,14 -orangecolor,351,14 -orangedye,351,14 -bonemeal,351,15 -whitebonemeal,351,15 -whitebonemealcolour,351,15 -whitebonemealcolor,351,15 -whitebonemealdye,351,15 -bonemealwhite,351,15 -bonemealwhitecolour,351,15 -bonemealwhitecolor,351,15 -bonemealwhitedye,351,15 -whitebonem,351,15 -whitebonemcolour,351,15 -whitebonemcolor,351,15 -whitebonemdye,351,15 -bonemwhite,351,15 -bonemwhitecolour,351,15 -bonemwhitecolor,351,15 -bonemwhitedye,351,15 -bonemealcolour,351,15 -bonemealcolor,351,15 -bonemealdye,351,15 -bonem,351,15 -bonemcolour,351,15 -bonemcolor,351,15 -bonemdye,351,15 -whitecolour,351,15 -whitecolor,351,15 -whitedye,351,15 -bone,352,0 -sugar,353,0 -whitedust,353,0 -cake,354,0 -bed,355,0 -redstonerepeater,356,0 -redstonerepeat,356,0 -redstonedelayer,356,0 -redstonedelay,356,0 -redstonedioder,356,0 -redstonediode,356,0 -rstonerepeater,356,0 -rstonerepeat,356,0 -rstonedelayer,356,0 -rstonedelay,356,0 -rstonedioder,356,0 -rstonediode,356,0 -redsrepeater,356,0 -redsrepeat,356,0 -redsdelayer,356,0 -redsdelay,356,0 -redsdioder,356,0 -redsdiode,356,0 -rsrepeater,356,0 -rsrepeat,356,0 -rsdelayer,356,0 -rsdelay,356,0 -rsdioder,356,0 -rsdiode,356,0 -repeater,356,0 -repeat,356,0 -delayer,356,0 -delay,356,0 -dioder,356,0 -diode,356,0 -cookie,357,0 -chart,358,0 -map0,358,0 -map1,358,1 -map2,358,2 -map3,358,3 -map4,358,4 -map5,358,5 -map6,358,6 -map7,358,7 -map8,358,8 -map9,358,9 -map10,358,10 -map11,358,11 -map12,358,12 -map13,358,13 -map14,358,14 -map15,358,15 -shears,359,0 -shear,359,0 -sheers,359,0 -sheer,359,0 -woolcutters,359,0 -woolcutter,359,0 -cutterswool,359,0 -cutterwool,359,0 -melonslice,360,0 -mslice,360,0 -slicemelon,360,0 -watermelonslice,360,0 -greenmelonslice,360,0 -melongreenslice,360,0 -pumpkinseeds,361,0 -pseeds,361,0 -seedsp,361,0 -seedspumpkin,361,0 -pumpseeds,361,0 -seedspump,361,0 -melonseeds,362,0 -mseeds,362,0 -watermelonseeds,362,0 -greenmelonseeds,362,0 -gmelonseeds,362,0 -seedsmelon,362,0 -seedswatermelon,362,0 -rawbeef,363,0 -rawsteak,363,0 -uncookedbeef,363,0 -uncookedsteak,363,0 -cowmeat,363,0 -plainbeef,363,0 -beef,364,0 -steak,364,0 -cookedbeef,364,0 -grilledbeef,364,0 -cookedsteak,364,0 -grilledsteak,364,0 -cookedcowmeat,364,0 -rawchicken,365,0 -uncookedchicken,365,0 -plainchicken,365,0 -chickenplain,365,0 -chickenuncooked,365,0 -chickenraw,365,0 -cookedchicken,366,0 -grilledchicken,366,0 -toastedchicken,366,0 -gchicken,366,0 -bbqchicken,366,0 -friedchicken,366,0 -cchicken,366,0 -rottenflesh,367,0 -zombieflesh,367,0 -rottenmeat,367,0 -zombiemeat,367,0 -badflesh,367,0 -poisonflesh,367,0 -zombieremains,367,0 -enderpearl,368,0 -endpearl,368,0 -pearl,368,0 -epearl,368,0 -bluepearl,368,0 -endergem,368,0 -blazerod,369,0 -goldenrod,369,0 -goldrod,369,0 -blazestick,369,0 -goldstick,369,0 -brod,369,0 -grod,369,0 -bstick,369,0 -gstick,369,0 -ghasttear,370,0 -ghastdrop,370,0 -ghosttear,370,0 -ghostdrop,370,0 -gtear,370,0 -gdrop,370,0 -tear,370,0 -goldnugget,371,0 -gnugget,371,0 -goldpebble,371,0 -gpebble,371,0 -goldball,371,0 -gball,371,0 -netherstalk,372,0 -deathstalk,372,0 -hellstalk,372,0 -nstalk,372,0 -dstalk,372,0 -hstalk,372,0 -netherwarts,372,0 -netherwart,372,0 -netherplant,372,0 -nethercrop,372,0 -hellwarts,372,0 -hellwart,372,0 -hellplant,372,0 -hellcrop,372,0 -deathwarts,372,0 -deathwart,372,0 -deathplant,372,0 -deathcrop,372,0 -nwarts,372,0 -nwart,372,0 -ncrop,372,0 -nplant,372,0 -hwarts,372,0 -hwart,372,0 -hplant,372,0 -hcrop,372,0 -dwarts,372,0 -dwart,372,0 -dplant,372,0 -dcrop,372,0 -potion,373,0 -mixture,373,0 -potions,373,0 -waterbottle,373,0 -fullbottle,373,0 -watervase,373,0 -fullvase,373,0 -clearpotion,373,6 -clearpot,373,6 -clearextendedpotion,373,7 -clearexpotion,373,7 -clear2potion,373,7 -clearextendedpot,373,7 -clearexpot,373,7 -clear2pot,373,7 -diffusepotion,373,11 -diffusepot,373,11 -artlesspotion,373,13 -artlesspot,373,13 -thinpotion,373,14 -thinpot,373,14 -thinextendedpotion,373,15 -thinexpotion,373,15 -thin2potion,373,15 -thinextendedpot,373,15 -thinexpot,373,15 -thin2pot,373,15 -awkwardpotion,373,16 -awkwardpot,373,16 -bunglingpotion,373,22 -bunglingpot,373,22 -bunglingextendedpotion,373,23 -bunglingexpotion,373,23 -bungling2potion,373,23 -bunglingextendedpot,373,23 -bunglingexpot,373,23 -bungling2pot,373,23 -smoothpotion,373,27 -smoothpot,373,27 -suavepotion,373,29 -suavepot,373,29 -debonairpotion,373,30 -debonairpot,373,30 -debonairextendedpotion,373,31 -debonairexpotion,373,31 -debonair2potion,373,31 -debonairextendedpot,373,31 -debonairexpot,373,31 -debonair2pot,373,31 -thickpotion,373,32 -thickpot,373,32 -charmingpotion,373,38 -charmingpot,373,38 -charmingextendedpotion,373,39 -charmingexpotion,373,39 -charming2potion,373,39 -charmingextendedpot,373,39 -charmingexpot,373,39 -charming2pot,373,39 -refinedpotion,373,43 -refinedpot,373,43 -cordialpotion,373,45 -cordialpot,373,45 -sparklingpotion,373,46 -sparklingpot,373,46 -sparklingextendedpotion,373,47 -sparklingexpotion,373,47 -sparkling2potion,373,47 -sparklingextendedpot,373,47 -sparklingexpot,373,47 -sparkling2pot,373,47 -potentpotion,373,48 -potentpot,373,48 -rankpotion,373,54 -rankpot,373,54 -rankextendedpotion,373,55 -rankexpotion,373,55 -rank2potion,373,55 -rankextendedpot,373,55 -rankexpot,373,55 -rank2pot,373,55 -acridpotion,373,59 -acridpot,373,59 -grosspotion,373,61 -grosspot,373,61 -stinkypotion,373,62 -stinkypot,373,62 -stinkyextendedpotion,373,63 -stinkyexpotion,373,63 -stinky2potion,373,63 -stinkyextendedpot,373,63 -stinkyexpot,373,63 -stinky2pot,373,63 -mundaneextendedpotion,373,64 -mundaneexpotion,373,64 -mundane2potion,373,64 -mundaneextendedpot,373,64 -mundaneexpot,373,64 -mundane2pot,373,64 -mundanepotion,373,8192 -mundanepot,373,8192 -regenerationpotion,373,8193 -regeneratepotion,373,8193 -regenpotion,373,8193 -regenerationpot,373,8193 -regeneratepot,373,8193 -regenpot,373,8193 -rpot,373,8193 -swiftnesspotion,373,8194 -swiftpotion,373,8194 -speedpotion,373,8194 -swiftnesspot,373,8194 -swiftpot,373,8194 -speedpot,373,8194 -swpot,373,8194 -fireresistancepotion,373,8195 -fireresistpotion,373,8195 -firerespotion,373,8195 -fireresistancepot,373,8195 -fireresistpot,373,8195 -firerespot,373,8195 -fpot,373,8195 -poisonpotion,373,8196 -acidpotion,373,8196 -poisonpot,373,8196 -acidpot,373,8196 -ppot,373,8196 -healingpotion,373,8197 -healpotion,373,8197 -lifepotion,373,8197 -healingpot,373,8197 -healpot,373,8197 -lifepot,373,8197 -hpot,373,8197 -nightvisionpotion,373,8198 -nvisionpotion,373,8198 -nightvpotion,373,8198 -darkvisionpotion,373,8198 -dvisionpotion,373,8198 -darkvpotion,373,8198 -nightvisionpot,373,8198 -nvisionpot,373,8198 -nightvpot,373,8198 -darkvisionpot,373,8198 -dvisionpot,373,8198 -darkvpot,373,8198 -npot,373,8198 -weaknesspotion,373,8200 -weakpotion,373,8200 -weaknesspot,373,8200 -weakpot,373,8200 -wpot,373,8200 -strengthpotion,373,8201 -strongpotion,373,8201 -strpotion,373,8201 -strengthpot,373,8201 -strongpot,373,8201 -strpot,373,8201 -stpot,373,8201 -slownesspotion,373,8202 -slowpotion,373,8202 -slownesspot,373,8202 -slowpot,373,8202 -slpot,373,8202 -harmingpotion,373,8204 -damagepotion,373,8204 -dmgpotion,373,8204 -harmingpot,373,8204 -damagepot,373,8204 -dmgpot,373,8204 -dpot,373,8204 -waterbreathingpotion,373,8205 -waterbreathpotion,373,8205 -breathingpotion,373,8205 -breathpotion,373,8205 -waterbreathingpot,373,8205 -waterbreathpot,373,8205 -breathingpot,373,8205 -breathpot,373,8205 -wbpot,373,8205 -invisibilitypotion,373,8206 -invisiblepotion,373,8206 -invpotion,373,8206 -invisibilitypot,373,8206 -invisiblepot,373,8206 -invpot,373,8206 -ipot,373,8206 -regenerationleveliipotion,373,8225 -regenerateleveliipotion,373,8225 -regenleveliipotion,373,8225 -regenerationlevel2potion,373,8225 -regeneratelevel2potion,373,8225 -regenlevel2potion,373,8225 -regenerationiipotion,373,8225 -regenerateiipotion,373,8225 -regeniipotion,373,8225 -regenerationleveliipot,373,8225 -regenerateleveliipot,373,8225 -regenleveliipot,373,8225 -regenerationlevel2pot,373,8225 -regeneratelevel2pot,373,8225 -regenlevel2pot,373,8225 -regenerationiipot,373,8225 -regenerateiipot,373,8225 -regeniipot,373,8225 -r2pot,373,8225 -swiftnessleveliipotion,373,8226 -swiftleveliipotion,373,8226 -speedleveliipotion,373,8226 -swiftnesslevel2potion,373,8226 -swiftlevel2potion,373,8226 -speedlevel2potion,373,8226 -swiftnessiipotion,373,8226 -swiftiipotion,373,8226 -speediipotion,373,8226 -swiftnessleveliipot,373,8226 -swiftleveliipot,373,8226 -speedleveliipot,373,8226 -swiftnesslevel2pot,373,8226 -swiftlevel2pot,373,8226 -speedlevel2pot,373,8226 -swiftnessiipot,373,8226 -swiftiipot,373,8226 -speediipot,373,8226 -sw2pot,373,8226 -poisonleveliipotion,373,8228 -acidleveliipotion,373,8228 -poisonlevel2potion,373,8228 -acidlevel2potion,373,8228 -poisoniipotion,373,8228 -acidiipotion,373,8228 -poisonleveliipot,373,8228 -acidleveliipot,373,8228 -poisonlevel2pot,373,8228 -acidlevel2pot,373,8228 -poisoniipot,373,8228 -acidiipot,373,8228 -p2pot,373,8228 -healingleveliipotion,373,8229 -healleveliipotion,373,8229 -healinglevel2potion,373,8229 -heallevel2potion,373,8229 -healingiipotion,373,8229 -healiipotion,373,8229 -healingleveliipot,373,8229 -healleveliipot,373,8229 -healinglevel2pot,373,8229 -heallevel2pot,373,8229 -healingiipot,373,8229 -healiipot,373,8229 -h2pot,373,8229 -strengthleveliipotion,373,8233 -strongleveliipotion,373,8233 -strleveliipotion,373,8233 -strengthlevel2potion,373,8233 -stronglevel2potion,373,8233 -strlevel2potion,373,8233 -strengthiipotion,373,8233 -strongiipotion,373,8233 -striipotion,373,8233 -strengthleveliipot,373,8233 -strongleveliipot,373,8233 -strleveliipot,373,8233 -strengthlevel2pot,373,8233 -stronglevel2pot,373,8233 -strlevel2pot,373,8233 -strengthiipot,373,8233 -strongiipot,373,8233 -striipot,373,8233 -st2pot,373,8233 -leapingleveliipotion,373,8235 -leapleveliipotion,373,8235 -leaplevel2potion,373,8235 -leapinglevel2potion,373,8235 -leapingiipotion,373,8235 -leapiipotion,373,8235 -leapiipotion,373,8235 -leapingiipotion,373,8235 -leap2potion,373,8235 -leaping2potion,373,8235 -harmingleveliipotion,373,8236 -damageleveliipotion,373,8236 -dmgleveliipotion,373,8236 -harminglevel2potion,373,8236 -damagelevel2potion,373,8236 -dmglevel2potion,373,8236 -harmingiipotion,373,8236 -damageiipotion,373,8236 -dmgiipotion,373,8236 -harmingleveliipot,373,8236 -damageleveliipot,373,8236 -dmgleveliipot,373,8236 -harminglevel2pot,373,8236 -damagelevel2pot,373,8236 -dmglevel2pot,373,8236 -harmingiipot,373,8236 -damageiipot,373,8236 -dmgiipot,373,8236 -d2pot,373,8236 -regenerationextendedpotion,373,8257 -regenerateextendedpotion,373,8257 -regenextendepotion,373,8257 -regenerationexpotion,373,8257 -regenerateexpotion,373,8257 -regenexpotion,373,8257 -regenerationextendedpot,373,8257 -regenerateextendedpot,373,8257 -regenextendepot,373,8257 -regenerationexpot,373,8257 -regenerateexpot,373,8257 -regenexpot,373,8257 -repot,373,8257 -swiftnessextendedpotion,373,8258 -swiftextendedpotion,373,8258 -speedextendedpotion,373,8258 -swiftnessexpotion,373,8258 -swiftexpotion,373,8258 -speedexpotion,373,8258 -swiftnessextendedpot,373,8258 -swiftextendedpot,373,8258 -speedextendedpot,373,8258 -swiftnessexpot,373,8258 -swiftexpot,373,8258 -speedexpot,373,8258 -swepot,373,8258 -fireresistancepotion,373,8227 -fireresistpotion,373,8227 -firerespotion,373,8227 -fireresistpotion,373,8227 -fireresistancepot,373,8227 -fireresistpot,373,8227 -firerespot,373,8227 -frpot,373,8227 -fireresistanceextendedpotion,373,8259 -fireresistextendedpotion,373,8259 -fireresextendedpotion,373,8259 -fireresistanceexpotion,373,8259 -fireresistexpotion,373,8259 -fireresexpotion,373,8259 -fireresistanceextendedpot,373,8259 -fireresistextendedpot,373,8259 -fireresextendedpot,373,8259 -fireresistanceexpot,373,8259 -fireresistexpot,373,8259 -fireresexpot,373,8259 -fepot,373,8259 -poisonextendedpotion,373,8260 -acidextendedpotion,373,8260 -poisonexpotion,373,8260 -acidexpotion,373,8260 -poisonextendedpot,373,8260 -acidextendedpot,373,8260 -poisonexpot,373,8260 -acidexpot,373,8260 -pepot,373,8260 -nightvisionextendedpotion,373,8262 -nvisionextendedpotion,373,8262 -nightvextendedpotion,373,8262 -darkvisionextendedpotion,373,8262 -dvisionextendedpotion,373,8262 -darkvextendedpotion,373,8262 -nightvisionexpotion,373,8262 -nvisionexpotion,373,8262 -nightvexpotion,373,8262 -darkvisionexpotion,373,8262 -dvisionexpotion,373,8262 -darkvexpotion,373,8262 -nightvisionextendedpot,373,8262 -nvisionextendedpot,373,8262 -nightvextendedpot,373,8262 -darkvisionextendedpot,373,8262 -dvisionextendedpot,373,8262 -darkvextendedpot,373,8262 -nightvisionexpot,373,8262 -nvisionexpot,373,8262 -nightvexpot,373,8262 -darkvisionexpot,373,8262 -dvisionexpot,373,8262 -darkvexpot,373,8262 -nepot,373,8262 -weaknessextendedpotion,373,8264 -weakextendedpotion,373,8264 -weaknessexpotion,373,8264 -weakexpotion,373,8264 -weaknessextendedpot,373,8264 -weakextendedpot,373,8264 -weaknessexpot,373,8264 -weakexpot,373,8264 -wepot,373,8264 -strengthextendedpotion,373,8265 -strongextendedpotion,373,8265 -strextendedpotion,373,8265 -strengthexpotion,373,8265 -strongexpotion,373,8265 -strexpotion,373,8265 -strengthextendedpot,373,8265 -strongextendedpot,373,8265 -strextendedpot,373,8265 -strengthexpot,373,8265 -strongexpot,373,8265 -strexpot,373,8265 -stepot,373,8265 -slownessextendedpotion,373,8266 -slowextenedpotion,373,8266 -slownessexpotion,373,8266 -slowexpotion,373,8266 -slownessextendedpot,373,8266 -slowextenedpot,373,8266 -slownessexpot,373,8266 -slowexpot,373,8266 -slepot,373,8266 -leapingpotion,373,8267 -leappotion,373,8267 -waterbreathingextendedpotion,373,8269 -waterbreathextendedpotion,373,8269 -breathingextendedpotion,373,8269 -breathextendedpotion,373,8269 -waterbreathingextendedpot,373,8269 -waterbreathextendedpot,373,8269 -breathingextendedpot,373,8269 -breathextendedpot,373,8269 -waterbreathingexpotion,373,8269 -waterbreathexpotion,373,8269 -breathingexpotion,373,8269 -breathexpotion,373,8269 -waterbreathingexpot,373,8269 -waterbreathexpot,373,8269 -breathingexpot,373,8269 -breathexpot,373,8269 -wbepot,373,8269 -invisibilityextendedpotion,373,8270 -invisibleextendedpotion,373,8270 -invextendedpotion,373,8270 -invisibilityexpotion,373,8270 -invisibleexpotion,373,8270 -invexpotion,373,8270 -invisibilityextendedpot,373,8270 -invisibleextendedpot,373,8270 -invextendedpot,373,8270 -invisibilityexpot,373,8270 -invisibleexpot,373,8270 -invexpot,373,8270 -iepot,373,8270 -regenerationdualbitpotion,373,8289 -regeneratedualbitpotion,373,8289 -regendualbitpotion,373,8289 -regenerationdbpotion,373,8289 -regeneratedbpotion,373,8289 -regendbpotion,373,8289 -regenerationdualbitpot,373,8289 -regeneratedualbitpot,373,8289 -regendualbitpot,373,8289 -regenerationdbpot,373,8289 -regeneratedbpot,373,8289 -regendbpot,373,8289 -rdbpot,373,8289 -swiftnessdualbitpotion,373,8290 -swiftdualbitpotion,373,8290 -speeddualbitpotion,373,8290 -swiftnessdualbitpot,373,8290 -swiftdualbitpot,373,8290 -speeddualbitpot,373,8290 -swiftnessdbpotion,373,8290 -swiftdbpotion,373,8290 -speeddbpotion,373,8290 -swiftnessdbpot,373,8290 -swiftdbpot,373,8290 -speeddbpot,373,8290 -swdbpot,373,8290 -poisondualbitpotion,373,8292 -aciddualbitpotion,373,8292 -poisondualbitpot,373,8292 -aciddualbitpot,373,8292 -poisondbpotion,373,8292 -aciddbpotion,373,8292 -poisondbpot,373,8292 -aciddbpot,373,8292 -pdbpot,373,8292 -strengthdualbitpotion,373,8297 -strongdualbitpotion,373,8297 -strdualbitpotion,373,8297 -strengthdualbitpot,373,8297 -strongdualbitpot,373,8297 -strdualbitpot,373,8297 -strengthdbpotion,373,8297 -strongdbpotion,373,8297 -strdbpotion,373,8297 -strengthdbpot,373,8297 -strongdbpot,373,8297 -strdbpot,373,8297 -stdbpot,373,8297 -splashmundanepotion,373,16384 -splmundanepotion,373,16384 -splashregenerationpotion,373,16385 -splashregeneratepotion,373,16385 -splashregenpotion,373,16385 -splashregenerationpot,373,16385 -splashregeneratepot,373,16385 -splashregenpot,373,16385 -regenerationsplashpotion,373,16385 -regeneratesplashpotion,373,16385 -regensplashpotion,373,16385 -splregenerationpotion,373,16385 -splregeneratepotion,373,16385 -splregenpotion,373,16385 -splregenerationpot,373,16385 -splregeneratepot,373,16385 -splregenpot,373,16385 -sprpot,373,16385 -splashswiftnesspotion,373,16386 -splashswiftpotion,373,16386 -splashspeedpotion,373,16386 -splashswiftnesspot,373,16386 -splashswiftpot,373,16386 -splashspeedpot,373,16386 -splswiftnesspotion,373,16386 -splswiftpotion,373,16386 -splspeedpotion,373,16386 -splswiftnesspot,373,16386 -splswiftpot,373,16386 -splspeedpot,373,16386 -spswpot,373,16386 -splashfireresistancepotion,373,16387 -splashfireresistpotion,373,16387 -splashfirerespotion,373,16387 -splashfireresistancepot,373,16387 -splashfireresistpot,373,16387 -splashfirerespot,373,16387 -splfireresistancepotion,373,16387 -splfireresistpotion,373,16387 -splfirerespotion,373,16387 -splfireresistancepot,373,16387 -splfireresistpot,373,16387 -splfirerespot,373,16387 -spfpot,373,16387 -splashpoisonpotion,373,16388 -splashacidpotion,373,16388 -splashpoisonpot,373,16388 -splashacidpot,373,16388 -splpoisonpotion,373,16388 -splacidpotion,373,16388 -splpoisonpot,373,16388 -splacidpot,373,16388 -spppot,373,16388 -splashhealingpotion,373,16389 -splashhealpotion,373,16389 -splashlifepotion,373,16389 -splashhealingpot,373,16389 -splashhealpot,373,16389 -splashlifepot,373,16389 -splhealingpotion,373,16389 -splhealpotion,373,16389 -spllifepotion,373,16389 -splhealingpot,373,16389 -splhealpot,373,16389 -spllifepot,373,16389 -sphpot,373,16389 -splashclearpotion,373,16390 -splashclearpot,373,16390 -splclearpotion,373,16390 -splclearpot,373,16390 -splashnightvisionpotion,373,16390 -splashnvisionpotion,373,16390 -splashnightvpotion,373,16390 -splashdarkvisionpotion,373,16390 -splashdvisionpotion,373,16390 -splashdarkvpotion,373,16390 -splashnightvisionpot,373,16390 -splashnvisionpot,373,16390 -splashnightvpot,373,16390 -splashdarkvisionpot,373,16390 -splashdvisionpot,373,16390 -splashdarkvpot,373,16390 -splnightvisionpotion,373,16390 -splnvisionpotion,373,16390 -splnightvpotion,373,16390 -spldarkvisionpotion,373,16390 -spldvisionpotion,373,16390 -spldarkvpotion,373,16390 -splnightvisionpot,373,16390 -splnvisionpot,373,16390 -splnightvpot,373,16390 -spldarkvisionpot,373,16390 -spldvisionpot,373,16390 -spldarkvpot,373,16390 -spnpot,373,16390 -splashclearextendedpotion,373,16391 -splashclearexpotion,373,16391 -splashclear2potion,373,16391 -splashclearextendedpot,373,16391 -splashclearexpot,373,16391 -splashclear2pot,373,16391 -splclearextendedpotion,373,16391 -splclearexpotion,373,16391 -splclear2potion,373,16391 -splclearextendedpot,373,16391 -splclearexpot,373,16391 -splclear2pot,373,16391 -splashweaknesspotion,373,16392 -splashweakpotion,373,16392 -splashweaknesspot,373,16392 -splashweakpot,373,16392 -splweaknesspotion,373,16392 -splweakpotion,373,16392 -splweaknesspot,373,16392 -splweakpot,373,16392 -spwpot,373,16392 -splashstrengthpotion,373,16393 -splashstrongpotion,373,16393 -splashstrpotion,373,16393 -splashstrengthpot,373,16393 -splashstrongpot,373,16393 -splashstrpot,373,16393 -splstrengthpotion,373,16393 -splstrongpotion,373,16393 -splstrpotion,373,16393 -splstrengthpot,373,16393 -splstrongpot,373,16393 -splstrpot,373,16393 -spstpot,373,16393 -splashslownesspotion,373,16394 -splashslowpotion,373,16394 -splashslownesspot,373,16394 -splashslowpot,373,16394 -splslownesspotion,373,16394 -splslowpotion,373,16394 -splslownesspot,373,16394 -splslowpot,373,16394 -spslpot,373,16394 -splashdiffusepotion,373,16395 -splashdiffusepot,373,16395 -spldiffusepotion,373,16395 -spldiffusepot,373,16395 -splashharmingpotion,373,16396 -splashdamagepotion,373,16396 -splashdmgpotion,373,16396 -splashharmingpot,373,16396 -splashdamagepot,373,16396 -splashdmgpot,373,16396 -splharmingpotion,373,16396 -spldamagepotion,373,16396 -spldmgpotion,373,16396 -splharmingpot,373,16396 -spldamagepot,373,16396 -spldmgpot,373,16396 -spdpot,373,16396 -splashartlesspotion,373,16397 -splashartlesspot,373,16397 -splartlesspotion,373,16397 -splartlesspot,373,16397 -splashwaterbreathingpotion,373,16397 -splashwaterbreathpotion,373,16397 -splashbreathingpotion,373,16397 -splashbreathpotion,373,16397 -splashwaterbreathingpot,373,16397 -splashwaterbreathpot,373,16397 -splashbreathingpot,373,16397 -splashbreathpot,373,16397 -splwaterbreathingpotion,373,16397 -splwaterbreathpotion,373,16397 -splbreathingpotion,373,16397 -splbreathpotion,373,16397 -splwaterbreathingpot,373,16397 -splwaterbreathpot,373,16397 -splbreathingpot,373,16397 -splbreathpot,373,16397 -spwbpot,373,16397 -splashthinpotion,373,16398 -splashthinpot,373,16398 -splthinpotion,373,16398 -splthinpot,373,16398 -splashinvisibilitypotion,373,16398 -splashinvisiblepotion,373,16398 -splashinvpotion,373,16398 -splashinvisibilitypot,373,16398 -splashinvisiblepot,373,16398 -splashinvpot,373,16398 -splinvisibilitypotion,373,16398 -splinvisiblepotion,373,16398 -splinvpotion,373,16398 -splinvisibilitypot,373,16398 -splinvisiblepot,373,16398 -splinvpot,373,16398 -spipot,373,16398 -splashthinextendedpotion,373,16399 -splashthinexpotion,373,16399 -splashthin2potion,373,16399 -splashthinextendedpot,373,16399 -splashthinexpot,373,16399 -splashthin2pot,373,16399 -splthinextendedpotion,373,16399 -splthinexpotion,373,16399 -splthin2potion,373,16399 -splthinextendedpot,373,16399 -splthinexpot,373,16399 -splthin2pot,373,16399 -splashawkwardpotion,373,16400 -splashawkwardpot,373,16400 -splawkwardpotion,373,16400 -splawkwardpot,373,16400 -splashbunglingpotion,373,16406 -splashbunglingpot,373,16406 -splbunglingpotion,373,16406 -splbunglingpot,373,16406 -splashbunglingextendedpotion,373,16407 -splashbunglingexpotion,373,16407 -splashbungling2potion,373,16407 -splashbunglingextendedpot,373,16407 -splashbunglingexpot,373,16407 -splashbungling2pot,373,16407 -splbunglingextendedpotion,373,16407 -splbunglingexpotion,373,16407 -splbungling2potion,373,16407 -splbunglingextendedpot,373,16407 -splbunglingexpot,373,16407 -splbungling2pot,373,16407 -splashsmoothpotion,373,16411 -splashsmoothpot,373,16411 -splsmoothpotion,373,16411 -splsmoothpot,373,16411 -splashsuavepotion,373,16413 -splashsuavepot,373,16413 -splsuavepotion,373,16413 -splsuavepot,373,16413 -splashdebonairpotion,373,16414 -splashdebonairpot,373,16414 -spldebonairpotion,373,16414 -spldebonairpot,373,16414 -splashdebonairextendedpotion,373,16415 -splashdebonairexpotion,373,16415 -splashdebonair2potion,373,16415 -splashdebonairextendedpot,373,16415 -splashdebonairexpot,373,16415 -splashdebonair2pot,373,16415 -spldebonairextendedpotion,373,16415 -spldebonairexpotion,373,16415 -spldebonair2potion,373,16415 -spldebonairextendedpot,373,16415 -spldebonairexpot,373,16415 -spldebonair2pot,373,16415 -splashthickpotion,373,16416 -splashthickpot,373,16416 -splthickpotion,373,16416 -splthickpot,373,16416 -splashregenerationleveliipotion,373,16417 -splashregenerateleveliipotion,373,16417 -splashregenleveliipotion,373,16417 -splashregenerationlevel2potion,373,16417 -splashregeneratelevel2potion,373,16417 -splashregenlevel2potion,373,16417 -splashregenerationiipotion,373,16417 -splashregenerateiipotion,373,16417 -splashregeniipotion,373,16417 -splashregenerationleveliipot,373,16417 -splashregenerateleveliipot,373,16417 -splashregenleveliipot,373,16417 -splashregenerationlevel2pot,373,16417 -splashregeneratelevel2pot,373,16417 -splashregenlevel2pot,373,16417 -splashregenerationiipot,373,16417 -splashregenerateiipot,373,16417 -splashregeniipot,373,16417 -splregenerationleveliipotion,373,16417 -splregenerateleveliipotion,373,16417 -splregenleveliipotion,373,16417 -splregenerationlevel2potion,373,16417 -splregeneratelevel2potion,373,16417 -splregenlevel2potion,373,16417 -splregenerationiipotion,373,16417 -splregenerateiipotion,373,16417 -splregeniipotion,373,16417 -splregenerationleveliipot,373,16417 -splregenerateleveliipot,373,16417 -splregenleveliipot,373,16417 -splregenerationlevel2pot,373,16417 -splregeneratelevel2pot,373,16417 -splregenlevel2pot,373,16417 -splregenerationiipot,373,16417 -splregenerateiipot,373,16417 -splregeniipot,373,16417 -spr2pot,373,16417 -splashswiftnessleveliipotion,373,16418 -splashswiftleveliipotion,373,16418 -splashspeedleveliipotion,373,16418 -splashswiftnesslevel2potion,373,16418 -splashswiftlevel2potion,373,16418 -splashspeedlevel2potion,373,16418 -splashswiftnessiipotion,373,16418 -splashswiftiipotion,373,16418 -splashspeediipotion,373,16418 -splashswiftnessleveliipot,373,16418 -splashswiftleveliipot,373,16418 -splashspeedleveliipot,373,16418 -splashswiftnesslevel2pot,373,16418 -splashswiftlevel2pot,373,16418 -splashspeedlevel2pot,373,16418 -splashswiftnessiipot,373,16418 -splashswiftiipot,373,16418 -splashspeediipot,373,16418 -splswiftnessleveliipotion,373,16418 -splswiftleveliipotion,373,16418 -splspeedleveliipotion,373,16418 -splswiftnesslevel2potion,373,16418 -splswiftlevel2potion,373,16418 -splspeedlevel2potion,373,16418 -splswiftnessiipotion,373,16418 -splswiftiipotion,373,16418 -splspeediipotion,373,16418 -splswiftnessleveliipot,373,16418 -splswiftleveliipot,373,16418 -splspeedleveliipot,373,16418 -splswiftnesslevel2pot,373,16418 -splswiftlevel2pot,373,16418 -splspeedlevel2pot,373,16418 -splswiftnessiipot,373,16418 -splswiftiipot,373,16418 -splspeediipot,373,16418 -spsw2pot,373,16418 -splashpoisonleveliipotion,373,16420 -splashacidleveliipotion,373,16420 -splashpoisonlevel2potion,373,16420 -splashacidlevel2potion,373,16420 -splashpoisoniipotion,373,16420 -splashacidiipotion,373,16420 -splashpoisonleveliipot,373,16420 -splashacidleveliipot,373,16420 -splashpoisonlevel2pot,373,16420 -splashacidlevel2pot,373,16420 -splashpoisoniipot,373,16420 -splashacidiipot,373,16420 -splpoisonleveliipotion,373,16420 -splacidleveliipotion,373,16420 -splpoisonlevel2potion,373,16420 -splcidlevel2potion,373,16420 -splpoisoniipotion,373,16420 -splacidiipotion,373,16420 -splpoisonleveliipot,373,16420 -splacidleveliipot,373,16420 -splpoisonlevel2pot,373,16420 -splacidlevel2pot,373,16420 -splpoisoniipot,373,16420 -splacidiipot,373,16420 -spp2pot,373,16420 -splashhealingleveliipotion,373,16421 -splashhealleveliipotion,373,16421 -splashhealinglevel2potion,373,16421 -splashheallevel2potion,373,16421 -splashhealingiipotion,373,16421 -splashhealiipotion,373,16421 -splashhealingleveliipot,373,16421 -splashhealleveliipot,373,16421 -splashhealinglevel2pot,373,16421 -splashheallevel2pot,373,16421 -splashhealingiipot,373,16421 -splashhealiipot,373,16421 -splhealingleveliipotion,373,16421 -splhealleveliipotion,373,16421 -splhealinglevel2potion,373,16421 -splheallevel2potion,373,16421 -splhealingiipotion,373,16421 -splhealiipotion,373,16421 -splhealingleveliipot,373,16421 -splhealleveliipot,373,16421 -splhealinglevel2pot,373,16421 -splheallevel2pot,373,16421 -splhealingiipot,373,16421 -splhealiipot,373,16421 -sph2pot,373,16421 -splashcharmingpotion,373,16422 -splashcharmingpot,373,16422 -splcharmingpotion,373,16422 -splcharmingpot,373,16422 -splashcharmingextendedpotion,373,16423 -splashcharmingexpotion,373,16423 -splashcharming2potion,373,16423 -splashcharmingextendedpot,373,16423 -splashcharmingexpot,373,16423 -splashcharming2pot,373,16423 -splcharmingextendedpotion,373,16423 -splcharmingexpotion,373,16423 -splcharming2potion,373,16423 -splcharmingextendedpot,373,16423 -splcharmingexpot,373,16423 -splcharming2pot,373,16423 -splashstrengthleveliipotion,373,16425 -splashstrongleveliipotion,373,16425 -splashstrleveliipotion,373,16425 -splashstrengthlevel2potion,373,16425 -splashstronglevel2potion,373,16425 -splashstrlevel2potion,373,16425 -splashstrengthiipotion,373,16425 -splashstrongiipotion,373,16425 -splashstriipotion,373,16425 -splashstrengthleveliipot,373,16425 -splashstrongleveliipot,373,16425 -splashstrleveliipot,373,16425 -splashstrengthlevel2pot,373,16425 -splashstronglevel2pot,373,16425 -splashstrlevel2pot,373,16425 -splashstrengthiipot,373,16425 -splashstrongiipot,373,16425 -splashstriipot,373,16425 -splstrengthleveliipotion,373,16425 -splstrongleveliipotion,373,16425 -splstrleveliipotion,373,16425 -splstrengthlevel2potion,373,16425 -splstronglevel2potion,373,16425 -splstrlevel2potion,373,16425 -splstrengthiipotion,373,16425 -splstrongiipotion,373,16425 -splstriipotion,373,16425 -splstrengthleveliipot,373,16425 -splstrongleveliipot,373,16425 -splstrleveliipot,373,16425 -splstrengthlevel2pot,373,16425 -splstronglevel2pot,373,16425 -splstrlevel2pot,373,16425 -splstrengthiipot,373,16425 -splstrongiipot,373,16425 -splstriipot,373,16425 -spst2pot,373,16425 -splashrefinedpotion,373,16427 -splashrefinedpot,373,16427 -splrefinedpotion,373,16427 -splrefinedpot,373,16427 -splashharmingleveliipotion,373,16428 -splashdamageleveliipotion,373,16428 -splashdmgleveliipotion,373,16428 -splashharminglevel2potion,373,16428 -splashdamagelevel2potion,373,16428 -splashdmglevel2potion,373,16428 -splashharmingiipotion,373,16428 -splashdamageiipotion,373,16428 -splashdmgiipotion,373,16428 -splashharmingleveliipot,373,16428 -splashdamageleveliipot,373,16428 -splashdmgleveliipot,373,16428 -splashharminglevel2pot,373,16428 -splashdamagelevel2pot,373,16428 -splashdmglevel2pot,373,16428 -splashharmingiipot,373,16428 -splashdamageiipot,373,16428 -splashdmgiipot,373,16428 -splharmingleveliipotion,373,16428 -spldamageleveliipotion,373,16428 -spldmgleveliipotion,373,16428 -splharminglevel2potion,373,16428 -spldamagelevel2potion,373,16428 -spldmglevel2potion,373,16428 -splharmingiipotion,373,16428 -spldamageiipotion,373,16428 -spldmgiipotion,373,16428 -splharmingleveliipot,373,16428 -spldamageleveliipot,373,16428 -spldmgleveliipot,373,16428 -splharminglevel2pot,373,16428 -spldamagelevel2pot,373,16428 -spldmglevel2pot,373,16428 -splharmingiipot,373,16428 -spldamageiipot,373,16428 -spldmgiipot,373,16428 -spd2pot,373,16428 -splashcordialpotion,373,16429 -splashcordialpot,373,16429 -splcordialpotion,373,16429 -splcordialpot,373,16429 -splashsparklingpotion,373,16430 -splashsparklingpot,373,16430 -splsparklingpotion,373,16430 -splsparklingpot,373,16430 -splashsparklingextendedpotion,373,16431 -splashsparklingexpotion,373,16431 -splashsparkling2potion,373,16431 -splashsparklingextendedpot,373,16431 -splashsparklingexpot,373,16431 -splashsparkling2pot,373,16431 -splsparklingextendedpotion,373,16431 -splsparklingexpotion,373,16431 -splsparkling2potion,373,16431 -splsparklingextendedpot,373,16431 -splsparklingexpot,373,16431 -splsparkling2pot,373,16431 -splashpotentpotion,373,16432 -splashpotentpot,373,16432 -splpotentpotion,373,16432 -splpotentpot,373,16432 -splashrankpotion,373,16438 -splashrankpot,373,16438 -splrankpotion,373,16438 -splrankpot,373,16438 -splashrankextendedpotion,373,16439 -splashrankexpotion,373,16439 -splashrank2potion,373,16439 -splashrankextendedpot,373,16439 -splashrankexpot,373,16439 -splashrank2pot,373,16439 -splrankextendedpotion,373,16439 -splrankexpotion,373,16439 -splrank2potion,373,16439 -splrankextendedpot,373,16439 -splrankexpot,373,16439 -splrank2pot,373,16439 -splashacridpotion,373,16443 -splashacridpot,373,16443 -splacridpotion,373,16443 -splacridpot,373,16443 -splashgrosspotion,373,16445 -splashgrosspot,373,16445 -splgrosspotion,373,16445 -splgrosspot,373,16445 -splashstinkypotion,373,16446 -splashstinkypot,373,16446 -splstinkypotion,373,16446 -splstinkypot,373,16446 -splashstinkyextendedpotion,373,16447 -splashstinkyexpotion,373,16447 -splashstinky2potion,373,16447 -splashstinkyextendedpot,373,16447 -splashstinkyexpot,373,16447 -splashstinky2pot,373,16447 -splstinkyextendedpotion,373,16447 -splstinkyexpotion,373,16447 -splstinky2potion,373,16447 -splstinkyextendedpot,373,16447 -splstinkyexpot,373,16447 -splstinky2pot,373,16447 -splashmundaneextendedpotion,373,16448 -splashmundaneexpotion,373,16448 -splashmundane2potion,373,16448 -splashmundaneextendedpot,373,16448 -splashmundaneexpot,373,16448 -splashmundane2pot,373,16448 -splmundaneextendedpotion,373,16448 -splmundaneexpotion,373,16448 -splmundane2potion,373,16448 -splmundaneextendedpot,373,16448 -splmundaneexpot,373,16448 -splmundane2pot,373,16448 -splashregenerationextendedpotion,373,16449 -splashregenerateextendedpotion,373,16449 -splashregenextendepotion,373,16449 -splashregenerationexpotion,373,16449 -splashregenerateexpotion,373,16449 -splashregenexpotion,373,16449 -splashregenerationextendedpot,373,16449 -splashregenerateextendedpot,373,16449 -splashregenextendepot,373,16449 -splashregenerationexpot,373,16449 -splashregenerateexpot,373,16449 -splashregenexpot,373,16449 -splregenerationextendedpotion,373,16449 -splregenerateextendedpotion,373,16449 -splregenextendepotion,373,16449 -splregenerationexpotion,373,16449 -splregenerateexpotion,373,16449 -splregenexpotion,373,16449 -splregenerationextendedpot,373,16449 -splregenerateextendedpot,373,16449 -splregenextendepot,373,16449 -splregenerationexpot,373,16449 -splregenerateexpot,373,16449 -splregenexpot,373,16449 -sprepot,373,16449 -splashswiftnessextendedpotion,373,16450 -splashswiftextendedpotion,373,16450 -splashspeedextendedpotion,373,16450 -splashswiftnessexpotion,373,16450 -splashswiftexpotion,373,16450 -splashspeedexpotion,373,16450 -splashswiftnessextendedpot,373,16450 -splashswiftextendedpot,373,16450 -splashspeedextendedpot,373,16450 -splashswiftnessexpot,373,16450 -splashswiftexpot,373,16450 -splashspeedexpot,373,16450 -splswiftnessextendedpotion,373,16450 -splswiftextendedpotion,373,16450 -splspeedextendedpotion,373,16450 -splswiftnessexpotion,373,16450 -splswiftexpotion,373,16450 -splspeedexpotion,373,16450 -splswiftnessextendedpot,373,16450 -splswiftextendedpot,373,16450 -splspeedextendedpot,373,16450 -splswiftnessexpot,373,16450 -splswiftexpot,373,16450 -splspeedexpot,373,16450 -spswepot,373,16450 -splashfireresistanceextendedpotion,373,16451 -splashfireresistextendedpotion,373,16451 -splashfireresextendedpotion,373,16451 -splashfireresistanceexpotion,373,16451 -splashfireresistexpotion,373,16451 -splashfireresexpotion,373,16451 -splashfireresistanceextendedpot,373,16451 -splashfireresistextendedpot,373,16451 -splashfireresextendedpot,373,16451 -splashfireresistanceexpot,373,16451 -splashfireresistexpot,373,16451 -splashfireresexpot,373,16451 -splfireresistanceextendedpotion,373,16451 -splfireresistextendedpotion,373,16451 -splfireresextendedpotion,373,16451 -splfireresistanceexpotion,373,16451 -splfireresistexpotion,373,16451 -splfireresexpotion,373,16451 -splfireresistanceextendedpot,373,16451 -splfireresistextendedpot,373,16451 -splfireresextendedpot,373,16451 -splfireresistanceexpot,373,16451 -splfireresistexpot,373,16451 -splfireresexpot,373,16451 -spfepot,373,16451 -splashpoisonextendedpotion,373,16452 -splashacidextendedpotion,373,16452 -splashpoisonexpotion,373,16452 -splashacidexpotion,373,16452 -splashpoisonextendedpot,373,16452 -splashacidextendedpot,373,16452 -splashpoisonexpot,373,16452 -splashacidexpot,373,16452 -splpoisonextendedpotion,373,16452 -splacidextendedpotion,373,16452 -splpoisonexpotion,373,16452 -splacidexpotion,373,16452 -splpoisonextendedpot,373,16452 -splacidextendedpot,373,16452 -splpoisonexpot,373,16452 -splacidexpot,373,16452 -sppepot,373,16452 -splashnightvisionextendedpotion,373,16454 -splashnvisionextendedpotion,373,16454 -splashnightvextendedpotion,373,16454 -splashdarkvisionextendedpotion,373,16454 -splashdvisionextendedpotion,373,16454 -splashdarkvextendedpotion,373,16454 -splashnightvisionextendedpot,373,16454 -splashnvisionextendedpot,373,16454 -splashnightvextendedpot,373,16454 -splashdarkvisionextendedpot,373,16454 -splashdvisionextendedpot,373,16454 -splashdarkvextendedpot,373,16454 -splashnightvisionexpotion,373,16454 -splashnvisionexpotion,373,16454 -splashnightvexpotion,373,16454 -splashdarkvisionexpotion,373,16454 -splashdvisionexpotion,373,16454 -splashdarkvexpotion,373,16454 -splashnightvisionexpot,373,16454 -splashnvisionexpot,373,16454 -splashnightvexpot,373,16454 -splashdarkvisionexpot,373,16454 -splashdvisionexpot,373,16454 -splashdarkvexpot,373,16454 -splnightvisionextendedpotion,373,16454 -splnvisionextendedpotion,373,16454 -splnightvextendedpotion,373,16454 -spldarkvisionextendedpotion,373,16454 -spldvisionextendedpotion,373,16454 -spldarkvextendedpotion,373,16454 -splnightvisionextendedpot,373,16454 -splnvisionextendedpot,373,16454 -splnightvextendedpot,373,16454 -spldarkvisionextendedpot,373,16454 -spldvisionextendedpot,373,16454 -spldarkvextendedpot,373,16454 -splnightvisionexpotion,373,16454 -splnvisionexpotion,373,16454 -splnightvexpotion,373,16454 -spldarkvisionexpotion,373,16454 -spldvisionexpotion,373,16454 -spldarkvexpotion,373,16454 -splnightvisionexpot,373,16454 -splnvisionexpot,373,16454 -splnightvexpot,373,16454 -spldarkvisionexpot,373,16454 -spldvisionexpot,373,16454 -spldarkvexpot,373,16454 -spnepot,373,16454 -splashweaknessextendedpotion,373,16456 -splashweakextendedpotion,373,16456 -splashweaknessexpotion,373,16456 -splashweakexpotion,373,16456 -splashweaknessextendedpot,373,16456 -splashweakextendedpot,373,16456 -splashweaknessexpot,373,16456 -splashweakexpot,373,16456 -splweaknessextendedpotion,373,16456 -sphweakextendedpotion,373,16456 -splweaknessexpotion,373,16456 -splweakexpotion,373,16456 -splweaknessextendedpot,373,16456 -splweakextendedpot,373,16456 -splweaknessexpot,373,16456 -splweakexpot,373,16456 -spwepot,373,16456 -splashstrengthextendedpotion,373,16457 -splashstrongextendedpotion,373,16457 -splashstrextendedpotion,373,16457 -splashstrengthexpotion,373,16457 -splashstrongexpotion,373,16457 -splashstrexpotion,373,16457 -splashstrengthextendedpot,373,16457 -splashstrongextendedpot,373,16457 -splashstrextendedpot,373,16457 -splashstrengthexpot,373,16457 -splashstrongexpot,373,16457 -splashstrexpot,373,16457 -splstrengthextendedpotion,373,16457 -splstrongextendedpotion,373,16457 -splstrextendedpotion,373,16457 -splstrengthexpotion,373,16457 -splstrongexpotion,373,16457 -splstrexpotion,373,16457 -splstrengthextendedpot,373,16457 -splstrongextendedpot,373,16457 -splstrextendedpot,373,16457 -splstrengthexpot,373,16457 -splstrongexpot,373,16457 -splstrexpot,373,16457 -spstepot,373,16457 -splashslownessextendedpotion,373,16458 -splashslowextenedpotion,373,16458 -splashslownessexpotion,373,16458 -splashslowexpotion,373,16458 -splashslownessextendedpot,373,16458 -splashslowextenedpot,373,16458 -splashslownessexpot,373,16458 -splashslowexpot,373,16458 -splslownessextendedpotion,373,16458 -splslowextenedpotion,373,16458 -splslownessexpotion,373,16458 -splslowexpotion,373,16458 -splslownessextendedpot,373,16458 -splslowextenedpot,373,16458 -splslownessexpot,373,16458 -splslowexpot,373,16458 -spslepot,373,16458 -splashleapingpotion,373,16459 -splashleappotion,373,16459 -splleapingpotion,373,16459 -splleappotion,373,16459 -leapingsplashpotion,373,16459 -leapsplashpotion,373,16459 -leapingsplpotion,373,16459 -leapsplpotion,373,16459 -splashwaterbreathingextendedpotion,373,16461 -splashwaterbreathextendedpotion,373,16461 -splashbreathingextendedpotion,373,16461 -splashbreathextendedpotion,373,16461 -splashwaterbreathingextendedpot,373,16461 -splashwaterbreathextendedpot,373,16461 -splashbreathingextendedpot,373,16461 -splashbreathextendedpot,373,16461 -splwaterbreathingextendedpotion,373,16461 -splwaterbreathextendedpotion,373,16461 -splbreathingextendedpotion,373,16461 -splbreathextendedpotion,373,16461 -splwaterbreathingextendedpot,373,16461 -splwaterbreathextendedpot,373,16461 -splbreathingextendedpot,373,16461 -splbreathextendedpot,373,16461 -splashwaterbreathingexpotion,373,16461 -splashwaterbreathexpotion,373,16461 -splashbreathingexpotion,373,16461 -splashbreathexpotion,373,16461 -splashwaterbreathingexpot,373,16461 -splashwaterbreathexpot,373,16461 -splashbreathingexpot,373,16461 -splashbreathexpot,373,16461 -splwaterbreathingexpotion,373,16461 -splwaterbreathexpotion,373,16461 -splbreathingexpotion,373,16461 -splbreathexpotion,373,16461 -splwaterbreathingexpot,373,16461 -splwaterbreathexpot,373,16461 -splbreathingexpot,373,16461 -splbreathexpot,373,16461 -spwbepot,373,16461 -splashinvisibilityextendedpotion,373,16462 -splashinvisibleextendedpotion,373,16462 -splashinvextendedpotion,373,16462 -splashinvisibilityextendedpot,373,16462 -splashinvisibleextendedpot,373,16462 -splashinvextendedpot,373,16462 -splashinvisibilityexpotion,373,16462 -splashinvisibleexpotion,373,16462 -splashinvexpotion,373,16462 -splashinvisibilityexpot,373,16462 -splashinvisibleexpot,373,16462 -splashinvexpot,373,16462 -splinvisibilityextendedpotion,373,16462 -splinvisibleextendedpotion,373,16462 -splinvextendedpotion,373,16462 -splinvisibilityextendedpot,373,16462 -splinvisibleextendedpot,373,16462 -splinvextendedpot,373,16462 -splinvisibilityexpotion,373,16462 -splinvisibleexpotion,373,16462 -splinvexpotion,373,16462 -splinvisibilityexpot,373,16462 -splinvisibleexpot,373,16462 -splinvexpot,373,16462 -spiepot,373,16462 -splashregenerationdualbitpotion,373,16481 -splashregeneratedualbitpotion,373,16481 -splashregendualbitpotion,373,16481 -splashregenerationdualbitpot,373,16481 -splashregeneratedualbitpot,373,16481 -splashregendualbitpot,373,16481 -splregenerationdualbitpotion,373,16481 -splregeneratedualbitpotion,373,16481 -splregendualbitpotion,373,16481 -splregenerationdualbitpot,373,16481 -splregeneratedualbitpot,373,16481 -splregendualbitpot,373,16481 -splashregenerationdbpotion,373,16481 -splashregeneratedbpotion,373,16481 -splashregendbpotion,373,16481 -splashregenerationdbpot,373,16481 -splashregeneratedbpot,373,16481 -splashregendbpot,373,16481 -splregenerationdbpotion,373,16481 -splregeneratedbpotion,373,16481 -splregendbpotion,373,16481 -splregenerationdbpot,373,16481 -splregeneratedbpot,373,16481 -splregendbpot,373,16481 -sprdbpot,373,16481 -splashswiftnessdualbitpotion,373,16482 -splashswiftdualbitpotion,373,16482 -splashspeeddualbitpotion,373,16482 -splashswiftnessdualbitpot,373,16482 -splashswiftdualbitpot,373,16482 -splashspeeddualbitpot,373,16482 -splswiftnessdualbitpotion,373,16482 -splswiftdualbitpotion,373,16482 -splspeeddualbitpotion,373,16482 -splswiftnessdualbitpot,373,16482 -splswiftdualbitpot,373,16482 -splspeeddualbitpot,373,16482 -splashswiftnessdbpotion,373,16482 -splashswiftdbpotion,373,16482 -splashspeeddbpotion,373,16482 -splashswiftnessdbpot,373,16482 -splashswiftdbpot,373,16482 -splashspeeddbpot,373,16482 -splswiftnessdbpotion,373,16482 -splswiftdbpotion,373,16482 -splspeeddbpotion,373,16482 -splswiftnessdbpot,373,16482 -splswiftdbpot,373,16482 -splspeeddbpot,373,16482 -spswdbpot,373,16482 -splashpoisondualbitpotion,373,16484 -splashaciddualbitpotion,373,16484 -splashpoisondualbitpot,373,16484 -splashaciddualbitpot,373,16484 -splpoisondualbitpotion,373,16484 -splaciddualbitpotion,373,16484 -splpoisondualbitpot,373,16484 -splaciddualbitpot,373,16484 -splashpoisondbpotion,373,16484 -splashaciddbpotion,373,16484 -splashpoisondbpot,373,16484 -splashaciddbpot,373,16484 -splpoisondbpotion,373,16484 -splaciddbpotion,373,16484 -splpoisondbpot,373,16484 -splaciddbpot,373,16484 -sppdbpot,373,16484 -splashstrengthdualbitpotion,373,16489 -splashstrongdualbitpotion,373,16489 -splashstrdualbitpotion,373,16489 -splashstrengthdualbitpot,373,16489 -splashstrongdualbitpot,373,16489 -splashstrdualbitpot,373,16489 -splstrengthdualbitpotion,373,16489 -splstrongdualbitpotion,373,16489 -splstrdualbitpotion,373,16489 -splstrengthdualbitpot,373,16489 -splstrongdualbitpot,373,16489 -splstrdualbitpot,373,16489 -splashstrengthdbpotion,373,16489 -splashstrongdbpotion,373,16489 -splashstrdbpotion,373,16489 -splashstrengthdbpot,373,16489 -splashstrongdbpot,373,16489 -splashstrdbpot,373,16489 -splstrengthdbpotion,373,16489 -splstrongdbpotion,373,16489 -splstrdbpotion,373,16489 -splstrengthdbpot,373,16489 -splstrongdbpot,373,16489 -splstrdbpot,373,16489 -spstdbpot,373,16489 -glassbottle,374,0 -bottle,374,0 -gbottle,374,0 -gvase,374,0 -vase,374,0 -glassvase,374,0 -emptyglassbottle,374,0 -emptybottle,374,0 -emptygbottle,374,0 -emptygvase,374,0 -emptyvase,374,0 -emptyglassvase,374,0 -eglassbottle,374,0 -ebottle,374,0 -egbottle,374,0 -egvase,374,0 -evase,374,0 -eglassvase,374,0 -spidereye,375,0 -eyeofspider,375,0 -seye,375,0 -fermentedspidereye,376,0 -craftedspidereye,376,0 -fspidereye,376,0 -cspidereye,376,0 -fermentedeyeofspider,376,0 -craftedeyeofspider,376,0 -feyeofspider,376,0 -ceyeofspider,376,0 -fermentedseye,376,0 -craftedseye,376,0 -fseye,376,0 -cseye,376,0 -blazepowder,377,0 -blazedust,377,0 -goldpowder,377,0 -golddust,377,0 -gdust,377,0 -gpowder,377,0 -bpowder,377,0 -bdust,377,0 -magmacream,378,0 -goldcream,378,0 -blazecream,378,0 -mcream,378,0 -gcream,378,0 -bcream,378,0 -combinedcream,378,0 -ccream,378,0 -bstand,379,0 -pstand,379,0 -brewingstand,379,0 -potionstand,379,0 -cauld,380,0 -cauldron,380,0 -steelcauldron,380,0 -ironcauldron,380,0 -icauldron,380,0 -scauldron,380,0 -potioncauldron,380,0 -pcauldron,380,0 -eyeofender,381,0 -endereye,381,0 -endeye,381,0 -evilendereye,381,0 -evileyeofender,381,0 -evilenderpearl,381,0 -eeye,381,0 -eofender,381,0 -glisteringmelon,382,0 -speckledmelon,382,0 -goldmelon,382,0 -sparklymelon,382,0 -shiningmelon,382,0 -gmelon,382,0 -smelon,382,0 -creeperegg,383,50 -eggcreeper,383,50 -skeletonegg,383,51 -eggskeleton,383,51 -spideregg,383,52 -eggspider,383,52 -giantegg,383,53 -egggiant,383,53 -zombieegg,383,54 -eggzombie,383,54 -slimeegg,383,55 -eggslime,383,55 -ghastegg,383,56 -eggghast,383,56 -zombiepigmanegg,383,57 -zpigmanegg,383,57 -pigmanegg,383,57 -zombiepmanegg,383,57 -zpmanegg,383,57 -zombiepigmegg,383,57 -zpigmegg,383,57 -zombiepigegg,383,57 -zpigegg,383,57 -zombiepmegg,383,57 -zombiepegg,383,57 -eggzombiepigman,383,57 -eggzpigman,383,57 -eggpigman,383,57 -eggzombiepman,383,57 -eggzpman,383,57 -eggzombiepigm,383,57 -eggzpigm,383,57 -eggzombiepig,383,57 -eggzpig,383,57 -eggzombiepm,383,57 -eggzombiep,383,57 -endermanegg,383,58 -eggenderman,383,58 -eggcavespider,383,59 -cavespideregg,383,59 -silverfishegg,383,60 -eggsilverfish,383,60 -blazeegg,383,61 -eggblaze,383,61 -lavaslimeegg,383,62 -lavacubeegg,383,62 -magmacubeegg,383,62 -magmaslimeegg,383,62 -egglavaslime,383,62 -egglavacube,383,62 -eggmagmacube,383,62 -eggmagmaslime,383,62 -bategg,383,65 -eggbat,383,65 -witchegg,383,66 -eggwitch,383,66 -endermiteegg,383,67 -endermitespawnegg,383,67 -eggendermite,383,67 -guardianegg,383,68 -guardianspawnegg,383,68 -eggguardian,383,68 -spawneggshulker,383,69 -spawnshulker,383,69 -shulkerspawnegg,383,69 -shulkeregg,383,69 -shulkegg,383,69 -pigegg,383,90 -eggpig,383,90 -sheepegg,383,91 -eggsheep,383,91 -cowegg,383,92 -eggcow,383,92 -chickenegg,383,93 -eggchicken,383,93 -squidegg,383,94 -eggsquid,383,94 -wolfegg,383,95 -eggwolf,383,95 -mooshroomegg,383,96 -mushroomcowegg,383,96 -eggmooshroom,383,96 -eggmushroomcow,383,96 -snowgolemegg,383,97 -sgolemegg,383,97 -eggsnowgolem,383,97 -eggsgolem,383,97 -ocelotegg,383,98 -eggocelot,383,98 -irongolemegg,383,99 -igolemegg,383,99 -eggirongolem,383,99 -eggigolem,383,99 -egghorse,383,100 -horseegg,383,100 -rabbitegg,383,101 -rabbitspawnegg,383,101 -spawneggpolarbear,383,102 -spawneggpolar,383,102 -spawneggbear,383,102 -spawnpolarbear,383,102 -spawnpolar,383,102 -spawnbear,383,102 -polarbearspawnegg,383,102 -polarspawnegg,383,102 -bearspawnegg,383,102 -polarbearegg,383,102 -polaregg,383,102 -bearegg,383,102 -villageregg,383,120 -eggvillager,383,120 -bottleofenchanting,384,0 -enchantingbottle,384,0 -expbottle,384,0 -xpbottle,384,0 -bottleexp,384,0 -bottlexp,384,0 -enchantbottle,384,0 -bottleenchanting,384,0 -bottleenchant,384,0 -bottleoenchanting,384,0 -firecharge,385,0 -fireball,385,0 -grenade,385,0 -bookandquill,386,0 -booknquill,386,0 -bookandfeather,386,0 -booknfeather,386,0 -writeablebook,386,0 -writtenbook,387,0 -readablebook,387,0 -sealedbook,387,0 -diary,387,0 -ownedbook,387,0 -emerald,388,0 -itemframe,389,0 -pictureframe,389,0 -iframe,389,0 -pframe,389,0 -flowerpot,390,0 -pot,390,0 -carrot,391,0 -potato,392,0 -rawpotato,392,0 -bakedpotato,393,0 -roastedpotato,393,0 -cookedpotato,393,0 -bakepotato,393,0 -roastpotato,393,0 -cookpotato,393,0 -bpotato,393,0 -rpotato,393,0 -cpotato,393,0 -poisonouspotato,394,0 -poisonpotato,394,0 -ppotato,394,0 -emptymap,395,0 -map,395,0 -goldencarrot,396,0 -goldcarrot,396,0 -gcarrot,396,0 -head,397,0 -skull,397,0 -skhead,397,0 -skeletonhead,397,0 -headskeleton,397,0 -skeletonskull,397,0 -skullskeleton,397,0 -witherhead,397,1 -witherskeletonhead,397,1 -wskeletionhead,397,1 -headwither,397,1 -headwitherskeleton,397,1 -headwskeletion,397,1 -witherskull,397,1 -witherskeletonskull,397,1 -wskeletionskull,397,1 -skullwither,397,1 -skullwitherskeleton,397,1 -skullwskeletion,397,1 -zohead,397,2 -zombiehead,397,2 -headzombie,397,2 -zombieskull,397,2 -skullzombie,397,2 -playerhead,397,3 -humanhead,397,3 -stevehead,397,3 -headplayer,397,3 -headhuman,397,3 -headsteve,397,3 -playerskull,397,3 -humanskull,397,3 -steveskull,397,3 -skullplayer,397,3 -skullhuman,397,3 -skullsteve,397,3 -crhead,397,4 -creeperhead,397,4 -headcreeper,397,4 -creeperskull,397,4 -skullcreeper,397,4 -dragonhead,397,5 -dragonmask,397,5 -dragonheadmask,397,5 -dragmask,397,5 -dragonskull,397,5 -dragskull,397,5 -carrotonastick,398,0 -carrotonstick,398,0 -netherstar,399,0 -hellstar,399,0 -nstar,399,0 -hstar,399,0 -star,399,0 -pumpkinpie,400,0 -pumpkincake,400,0 -ppie,400,0 -pcake,400,0 -pie,400,0 -fireworkrocket,401,0 -fireworkmissle,401,0 -firework,401,0 -fworkrocket,401,0 -fworkmissle,401,0 -fwork,401,0 -fwrocket,401,0 -fwmissle,401,0 -fireworkstar,402,0 -fworkstar,402,0 -fwstar,402,0 -fireworkball,402,0 -fworkball,402,0 -fwball,402,0 -fireworkpowder,402,0 -fworkpowder,402,0 -fwpowder,402,0 -fireworkcharge,402,0 -fworkcharge,402,0 -fwcharge,402,0 -enchantedbook,403,0 -enchantmentbook,403,0 -enchantingbook,403,0 -enchantbook,403,0 -magicalbook,403,0 -magicbook,403,0 -ebook,403,0 -mbook,403,0 -redstonecomparator,404,0 -redstonecomparer,404,0 -redstonecompare,404,0 -rstonecomparator,404,0 -rstonecomparer,404,0 -rstonecompare,404,0 -redscomparator,404,0 -redscomparer,404,0 -redscompare,404,0 -rscomparator,404,0 -rscomparer,404,0 -rscompare,404,0 -comparator,404,0 -comparer,404,0 -compare,404,0 -netherbrick,405,0 -nbrick,405,0 -hellbrick,405,0 -deathbrick,405,0 -dbrick,405,0 -hbrick,405,0 -netherquartz,406,0 -deathquartz,406,0 -hellquartz,406,0 -nquartz,406,0 -dquartz,406,0 -hquartz,406,0 -quartz,406,0 -tntminecart,407,0 -dynamiteminecart,407,0 -dynamitemcart,407,0 -dynamitecart,407,0 -bombminecart,407,0 -bombmcart,407,0 -bombcart,407,0 -tntmcart,407,0 -tntcart,407,0 -dminecart,407,0 -dmcart,407,0 -dcart,407,0 -bminecart,407,0 -bmcart,407,0 -bcart,407,0 -tminecart,407,0 -tmcart,407,0 -tcart,407,0 -hopperminecart,408,0 -hoppermcart,408,0 -hoppercart,408,0 -hopminecart,408,0 -hopmcart,408,0 -hopcart,408,0 -hminecart,408,0 -hmcart,408,0 -hcart,408,0 -prismarineshard,409,0 -priseshard,409,0 -prisemarinecrystals,410,0 -prisecrystals,410,0 -rabbit,411,0 -rabbitmeat,411,0 -cookedrabbit,412,0 -rabbitstew,413,0 -hasenpfeffer,413,0 -rabbitfoot,414,0 -rabbithide,415,0 -armorstand,416,0 -ironhorsearmor,417,0 -ironharmor,417,0 -ironarmor,417,0 -ihorsearmor,417,0 -iharmor,417,0 -iarmor,417,0 -steelhorsearmor,417,0 -steelharmor,417,0 -steelarmor,417,0 -shorsearmor,417,0 -sharmor,417,0 -sarmor,417,0 -goldenhorsearmor,418,0 -goldenharmor,418,0 -goldenarmor,418,0 -goldhorsearmor,418,0 -goldharmor,418,0 -goldarmor,418,0 -ghorsearmor,418,0 -gharmor,418,0 -garmor,418,0 -diamondhorsearmor,419,0 -diamondharmor,419,0 -diamondarmor,419,0 -dhorsearmor,419,0 -dharmor,419,0 -darmor,419,0 -crystalhorsearmor,419,0 -crystalharmor,419,0 -crystalarmor,419,0 -chorsearmor,419,0 -charmor,419,0 -carmor,419,0 -lead,420,0 -leash,420,0 -rope,420,0 -nametag,421,0 -tag,421,0 -commandblockminecart,422,0 -cmdblockminecart,422,0 -cblockminecart,422,0 -commandminecart,422,0 -cmdminecart,422,0 -cbminecart,422,0 -commandblockcart,422,0 -cmdblockcart,422,0 -cblockcart,422,0 -commandcart,422,0 -cmdcart,422,0 -cbcart,422,0 -mutton,423,0 -sheepmeat,423,0 -cookedmutton,424,0 -cookedsheep,424,0 -banner,425,0 -blackbanner,425,0 -standingbanner,425,0 -wallbanner,425,0 -redbanner,425,1 -greenbanner,425,2 -brownbanner,425,3 -bluebanner,425,4 -purplebanner,425,5 -cyanbanner,425,6 -lgreybanner,425,7 -lightgreybanner,425,7 -greybanner,425,8 -pinkbanner,425,9 -limebanner,425,10 -yellowbanner,425,11 -lbluebanner,425,12 -lightbluebanner,425,12 -magentabanner,425,13 -orangebanner,425,14 -whitebanner,425,15 -sprucedoor,193,0 -sprucedooritem,427,0 -birchdoor,428,0 -birchdooritem,428,0 -jungledoor,195,0 -jungledooritem,429,0 -acaciadoor,196,0 -acaciadooritem,430,0 -darkoakdoor,197,0 -darkoakdooritem,431,0 -totem,449,0 -shulkershell,450,0 -13disc,2256,0 -goldmusicrecord,2256,0 -goldmusicdisk,2256,0 -goldmusicdisc,2256,0 -goldmusiccd,2256,0 -13musicrecord,2256,0 -13musicdisk,2256,0 -13musicdisc,2256,0 -13musiccd,2256,0 -gomusicrecord,2256,0 -gomusicdisk,2256,0 -gomusicdisc,2256,0 -gomusiccd,2256,0 -goldmrecord,2256,0 -goldmdisk,2256,0 -goldmdisc,2256,0 -goldmcd,2256,0 -13mrecord,2256,0 -13mdisk,2256,0 -13mdisc,2256,0 -13mcd,2256,0 -gomrecord,2256,0 -gomdisk,2256,0 -gomdisc,2256,0 -gomcd,2256,0 -goldrecord,2256,0 -golddisk,2256,0 -golddisc,2256,0 -goldcd,2256,0 -13record,2256,0 -13disk,2256,0 -13cd,2256,0 -gorecord,2256,0 -godisk,2256,0 -godisc,2256,0 -gocd,2256,0 -record1,2256,0 -disk1,2256,0 -disc1,2256,0 -cd1,2256,0 -1record,2256,0 -1disk,2256,0 -1disc,2256,0 -1cd,2256,0 -catdisc,2257,0 -greenmusicrecord,2257,0 -greenmusicdisk,2257,0 -greenmusicdisc,2257,0 -greenmusiccd,2257,0 -catmusicrecord,2257,0 -catmusicdisk,2257,0 -catmusicdisc,2257,0 -catmusiccd,2257,0 -grmusicrecord,2257,0 -grmusicdisk,2257,0 -grmusicdisc,2257,0 -grmusiccd,2257,0 -greenmrecord,2257,0 -greenmdisk,2257,0 -greenmdisc,2257,0 -greenmcd,2257,0 -catmrecord,2257,0 -catmdisk,2257,0 -catmdisc,2257,0 -catmcd,2257,0 -grmrecord,2257,0 -grmdisk,2257,0 -grmdisc,2257,0 -grmcd,2257,0 -greenrecord,2257,0 -greendisk,2257,0 -greendisc,2257,0 -greencd,2257,0 -catrecord,2257,0 -catdisk,2257,0 -catcd,2257,0 -grrecord,2257,0 -grdisk,2257,0 -grdisc,2257,0 -grcd,2257,0 -record2,2257,0 -disk2,2257,0 -disc2,2257,0 -cd2,2257,0 -2record,2257,0 -2disk,2257,0 -2disc,2257,0 -2cd,2257,0 -blocksdisc,2258,0 -orangemusicrecord,2258,0 -orangemusicdisk,2258,0 -orangemusicdisc,2258,0 -orangemusiccd,2258,0 -blocksmusicrecord,2258,0 -blocksmusicdisk,2258,0 -blocksmusicdisc,2258,0 -blocksmusiccd,2258,0 -ormusicrecord,2258,0 -ormusicdisk,2258,0 -ormusicdisc,2258,0 -ormusiccd,2258,0 -orangemrecord,2258,0 -orangemdisk,2258,0 -orangemdisc,2258,0 -orangemcd,2258,0 -blocksmrecord,2258,0 -blocksmdisk,2258,0 -blocksmdisc,2258,0 -blocksmcd,2258,0 -ormrecord,2258,0 -ormdisk,2258,0 -ormdisc,2258,0 -ormcd,2258,0 -orangerecord,2258,0 -orangedisk,2258,0 -orangedisc,2258,0 -orangecd,2258,0 -blocksrecord,2258,0 -blocksdisk,2258,0 -blockscd,2258,0 -orrecord,2258,0 -ordisk,2258,0 -ordisc,2258,0 -orcd,2258,0 -record3,2258,0 -disk3,2258,0 -disc3,2258,0 -cd3,2258,0 -3record,2258,0 -3disk,2258,0 -3disc,2258,0 -3cd,2258,0 -chirpdisc,2259,0 -redmusicrecord,2259,0 -redmusicdisk,2259,0 -redmusicdisc,2259,0 -redmusiccd,2259,0 -chirpmusicrecord,2259,0 -chirpmusicdisk,2259,0 -chirpmusicdisc,2259,0 -chirpmusiccd,2259,0 -remusicrecord,2259,0 -remusicdisk,2259,0 -remusicdisc,2259,0 -remusiccd,2259,0 -redmrecord,2259,0 -redmdisk,2259,0 -redmdisc,2259,0 -redmcd,2259,0 -chirpmrecord,2259,0 -chirpmdisk,2259,0 -chirpmdisc,2259,0 -chirpmcd,2259,0 -remrecord,2259,0 -remdisk,2259,0 -remdisc,2259,0 -remcd,2259,0 -redrecord,2259,0 -reddisk,2259,0 -reddisc,2259,0 -redcd,2259,0 -chirprecord,2259,0 -chirpdisk,2259,0 -chirpcd,2259,0 -rerecord,2259,0 -redisk,2259,0 -redisc,2259,0 -recd,2259,0 -record4,2259,0 -disk4,2259,0 -disc4,2259,0 -cd4,2259,0 -4record,2259,0 -4disk,2259,0 -4disc,2259,0 -4cd,2259,0 -fardisc,2260,0 -lightgreenmusicrecord,2260,0 -lightgreenmusicdisk,2260,0 -lightgreenmusicdisc,2260,0 -lightgreenmusiccd,2260,0 -lgreenmusicrecord,2260,0 -lgreenmusicdisk,2260,0 -lgreenmusicdisc,2260,0 -lgreenmusiccd,2260,0 -lightgrmusicrecord,2260,0 -lightgrmusicdisk,2260,0 -lightgrmusicdisc,2260,0 -lightgrmusiccd,2260,0 -farmusicrecord,2260,0 -farmusicdisk,2260,0 -farmusicdisc,2260,0 -farmusiccd,2260,0 -lgrmusicrecord,2260,0 -lgrmusicdisk,2260,0 -lgrmusicdisc,2260,0 -lgrmusiccd,2260,0 -lightgreenmrecord,2260,0 -lightgreenmdisk,2260,0 -lightgreenmdisc,2260,0 -lightgreenmcd,2260,0 -lgreenmrecord,2260,0 -lgreenmdisk,2260,0 -lgreenmdisc,2260,0 -lgreenmcd,2260,0 -lightgrmrecord,2260,0 -lightgrmdisk,2260,0 -lightgrmdisc,2260,0 -lightgrmcd,2260,0 -farmrecord,2260,0 -farmdisk,2260,0 -farmdisc,2260,0 -farmcd,2260,0 -lgrmrecord,2260,0 -lgrmdisk,2260,0 -lgrmdisc,2260,0 -lgrmcd,2260,0 -lightgreenrecord,2260,0 -lightgreendisk,2260,0 -lightgreendisc,2260,0 -lightgreencd,2260,0 -lgreenrecord,2260,0 -lgreendisk,2260,0 -lgreendisc,2260,0 -lgreencd,2260,0 -lightgrrecord,2260,0 -lightgrdisk,2260,0 -lightgrdisc,2260,0 -lightgrcd,2260,0 -farrecord,2260,0 -fardisk,2260,0 -farcd,2260,0 -lgrrecord,2260,0 -lgrdisk,2260,0 -lgrdisc,2260,0 -lgrcd,2260,0 -record5,2260,0 -disk5,2260,0 -disc5,2260,0 -cd5,2260,0 -5record,2260,0 -5disk,2260,0 -5disc,2260,0 -5cd,2260,0 -malldisc,2261,0 -purplemusicrecord,2261,0 -purplemusicdisk,2261,0 -purplemusicdisc,2261,0 -purplemusiccd,2261,0 -mallmusicrecord,2261,0 -mallmusicdisk,2261,0 -mallmusicdisc,2261,0 -mallmusiccd,2261,0 -pumusicrecord,2261,0 -pumusicdisk,2261,0 -pumusicdisc,2261,0 -pumusiccd,2261,0 -purplemrecord,2261,0 -purplemdisk,2261,0 -purplemdisc,2261,0 -purplemcd,2261,0 -mallmrecord,2261,0 -mallmdisk,2261,0 -mallmdisc,2261,0 -mallmcd,2261,0 -pumrecord,2261,0 -pumdisk,2261,0 -pumdisc,2261,0 -pumcd,2261,0 -purplerecord,2261,0 -purpledisk,2261,0 -purpledisc,2261,0 -purplecd,2261,0 -mallrecord,2261,0 -malldisk,2261,0 -mallcd,2261,0 -purecord,2261,0 -pudisk,2261,0 -pudisc,2261,0 -pucd,2261,0 -record6,2261,0 -disk6,2261,0 -disc6,2261,0 -cd6,2261,0 -6record,2261,0 -6disk,2261,0 -6disc,2261,0 -6cd,2261,0 -mellohidisc,2262,0 -pinkmusicrecord,2262,0 -pinkmusicdisk,2262,0 -pinkmusicdisc,2262,0 -pinkmusiccd,2262,0 -mellohimusicrecord,2262,0 -mellohimusicdisk,2262,0 -mellohimusicdisc,2262,0 -mellohimusiccd,2262,0 -pimusicrecord,2262,0 -pimusicdisk,2262,0 -pimusicdisc,2262,0 -pimusiccd,2262,0 -pinkmrecord,2262,0 -pinkmdisk,2262,0 -pinkmdisc,2262,0 -pinkmcd,2262,0 -mellohimrecord,2262,0 -mellohimdisk,2262,0 -mellohimdisc,2262,0 -mellohimcd,2262,0 -pimrecord,2262,0 -pimdisk,2262,0 -pimdisc,2262,0 -pimcd,2262,0 -pinkrecord,2262,0 -pinkdisk,2262,0 -pinkdisc,2262,0 -pinkcd,2262,0 -mellohirecord,2262,0 -mellohidisk,2262,0 -mellohicd,2262,0 -pirecord,2262,0 -pidisk,2262,0 -pidisc,2262,0 -picd,2262,0 -record7,2262,0 -disk7,2262,0 -disc7,2262,0 -cd7,2262,0 -7record,2262,0 -7disk,2262,0 -7disc,2262,0 -7cd,2262,0 -staldisc,2263,0 -blackmusicrecord,2263,0 -blackmusicdisk,2263,0 -blackmusicdisc,2263,0 -blackmusiccd,2263,0 -stalmusicrecord,2263,0 -stalmusicdisk,2263,0 -stalmusicdisc,2263,0 -stalmusiccd,2263,0 -blmusicrecord,2263,0 -blmusicdisk,2263,0 -blmusicdisc,2263,0 -blmusiccd,2263,0 -blackmrecord,2263,0 -blackmdisk,2263,0 -blackmdisc,2263,0 -blackmcd,2263,0 -stalmrecord,2263,0 -stalmdisk,2263,0 -stalmdisc,2263,0 -stalmcd,2263,0 -blmrecord,2263,0 -blmdisk,2263,0 -blmdisc,2263,0 -blmcd,2263,0 -blackrecord,2263,0 -blackdisk,2263,0 -blackdisc,2263,0 -blackcd,2263,0 -stalrecord,2263,0 -staldisk,2263,0 -stalcd,2263,0 -blrecord,2263,0 -bldisk,2263,0 -bldisc,2263,0 -blcd,2263,0 -record8,2263,0 -disk8,2263,0 -disc8,2263,0 -cd8,2263,0 -8record,2263,0 -8disk,2263,0 -8disc,2263,0 -8cd,2263,0 -straddisc,2264,0 -whitemusicrecord,2264,0 -whitemusicdisk,2264,0 -whitemusicdisc,2264,0 -whitemusiccd,2264,0 -stradmusicrecord,2264,0 -stradmusicdisk,2264,0 -stradmusicdisc,2264,0 -stradmusiccd,2264,0 -whmusicrecord,2264,0 -whmusicdisk,2264,0 -whmusicdisc,2264,0 -whmusiccd,2264,0 -whitemrecord,2264,0 -whitemdisk,2264,0 -whitemdisc,2264,0 -whitemcd,2264,0 -stradmrecord,2264,0 -stradmdisk,2264,0 -stradmdisc,2264,0 -stradmcd,2264,0 -whmrecord,2264,0 -whmdisk,2264,0 -whmdisc,2264,0 -whmcd,2264,0 -whiterecord,2264,0 -whitedisk,2264,0 -whitedisc,2264,0 -whitecd,2264,0 -stradrecord,2264,0 -straddisk,2264,0 -stradcd,2264,0 -whrecord,2264,0 -whdisk,2264,0 -whdisc,2264,0 -whcd,2264,0 -record9,2264,0 -disk9,2264,0 -disc9,2264,0 -cd9,2264,0 -9record,2264,0 -9disk,2264,0 -9disc,2264,0 -9cd,2264,0 -warddisc,2265,0 -darkgreenmusicrecord,2265,0 -darkgreenmusicdisk,2265,0 -darkgreenmusicdisc,2265,0 -darkgreenmusiccd,2265,0 -dgreenmusicrecord,2265,0 -dgreenmusicdisk,2265,0 -dgreenmusicdisc,2265,0 -dgreenmusiccd,2265,0 -darkgrmusicrecord,2265,0 -darkgrmusicdisk,2265,0 -darkgrmusicdisc,2265,0 -darkgrmusiccd,2265,0 -wardmusicrecord,2265,0 -wardmusicdisk,2265,0 -wardmusicdisc,2265,0 -wardmusiccd,2265,0 -dgrmusicrecord,2265,0 -dgrmusicdisk,2265,0 -dgrmusicdisc,2265,0 -dgrmusiccd,2265,0 -darkgreenmrecord,2265,0 -darkgreenmdisk,2265,0 -darkgreenmdisc,2265,0 -darkgreenmcd,2265,0 -dgreenmrecord,2265,0 -dgreenmdisk,2265,0 -dgreenmdisc,2265,0 -dgreenmcd,2265,0 -darkgrmrecord,2265,0 -darkgrmdisk,2265,0 -darkgrmdisc,2265,0 -darkgrmcd,2265,0 -wardmrecord,2265,0 -wardmdisk,2265,0 -wardmdisc,2265,0 -wardmcd,2265,0 -dgrmrecord,2265,0 -dgrmdisk,2265,0 -dgrmdisc,2265,0 -dgrmcd,2265,0 -darkgreenrecord,2265,0 -darkgreendisk,2265,0 -darkgreendisc,2265,0 -darkgreencd,2265,0 -dgreenrecord,2265,0 -dgreendisk,2265,0 -dgreendisc,2265,0 -dgreencd,2265,0 -darkgrrecord,2265,0 -darkgrdisk,2265,0 -darkgrdisc,2265,0 -darkgrcd,2265,0 -wardrecord,2265,0 -warddisk,2265,0 -wardcd,2265,0 -dgrrecord,2265,0 -dgrdisk,2265,0 -dgrdisc,2265,0 -dgrcd,2265,0 -record10,2265,0 -disk10,2265,0 -disc10,2265,0 -cd10,2265,0 -10record,2265,0 -10disk,2265,0 -10disc,2265,0 -10cd,2265,0 -11disc,2266,0 -crackedmusicrecord,2266,0 -crackedmusicdisk,2266,0 -crackedmusicdisc,2266,0 -crackedmusiccd,2266,0 -crackmusicrecord,2266,0 -crackmusicdisk,2266,0 -crackmusicdisc,2266,0 -crackmusiccd,2266,0 -11musicrecord,2266,0 -11musicdisk,2266,0 -11musicdisc,2266,0 -11musiccd,2266,0 -cmusicrecord,2266,0 -cmusicdisk,2266,0 -cmusicdisc,2266,0 -cmusiccd,2266,0 -crackedmrecord,2266,0 -crackedmdisk,2266,0 -crackedmdisc,2266,0 -crackedmcd,2266,0 -crackmrecord,2266,0 -crackmdisk,2266,0 -crackmdisc,2266,0 -crackmcd,2266,0 -11mrecord,2266,0 -11mdisk,2266,0 -11mdisc,2266,0 -11mcd,2266,0 -cmrecord,2266,0 -cmdisk,2266,0 -cmdisc,2266,0 -cmcd,2266,0 -crackedrecord,2266,0 -crackeddisk,2266,0 -crackeddisc,2266,0 -crackedcd,2266,0 -crackrecord,2266,0 -crackdisk,2266,0 -crackdisc,2266,0 -crackcd,2266,0 -crecord,2266,0 -cdisk,2266,0 -cdisc,2266,0 -ccd,2266,0 -record11,2266,0 -disk11,2266,0 -disc11,2266,0 -cd11,2266,0 -11record,2266,0 -11disk,2266,0 -11cd,2266,0 -waitdisc,2267,0 -waitmusicrecord,2267,0 -waitmusicdisk,2267,0 -waitmusicdisc,2267,0 -waitmusiccd,2267,0 -bluemusicrecord,2267,0 -bluemusicdisk,2267,0 -bluemusicdisc,2267,0 -bluemusiccd,2267,0 -12musicrecord,2267,0 -12musicdisk,2267,0 -12musicdisc,2267,0 -12musiccd,2267,0 -cyanmusicrecord,2267,0 -cyanmusicdisk,2267,0 -cyanmusicdisc,2267,0 -cyanmusiccd,2267,0 -waitmrecord,2267,0 -waitmdisk,2267,0 -waitmdisc,2267,0 -waitmcd,2267,0 -bluemrecord,2267,0 -bluemdisk,2267,0 -bluemdisc,2267,0 -bluemcd,2267,0 -12mrecord,2267,0 -12mdisk,2267,0 -12mdisc,2267,0 -12mcd,2267,0 -cyanmrecord,2267,0 -cyanmdisk,2267,0 -cyanmdisc,2267,0 -cyanmcd,2267,0 -waitrecord,2267,0 -waitdisk,2267,0 -waitcd,2267,0 -bluerecord,2267,0 -bluedisk,2267,0 -bluedisc,2267,0 -bluecd,2267,0 -cyanrecord,2267,0 -cyandisk,2267,0 -cyandisc,2267,0 -cyancd,2267,0 -record12,2267,0 -disk12,2267,0 -disc12,2267,0 -cd12,2267,0 -12record,2267,0 -12disk,2267,0 -12disc,2267,0 -12cd,2267,0 -chorusflower,200,0 -corusflower,200,0 -chorusblock,200,0 -endflower,200,0 -enderflower,200,0 -chorusplant,199,0 -corusplant,199,0 -chorusstem,199,0 -corusstem,199,0 -endplant,199,0 -enderplant,199,0 -endgateway,209,0 -eislandportal,209,0 -endgate,209,0 -endergate,209,0 -endrod,198,0 -enderrod,198,0 -erod,198,0 -endlight,198,0 -elight,198,0 -endtorch,198,0 -etorch,198,0 -endstonebricks,206,0 -endbricks,206,0 -enderbricks,206,0 -ebricks,206,0 -ebrick,206,0 -grasspath,208,0 -gpath,208,0 -path,208,0 -pathblock,208,0 -dirtpath,208,0 -dpath,208,0 -worngrass,208,0 -grasswalkway,208,0 -dirtwalkway,208,0 -purpurblock,201,0 -purblock,201,0 -purpleblock,201,0 -purplestone,201,0 -purstone,201,0 -purpurpillar,202,0 -purpillar,202,0 -purpillarblock,202,0 -purpillarstone,202,0 -purpillar,202,0 -purplepillar,202,0 -purpurcollum,202,0 -purcollum,202,0 -purplecollum,202,0 -purpurstairs,203,0 -purpurstep,203,0 -purpursteps,203,0 -purplestairs,203,0 -purplesteps,203,0 -purplestep,203,0 -purstairs,203,0 -pursteps,203,0 -purstep,203,0 -purpurslab,205,0 -purpurhalf,205,0 -purslab,205,0 -purpleslab,205,0 -purhalf,205,0 -purplehalf,205,0 -beetroot,434,0 -broot,434,0 -beet,434,0 -beets,434,0 -beetplant,434,0 -beetcrop,434,0 -beetrootsoup,436,0 -brootsoup,436,0 -beetsoup,436,0 -beetssoup,436,0 -beetplantsoup,436,0 -beetcropsoup,436,0 -redsoup,436,0 -beetrootseed,435,0 -beetrootseeds,435,0 -brootseed,435,0 -brootseeds,435,0 -beetseed,435,0 -beetseeds,435,0 -beetsseeds,435,0 -beetplantseeds,435,0 -beetcropseeds,435,0 -chorusfruit,432,0 -chorfruit,432,0 -corusfruit,432,0 -corfruit,432,0 -endfruit,432,0 -enderfruit,432,0 -purpurfruit,432,0 -purfruit,432,0 -purplefruit,432,0 -dragonbreath,437,0 -dragonsbreath,437,0 -dbreath,437,0 -edragonbreath,437,0 -edragonsbreath,437,0 -dragonpotion,437,0 -dragonfire,437,0 -endbreath,437,0 -dragonpot,437,0 -elytra,443,0 -hangglider,443,0 -glider,443,0 -wings,443,0 -wing,443,0 -playerwings,443,0 -playerwing,443,0 -pwings,443,0 -pwing,443,0 -endcrystal,426,0 -endercrystal,426,0 -ecrystal,426,0 -dragoncrystal,426,0 -endgem,426,0 -endergem,426,0 -egem,426,0 -dragongem,426,0 -chorusfruitpopped,433,0 -corusfruitpopped,433,0 -fruitpopped,433,0 -poppedfruit,433,0 -poppedcfruit,433,0 -poppedendfruit,433,0 -poppedenderfruit,433,0 -poppedpurpurfruit,433,0 -poppedpurfruit,433,0 -dragongem,426,0 -chorpopped,433,0 -corpopped,433,0 -chorfruitpopped,433,0 -corfruitpopped,433,0 -shield,442,0 -handshield,442,0 -woodshield,442,0 -woodenshield,442,0 -spectralarrow,439,0 -specterarrow,439,0 -glowstonearrow,439,0 -glowingarrow,439,0 -glowarrow,439,0 -arrowregeneration,440,0 -regenerationarrow,440,0 -arrowregen,440,0 -regenarrow,440,0 -arrowswiftness,440,0 -swiftnessarrow,440,0 -arrowswift,440,0 -swiftarrow,440,0 -arrowfireresist,440,0 -fireresistarrow,440,0 -arrowfireres,440,0 -fireresarrow,440,0 -arrowhealing,440,0 -healingarrow,440,0 -arrowheal,440,0 -healarrow,440,0 -arrownightvision,440,0 -nightvisionarrow,440,0 -arrownv,440,0 -nvarrow,440,0 -arrowstrength,440,0 -strengtharrow,440,0 -arrowstr,440,0 -strarrow,440,0 -arrowleaping,440,0 -leapingarrow,440,0 -arrowleap,440,0 -leaparrow,440,0 -arrowinvisibility,440,0 -invisibilityarrow,440,0 -arrowinvis,440,0 -invisarrow,440,0 -arrowpoison,440,0 -poisonarrow,440,0 -arrowpoi,440,0 -poiarrow,440,0 -arrowweakness,440,0 -weaknessarrow,440,0 -arrowweak,440,0 -weakarrow,440,0 -arrowslowness,440,0 -slownessarrow,440,0 -arrowslow,440,0 -slowarrow,440,0 -arrowharming,440,0 -harmingarrow,440,0 -arrowharm,440,0 -harmarrow,440,0 -arrowwaterbreathing,440,0 -waterbreathingarrow,440,0 -arrowwb,440,0 -wbarrow,440,0 -arrowluck,440,0 -luckarrow,440,0 -arrowlucky,440,0 -luckyarrow,440,0 -arrowregeneration2,440,0 -regenerationarrow2,440,0 -arrowregen2,440,0 -regenarrow2,440,0 -arrowswiftness2,440,0 -swiftnessarrow2,440,0 -arrowswift2,440,0 -swiftarrow2,440,0 -arrowfireresist2,440,0 -fireresistarrow2,440,0 -arrowfireres2,440,0 -fireresarrow2,440,0 -arrowhealing2,440,0 -healingarrow2,440,0 -arrowheal2,440,0 -healarrow2,440,0 -arrownightvision2,440,0 -nightvisionarrow2,440,0 -arrownv2,440,0 -nvarrow2,440,0 -arrowstrength2,440,0 -strengtharrow2,440,0 -arrowstr,440,0 -strarrow,440,0 -arrowleaping2,440,0 -leapingarrow2,440,0 -arrowleap2,440,0 -leaparrow2,440,0 -arrowinvisibility2,440,0 -invisibilityarrow2,440,0 -arrowinvis2,440,0 -invisarrow2,440,0 -arrowpoison2,440,0 -poisonarrow2,440,0 -arrowpoi2,440,0 -poiarrow2,440,0 -arrowweakness2,440,0 -weaknessarrow2,440,0 -arrowweak2,440,0 -weakarrow2,440,0 -arrowslowness2,440,0 -slownessarrow2,440,0 -arrowslow2,440,0 -slowarrow2,440,0 -arrowharming2,440,0 -harmingarrow2,440,0 -arrowharm2,440,0 -harmarrow2,440,0 -arrowwaterbreathing2,440,0 -waterbreathingarrow2,440,0 -arrowwb2,440,0 -wbarrow2,440,0 -arrowluck2,440,0 -luckarrow2,440,0 -arrowlucky2,440,0 -luckyarrow2,440,0 -arrowregenerationii,440,0 -regenerationarrowii,440,0 -arrowregenii,440,0 -regenarrowii,440,0 -arrowswiftnessii,440,0 -swiftnessarrowii,440,0 -arrowswiftii,440,0 -swiftarrowii,440,0 -arrowfireresistii,440,0 -fireresistarrowii,440,0 -arrowfireresii,440,0 -fireresarrowii,440,0 -arrowhealingii,440,0 -healingarrowii,440,0 -arrowhealii,440,0 -healarrowii,440,0 -arrownightvisionii,440,0 -nightvisionarrowii,440,0 -arrownvii,440,0 -nvarrowii,440,0 -arrowstrengthii,440,0 -strengtharrowii,440,0 -arrowstrii,440,0 -strarrowii,440,0 -arrowleapingii,440,0 -leapingarrowii,440,0 -arrowleapii,440,0 -leaparrowii,440,0 -arrowinvisibilityii,440,0 -invisibilityarrowii,440,0 -arrowinvisii,440,0 -invisarrowii,440,0 -arrowpoisonii,440,0 -poisonarrowii,440,0 -arrowpoiii,440,0 -poiarrowii,440,0 -arrowweaknessii,440,0 -weaknessarrowii,440,0 -arrowweakii,440,0 -weakarrowii,440,0 -arrowslownessii,440,0 -slownessarrowii,440,0 -arrowslowii,440,0 -slowarrowii,440,0 -arrowharmingii,440,0 -harmingarrowii,440,0 -arrowharmii,440,0 -harmarrowii,440,0 -arrowwaterbreathingii,440,0 -waterbreathingarrowii,440,0 -arrowwbii,440,0 -wbarrowii,440,0 -arrowluckii,440,0 -luckarrowii,440,0 -arrowluckyii,440,0 -luckyarrowii,440,0 -lingeringpotion,441,0 -lingerpotion,441,0 -lingerpot,441,0 -aoepotion,441,0 -aoepot,441,0 -areapotion,441,0 -areapot,441,0 -cloudpotion,441,0 -cloudpot,441,0 -lingerpotregenerationii,440,0 -regenerationlingerpotii,440,0 -lingerpotregenii,440,0 -regenlingerpotii,440,0 -lingerpotswiftnessii,440,0 -swiftnesslingerpotii,440,0 -lingerpotswiftii,440,0 -swiftlingerpotii,440,0 -lingerpotfireresistii,440,0 -fireresistlingerpotii,440,0 -lingerpotfireresii,440,0 -firereslingerpotii,440,0 -lingerpothealingii,440,0 -healinglingerpotii,440,0 -lingerpothealii,440,0 -heallingerpotii,440,0 -lingerpotnightvisionii,440,0 -nightvisionlingerpotii,440,0 -lingerpotnvii,440,0 -nvlingerpotii,440,0 -lingerpotstrengthii,440,0 -strengthlingerpotii,440,0 -lingerpotstrii,440,0 -strlingerpotii,440,0 -lingerpotleapingii,440,0 -leapinglingerpotii,440,0 -lingerpotleapii,440,0 -leaplingerpotii,440,0 -lingerpotinvisibilityii,440,0 -invisibilitylingerpotii,440,0 -lingerpotinvisii,440,0 -invislingerpotii,440,0 -lingerpotpoisonii,440,0 -poisonlingerpotii,440,0 -lingerpotpoiii,440,0 -poilingerpotii,440,0 -lingerpotweaknessii,440,0 -weaknesslingerpotii,440,0 -lingerpotweakii,440,0 -weaklingerpotii,440,0 -lingerpotslownessii,440,0 -slownesslingerpotii,440,0 -lingerpotslowii,440,0 -slowlingerpotii,440,0 -lingerpotharmingii,440,0 -harminglingerpotii,440,0 -lingerpotharmii,440,0 -harmlingerpotii,440,0 -lingerpotwaterbreathingii,440,0 -waterbreathinglingerpotii,440,0 -lingerpotwbii,440,0 -wblingerpotii,440,0 -lingerpotluckii,440,0 -lucklingerpotii,440,0 -lingerpotluckyii,440,0 -luckylingerpotii,440,0 -lingerpotregeneration2,440,0 -regenerationlingerpot2,440,0 -lingerpotregen2,440,0 -regenlingerpot2,440,0 -lingerpotswiftness2,440,0 -swiftnesslingerpot2,440,0 -lingerpotswift2,440,0 -swiftlingerpot2,440,0 -lingerpotfireresist2,440,0 -fireresistlingerpot2,440,0 -lingerpotfireres2,440,0 -firereslingerpot2,440,0 -lingerpothealing2,440,0 -healinglingerpot2,440,0 -lingerpotheal2,440,0 -heallingerpot2,440,0 -lingerpotnightvision2,440,0 -nightvisionlingerpot2,440,0 -lingerpotnv2,440,0 -nvlingerpot2,440,0 -lingerpotstrength2,440,0 -strengthlingerpot2,440,0 -lingerpotstr2,440,0 -strlingerpot2,440,0 -lingerpotleaping2,440,0 -leapinglingerpot2,440,0 -lingerpotleap2,440,0 -leaplingerpot2,440,0 -lingerpotinvisibility2,440,0 -invisibilitylingerpot2,440,0 -lingerpotinvis2,440,0 -invislingerpot2,440,0 -lingerpotpoison2,440,0 -poisonlingerpot2,440,0 -lingerpotpo2i,440,0 -poilingerpot2,440,0 -lingerpotweakness2,440,0 -weaknesslingerpot2,440,0 -lingerpotweak2,440,0 -weaklingerpot2,440,0 -lingerpotslowness2,440,0 -slownesslingerpot2,440,0 -lingerpotslow2,440,0 -slowlingerpot2,440,0 -lingerpotharming2,440,0 -harminglingerpot2,440,0 -lingerpotharm2,440,0 -harmlingerpot2,440,0 -lingerpotwaterbreathing2,440,0 -waterbreathinglingerpot2,440,0 -lingerpotwb2,440,0 -wblingerpot2,440,0 -lingerpotluck2,440,0 -lucklingerpot2,440,0 -lingerpotlucky2,440,0 -luckylingerpot2,440,0 -lingerpotregeneration,440,0 -regenerationlingerpot,440,0 -lingerpotregen,440,0 -regenlingerpot,440,0 -lingerpotswiftness,440,0 -swiftnesslingerpot,440,0 -lingerpotswift,440,0 -swiftlingerpot,440,0 -lingerpotfireresist,440,0 -fireresistlingerpot,440,0 -lingerpotfireres,440,0 -firereslingerpot,440,0 -lingerpothealing,440,0 -healinglingerpot,440,0 -lingerpotheal,440,0 -heallingerpot,440,0 -lingerpotnightvision,440,0 -nightvisionlingerpot,440,0 -lingerpotnv,440,0 -nvlingerpot,440,0 -lingerpotstrength,440,0 -strengthlingerpot,440,0 -lingerpotstr,440,0 -strlingerpot,440,0 -lingerpotleaping,440,0 -leapinglingerpot,440,0 -lingerpotleap,440,0 -leaplingerpot,440,0 -lingerpotinvisibility,440,0 -invisibilitylingerpot,440,0 -lingerpotinvis,440,0 -invislingerpot,440,0 -lingerpotpoison,440,0 -poisonlingerpot,440,0 -lingerpotpoi,440,0 -poilingerpot,440,0 -lingerpotweakness,440,0 -weaknesslingerpot,440,0 -lingerpotweak,440,0 -weaklingerpot,440,0 -lingerpotslowness,440,0 -slownesslingerpot,440,0 -lingerpotslow,440,0 -slowlingerpot,440,0 -lingerpotharming,440,0 -harminglingerpot,440,0 -lingerpotharm,440,0 -harmlingerpot,440,0 -lingerpotwaterbreathing,440,0 -waterbreathinglingerpot,440,0 -lingerpotwb,440,0 -wblingerpot,440,0 -lingerpotluck,440,0 -lucklingerpot,440,0 -lingerpotlucky,440,0 -luckylingerpot,440,0 -aoepotregenerationii,440,0 -regenerationaoepotii,440,0 -aoepotregenii,440,0 -regenaoepotii,440,0 -aoepotswiftnessii,440,0 -swiftnessaoepotii,440,0 -aoepotswiftii,440,0 -swiftaoepotii,440,0 -aoepotfireresistii,440,0 -fireresistaoepotii,440,0 -aoepotfireresii,440,0 -fireresaoepotii,440,0 -aoepothealingii,440,0 -healingaoepotii,440,0 -aoepothealii,440,0 -healaoepotii,440,0 -aoepotnightvisionii,440,0 -nightvisionaoepotii,440,0 -aoepotnvii,440,0 -nvaoepotii,440,0 -aoepotstrengthii,440,0 -strengthaoepotii,440,0 -aoepotstrii,440,0 -straoepotii,440,0 -aoepotleapingii,440,0 -leapingaoepotii,440,0 -aoepotleapii,440,0 -leapaoepotii,440,0 -aoepotinvisibilityii,440,0 -invisibilityaoepotii,440,0 -aoepotinvisii,440,0 -invisaoepotii,440,0 -aoepotpoisonii,440,0 -poisonaoepotii,440,0 -aoepotpoiii,440,0 -poiaoepotii,440,0 -aoepotweaknessii,440,0 -weaknessaoepotii,440,0 -aoepotweakii,440,0 -weakaoepotii,440,0 -aoepotslownessii,440,0 -slownessaoepotii,440,0 -aoepotslowii,440,0 -slowaoepotii,440,0 -aoepotharmingii,440,0 -harmingaoepotii,440,0 -aoepotharmii,440,0 -harmaoepotii,440,0 -aoepotwaterbreathingii,440,0 -waterbreathingaoepotii,440,0 -aoepotwbii,440,0 -wbaoepotii,440,0 -aoepotluckii,440,0 -luckaoepotii,440,0 -aoepotluckyii,440,0 -luckyaoepotii,440,0 -aoepotregeneration2,440,0 -regenerationaoepot2,440,0 -aoepotregen2,440,0 -regenaoepot2,440,0 -aoepotswiftness2,440,0 -swiftnessaoepot2,440,0 -aoepotswift2,440,0 -swiftaoepot2,440,0 -aoepotfireresist2,440,0 -fireresistaoepot2,440,0 -aoepotfireres2,440,0 -fireresaoepot2,440,0 -aoepothealing2,440,0 -healingaoepot2,440,0 -aoepotheal2,440,0 -healaoepot2,440,0 -aoepotnightvision2,440,0 -nightvisionaoepot2,440,0 -aoepotnv2,440,0 -nvaoepot2,440,0 -aoepotstrength2,440,0 -strengthaoepot2,440,0 -aoepotstr2,440,0 -straoepot2,440,0 -aoepotleaping2,440,0 -leapingaoepot2,440,0 -aoepotleap2,440,0 -leapaoepot2,440,0 -aoepotinvisibility2,440,0 -invisibilityaoepot2,440,0 -aoepotinvis2,440,0 -invisaoepot2,440,0 -aoepotpoison2,440,0 -poisonaoepot2,440,0 -aoepotpo2i,440,0 -poiaoepot2,440,0 -aoepotweakness2,440,0 -weaknessaoepot2,440,0 -aoepotweak2,440,0 -weakaoepot2,440,0 -aoepotslowness2,440,0 -slownessaoepot2,440,0 -aoepotslow2,440,0 -slowaoepot2,440,0 -aoepotharming2,440,0 -harmingaoepot2,440,0 -aoepotharm2,440,0 -harmaoepot2,440,0 -aoepotwaterbreathing2,440,0 -waterbreathingaoepot2,440,0 -aoepotwb2,440,0 -wbaoepot2,440,0 -aoepotluck2,440,0 -luckaoepot2,440,0 -aoepotlucky2,440,0 -luckyaoepot2,440,0 -aoepotregeneration,440,0 -regenerationaoepot,440,0 -aoepotregen,440,0 -regenaoepot,440,0 -aoepotswiftness,440,0 -swiftnessaoepot,440,0 -aoepotswift,440,0 -swiftaoepot,440,0 -aoepotfireresist,440,0 -fireresistaoepot,440,0 -aoepotfireres,440,0 -fireresaoepot,440,0 -aoepothealing,440,0 -healingaoepot,440,0 -aoepotheal,440,0 -healaoepot,440,0 -aoepotnightvision,440,0 -nightvisionaoepot,440,0 -aoepotnv,440,0 -nvaoepot,440,0 -aoepotstrength,440,0 -strengthaoepot,440,0 -aoepotstr,440,0 -straoepot,440,0 -aoepotleaping,440,0 -leapingaoepot,440,0 -aoepotleap,440,0 -leapaoepot,440,0 -aoepotinvisibility,440,0 -invisibilityaoepot,440,0 -aoepotinvis,440,0 -invisaoepot,440,0 -aoepotpoison,440,0 -poisonaoepot,440,0 -aoepotpoi,440,0 -poiaoepot,440,0 -aoepotweakness,440,0 -weaknessaoepot,440,0 -aoepotweak,440,0 -weakaoepot,440,0 -aoepotslowness,440,0 -slownessaoepot,440,0 -aoepotslow,440,0 -slowaoepot,440,0 -aoepotharming,440,0 -harmingaoepot,440,0 -aoepotharm,440,0 -harmaoepot,440,0 -aoepotwaterbreathing,440,0 -waterbreathingaoepot,440,0 -aoepotwb,440,0 -wbaoepot,440,0 -aoepotluck,440,0 -luckaoepot,440,0 -aoepotlucky,440,0 -luckyaoepot,440,0 -watersplashpotion,438,0 -watersplashpot,438,0 -watersplash,438,0 -thrownwater,438,0 -thrownwaterpot,438,0 -splashwater,438,0 -potionofluck,373,0 -potofluck,373,0 -luckpotion,373,0 -luckypotion,373,0 -splashpotionofluck,438,0 -splashpotofluck,438,0 -splashluckpotion,438,0 -lucksplashpotion,438,0 -luckysplashpotion,438,0 -luckysplashpot,438,0 -splashluckpot,438,0 \ No newline at end of file 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 29ad335dd..3f0d1ad53 100644 --- a/prison-core/src/test/java/tech/mcprison/prison/TestPlatform.java +++ b/prison-core/src/test/java/tech/mcprison/prison/TestPlatform.java @@ -31,7 +31,6 @@ import tech.mcprison.prison.commands.PluginCommand; import tech.mcprison.prison.file.FileStorage; import tech.mcprison.prison.file.YamlFileIO; -import tech.mcprison.prison.gui.GUI; import tech.mcprison.prison.integration.IntegrationManager.PlaceHolderFlags; import tech.mcprison.prison.integration.Placeholders; import tech.mcprison.prison.internal.CommandSender; @@ -42,6 +41,8 @@ import tech.mcprison.prison.internal.platform.Capability; import tech.mcprison.prison.internal.platform.Platform; import tech.mcprison.prison.internal.scoreboard.ScoreboardManager; +import tech.mcprison.prison.modules.ModuleElement; +import tech.mcprison.prison.modules.ModuleElementType; import tech.mcprison.prison.output.ChatDisplay; import tech.mcprison.prison.store.Storage; import tech.mcprison.prison.util.ChatColor; @@ -108,8 +109,14 @@ public boolean shouldShowAlerts() { } - @Override public void unregisterCommand(String command) { + @Override + public void unregisterCommand(String command) { + } + + @Override + public void unregisterAllCommands() { + } @Override public List getCommands() { @@ -127,12 +134,7 @@ public void dispatchCommand( CommandSender sender, String cmd ) { return new TestScheduler(); } - @Override public GUI createGUI(String title, int numRows) { - return null; - } - @Override public void toggleDoor(Location doorLocation) { - } @Override public void log(String message, Object... format) { @@ -142,6 +144,14 @@ public void dispatchCommand( CommandSender sender, String cmd ) { System.out.println(ChatColor.stripColor(String.format(message, format))); } + @Override + public void logCore( String message ) { + if (suppressOutput) { + return; + } + System.out.println(ChatColor.stripColor(message)); + } + @Override public void debug(String message, Object... format) { log(message, format); } @@ -239,4 +249,31 @@ public void getAllPlatformBlockTypes( List blockTypes ) { public PrisonBlock getPrisonBlock( String blockName ) { return null; } + + @Override + public boolean linkModuleElements( ModuleElement sourceElement, + ModuleElementType targetElementType, String name ) { + return false; + } + + @Override + public boolean unlinkModuleElements( ModuleElement elementA, ModuleElement elementB ) { + return false; + } + + @Override + public ModuleElement createModuleElement( CommandSender sender, ModuleElementType elementType, String name, String tag ) { + return null; + } + + @Override + public int getModuleElementCount( ModuleElementType elementType ) { + return 0; + } + + @Override + public void autoCreateMineBlockAssignment() { + + } + } 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 c005e6419..175704655 100644 --- a/prison-core/src/test/java/tech/mcprison/prison/TestPlayer.java +++ b/prison-core/src/test/java/tech/mcprison/prison/TestPlayer.java @@ -119,4 +119,9 @@ public List getInput() { @Override public Inventory getInventory() { return null; } + + @Override + public void printDebugInventoryInformationToConsole() { + + } } diff --git a/prison-core/src/test/java/tech/mcprison/prison/commands/TabCompleterDataTest.java b/prison-core/src/test/java/tech/mcprison/prison/commands/TabCompleterDataTest.java new file mode 100644 index 000000000..7fffbb3b7 --- /dev/null +++ b/prison-core/src/test/java/tech/mcprison/prison/commands/TabCompleterDataTest.java @@ -0,0 +1,121 @@ +package tech.mcprison.prison.commands; + +import static org.junit.Assert.assertEquals; + +import java.util.List; + +import org.junit.Test; + +public class TabCompleterDataTest + extends + TabCompleaterData +{ + + @Test + public void test() + { + String testA = "/cmd a"; + String testB = "/cmd b"; + String testC = "/cmd mid c"; + String testD = "/cmd mid d"; + String testE = "/e"; + String testF = "/f"; + String testG = "/e g"; + + TabCompleaterData tcd = new TabCompleaterData(); + + assertEquals( 0, tcd.getData().size() ); + + RegisteredCommand testRCA = RegisteredCommand.junitTest( testA ); + assertEquals( "/cmd a", testRCA.getUsage() ); + + assertEquals( 0, tcd.getData().size() ); + + RegisteredCommand testRCB = RegisteredCommand.junitTest( testB ); + RegisteredCommand testRCC = RegisteredCommand.junitTest( testC ); + RegisteredCommand testRCD = RegisteredCommand.junitTest( testD ); + RegisteredCommand testRCE = RegisteredCommand.junitTest( testE ); + RegisteredCommand testRCF = RegisteredCommand.junitTest( testF ); + RegisteredCommand testRCG = RegisteredCommand.junitTest( testG ); + + tcd.add( testRCA ); + + assertEquals( 1, tcd.getData().size() ); + assertEquals( 1, tcd.getData().get( "cmd" ).getData().size() ); + + tcd.add( testRCB ); + + assertEquals( 1, tcd.getData().size() ); + assertEquals( 2, tcd.getData().get( "cmd" ).getData().size() ); + + tcd.add( testRCC ); + + assertEquals( 1, tcd.getData().size() ); + assertEquals( 3, tcd.getData().get( "cmd" ).getData().size() ); + assertEquals( 1, tcd.getData().get( "cmd" ).getData().get( "mid" ).getData().size() ); + + tcd.add( testRCD ); + + assertEquals( 1, tcd.getData().size() ); + assertEquals( 3, tcd.getData().get( "cmd" ).getData().size() ); + assertEquals( 2, tcd.getData().get( "cmd" ).getData().get( "mid" ).getData().size() ); + + tcd.add( testRCE ); + + assertEquals( 2, tcd.getData().size() ); + + tcd.add( testRCF ); + + assertEquals( 3, tcd.getData().size() ); + + tcd.add( testRCG ); + + assertEquals( 3, tcd.getData().size() ); + assertEquals( 1, tcd.getData().get( "e" ).getData().size() ); + + + // Structure should be "good": + + // Now test pulling out results: + List results1 = tcd.check( "cmd", "" ); + + assertEquals( 3, results1.size() ); + assertEquals( "a", results1.get(0) ); + assertEquals( "b", results1.get(1) ); + assertEquals( "mid", results1.get(2) ); + + List results2 = tcd.check( "cmd", "m" ); + + assertEquals( 1, results2.size() ); + + + List results3 = tcd.check( "cmd", "mi" ); + + assertEquals( 1, results3.size() ); + + List results4 = tcd.check( "cmd", "mid" ); + + assertEquals( 1, results4.size() ); + + + List results5 = tcd.check( "cmd", "mid", "" ); + + assertEquals( 2, results5.size() ); + assertEquals( "c", results5.get(0) ); + assertEquals( "d", results5.get(1) ); + + List results6 = tcd.check( "cmd", "mid", "c" ); + + assertEquals( 1, results6.size() ); + assertEquals( "c", results6.get(0) ); + + + List results7 = tcd.check( "cmd", "mid", "x" ); + + assertEquals( 0, results7.size() ); + + + + } + +} diff --git a/prison-core/src/test/java/tech/mcprison/prison/util/PlaceholdersUtilTest.java b/prison-core/src/test/java/tech/mcprison/prison/util/PlaceholdersUtilTest.java new file mode 100644 index 000000000..44f2053d4 --- /dev/null +++ b/prison-core/src/test/java/tech/mcprison/prison/util/PlaceholdersUtilTest.java @@ -0,0 +1,58 @@ +package tech.mcprison.prison.util; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class PlaceholdersUtilTest + extends + PlaceholdersUtil +{ + + @Test + public void test() + { + + assertEquals( "0.00", formattedSize(0) ); + assertEquals( "1.00", formattedSize(1) ); + assertEquals( "123.00", formattedSize(123) ); + + assertEquals( "1.23 k", formattedSize(1234) ); + assertEquals( "12.35 k", formattedSize(12345) ); + assertEquals( "123.46 k", formattedSize(123456) ); + + assertEquals( "1.23 M", formattedSize(1234567) ); + assertEquals( "12.35 M", formattedSize(12345678) ); + assertEquals( "123.46 M", formattedSize(123456789) ); + + assertEquals( "1.23 G", formattedSize(1234567890.0d) ); + assertEquals( "12.35 G", formattedSize(12345678901.0d) ); + assertEquals( "123.46 G", formattedSize(123456789012.0d) ); + + assertEquals( "1.23 T", formattedSize(1234567890123.0d) ); + assertEquals( "12.35 T", formattedSize(12345678901234.0d) ); + assertEquals( "123.46 T", formattedSize(123456789012345.0d) ); + + assertEquals( "1.23 P", formattedSize(1234567890123456.0d) ); + assertEquals( "12.35 P", formattedSize(12345678901234567.0d) ); + assertEquals( "123.46 P", formattedSize(123456789012345678.0d) ); + + assertEquals( "1.23 E", formattedSize(1234567890123456789.0d) ); + assertEquals( "12.35 E", formattedSize(12345678901234567890.0d) ); + assertEquals( "123.46 E", formattedSize(123456789012345678901.0d) ); + + assertEquals( "1.23 Z", formattedSize(1234567890123456789012.0d) ); + assertEquals( "12.35 Z", formattedSize(12345678901234567890123.0d) ); + assertEquals( "123.46 Z", formattedSize(123456789012345678901234.0d) ); + + assertEquals( "1.23 Y", formattedSize(1234567890123456789012345.0d) ); + assertEquals( "12.35 Y", formattedSize(12345678901234567890123456.0d) ); + assertEquals( "123.46 Y", formattedSize(123456789012345678901234567.0d) ); + + assertEquals( "1,234.57 Y", formattedSize(1234567890123456789012345678.0d) ); + assertEquals( "12,345.68 Y", formattedSize(12345678901234567890123456789.0d) ); + assertEquals( "123,456.79 Y", formattedSize(123456789012345678901234567890.0d) ); + + } + +} diff --git a/prison-mines/src/main/java/tech/mcprison/prison/mines/PrisonMines.java b/prison-mines/src/main/java/tech/mcprison/prison/mines/PrisonMines.java index d0b3f8b9b..43f390df5 100644 --- a/prison-mines/src/main/java/tech/mcprison/prison/mines/PrisonMines.java +++ b/prison-mines/src/main/java/tech/mcprison/prison/mines/PrisonMines.java @@ -33,7 +33,9 @@ import tech.mcprison.prison.mines.commands.MinesCommands; import tech.mcprison.prison.mines.data.Mine; import tech.mcprison.prison.mines.data.MinesConfig; +import tech.mcprison.prison.mines.data.PrisonSortableResults; import tech.mcprison.prison.mines.managers.MineManager; +import tech.mcprison.prison.mines.managers.MineManager.MineSortOrder; import tech.mcprison.prison.mines.managers.PlayerManager; import tech.mcprison.prison.modules.Module; import tech.mcprison.prison.output.Output; @@ -59,6 +61,8 @@ public class PrisonMines extends Module { private MineManager mineManager; private PlayerManager player; + + private MinesCommands minesCommands; /** @@ -71,7 +75,7 @@ public class PrisonMines extends Module { * */ private final TreeMap playerCache; - + public PrisonMines(String version) { @@ -109,7 +113,9 @@ public void enable() { // initMines(); PrisonAPI.getEventBus().register(new MinesListener()); - Prison.get().getCommandHandler().registerCommands(new MinesCommands()); + + setMinesCommands( new MinesCommands() ); + Prison.get().getCommandHandler().registerCommands( getMinesCommands() ); //Prison.get().getCommandHandler().registerCommands(new PowertoolCommands()); ConversionManager.getInstance().registerConversionAgent(new MinesConversionAgent()); @@ -232,6 +238,10 @@ public MineManager getMineManager() { public List getMines() { return getMineManager().getMines(); } + + public PrisonSortableResults getMines( MineSortOrder sortOrder ) { + return getMineManager().getMines( sortOrder ); + } public Mine getMine(String mineName) { return getMineManager().getMine(mineName); @@ -249,4 +259,11 @@ public PlayerManager getPlayerManager() { return player; } + public MinesCommands getMinesCommands() { + return minesCommands; + } + public void setMinesCommands( MinesCommands minesCommands ) { + this.minesCommands = minesCommands; + } + } diff --git a/prison-mines/src/main/java/tech/mcprison/prison/mines/commands/MinesCommands.java b/prison-mines/src/main/java/tech/mcprison/prison/mines/commands/MinesCommands.java index 8ef929c41..9e19a58b9 100644 --- a/prison-mines/src/main/java/tech/mcprison/prison/mines/commands/MinesCommands.java +++ b/prison-mines/src/main/java/tech/mcprison/prison/mines/commands/MinesCommands.java @@ -31,33 +31,46 @@ import tech.mcprison.prison.Prison; import tech.mcprison.prison.chat.FancyMessage; import tech.mcprison.prison.commands.Arg; +import tech.mcprison.prison.commands.BaseCommands; import tech.mcprison.prison.commands.Command; import tech.mcprison.prison.commands.CommandPagedData; import tech.mcprison.prison.commands.Wildcard; import tech.mcprison.prison.internal.CommandSender; import tech.mcprison.prison.internal.Player; import tech.mcprison.prison.internal.block.PrisonBlock; -import tech.mcprison.prison.localization.Localizable; import tech.mcprison.prison.mines.PrisonMines; import tech.mcprison.prison.mines.data.Block; import tech.mcprison.prison.mines.data.Mine; import tech.mcprison.prison.mines.data.MineData; import tech.mcprison.prison.mines.data.MineData.MineNotificationMode; +import tech.mcprison.prison.mines.data.MineLinerBuilder; +import tech.mcprison.prison.mines.data.MineLinerBuilder.LinerPatterns; +import tech.mcprison.prison.mines.data.PrisonSortableResults; import tech.mcprison.prison.mines.managers.MineManager; +import tech.mcprison.prison.mines.managers.MineManager.MineSortOrder; +import tech.mcprison.prison.modules.ModuleElement; +import tech.mcprison.prison.modules.ModuleElementType; import tech.mcprison.prison.output.BulletedListComponent; import tech.mcprison.prison.output.ChatDisplay; import tech.mcprison.prison.output.FancyMessageComponent; +import tech.mcprison.prison.output.LogLevel; import tech.mcprison.prison.output.Output; import tech.mcprison.prison.output.RowComponent; import tech.mcprison.prison.selection.Selection; import tech.mcprison.prison.util.BlockType; +import tech.mcprison.prison.util.Bounds.Edges; import tech.mcprison.prison.util.MaterialType; import tech.mcprison.prison.util.Text; /** * @author Dylan M. Perks */ -public class MinesCommands { +public class MinesCommands + extends BaseCommands { + + public MinesCommands() { + super( "MinesCommands" ); + } private Long confirmTimestamp; @@ -75,59 +88,143 @@ private boolean performCheckMineExists(CommandSender sender, String mineName) { return true; } - @Command(identifier = "mines create", description = "Creates a new mine.", + @Command(identifier = "mines create", description = "Creates a new mine, or even a virtual mine.", onlyPlayers = false, permissions = "mines.create") public void createCommand(CommandSender sender, + @Arg(name = "virtual", description = "Create a virtual mine in name only; no physical location. " + + "This allows the mine to be predefined before specifying the coordinates. Use [virtual]. ", def = "") + String virtualMine, @Wildcard(join=true) - @Arg(name = "mineName", description = "The name of the new mine.", def = " ") String mineName) { + @Arg(name = "mineName", description = "The name of the new mine.", def = " ") String mineName + ) { + boolean virtual = false; + + if ( virtualMine != null && virtualMine.trim().length() > 0 ) { + if ( "virtual".equalsIgnoreCase( virtualMine.trim()) ) { + virtual = true; + } + else { + // Combine virtualMine to the beginning of the mineName if it exists. It was not + // intended to be the virtualMine parameter. Yes, adding a space will be an error, but + // they added it any way. + mineName = virtualMine + (mineName == null ? "" : " " + mineName.trim() ).trim(); + } + } if ( mineName == null || mineName.contains( " " ) || mineName.trim().length() == 0 ) { - sender.sendMessage( "&3Names cannot contain spaces or be empty. &b[&d" + mineName + "&b]" ); + sendMessage( sender, "&3Names cannot contain spaces or be empty. &b[&d" + mineName + "&b]" ); return; } mineName = mineName.trim(); Player player = getPlayer( sender ); - if (player == null || !player.isOnline()) { - sender.sendMessage( "&3You must be a player in the game to run this command." ); + if ( !virtual && (player == null || !player.isOnline())) { + sendMessage( sender, "&3You must be a player in the game to run this command." ); return; } PrisonMines pMines = PrisonMines.getInstance(); - Selection selection = Prison.get().getSelectionManager().getSelection(player); - if (!selection.isComplete()) { - pMines.getMinesMessages().getLocalizable("select_bounds") - .sendTo(sender, Localizable.Level.ERROR); - return; - } + + if (PrisonMines.getInstance().getMine(mineName) != null) { + pMines.getMinesMessages().getLocalizable("mine_exists") + .sendTo(sender, LogLevel.ERROR); + return; + } - if (!selection.getMin().getWorld().getName() - .equalsIgnoreCase(selection.getMax().getWorld().getName())) { - pMines.getMinesMessages().getLocalizable("world_diff") - .sendTo(sender, Localizable.Level.ERROR); - return; - } + Selection selection = null; - if (PrisonMines.getInstance().getMine(mineName) != null) { - pMines.getMinesMessages().getLocalizable("mine_exists") - .sendTo(sender, Localizable.Level.ERROR); - return; - } + // virtual mine will skip the setting of the boundaries, but it will make + // the mine unusable. + if ( !virtual ) { + + selection = Prison.get().getSelectionManager().getSelection(player); + if (!selection.isComplete()) { + pMines.getMinesMessages().getLocalizable("select_bounds") + .sendTo(sender, LogLevel.ERROR); + return; + } + + if (!selection.getMin().getWorld().getName() + .equalsIgnoreCase(selection.getMax().getWorld().getName())) { + pMines.getMinesMessages().getLocalizable("world_diff") + .sendTo(sender, LogLevel.ERROR); + return; + } + } + setLastMineReferenced(mineName); Mine mine = new Mine(mineName, selection); pMines.getMineManager().add(mine); - pMines.getMinesMessages().getLocalizable("mine_created").sendTo(sender); - // Delete the selection: - Prison.get().getSelectionManager().clearSelection((Player) sender); + if ( mine.isVirtual() ) { + sendMessage( sender, "&3Virtual mine created: use command " + + "&7/mines set area &3 to enable as a normal mine." ); + } + else { + pMines.getMinesMessages().getLocalizable("mine_created").sendTo(sender); + } + + if ( !virtual && sender != null && sender instanceof Player ) { + // Delete the selection: + Prison.get().getSelectionManager().clearSelection((Player) sender); + } + } + + private void sendMessage( CommandSender sender, String message ) { + if ( sender == null ) { + Output.get().logInfo( message ); + } + else { + sender.sendMessage( message ); + } + } + + @Command(identifier = "mines rename", description = "Rename a mine.", + onlyPlayers = false, permissions = "mines.rename") + public void renameCommand(CommandSender sender, + @Arg(name = "mineName", description = "The existing name of the mine.", def = " ") String mineName, + @Wildcard(join=true) + @Arg(name = "newName", description = "The new name for the mine.", def = " ") String newName + ) { + + if (!performCheckMineExists(sender, mineName)) { + return; + } + + if ( newName == null || newName.contains( " " ) || newName.trim().length() == 0 ) { + sender.sendMessage( "&3New mine name cannot contain spaces or be empty. &b[&d" + newName + "&b]" ); + return; + } + newName = newName.trim(); + + PrisonMines pMines = PrisonMines.getInstance(); + + if ( pMines.getMine(newName) != null ) { + sender.sendMessage( "&3Invalid new mine name. Another mine has that name. &b[&d" + newName + "&b]" ); + return; + + } + + Mine mine = pMines.getMine(mineName); + setLastMineReferenced(newName); + + + pMines.getMineManager().rename(mine, newName); + + + sender.sendMessage( String.format( "&3Mine &d%s &3was successfully renamed to &d%s&3.", mineName, newName) ); + + pMines.getMinesMessages().getLocalizable("mine_created").sendTo(sender); + } + @Command(identifier = "mines set spawn", description = "Set the mine's spawn to where you're standing.", - onlyPlayers = false, permissions = "mines.set") + onlyPlayers = true, permissions = "mines.set") public void spawnpointCommand(CommandSender sender, @Arg(name = "mineName", description = "The name of the mine to edit.") String mineName) { @@ -145,6 +242,12 @@ public void spawnpointCommand(CommandSender sender, PrisonMines pMines = PrisonMines.getInstance(); Mine mine = pMines.getMine(mineName); + + if ( mine.isVirtual() ) { + sender.sendMessage( "&cMine is a virtual mine&7. Use &a/mines set area &7to enable the mine." ); + return; + } + if ( !mine.isEnabled() ) { sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); return; @@ -171,6 +274,117 @@ public void spawnpointCommand(CommandSender sender, pMines.getMinesMessages().getLocalizable("spawn_set").sendTo(sender); } + + @Command(identifier = "mines set tag", description = "Sets the mine's tag name.", + onlyPlayers = true, permissions = "mines.set") + public void tagCommand(CommandSender sender, + @Arg(name = "mineName", description = "The name of the mine to edit.") String mineName, + @Wildcard(join=true) + @Arg(name = "tag", description = "Tag value for the mine. Use [null] to remove.") String tag ) { + + if (!performCheckMineExists(sender, mineName)) { + return; + } + + if ( tag == null || tag.trim().length() == 0 ) { + sender.sendMessage( "&cTag name must be a valid value. To remove use a value of &anull&c." ); + return; + } + + if ( tag.equalsIgnoreCase( "null" ) ) { + tag = null; + } + + PrisonMines pMines = PrisonMines.getInstance(); + Mine mine = pMines.getMine(mineName); + + if ( tag == null && mine.getTag() == null || + mine.getTag() != null && + mine.getTag().equalsIgnoreCase( tag )) { + + sender.sendMessage( "&cThe new tag name is the same as what it was. No change was made." ); + return; + } + + mine.setTag( tag ); + + setLastMineReferenced(mineName); + + pMines.getMineManager().saveMine(mine); + + if ( tag == null ) { + sender.sendMessage( + String.format( "&cThe tag name was cleared for the mine %s.", + mine.getName() ) ); + } + else { + sender.sendMessage( + String.format( "&cThe tag name was changed to %s for the mine %s.", + tag, mine.getName() ) ); + } + + } + + + @Command(identifier = "mines set sortOrder", description = "Sets the mine's sort order, or " + + "prevents a mine from being included in most listings. If more than one mine has the " + + "same sort order, then they will be sorted alphabetically within that sub-group.", + onlyPlayers = true, permissions = "mines.set") + public void sortOrderCommand(CommandSender sender, + @Arg(name = "mineName", description = "The name of the mine to edit.") String mineName, + @Arg(name = "sortOrder", description = "The sort order for listing mines. A value " + + "of -1 or [supress] will prevent the mine from beign included in most listings.", + def = "0" ) String sortOrder ) { + + int order = 0; + + if (!performCheckMineExists(sender, mineName)) { + return; + } + + if ( sortOrder == null ) { + sortOrder = "0"; + } + else if ( "suppress".equalsIgnoreCase( sortOrder.trim() ) ) { + sortOrder = "-1"; + } + + try { + order = Integer.parseInt( sortOrder ); + } + catch ( NumberFormatException e ) { + sender.sendMessage( "Invalid sortOrder. Use an integer value of [0-n], or " + + "[-1, supress] to prevent the mine from being included in most listings." ); + return; + } + + if ( order < -1 ) { + order = -1; + } + + PrisonMines pMines = PrisonMines.getInstance(); + Mine mine = pMines.getMine(mineName); + + if ( order == mine.getSortOrder()) { + sender.sendMessage( "&cThe new sort order is the same as what it was. No change was made." ); + return; + } + + mine.setSortOrder( order ); + + setLastMineReferenced(mineName); + + pMines.getMineManager().saveMine(mine); + + String suppressedMessage = order == -1 ? "This mine will be suppressed from most listings." : ""; + sender.sendMessage( + String.format( "&cThe sort order was changed to %s for the mine %s. %s", + Integer.toString( mine.getSortOrder() ), mine.getName(), + suppressedMessage ) ); + + } + + @Command(identifier = "mines block add", permissions = "mines.block", onlyPlayers = false, description = "Adds a block to a mine.") public void addBlockCommand(CommandSender sender, @@ -190,50 +404,47 @@ public void addBlockCommand(CommandSender sender, Mine m = pMines.getMine(mineName); - if ( !m.isEnabled() ) { - sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); - return; - } + // should be able manage blocks even if disabled or virtual: +// if ( !m.isEnabled() ) { +// sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); +// return; +// } if ( Prison.get().getPlatform().getConfigBooleanFalse( "use-new-prison-block-model" ) ) { - PrisonBlock prisonBlock = Prison.get().getPlatform().getPrisonBlock( block ); - if ( prisonBlock != null ) { - pMines.getMinesMessages().getLocalizable("not_a_block"). - withReplacements(block).sendTo(sender); - return; - } - + block = block == null ? null : block.trim().toLowerCase(); + PrisonBlock prisonBlock = null; - if (m.isInMine(prisonBlock)) { - pMines.getMinesMessages().getLocalizable("block_already_added"). - sendTo(sender); - return; + if ( block != null && Prison.get().getPrisonBlockTypes().getBlockTypesByName().containsKey( block ) ) { + prisonBlock = Prison.get().getPrisonBlockTypes().getBlockTypesByName().get( block ); } - if ( chance <= 0 ) { - sender.sendMessage( "The percent chance must have a value greater than zero." ); + if ( prisonBlock == null ) { + pMines.getMinesMessages().getLocalizable("not_a_block"). + withReplacements(block).sendTo(sender); return; } - final double[] totalComp = {chance}; - m.getPrisonBlocks().forEach(block1 -> totalComp[0] += block1.getChance()); - if (totalComp[0] > 100.0d) { - pMines.getMinesMessages().getLocalizable("mine_full"). - sendTo(sender, Localizable.Level.ERROR); - return; - } +// if (m.isInMine(prisonBlock)) { +// pMines.getMinesMessages().getLocalizable("block_already_added"). +// sendTo(sender); +// return; +// } +// + updateMinePrisonBlock( sender, m, prisonBlock, chance, pMines ); + - prisonBlock.setChance( chance ); - m.getPrisonBlocks().add( prisonBlock ); + + } else { BlockType blockType = BlockType.getBlock(block); + if (blockType == null || blockType.getMaterialType() != MaterialType.BLOCK ) { pMines.getMinesMessages().getLocalizable("not_a_block") - .withReplacements(block).sendTo(sender); + .withReplacements(block).sendTo(sender); return; } @@ -248,27 +459,94 @@ public void addBlockCommand(CommandSender sender, return; } - final double[] totalComp = {chance}; - m.getBlocks().forEach(block1 -> totalComp[0] += block1.getChance()); - if (totalComp[0] > 100.0d) { + BlockPercentTotal percentTotal = calculatePercentage( chance, blockType, m ); + + if ( percentTotal.getTotalChance() > 100.0d) { pMines.getMinesMessages().getLocalizable("mine_full") - .sendTo(sender, Localizable.Level.ERROR); + .sendTo(sender, LogLevel.ERROR); return; } - m.getBlocks().add(new Block(blockType, chance)); + // This is an add block function so if we get this far, add it: + if ( percentTotal.getOldBlock() == null ) { + // add the block since it does not exist in the mine: + m.getBlocks().add( new Block( blockType, chance) ); + } + else if ( chance <= 0 ) { + // block exists in mine, but chance is set to zero so remove it: + m.getBlocks().remove( percentTotal.getOldBlock() ); + } + else { + // update the block chance. The block in percentTotal comes from this mine + // so just update the chance: + percentTotal.getOldBlock().setChance( chance ); + } + + pMines.getMineManager().saveMine( m ); + + pMines.getMinesMessages().getLocalizable("block_added") + .withReplacements(block, mineName).sendTo(sender); } - pMines.getMineManager().saveMine( m ); - - pMines.getMinesMessages().getLocalizable("block_added") - .withReplacements(block, mineName).sendTo(sender); getBlocksList(m, null).send(sender); //pMines.getMineManager().clearCache(); } + private void updateMinePrisonBlock( CommandSender sender, Mine m, PrisonBlock prisonBlock, double chance, PrisonMines pMines ) + { + PrisonBlock existingPrisonBlock = m.getPrisonBlock( prisonBlock ); + + if ( chance <= 0 ) { + if ( existingPrisonBlock == null ) { + sender.sendMessage( "The percent chance must have a value greater than zero." ); + } + else { + // Delete the block since it exists and the chance was set to zero: + deleteBlock( sender, pMines, m, existingPrisonBlock ); + } + return; + } + + + + BlockPercentTotal percentTotal = calculatePercentage( chance, prisonBlock, m ); + + if ( percentTotal.getTotalChance() > 100.0d) { + pMines.getMinesMessages().getLocalizable("mine_full"). + sendTo(sender, LogLevel.ERROR); + return; + } + + if ( existingPrisonBlock != null ) { + + if ( chance <= 0 ) { + // remove the block since it has zero chance + m.getPrisonBlocks().remove( existingPrisonBlock ); + } + else { + // update chance for the prisonBlock. This block is + // still in the mine, so just update the chance. + existingPrisonBlock.setChance( chance ); + } + + pMines.getMineManager().saveMine( m ); + + pMines.getMinesMessages().getLocalizable("block_set") + .withReplacements( existingPrisonBlock.getBlockName(), m.getName()).sendTo(sender); + } + else { + prisonBlock.setChance( chance ); + m.getPrisonBlocks().add( prisonBlock ); + + pMines.getMineManager().saveMine( m ); + + pMines.getMinesMessages().getLocalizable("block_added") + .withReplacements(prisonBlock.getBlockName(), m.getName()).sendTo(sender); + } + } + @Command(identifier = "mines block set", permissions = "mines.block", onlyPlayers = false, description = "Changes the percentage of a block in a mine.") public void setBlockCommand(CommandSender sender, @@ -288,22 +566,24 @@ public void setBlockCommand(CommandSender sender, PrisonMines pMines = PrisonMines.getInstance(); Mine m = pMines.getMine(mineName); - if ( !m.isEnabled() ) { - sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); - return; - } + // you should be able to configure virtual and disabled mines +// if ( !m.isEnabled() ) { +// sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); +// return; +// } if ( Prison.get().getPlatform().getConfigBooleanFalse( "use-new-prison-block-model" ) ) { - - PrisonBlock prisonBlock = Prison.get().getPlatform().getPrisonBlock( block ); - if ( prisonBlock == null ) { - pMines.getMinesMessages().getLocalizable("not_a_block"). - withReplacements(block).sendTo(sender); - return; + + block = block == null ? null : block.trim().toLowerCase(); + PrisonBlock prisonBlock = null; + + if ( block != null && Prison.get().getPrisonBlockTypes().getBlockTypesByName().containsKey( block ) ) { + prisonBlock = Prison.get().getPrisonBlockTypes().getBlockTypesByName().get( block ); } + // Change behavior: If trying to change a block that is not in the mine, then instead add it: if (!m.isInMine(prisonBlock)) { addBlockCommand( sender, mineName, block, chance ); @@ -312,34 +592,37 @@ public void setBlockCommand(CommandSender sender, return; } - // If it's 0, just delete it! - if (chance <= 0.0d) { - deleteBlock( sender, pMines, m, prisonBlock ); -// delBlockCommand(sender, mine, block); - return; - } - - - double totalChance = chance; - PrisonBlock blockToUpdate = null; - for ( PrisonBlock blk : m.getPrisonBlocks() ) { - if ( blk.getBlockName().equalsIgnoreCase( prisonBlock.getBlockName() ) ) { - totalChance -= blk.getChance(); - blockToUpdate = blk; - } - else { - totalChance += blk.getChance(); - } - } - - if (totalChance > 100.0d) { - pMines.getMinesMessages().getLocalizable("mine_full"). - sendTo(sender, Localizable.Level.ERROR); - return; - } - - blockToUpdate.setChance( chance ); + updateMinePrisonBlock( sender, m, prisonBlock, chance, pMines ); + +// // If it's 0, just delete it! +// if (chance <= 0.0d) { +// deleteBlock( sender, pMines, m, prisonBlock ); +//// delBlockCommand(sender, mine, block); +// return; +// } +// +// +// double totalChance = chance; +// PrisonBlock blockToUpdate = null; +// for ( PrisonBlock blk : m.getPrisonBlocks() ) { +// if ( blk.getBlockName().equalsIgnoreCase( prisonBlock.getBlockName() ) ) { +// totalChance -= blk.getChance(); +// blockToUpdate = blk; +// } +// else { +// totalChance += blk.getChance(); +// } +// } +// +// if (totalChance > 100.0d) { +// pMines.getMinesMessages().getLocalizable("mine_full"). +// sendTo(sender, LogLevel.ERROR); +// return; +// } +// +// blockToUpdate.setChance( chance ); +// // // total chance is not being calculated correctly... // // final double[] totalComp = {chance}; @@ -377,7 +660,7 @@ public void setBlockCommand(CommandSender sender, return; } - // If it's 0, just delete it! + // If it's 0, just delete it! If the block is not in the mine, then nothing will happen. if (chance <= 0.0d) { deleteBlock( sender, pMines, m, blockType ); // delBlockCommand(sender, mine, block); @@ -385,39 +668,110 @@ public void setBlockCommand(CommandSender sender, } - double totalChance = chance; - Block blockToUpdate = null; - for ( Block blk : m.getBlocks() ) { - if ( blk.getType() == blockType ) { - totalChance -= blk.getChance(); - blockToUpdate = blk; - } - else { - totalChance += blk.getChance(); - } - } + BlockPercentTotal percentTotal = calculatePercentage( chance, blockType, m ); + - if (totalChance > 100.0d) { + if ( percentTotal.getTotalChance() > 100.0d) { pMines.getMinesMessages().getLocalizable("mine_full"). - sendTo(sender, Localizable.Level.ERROR); + sendTo(sender, LogLevel.ERROR); return; } - blockToUpdate.setChance( chance ); + // Block would have been added or deleted above, so if it gets here, then + // just update the block that's in the mine, which is stored in the percentTotal + // result object: + percentTotal.getOldBlock().setChance( chance ); + + pMines.getMineManager().saveMine( m ); + + pMines.getMinesMessages().getLocalizable("block_set") + .withReplacements(block, mineName).sendTo(sender); } - - pMines.getMineManager().saveMine( m ); - - pMines.getMinesMessages().getLocalizable("block_set") - .withReplacements(block, mineName).sendTo(sender); getBlocksList(m, null).send(sender); //pMines.getMineManager().clearCache(); } + + + private BlockPercentTotal calculatePercentage( double chance, BlockType blockType, Mine m ) { + BlockPercentTotal results = new BlockPercentTotal(); + results.addChance( chance ); + + for ( Block block : m.getBlocks() ) { + if ( block.getType() == blockType ) { + // do not replace the block's chance since this may fail + results.setOldBlock( block ); + } + else { + results.addChance( block.getChance() ); + } + } + + if ( results.getOldBlock() == null ) { + results.setOldBlock( new Block(blockType, chance) ); + } + return results; + } + + private BlockPercentTotal calculatePercentage( double chance, PrisonBlock prisonBlock, Mine m ) { + BlockPercentTotal results = new BlockPercentTotal(); + results.addChance( chance ); + + for ( PrisonBlock block : m.getPrisonBlocks() ) { + if ( block.equals( prisonBlock ) ) { + // do not replace the block's chance since this may fail + results.setPrisonBlock( block ); + } + else { + results.addChance( block.getChance() ); + } + } + + if ( results.getPrisonBlock() == null ) { + prisonBlock.setChance( chance ); + results.setPrisonBlock( prisonBlock ); + } + return results; + } + + protected class BlockPercentTotal { + private double totalChance = 0d; + private Block oldBlock = null; + private PrisonBlock prisonBlock = null; + + public BlockPercentTotal() { + } + + public void addChance( double chance ) { + this.totalChance += chance; + } + public double getTotalChance() { + return totalChance; + } + public void setTotalChance( double totalChance ) { + this.totalChance = totalChance; + } + + public Block getOldBlock() { + return oldBlock; + } + public void setOldBlock( Block oldBlock ) { + this.oldBlock = oldBlock; + } + + public PrisonBlock getPrisonBlock() { + return prisonBlock; + } + public void setPrisonBlock( PrisonBlock prisonBlock ) { + this.prisonBlock = prisonBlock; + } + + } + @Command(identifier = "mines block remove", permissions = "mines.block", onlyPlayers = false, description = "Deletes a block from a mine.") public void delBlockCommand(CommandSender sender, @@ -433,25 +787,50 @@ public void delBlockCommand(CommandSender sender, PrisonMines pMines = PrisonMines.getInstance(); Mine m = pMines.getMine(mineName); - if ( !m.isEnabled() ) { - sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); - return; - } - BlockType blockType = BlockType.getBlock(block); - if (blockType == null) { - pMines.getMinesMessages().getLocalizable("not_a_block") - .withReplacements(block).sendTo(sender); - return; + if ( Prison.get().getPlatform().getConfigBooleanFalse( "use-new-prison-block-model" ) ) { + + + block = block == null ? null : block.trim().toLowerCase(); + PrisonBlock prisonBlock = null; + + if ( block != null && Prison.get().getPrisonBlockTypes().getBlockTypesByName().containsKey( block ) ) { + prisonBlock = Prison.get().getPrisonBlockTypes().getBlockTypesByName().get( block ); + } + + // Cannot delete a block if it does not exist: +// if (!m.isInMine(prisonBlock)) { +// return; +// } + + // make sure the deleteBlock is deleting the actual block stored in the mine: + PrisonBlock preexistingPrisonBlock = m.getPrisonBlock( prisonBlock ); + + if ( preexistingPrisonBlock != null ) { + + deleteBlock( sender, pMines, m, preexistingPrisonBlock ); + } + } - - if (!m.isInMine(blockType)) { - pMines.getMinesMessages().getLocalizable("block_not_removed") - .sendTo(sender); - return; + else { + + BlockType blockType = BlockType.getBlock(block); + if (blockType == null) { + pMines.getMinesMessages().getLocalizable("not_a_block") + .withReplacements(block).sendTo(sender); + return; + } + + if (!m.isInMine(blockType)) { + pMines.getMinesMessages().getLocalizable("block_not_removed") + .sendTo(sender); + return; + } + + deleteBlock( sender, pMines, m, blockType ); } - - deleteBlock( sender, pMines, m, blockType ); + + getBlocksList(m, null).send(sender); } /** @@ -476,7 +855,6 @@ private void deleteBlock( CommandSender sender, PrisonMines pMines, Mine m, Pris pMines.getMinesMessages().getLocalizable("block_deleted"). withReplacements(prisonBlock.getBlockName(), m.getName()).sendTo(sender); - getBlocksList(m, null).send(sender); } } /** @@ -501,7 +879,6 @@ private void deleteBlock( CommandSender sender, PrisonMines pMines, Mine m, Bloc pMines.getMinesMessages().getLocalizable("block_deleted") .withReplacements(blockType.name(), m.getName()).sendTo(sender); - getBlocksList(m, null).send(sender); } } @@ -517,12 +894,81 @@ public void searchBlockCommand(CommandSender sender, pMines.getMinesMessages().getLocalizable("block_search_blank").sendTo(sender); } - ChatDisplay display = blockSearchBuilder(search, page); + ChatDisplay display = null; + + if ( Prison.get().getPlatform().getConfigBooleanFalse( "use-new-prison-block-model" ) ) { + + display = prisonBlockSearchBuilder(search, page); + } + else { + + display = blockSearchBuilder(search, page); + } display.send(sender); //pMines.getMineManager().clearCache(); } + + private ChatDisplay prisonBlockSearchBuilder(String search, String page) + { + List blocks = new ArrayList<>(); + + for ( PrisonBlock pBlock : Prison.get().getPrisonBlockTypes().getBlockTypes() ) { + if ( pBlock.isBlock() && pBlock.getBlockName().contains( search.toLowerCase() )) { + blocks.add( pBlock ); + } + } + + CommandPagedData cmdPageData = new CommandPagedData( + "/mines block search " + search, blocks.size(), + 0, page ); + + // Same page logic as in mines info +// int curPage = 1; +// int pageSize = 10; +// int pages = (blocks.size() / pageSize) + 1; +// try +// { +// curPage = Integer.parseInt(page); +// } +// catch ( NumberFormatException e ) +// { +// // Ignore: Not an integer, will use the default value. +// } +// curPage = ( curPage < 1 ? 1 : (curPage > pages ? pages : curPage )); +// int pageStart = (curPage - 1) * pageSize; +// int pageEnd = ((pageStart + pageSize) > blocks.size() ? blocks.size() : pageStart + pageSize); + + + ChatDisplay display = new ChatDisplay("Block Search (" + blocks.size() + ")"); + display.text("&8Click a block to add it to a mine."); + + BulletedListComponent.BulletedListBuilder builder = + new BulletedListComponent.BulletedListBuilder(); + for ( int i = cmdPageData.getPageStart(); i < cmdPageData.getPageEnd(); i++ ) + { + PrisonBlock block = blocks.get(i); + FancyMessage msg = + new FancyMessage( + String.format("&7%s %s", + Integer.toString(i), block.getBlockName() +// block.getAltName(), + )) + .suggest("/mines block add " + getLastMineReferenced() + + " " + block.getBlockName() + " %") + .tooltip("&7Click to add block to a mine."); + builder.add(msg); + } + display.addComponent(builder.build()); + + // This command plus parameters used: +// String pageCmd = "/mines block search " + search; + + cmdPageData.generatePagedCommandFooter( display ); + + return display; + } private ChatDisplay blockSearchBuilder(String search, String page) { @@ -569,8 +1015,11 @@ private ChatDisplay blockSearchBuilder(String search, String page) BlockType block = blocks.get(i); FancyMessage msg = new FancyMessage( - String.format("&7%s %s (%s)", - Integer.toString(i), block.name(), block.getId().replace("minecraft:", ""))) + String.format("&7%s %s (%s)%s", + Integer.toString(i), block.name(), + block.getId().replace("minecraft:", ""), + (block.getMaterialVersion() == null ? "" : + "(" + block.getMaterialVersion() + ")"))) .suggest("/mines block add " + getLastMineReferenced() + " " + block.name() + " %") .tooltip("&7Click to add block to a mine."); builder.add(msg); @@ -606,10 +1055,11 @@ public void deleteCommand(CommandSender sender, Mine mine = pMines.getMine(mineName); - if ( !mine.isEnabled() ) { - sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); - return; - } + // should be able to delete disabled and virtual mines: +// if ( !mine.isEnabled() ) { +// sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); +// return; +// } // Remove from the manager: pMines.getMineManager().removeMine(mine); @@ -725,37 +1175,55 @@ public void infoCommand(CommandSender sender, // Display Mine Info only: if ( cmdPageData.getCurPage() == 1 ) { + if ( m.isVirtual() ) { + chatDisplay.text("&cWarning!! This mine is &lVirtual&r&c!! &7Use &3/mines set area &7to enable." ); + } + if ( !m.isEnabled() ) { chatDisplay.text("&cWarning!! This mine is &lDISABLED&r&c!!" ); } - String worldName = m.getWorld().isPresent() ? m.getWorld().get().getName() : "&cmissing"; - chatDisplay.text("&3World: &7%s", worldName); + String noTagMessag = String.format( "&7(not set) &3Will default to mine name if used." ); + chatDisplay.text("&3Tag: &7%s", m.getTag() == null ? noTagMessag : m.getTag()); - String minCoords = m.getBounds().getMin().toBlockCoordinates(); - String maxCoords = m.getBounds().getMax().toBlockCoordinates(); - chatDisplay.text("&3Bounds: &7%s &8to &7%s", minCoords, maxCoords); - Player player = getPlayer( sender ); - - chatDisplay.text("&3Center: &7%s &3%s &7%s", - m.getBounds().getCenter().toBlockCoordinates(), - (player == null ? "" : "Distance:"), - (player == null ? "" : fFmt.format( m.getBounds().getDistance3d( player.getLocation() ) )) - ); - if ( mMan.isMineStats() ) { + if ( !m.isVirtual() ) { + String worldName = m.getWorld().isPresent() ? m.getWorld().get().getName() : "&cmissing"; + chatDisplay.text("&3World: &7%s", worldName); } - String spawnPoint = m.getSpawn() != null ? m.getSpawn().toBlockCoordinates() : "&cnot set"; - chatDisplay.text("&3Spawnpoint: &7%s", spawnPoint); + if ( m.getRank() == null ) { + chatDisplay.text( "&3No rank is linked to this mine." ); + } + else { + chatDisplay.text( "&3Rank: &7%s", m.getRank() ); + } + - if ( mMan.isMineStats() ) { - RowComponent rowStats = new RowComponent(); - rowStats.addTextComponent( " -- &7 Stats :: " ); - rowStats.addTextComponent( m.statsMessage() ); + if ( !m.isVirtual() ) { + String minCoords = m.getBounds().getMin().toBlockCoordinates(); + String maxCoords = m.getBounds().getMax().toBlockCoordinates(); + chatDisplay.text("&3Bounds: &7%s &8to &7%s", minCoords, maxCoords); + Player player = getPlayer( sender ); + + chatDisplay.text("&3Center: &7%s &3%s &7%s", + m.getBounds().getCenter().toBlockCoordinates(), + (player == null ? "" : "Distance:"), + (player == null ? "" : fFmt.format( m.getBounds().getDistance3d( player.getLocation() ) )) + ); - chatDisplay.addComponent(rowStats); + + String spawnPoint = m.getSpawn() != null ? m.getSpawn().toBlockCoordinates() : "&cnot set"; + chatDisplay.text("&3Spawnpoint: &7%s", spawnPoint); + + if ( mMan.isMineStats() ) { + RowComponent rowStats = new RowComponent(); + rowStats.addTextComponent( " -- &7 Stats :: " ); + rowStats.addTextComponent( m.statsMessage() ); + + chatDisplay.addComponent(rowStats); + } } @@ -782,7 +1250,7 @@ public void infoCommand(CommandSender sender, chatDisplay.addComponent( row ); } - { + if ( !m.isVirtual() ) { RowComponent row = new RowComponent(); long targetResetTime = m.getTargetResetTime(); @@ -824,7 +1292,7 @@ public void infoCommand(CommandSender sender, // chatDisplay.text("&3Size: &7%d&8x&7%d&8x&7%d", Math.round(m.getBounds().getWidth()), // Math.round(m.getBounds().getHeight()), Math.round(m.getBounds().getLength())); - { + if ( !m.isVirtual() ) { RowComponent row = new RowComponent(); row.addTextComponent( "&3Size: &7%d&8x&7%d&8x&7%d", Math.round(m.getBounds().getWidth()), Math.round(m.getBounds().getHeight()), Math.round(m.getBounds().getLength()) ); @@ -835,7 +1303,7 @@ public void infoCommand(CommandSender sender, } - { + if ( !m.isVirtual() ) { RowComponent row = new RowComponent(); row.addTextComponent( "&3Blocks Remaining: &7%s %s%% ", dFmt.format( m.getRemainingBlockCount() ), @@ -863,7 +1331,7 @@ public void infoCommand(CommandSender sender, } - { + if ( !m.isVirtual() ) { RowComponent row = new RowComponent(); if ( m.getResetThresholdPercent() == 0 ) { row.addTextComponent( "&3Reset Threshold: &cDISABLED"); @@ -957,8 +1425,7 @@ private BulletedListComponent getBlocksList(Mine m, CommandPagedData cmdPageData if ( cmdPageData == null || count++ >= cmdPageData.getPageStart() && count <= cmdPageData.getPageEnd() ) { - String blockName = - StringUtils.capitalize(block.getBlockName().replaceAll("_", " ").toLowerCase()); + String blockName = block.getBlockName().replaceAll("_", " ").toLowerCase(); String percent = dFmt.format(chance) + "%"; FancyMessage msg = new FancyMessage(String.format("&7%s - %s (%s)", percent, block.getBlockName(), blockName)) @@ -1011,6 +1478,13 @@ public void resetCommand(CommandSender sender, Mine m = pMines.getMine(mineName); + + if ( m.isVirtual() ) { + sender.sendMessage( "&cInvalid option. This mine is a virtual mine&7. Use &a/mines set area &7to enable the mine." ); + return; + } + + if ( !m.isEnabled() ) { sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); return; @@ -1030,9 +1504,10 @@ public void resetCommand(CommandSender sender, @Command(identifier = "mines list", permissions = "mines.list", onlyPlayers = false) public void listCommand(CommandSender sender, - @Arg(name = "sort", def = "alpha", - description = "Sort the list by either alpha or active [alpha, active]. " + - " Most active mines are based upon blocks mined since server restart.") + @Arg(name = "sort", def = "sortOrder", + description = "Sort the list by either alpha or active [" + + "sortOrder alpha active xSortOrder xAlpha xActive" + + "]. Most active mines are based upon blocks mined since server restart.") String sort, @Arg(name = "page", def = "1", description = "Page of search results (optional) [1-n, ALL]") String page @@ -1041,53 +1516,64 @@ public void listCommand(CommandSender sender, display.text("&8Click a mine's name to see more information."); Player player = getPlayer( sender ); - if ( sort != null && !sort.equalsIgnoreCase( "alpha" ) && - !sort.equalsIgnoreCase( "active" )) { - if ( "ALL".equalsIgnoreCase( sort )) { + MineSortOrder sortOrder = MineSortOrder.fromString( sort ); + + // If sort was invalid, double check to see if it is a page number or ALL: + if ( sortOrder == MineSortOrder.invalid ) { + sortOrder = MineSortOrder.sortOrder; + + if ( sort != null && "ALL".equalsIgnoreCase( sort )) { // The user did not specify a sort order, but instead this is the page number // so fix it for them: - sort = "alpha"; page = "ALL"; } - else { + else if ( sort != null ) { try { int test = Integer.parseInt( sort ); // This is actually the page number so default to alpha sort: - sort = "alpha"; page = Integer.toString( test ); } catch ( NumberFormatException e ) { // Oof... this isn't a page number, so report an error. - sender.sendMessage( "Invalid sort order. Use either alpha, " + - "active, or a page number such as [1-n, ALL]" ); + sender.sendMessage( "Invalid sort order. Use a valid sort order " + + "or a page number such as [1-n, ALL]" ); } } } - + PrisonMines pMines = PrisonMines.getInstance(); MineManager mMan = pMines.getMineManager(); - // Sort mines by: total blocks mined, name - List mineList = pMines.getMines(); + // Get mines in the correct sorted order and suppress the mines if they should + PrisonSortableResults sortedMines = pMines.getMines( sortOrder ); - // Sort first by name, then blocks mined so final sort order will be: - // Most blocks mined, then alphabetical - mineList.sort( (a, b) -> a.getName().compareToIgnoreCase( b.getName()) ); - - // for now hold off on sorting by total blocks mined. - if ( "active".equalsIgnoreCase( sort )) { - mineList.sort( (a, b) -> Long.compare(b.getTotalBlocksMined(), a.getTotalBlocksMined()) ); + display.text( "&3 Mines listed: &7%s &3Mines suppressed: &7%s", + sortedMines.getSortedList().size(), + sortedMines.getSortedSuppressedList().size()); + + if ( sortedMines.getSortedSuppressedList().size() > 0 ) { + display.text( "&8To view suppressed mines sort by: %s", + sortedMines.getSuppressedListSortTypes() ); } + +// // Sort first by name, then blocks mined so final sort order will be: +// // Most blocks mined, then alphabetical +// mineList.sort( (a, b) -> a.getName().compareToIgnoreCase( b.getName()) ); +// +// // for now hold off on sorting by total blocks mined. +// if ( "active".equalsIgnoreCase( sort )) { +// mineList.sort( (a, b) -> Long.compare(b.getTotalBlocksMined(), a.getTotalBlocksMined()) ); +// } CommandPagedData cmdPageData = new CommandPagedData( - "/mines list " + sort, pMines.getMines().size(), + "/mines list " + sortOrder.name(), sortedMines.getSortedList().size(), 0, page, 7 ); BulletedListComponent list = - getMinesLineItemList(pMines.getMines(), player, cmdPageData, mMan.isMineStats()); + getMinesLineItemList(sortedMines, player, cmdPageData, mMan.isMineStats()); display.addComponent(list); @@ -1098,7 +1584,7 @@ public void listCommand(CommandSender sender, } - private BulletedListComponent getMinesLineItemList( List mines, Player player, + private BulletedListComponent getMinesLineItemList( PrisonSortableResults sortedMines, Player player, CommandPagedData cmdPageData, boolean isMineStatsEnabled ) { BulletedListComponent.BulletedListBuilder builder = @@ -1109,7 +1595,7 @@ private BulletedListComponent getMinesLineItemList( List mines, Player pla int count = 0; - for (Mine m : mines) { + for (Mine m : sortedMines.getSortedList()) { if ( cmdPageData == null || count++ >= cmdPageData.getPageStart() && count <= cmdPageData.getPageEnd() ) { @@ -1118,11 +1604,29 @@ private BulletedListComponent getMinesLineItemList( List mines, Player pla //row.addTextComponent( m.getWorldName() + " " ); + if ( m.getSortOrder() < 0 ) { + row.addFancy( + new FancyMessage( String.format("&3(&b%s&3) ", + "X") ) + .tooltip("&7Sort order: Suppressed")); + } + else { + row.addFancy( + new FancyMessage( String.format("&3(&b%s&3) ", + Integer.toString( m.getSortOrder() )) ) + .tooltip("&7Sort order.")); + } + + row.addFancy( new FancyMessage( String.format("&3Mine: &7%s ", m.getName()) ) .command("/mines info " + m.getName()) .tooltip("&7Click to view info.")); + if ( m.getTag() != null && m.getTag().trim().length() > 0 ) { + row.addTextComponent( "%s ", m.getTag() ); + } + boolean hasCmds = m.getResetCommands().size() > 0; if ( hasCmds ) { row.addFancy( @@ -1134,6 +1638,14 @@ private BulletedListComponent getMinesLineItemList( List mines, Player pla + if ( m.isVirtual() ) { + row.addFancy( + new FancyMessage( "&cVIRTUAL " ) + .command("/mines set area " + m.getName()) + .tooltip("&7Click to set the mine's area to make it a real mine. ")); + } + + if ( !m.isEnabled() ) { row.addFancy( new FancyMessage( "&cDISABLED!! " ) @@ -1142,9 +1654,11 @@ private BulletedListComponent getMinesLineItemList( List mines, Player pla "disabled. World may not exist? ")); } - row.addFancy( - new FancyMessage("&eTP ").command("/mines tp " + m.getName()) - .tooltip("&7Click to TP to the mine")); + if ( !m.isVirtual() ) { + row.addFancy( + new FancyMessage("&eTP ").command("/mines tp " + m.getName()) + .tooltip("&7Click to TP to the mine")); + } if ( m.isUsePagingOnReset() ) { @@ -1156,16 +1670,20 @@ private BulletedListComponent getMinesLineItemList( List mines, Player pla row.addTextComponent( " &3Reset: &7" ); - row.addFancy( - new FancyMessage(dFmt.format(m.getRemainingTimeSec())) - .tooltip( "Estimated time in seconds before the mine resets" ) ); - row.addTextComponent( " sec &3(&b" ); + if ( !m.isVirtual() ) { + row.addFancy( + new FancyMessage(dFmt.format(m.getRemainingTimeSec())) + .tooltip( "Estimated time in seconds before the mine resets" ) ); + row.addTextComponent( " sec &3(&b" ); + } + row.addFancy( new FancyMessage(dFmt.format(m.getResetTime())) .tooltip( "Reset time in seconds" ) ); row.addTextComponent( " sec&3)&b" ); - if ( player != null && m.getBounds().withinSameWorld( player.getLocation() ) ) { + if ( !m.isVirtual() && player != null && + m.getBounds().withinSameWorld( player.getLocation() ) ) { row.addTextComponent( " &3Dist: &7"); row.addFancy( @@ -1177,35 +1695,37 @@ private BulletedListComponent getMinesLineItemList( List mines, Player pla builder.add(row.getFancy()); - - RowComponent row2 = new RowComponent(); + if ( !m.isVirtual() ) { + RowComponent row2 = new RowComponent(); // row2.addTextComponent( " &3Rem: " ); - - // Right justify the total blocks mined, with 1000's separators: - String blocksMined = " " + dFmt.format( m.getTotalBlocksMined() ); - blocksMined = blocksMined.substring( blocksMined.length() - 10); - - row2.addFancy( - new FancyMessage( String.format(" %s &3Rem: ", blocksMined)). - tooltip( "Blocks mined" ) ); - - row2.addFancy( - new FancyMessage(fFmt.format(m.getPercentRemainingBlockCount())). - tooltip( "Percent Blocks Remaining" ) ); - - row2.addTextComponent( "%% &3RCnt: &7" ); - - row2.addFancy( - new FancyMessage(dFmt.format(m.getResetCount())). - tooltip( "Times the mine was reset." ) ); - - - row2.addTextComponent( " &3 Vol: &7" ); - row2.addFancy( - new FancyMessage(dFmt.format(m.getBounds().getTotalBlockCount())). - tooltip( "Volume in Blocks" ) ); - - + + // Right justify the total blocks mined, with 1000's separators: + String blocksMined = " " + dFmt.format( m.getTotalBlocksMined() ); + blocksMined = blocksMined.substring( blocksMined.length() - 10); + + row2.addFancy( + new FancyMessage( String.format(" %s &3Rem: ", blocksMined)). + tooltip( "Blocks mined" ) ); + + row2.addFancy( + new FancyMessage(fFmt.format(m.getPercentRemainingBlockCount())). + tooltip( "Percent Blocks Remaining" ) ); + + row2.addTextComponent( "%% &3RCnt: &7" ); + + row2.addFancy( + new FancyMessage(dFmt.format(m.getResetCount())). + tooltip( "Times the mine was reset." ) ); + + if ( !m.isVirtual() ) { + + row2.addTextComponent( " &3 Vol: &7" ); + row2.addFancy( + new FancyMessage(dFmt.format(m.getBounds().getTotalBlockCount())). + tooltip( "Volume in Blocks" ) ); + } + + // String noteMode = m.getNotificationMode().name() + // ( m.getNotificationMode() == MineNotificationMode.radius ? // " " + dFmt.format( m.getNotificationRadius() ) : "" ); @@ -1218,11 +1738,14 @@ private BulletedListComponent getMinesLineItemList( List mines, Player pla // new FancyMessage(m.getBounds().getDimensions()).tooltip( "Size of Mine" ) ); // // row.addTextComponent( "&7 - &b"); - - builder.add(row2.getFancy()); + + builder.add(row2.getFancy()); + + } - if ( isMineStatsEnabled ) { + + if ( !m.isVirtual() && isMineStatsEnabled ) { RowComponent rowStats = new RowComponent(); rowStats.addTextComponent( " -- &7 Stats :: " ); @@ -1272,10 +1795,10 @@ public void skipResetCommand(CommandSender sender, PrisonMines pMines = PrisonMines.getInstance(); Mine m = pMines.getMine(mineName); - if ( !m.isEnabled() ) { - sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); - return; - } +// if ( !m.isEnabled() ) { +// sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); +// return; +// } boolean skipEnabled = "enabled".equalsIgnoreCase( enabled ); double skipPercent = 80.0d; @@ -1363,10 +1886,10 @@ public void resetTimeCommand(CommandSender sender, PrisonMines pMines = PrisonMines.getInstance(); Mine m = pMines.getMine(mineName); - if ( !m.isEnabled() ) { - sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); - return; - } +// if ( !m.isEnabled() ) { +// sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); +// return; +// } m.setResetTime( resetTime ); @@ -1439,10 +1962,10 @@ public void zeroBlockResetDelayCommand(CommandSender sender, PrisonMines pMines = PrisonMines.getInstance(); Mine m = pMines.getMine(mineName); - if ( !m.isEnabled() ) { - sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); - return; - } +// if ( !m.isEnabled() ) { +// sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); +// return; +// } m.setZeroBlockResetDelaySec( resetTime ); @@ -1501,10 +2024,10 @@ public void resetThresholdPercentCommand(CommandSender sender, PrisonMines pMines = PrisonMines.getInstance(); Mine m = pMines.getMine(mineName); - if ( !m.isEnabled() ) { - sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); - return; - } +// if ( !m.isEnabled() ) { +// sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); +// return; +// } double thresholdPercent = 0.0d; @@ -1533,8 +2056,9 @@ public void resetThresholdPercentCommand(CommandSender sender, pMines.getMineManager().saveMine( m ); - double blocks = m.getBounds().getTotalBlockCount() * - m.getResetThresholdPercent() / 100.0d; + double blocks = m.isVirtual() ? 0 : + m.getBounds().getTotalBlockCount() * + m.getResetThresholdPercent() / 100.0d; DecimalFormat dFmt = new DecimalFormat("#,##0"); DecimalFormat fFmt = new DecimalFormat("#,##0.00"); @@ -1573,10 +2097,10 @@ public void setNotificationCommand(CommandSender sender, PrisonMines pMines = PrisonMines.getInstance(); Mine m = pMines.getMine(mineName); - if ( !m.isEnabled() ) { - sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); - return; - } +// if ( !m.isEnabled() ) { +// sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); +// return; +// } MineNotificationMode noteMode = MineNotificationMode.fromString( mode, MineNotificationMode.displayOptions ); @@ -1634,7 +2158,8 @@ public void setNotificationCommand(CommandSender sender, @Command(identifier = "mines set notificationPerm", permissions = "mines.notification", description = "Enable or disable a mine's notification permission. If enabled, then players " + "must have the mine's permission to get messages for reset. This filter " + - "can be combined with the other notification settings.") + "can be combined with the other notification settings.", + altPermissions = "mines.notification.[mineName]") public void setNotificationPermissionCommand(CommandSender sender, @Arg(name = "mineName", description = "The name of the mine to edit.") String mineName, @Arg(name = "action", def="enable", description = "Enable or disable the permission filtering: [enable, disable]") @@ -1648,10 +2173,10 @@ public void setNotificationPermissionCommand(CommandSender sender, PrisonMines pMines = PrisonMines.getInstance(); Mine m = pMines.getMine(mineName); - if ( !m.isEnabled() ) { - sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); - return; - } +// if ( !m.isEnabled() ) { +// sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); +// return; +// } if ( !action.equalsIgnoreCase( "enable" ) && !action.equalsIgnoreCase( "disable" )) { sender.sendMessage( "&7Invalid value for action: [enable, disable]" ); @@ -1659,7 +2184,9 @@ public void setNotificationPermissionCommand(CommandSender sender, } if ( action.equalsIgnoreCase( "enable" ) && !m.isUseNotificationPermission() ) { - sender.sendMessage( "&7Notification Permission filter has been enabled." ); + sender.sendMessage( + String.format( "&7Notification Permission filter has been enabled. Using permission %s", + m.getMineNotificationPermissionName() ) ); m.setUseNotificationPermission( true ); pMines.getMineManager().saveMine( m ); } @@ -1678,11 +2205,88 @@ else if ( action.equalsIgnoreCase( "disable" ) && m.isUseNotificationPermission( } + @Command(identifier = "mines set rank", permissions = "mines.set", + description = "Links a mine to a rank.") + public void setMineRankCommand(CommandSender sender, + @Arg(name = "mineName", description = "The name of the mine.") String mineName, + @Arg(name = "rankName", description = "Then rank name to link to this mine.") + String rankName + + ) { + + if (performCheckMineExists(sender, mineName)) { + setLastMineReferenced(mineName); + + PrisonMines pMines = PrisonMines.getInstance(); + Mine m = pMines.getMine(mineName); + + + if ( rankName == null || rankName.trim().length() == 0 ) { + sender.sendMessage( "&cRank name is required." ); + return; + } + + if ( m.getRank() != null ) { + // First unlink the preexisting mine and rank: + Prison.get().getPlatform().unlinkModuleElements( m, m.getRank() ); + } + + boolean success = Prison.get().getPlatform().linkModuleElements( m, + ModuleElementType.RANK, rankName ); + + if ( !success ) { + sender.sendMessage( String.format( "&3Invalid Rank Name: &7%s", rankName )); + } + else { + sender.sendMessage( String.format( "&3Rank &7%s &3has been linked to mine &7%s", + rankName, m.getName() )); + } + } + } + + + + @Command(identifier = "mines set norank", permissions = "mines.set", + description = "Unlinks a rank from a mine") + public void setMineNoRankCommand(CommandSender sender, + @Arg(name = "mineName", description = "The name of the mine.") String mineName + + ) { + + if (performCheckMineExists(sender, mineName)) { + setLastMineReferenced(mineName); + + PrisonMines pMines = PrisonMines.getInstance(); + Mine m = pMines.getMine(mineName); + + if ( m.getRank() == null ) { + sender.sendMessage( "&cThis mine has no ranks to unlink." ); + return; + } + + ModuleElement rank = m.getRank(); + + Prison.get().getPlatform().unlinkModuleElements( m, m.getRank() ); + + + sender.sendMessage( String.format( "&3Rank &7%s &3has been removed from mine &7%s", + rank.getName(), m.getName() )); + + } + } + + @Command(identifier = "mines set area", permissions = "mines.set", - description = "Set the area of a mine to your current selection.") + description = "Set the area of a mine to your current selection or a 1x1 mine under your feet.") public void redefineCommand(CommandSender sender, - @Arg(name = "mineName", description = "The name of the mine to edit.") String mineName) { + @Arg(name = "mineName", description = "The name of the mine to edit.") String mineName, + @Arg(name = "source", description = "&3The source to use for setting the area. The &7wand&3 " + + "uses the area defined by the wand. &7Feet&3 defines a 1x1 mine under your feet" + + "which is useful in void worlds or when flying and can be enlarged with " + + "&7/mines set size help&3 . &2[&7wand feet&2]", + def = "wand") String source + ) { if (!performCheckMineExists(sender, mineName)) { return; @@ -1691,13 +2295,26 @@ public void redefineCommand(CommandSender sender, PrisonMines pMines = PrisonMines.getInstance(); Mine m = pMines.getMine(mineName); - if ( !m.isEnabled() ) { - sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); + Player player = getPlayer( sender ); + +// if ( !m.isEnabled() ) { +// sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); +// return; +// } + + Selection selection = null; + + if ( source != null && "feet".equalsIgnoreCase( source ) ) { + selection = new Selection( player.getLocation(), player.getLocation()); + } + else if ( source == null || "wand".equalsIgnoreCase( source ) ) { + selection = Prison.get().getSelectionManager().getSelection( player ); + } + else { + sender.sendMessage( "&3Valid values for &2source &3are &7wand&3 and &7feet&3." ); return; } - Selection selection = Prison.get().getSelectionManager().getSelection((Player) sender); - if (!selection.isComplete()) { pMines.getMinesMessages().getLocalizable("select_bounds") .sendTo(sender); @@ -1715,7 +2332,24 @@ public void redefineCommand(CommandSender sender, setLastMineReferenced(mineName); + boolean wasVirtual = m.isVirtual(); + + // Setting the bounds when it's virtual will configure all the internals: + m.setBounds(selection.asBounds()); + + if ( wasVirtual ) { + + + DecimalFormat dFmt = new DecimalFormat("#,##0"); + String message = String.format( "&3The mine &7%s &3 is no longer a virutal mine " + + "and has been enabled with an area of &7%s &3blocks.", + m.getName(), dFmt.format( m.getBounds().getTotalBlockCount() )); + + sender.sendMessage( message ); + Output.get().logInfo( message ); + } + pMines.getMineManager().saveMine( m ); pMines.getMinesMessages().getLocalizable("mine_redefined") @@ -1726,6 +2360,178 @@ public void redefineCommand(CommandSender sender, //pMines.getMineManager().clearCache(); } + + + @Command(identifier = "mines set tracer", permissions = "mines.set", + description = "Clear the mine and set a tracer around the outside") + public void setTracerCommand(CommandSender sender, + @Arg(name = "mineName", description = "The name of the mine to set the tracer in.") String mineName) { + + if (!performCheckMineExists(sender, mineName)) { + return; + } + + PrisonMines pMines = PrisonMines.getInstance(); + Mine mine = pMines.getMine(mineName); + + + if ( mine.isVirtual() ) { + sender.sendMessage( "&cMine is a virtual mine&7. Use &a/mines set area &7to enable the mine." ); + return; + } + + mine.enableTracer(); + + } + + + + @Command(identifier = "mines set size", permissions = "mines.set", description = "Change the size of the mine") + public void setSizeCommand(CommandSender sender, + @Arg(name = "mineName", description = "The name of the mine to set the tracer in.") String mineName, + @Arg(name = "edge", description = "Edge to adjust [top, bottom, north, east, south, west, walls]", def = "walls") String edge, + //@Arg(name = "adjustment", description = "How to adust the size [smaller, larger]", def = "larger") String adjustment, + @Arg(name = "amount", description = "amount to adjust, [-1, 1]", def = "1") int amount + + ) { + + if (!performCheckMineExists(sender, mineName)) { + return; + } + + Edges e = Edges.fromString( edge ); + if ( e == null ) { + sender.sendMessage( "&cInvalid edge value. [top, bottom, north, east, south, west, walls]" ); + return; + } + + if ( amount == 0 ) { + sender.sendMessage( "&cInvalid amount. Cannot be zero." ); + return; + } + +// if ( adjustment == null || "smaller".equalsIgnoreCase( adjustment ) || "larger".equalsIgnoreCase( adjustment ) ) { +// sender.sendMessage( "&cInvalid adjustment. [larger, smaller]" ); +// return; +// } + + PrisonMines pMines = PrisonMines.getInstance(); + Mine mine = pMines.getMine(mineName); + + if ( mine.isVirtual() ) { + sender.sendMessage( "&cMine is a virtual mine&7. Use &a/mines set area &7to enable the mine." ); + return; + } + + + mine.adjustSize( e, amount ); + + pMines.getMineManager().saveMine( mine ); + + + } + + +// @Command(identifier = "mines set move", permissions = "mines.set", +// description = "Move the location of the mine by a few blocks") + public void moveMineCommand(CommandSender sender, + @Arg(name = "mineName", description = "The name of the mine to set the tracer in.") String mineName, + @Arg(name = "direction", def = "north", + description = "Direction to move mine [top, bottom, north, east, south, west, walls]" ) String direction, + @Arg(name = "amount", description = "amount to move, [1, 2, 3, ...]", def = "1") int amount + + ) { + + if (!performCheckMineExists(sender, mineName)) { + return; + } + + Edges edge = Edges.fromString( direction ); + if ( edge == null || edge == Edges.walls ) { + sender.sendMessage( "&cInvalid direction value. [top, bottom, north, east, south, west]" ); + return; + } + + if ( amount < 1 ) { + sender.sendMessage( "&cInvalid amount. Must be 1 or more." ); + return; + } + + + PrisonMines pMines = PrisonMines.getInstance(); + Mine mine = pMines.getMine(mineName); + + if ( mine.isVirtual() ) { + sender.sendMessage( "&cMine is a virtual mine&7. Use &a/mines set area &7to enable the mine." ); + return; + } + + + mine.moveMine( edge, amount ); + + pMines.getMineManager().saveMine( mine ); + } + + @Command(identifier = "mines set liner", permissions = "mines.set", + description = "Change the blocks that line the mine.") + public void setLinerCommand(CommandSender sender, + @Arg(name = "mineName", description = "The name of the mine") String mineName, + @Arg(name = "edge", description = "Edge to use [top, bottom, north, east, south, west, walls]", def = "walls") String edge, + //@Arg(name = "adjustment", description = "How to adust the size [smaller, larger]", def = "larger") String adjustment, + @Arg(name = "pattern", description = "pattern to use [?]", def = "bright") String pattern, + @Arg(name = "force", description = "Force liner if air [force no]", def = "no") String force + + ) { + + if (!performCheckMineExists(sender, mineName)) { + return; + } + + Edges e = Edges.fromString( edge ); + if ( e == null ) { + sender.sendMessage( "&cInvalid edge value. &3[&7top bottom north east south west walls&3]" ); + return; + } + + if ( pattern != null && "?".equals( pattern )) { + sender.sendMessage( "&3Available Patterns: [&7" + + LinerPatterns.toStringAll() + "&3]" ); + + } + + LinerPatterns linerPattern = LinerPatterns.fromString( pattern ); + if ( linerPattern == null ) { + sender.sendMessage( "&cInvalid pattern.&3 Select one of these: [&7" + + LinerPatterns.toStringAll() + "&3]" ); + return; + } + + boolean isForced = false; + if ( force != null && !"force".equalsIgnoreCase( force ) && !"no".equalsIgnoreCase( force ) ) { + sender.sendMessage( + String.format( "&3The valid values for &7force &3 are &7force&3 and &7no&3. " + + "Was &2[&7%s&2]", force ) ); + } + else if ( "force".equalsIgnoreCase( force ) ) { + isForced = true; + } + + PrisonMines pMines = PrisonMines.getInstance(); + Mine mine = pMines.getMine(mineName); + + if ( mine.isVirtual() ) { + sender.sendMessage( "&cMine is a virtual mine.&7 Use &a/mines set area &7to enable the mine." ); + return; + } + + + new MineLinerBuilder( mine, e, linerPattern, isForced ); + + // NOTE: The mine itself was not changed, so nothing to save: + + } + + @Command(identifier = "mines set resetpaging", permissions = "mines.resetpaging", description = "Enable paging during a mine reset.") @@ -1742,10 +2548,10 @@ public void setMineResetPagingCommand(CommandSender sender, PrisonMines pMines = PrisonMines.getInstance(); Mine m = pMines.getMine(mineName); - if ( !m.isEnabled() ) { - sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); - return; - } +// if ( !m.isEnabled() ) { +// sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); +// return; +// } if ( paging == null || !"disable".equalsIgnoreCase( paging ) && !"enable".equalsIgnoreCase( paging ) ) { sender.sendMessage( "&cInvalid paging option&7. Use &adisable&7 or &aenable&7" ); @@ -1769,6 +2575,7 @@ else if ( "enable".equalsIgnoreCase( paging ) && !m.isUsePagingOnReset() ) { @Command(identifier = "mines tp", description = "TP to the mine.", + aliases = "mtp", altPermissions = {"mines.tp", "mines.tp.[mineName]"}) public void mineTp(CommandSender sender, @Arg(name = "mineName", description = "The name of the mine to teleport to.") String mineName, @@ -1782,7 +2589,10 @@ public void mineTp(CommandSender sender, Player playerAlt = getOnlinePlayer( playerName ); - if (player == null || !player.isOnline()) { + if ( sender.isOp() && playerAlt != null && playerAlt.isOnline() ) { + player = playerAlt; + } + else if ( player == null || !player.isOnline()) { if ( playerName != null && playerName.trim().length() > 0 && playerAlt == null) { sender.sendMessage( "&3Specified player is not in the game so they cannot be teleported." ); @@ -1799,7 +2609,7 @@ public void mineTp(CommandSender sender, } } - else if ( playerAlt != null ) { + else if ( playerAlt != null && !player.getName().equalsIgnoreCase( playerAlt.getName() ) ) { sender.sendMessage( "&3You cannot teleport other players to a mine. Ignoring parameter." ); } @@ -1813,21 +2623,27 @@ else if ( playerAlt != null ) { PrisonMines pMines = PrisonMines.getInstance(); Mine m = pMines.getMine(mineName); + + if ( m.isVirtual() ) { + sender.sendMessage( "&cInvalid option. This mine is a virtual mine&7. Use &a/mines set area &7to enable the mine." ); + return; + } + + String minePermission = "mines.tp." + m.getName().toLowerCase(); if ( !sender.isOp() && !sender.hasPermission("mines.tp") && !sender.hasPermission( minePermission ) ) { Output.get() - .sendError(sender, "You need the permission '%s' or '%s' to tp to this mine.", - "mines.tp", minePermission ); + .sendError(sender, "Sorry. You're unable to teleport there." ); return; } - if ( !m.isEnabled() ) { - sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); - return; - } +// if ( !m.isEnabled() ) { +// sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); +// return; +// } if ( sender instanceof Player ) { m.teleportPlayerOut( (Player) sender ); @@ -1876,14 +2692,14 @@ public void mineWhereAmI(CommandSender sender) { List inMine = new ArrayList<>(); TreeMap nearMine = new TreeMap<>(); for ( Mine mine : pMines.getMineManager().getMines() ) { - if ( mine.getBounds().within( player.getLocation() ) ) { + if ( !mine.isVirtual() && mine.getBounds().within( player.getLocation() ) ) { inMine.add( mine ); } // This is checking for within a certain distance from any mine, so we just need to use // some arbitrary distance as a max radius. We do not want to use the individual values // that have been set for each mine. - else if ( mine.getBounds().within( player.getLocation(), MineData.MINE_RESET__BROADCAST_RADIUS_BLOCKS) ) { + else if ( !mine.isVirtual() && mine.getBounds().within( player.getLocation(), MineData.MINE_RESET__BROADCAST_RADIUS_BLOCKS) ) { Double distance = mine.getBounds().getDistance3d( player.getLocation() ); // Double distance = new Bounds( mine.getBounds().getCenter(), player.getLocation()).getDistance(); nearMine.put( distance.intValue(), mine ); @@ -1908,7 +2724,8 @@ else if ( mine.getBounds().within( player.getLocation(), MineData.MINE_RESET__BR } } - } else { + } + else if ( inMine.size() == 0 ) { // you are not near any mines: sender.sendMessage( "&3Sorry, you are not within " + MineData.MINE_RESET__BROADCAST_RADIUS_BLOCKS + " blocks from any mine." ); @@ -1932,8 +2749,10 @@ private Player getOnlinePlayer( String playerName ) { - @Command(identifier = "mines wand", permissions = "mines.wand", description = "Receive a wand to select a mine area.") - public void wandCommand(Player sender) { + @Command(identifier = "mines wand", permissions = "mines.wand", + description = "Receive a wand to select a mine area.", + onlyPlayers = false ) + public void wandCommand(CommandSender sender) { Player player = getPlayer( sender ); @@ -1942,10 +2761,26 @@ public void wandCommand(Player sender) { return; } - Prison.get().getSelectionManager().bestowSelectionTool(sender); + Prison.get().getSelectionManager().bestowSelectionTool(player); sender.sendMessage( "&3Here you go! &7Left click to select the first corner, and right click to select the other."); } + + + @Command(identifier = "mines playerInventory", permissions = "mines.set", + description = "For listing what's in a player's inventory by dumping it to console.", + onlyPlayers = false ) + public void playerInventoryCommand(CommandSender sender) { + + Player player = getPlayer( sender ); + + if (player == null || !player.isOnline()) { + sender.sendMessage( "&3You must be a player in the game to run this command." ); + return; + } + + player.printDebugInventoryInformationToConsole(); + } @@ -2023,10 +2858,10 @@ public void commandRemove(CommandSender sender, // MineManager mMan = pMines.getMineManager(); Mine m = pMines.getMine(mineName); - if ( !m.isEnabled() ) { - sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); - return; - } +// if ( !m.isEnabled() ) { +// sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); +// return; +// } if (m.getResetCommands() == null || m.getResetCommands().size() == 0) { Output.get().sendInfo(sender, "The mine '%s' contains no commands.", m.getName()); @@ -2053,10 +2888,6 @@ public void commandAdd(CommandSender sender, @Arg(name = "state", def = "before", description = "State can be either before or after.") String state, @Arg(name = "command") @Wildcard String command) { -// if ( 1 < 2 ) { -// sender.sendMessage( "&cThis command is disabled&7. It will be enabled in the near future." ); -// return; -// } if (command.startsWith("/")) { command = command.replaceFirst("/", ""); @@ -2068,7 +2899,7 @@ public void commandAdd(CommandSender sender, if ( state == null || !state.equalsIgnoreCase( "before" ) && !state.equalsIgnoreCase( "after" )) { sender.sendMessage( - String.format("&7Please provide a valid state: b&before&7 or &bafter&7. Was state=[&b%s&7]", + String.format("&7Please provide a valid state: &bbefore&7 or &bafter&7. Was state=[&b%s&7]", state )); return; } @@ -2079,16 +2910,10 @@ public void commandAdd(CommandSender sender, // MineManager mMan = pMines.getMineManager(); Mine m = pMines.getMine(mineName); - if ( !m.isEnabled() ) { - sender.sendMessage( "&cMine is disabled&7. Use &a/mines info &7for possible cause." ); - return; - } - if ( command == null || command.trim().length() == 0 ) { sender.sendMessage( String.format( "&7Please provide a valid command: command=[%s]", command) ); return; - } String newComand = state + ": " + command; diff --git a/prison-mines/src/main/java/tech/mcprison/prison/mines/commands/PowertoolCommands.java b/prison-mines/src/main/java/tech/mcprison/prison/mines/commands/PowertoolCommands.java index f31f6843a..62844427e 100644 --- a/prison-mines/src/main/java/tech/mcprison/prison/mines/commands/PowertoolCommands.java +++ b/prison-mines/src/main/java/tech/mcprison/prison/mines/commands/PowertoolCommands.java @@ -1,11 +1,17 @@ package tech.mcprison.prison.mines.commands; +import tech.mcprison.prison.commands.BaseCommands; import tech.mcprison.prison.commands.Command; import tech.mcprison.prison.internal.CommandSender; import tech.mcprison.prison.internal.Player; import tech.mcprison.prison.mines.PrisonMines; -public class PowertoolCommands { +public class PowertoolCommands + extends BaseCommands { + + public PowertoolCommands() { + super("PowertoolCommands"); + } @Command(identifier = "autosmelt", description = "Enables/disables the autosmelt tool.", permissions = "mines.autosmelt") public void autosmeltCommand(CommandSender sender) { diff --git a/prison-mines/src/main/java/tech/mcprison/prison/mines/data/Block.java b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/Block.java index 729bd53c0..f8de3ada3 100644 --- a/prison-mines/src/main/java/tech/mcprison/prison/mines/data/Block.java +++ b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/Block.java @@ -42,6 +42,19 @@ public Block(BlockType block, double chance) { this.chance = chance; } + public Block(String blockType, double chance ) { + this.chance = chance; + + BlockType block = BlockType.fromString( blockType ); + this.type = block; + + } + + @Override + public String toString() { + return getType().name() + " " + Double.toString( getChance() ); + } + public BlockType getType() { return type; 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 cace801bf..fc428ed3d 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 @@ -67,11 +67,17 @@ public Mine(String name, Selection selection) { super(); setName(name); - setBounds(selection.asBounds()); - - setWorldName( getBounds().getMin().getWorld().getName()); - - setEnabled( true ); + if ( selection == null ) { + setVirtual( true ); + } + else { + + setBounds(selection.asBounds()); + + setWorldName( getBounds().getMin().getWorld().getName()); + + setEnabled( true ); + } // Kick off the initialize: initialize(); @@ -171,46 +177,67 @@ private void loadFromDocument( Document document ) String worldName = (String) document.get("world"); setWorldName( worldName ); setName((String) document.get("name")); // Mine name: - + + + String tag = (String) document.get("tag"); + setTag( tag ); + + + setVirtual( document.get("isVirtual") == null ? false : (boolean) document.get("isVirtual") ); + + + Double sortOrder = (Double) document.get( "sortOrder" ); + setSortOrder( sortOrder == null ? 0 : sortOrder.intValue() ); + + World world = null; - if ( worldName == null ) { - Output.get().logInfo( "Mines.loadFromDocument: Failure: World does not exist in Mine file. mine= %s " + - "Contact support on how to fix.", - getName()); - } + if ( !isVirtual() ) { + if ( worldName == null ) { + Output.get().logInfo( "Mines.loadFromDocument: Failure: World does not exist in Mine file. mine= %s " + + "Contact support on how to fix.", + getName()); + } + + Optional worldOptional = Prison.get().getPlatform().getWorld(worldName); + if (!worldOptional.isPresent()) { + MineManager mineMan = PrisonMines.getInstance().getMineManager(); + + // Store this mine and the world in MineManager's unavailableWorld for later + // processing and hooking up to the world object. Print an error message upon + // the first mine's world not existing. + mineMan.addUnavailableWorld( worldName, this ); + + setEnabled( false ); + } + else { + world = worldOptional.get(); + setEnabled( true ); + } + + // World world = worldOptional.get(); + - Optional worldOptional = Prison.get().getPlatform().getWorld(worldName); - if (!worldOptional.isPresent()) { - MineManager mineMan = PrisonMines.getInstance().getMineManager(); - - // Store this mine and the world in MineManager's unavailableWorld for later - // processing and hooking up to the world object. Print an error message upon - // the first mine's world not existing. - mineMan.addUnavailableWorld( worldName, this ); - - setEnabled( false ); - } - else { - world = worldOptional.get(); - setEnabled( true ); - } + + Location locMin = getLocation(document, world, "minX", "minY", "minZ"); + Location locMax = getLocation(document, world, "maxX", "maxY", "maxZ"); + + setBounds( new Bounds( + locMin, + locMax)); + + setHasSpawn((boolean) document.get("hasSpawn")); + if (isHasSpawn()) { + setSpawn(getLocation(document, world, "spawnX", "spawnY", "spawnZ", "spawnPitch", "spawnYaw")); + } + + } -// World world = worldOptional.get(); Double resetTimeDouble = (Double) document.get("resetTime"); setResetTime( resetTimeDouble != null ? resetTimeDouble.intValue() : PrisonMines.getInstance().getConfig().resetTime ); - setBounds( new Bounds( - getLocation(document, world, "minX", "minY", "minZ"), - getLocation(document, world, "maxX", "maxY", "maxZ"))); - - setHasSpawn((boolean) document.get("hasSpawn")); - if (isHasSpawn()) { - setSpawn(getLocation(document, world, "spawnX", "spawnY", "spawnZ", "spawnPitch", "spawnYaw")); - } - setNotificationMode( MineNotificationMode.fromString( (String) document.get("notificationMode")) ); Double noteRadius = (Double) document.get("notificationRadius"); @@ -232,6 +259,12 @@ private void loadFromDocument( Document document ) // When loading, skipResetBypassCount must be set to zero: setSkipResetBypassCount( 0 ); + + String rankString = (String) document.get( "rank" ); + setRank( null ); + setRankString( rankString ); + + // This is a validation set to ensure only one block type is loaded file system. // Must keep the first one loaded. Set validateBlockNames = new HashSet<>(); @@ -247,6 +280,44 @@ private void loadFromDocument( Document document ) // Use the BlockType.name() load the block type: BlockType blockType = BlockType.getBlock(blockTypeName); if ( blockType != null ) { + + + /** + *

The following is code to correct the use of items being used as a + * block in a mine, which will cause a failure in trying to place an + * item as a block. + *

+ * + *

This is intended for the old block model and is temp code to ensure + * that there are less errors the end user will experience. + *

+ */ + String errorMessage = "Warning! An invalid block type of %s was " + + "detect when loading blocks for " + + "mine %s. %s is not a valid block type. Using " + + "%s instead. If this is incorrect please fix manually."; + + if ( blockType == BlockType.REDSTONE ) { + BlockType itemType = blockType; + blockType = BlockType.REDSTONE_ORE; + + Output.get().logError( + String.format( errorMessage, itemType.name(), getName(), + "Redstone dust", blockType.name()) ); + + dirty = true; + } + else if ( blockType == BlockType.NETHER_BRICK ) { + BlockType itemType = blockType; + blockType = BlockType.DOUBLE_NETHER_BRICK_SLAB; + + Output.get().logError( + String.format( errorMessage, itemType.name(), getName(), + "Individual nether brick", blockType.name()) ); + + dirty = true; + } + Block block = new Block(blockType, chance); getBlocks().add(block); } @@ -355,15 +426,33 @@ else if (validateBlockNames.contains( blockTypeName ) ) { public Document toDocument() { Document ret = new Document(); - ret.put("world", getWorldName()); + + // If world name is not set, try to get it from the bounds: + String worldName = getWorldName(); + if ( worldName == null || worldName.trim().length() == 0 && + getBounds() != null && getBounds().getMin() != null && + getBounds().getMin().getWorld() != null ) { + worldName = getBounds().getMin().getWorld().getName(); + setWorldName( worldName ); + } + ret.put("world", worldName ); ret.put("name", getName()); - ret.put("minX", getBounds().getMin().getX()); - ret.put("minY", getBounds().getMin().getY()); - ret.put("minZ", getBounds().getMin().getZ()); - ret.put("maxX", getBounds().getMax().getX()); - ret.put("maxY", getBounds().getMax().getY()); - ret.put("maxZ", getBounds().getMax().getZ()); - ret.put("hasSpawn", isHasSpawn()); + + ret.put( "isVirtual", isVirtual() ); + + ret.put( "tag", getTag() ); + ret.put( "sortOrder", getSortOrder() ); + + if ( !isVirtual() ) { + ret.put("minX", getBounds().getMin().getX()); + ret.put("minY", getBounds().getMin().getY()); + ret.put("minZ", getBounds().getMin().getZ()); + ret.put("maxX", getBounds().getMax().getX()); + ret.put("maxY", getBounds().getMax().getY()); + ret.put("maxZ", getBounds().getMax().getZ()); + ret.put("hasSpawn", isHasSpawn()); + + } ret.put("resetTime", getResetTime() ); ret.put("notificationMode", getNotificationMode().name() ); @@ -418,9 +507,22 @@ public Document toDocument() { ret.put( "usePagingOnReset", isUsePagingOnReset() ); + + if ( getRank() != null ) { + String rank = getRank().getModuleElementType() + "," + getRank().getName() + "," + + getRank().getId() + "," + getRank().getTag(); + ret.put("rank", rank ); + } + + return ret; } + @Override + public String toString() { + return getName() + " " + getTotalBlocksMined(); + } + private Location getLocation(Document doc, World world, String x, String y, String z) { return new Location(world, (double) doc.get(x), (double) doc.get(y), (double) doc.get(z)); } @@ -443,4 +545,34 @@ public int hashCode() { return getName().hashCode(); } + + public String getBlockListString() + { + StringBuilder sb = new StringBuilder(); + + if ( Prison.get().getPlatform().getConfigBooleanFalse( "use-new-prison-block-model" ) ) { + for ( PrisonBlock block : getPrisonBlocks()) { + if ( sb.length() > 0 ) { + sb.append( ", " ); + } + sb.append( block.toString() ); + } + } + else { + for ( Block block : getBlocks() ) { + if ( sb.length() > 0 ) { + sb.append( ", " ); + } + sb.append( block.toString() ); + } + } + + sb.insert( 0, ": [" ); + sb.append( "]" ); + sb.insert( 0, getName() ); + sb.insert( 0, "Mine " ); + + return sb.toString(); + } + } diff --git a/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineData.java b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineData.java index 8460de481..eb1788be5 100644 --- a/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineData.java +++ b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineData.java @@ -9,20 +9,36 @@ import tech.mcprison.prison.Prison; import tech.mcprison.prison.internal.World; import tech.mcprison.prison.internal.block.PrisonBlock; +import tech.mcprison.prison.modules.ModuleElement; +import tech.mcprison.prison.modules.ModuleElementType; +import tech.mcprison.prison.output.Output; import tech.mcprison.prison.util.BlockType; import tech.mcprison.prison.util.Bounds; import tech.mcprison.prison.util.Location; -public abstract class MineData { +public abstract class MineData + implements ModuleElement { public static final int MINE_RESET__TIME_SEC__DEFAULT = 15 * 60; // 15 minutes public static final int MINE_RESET__TIME_SEC__MINIMUM = 30; // 30 seconds public static final long MINE_RESET__BROADCAST_RADIUS_BLOCKS = 150; public static final String MINE_NOTIFICATION_PERMISSION_PREFIX = "mines.notification."; + + private transient final ModuleElementType elementType; private String name; + private String tag; + private boolean enabled = false; + private boolean virtual = false; + + /** + * A sortOrder of -1 means it should be excluded from most mine listings. + * An example would be for private mines or child mines where you only want the + * parent listed. + */ + private int sortOrder = 0; private Bounds bounds; @@ -56,6 +72,14 @@ public abstract class MineData { private boolean usePagingOnReset = false; + private ModuleElement rank; + /** + * When loading mines, ranks will not have been loaded yet, so must + * save the rankString to be paired to the Ranks later. + * The rankString are the components of the ModuleElement. + */ + private String rankString; + public enum MineNotificationMode { disabled, @@ -84,10 +108,21 @@ public static MineNotificationMode fromString(String mode, MineNotificationMode } public MineData() { + this.elementType = ModuleElementType.MINE; + + this.tag = null; + this.blocks = new ArrayList<>(); this.prisonBlocks = new ArrayList<>(); this.enabled = false; + this.virtual = false; + + /** + * Mines are sorted based upon the sortOrder, ascending. If a mine is given + * a value of -1 then it will be excluded from most mine listings. + */ + this.sortOrder = 0; this.resetTime = MINE_RESET__TIME_SEC__DEFAULT; this.notificationMode = MineNotificationMode.radius; @@ -108,6 +143,9 @@ public MineData() { this.resetCommands = new ArrayList<>(); this.usePagingOnReset = false; + + this.rank = null; + this.rankString = null; } /** @@ -124,11 +162,34 @@ protected void initialize() { public boolean isEnabled() { - return enabled; + return !isVirtual() && enabled; } public void setEnabled( boolean enabled ) { this.enabled = enabled; } + + + /** + *

A virtual mine does not have any coordinates defined for either the + * mine itself, or the spawn point. A virtual mine can never be enabled. + *

+ * + *

A virtual mine can be potentially useful to be pre-created and auto + * configured. + *

+ * + * @return + */ + public boolean isVirtual() { + return virtual; + } + public void setVirtual( boolean virtual ) { + this.virtual = virtual; + } + + public ModuleElementType getModuleElementType() { + return elementType; + } /** * Gets the name of this mine @@ -139,6 +200,33 @@ public String getName() { return name; } + public String getTag() { + return tag; + } + public void setTag( String tag ) { + this.tag = tag; + } + + public int getSortOrder() { + return sortOrder; + } + public void setSortOrder( int sortOrder ) { + this.sortOrder = sortOrder; + } + + + /** + * Mines do not use an id. So these will always + * return a -1 and will ignore any value that is + * set. An id is forced by Ranks and Ladders. + */ + public int getId() { + return -1; + } + public void setId( int idIsIgnored ) { + // ignore + } + /** * Sets the name of this mine * @@ -149,10 +237,17 @@ public void setName(String name) { } public String getWorldName() { + if ( isVirtual() ) { + return "Virtually-Undefined"; + } return worldName; } public void setWorldName( String worldName ) { - this.worldName = worldName; + // cannot set the world name if it is a virtual mine: + if ( !isVirtual() ) { + this.worldName = worldName; + } + } /** @@ -170,7 +265,7 @@ public void setWorldName( String worldName ) { * @return */ public Optional getWorld() { - return Optional.ofNullable( getBounds().getMin().getWorld() ); + return Optional.ofNullable( isVirtual() ? null : getBounds().getMin().getWorld() ); // return Prison.get().getPlatform().getWorld(worldName); } @@ -218,6 +313,29 @@ public Bounds getBounds() { */ public void setBounds(Bounds bounds) { this.bounds = bounds; + + if ( bounds != null && ( isVirtual() || !getWorld().isPresent() || + getWorldName() == null || getWorldName().trim().length() == 0 ) ) { + + World world = bounds.getMin().getWorld(); + + if ( world != null ) { + + setWorld( world ); + setWorldName( world.getName() ); + setVirtual( false ); + setEnabled( true ); + + Output.get().logInfo( "Mine " + getName() + ": world has been set and is now enabled." ); + } + else { + setEnabled( false ); + Output.get().logWarn( + String.format( "&cCould not activate mine &7%s &cbecause the " + + "world object cannot be aquired. Bounds failed be set correctly " + + "and this mine is &ddisabled&c.", getName()) ); + } + } // The world name MUST NEVER be changed. If world is null then it will screw // up the original location of when the was created. World name is set @@ -262,10 +380,16 @@ public void setBlocks(HashMap blockMap) { } public boolean isInMine(Location location) { + if ( isVirtual() ) { + return false; + } return getBounds().within(location); } public boolean isInMine(BlockType blockType) { + if ( isVirtual() ) { + return false; + } for (Block block : getBlocks()) { if (blockType == block.getType()) { return true; @@ -275,6 +399,9 @@ public boolean isInMine(BlockType blockType) { } public boolean isInMine(PrisonBlock blockType) { + if ( isVirtual() ) { + return false; + } for (PrisonBlock block : getPrisonBlocks()) { if (blockType.getBlockName().equalsIgnoreCase( block.getBlockName())) { return true; @@ -282,8 +409,24 @@ public boolean isInMine(PrisonBlock blockType) { } return false; } + + public PrisonBlock getPrisonBlock( PrisonBlock blockType ) { + PrisonBlock results = null; + + for (PrisonBlock block : getPrisonBlocks()) { + if (blockType.getBlockName().equalsIgnoreCase( block.getBlockName())) { + results = block; + break; + } + } + + return results; + } public double area() { + if ( isVirtual() ) { + return 0; + } return getBounds().getArea(); } @@ -305,8 +448,11 @@ public Location getSpawn() { * @return this instance for chaining */ public void setSpawn(Location location) { - hasSpawn = (location != null); - spawn = location; + // cannot set spawn when virtual: + if ( !isVirtual() ) { + hasSpawn = (location != null); + spawn = location; + } } public boolean isHasSpawn() { @@ -352,7 +498,7 @@ public void setUseNotificationPermission( boolean useNotificationPermission ) { } public String getMineNotificationPermissionName() { - return MINE_NOTIFICATION_PERMISSION_PREFIX + getName(); + return MINE_NOTIFICATION_PERMISSION_PREFIX + getName().toLowerCase(); } /** @@ -467,9 +613,22 @@ public void setResetCommands( List resetCommands ) { public boolean isUsePagingOnReset() { return usePagingOnReset; } - public void setUsePagingOnReset( boolean usePagingOnReset ) { this.usePagingOnReset = usePagingOnReset; } + + public ModuleElement getRank() { + return rank; + } + public void setRank( ModuleElement rank ) { + this.rank = rank; + } + + public String getRankString() { + return rankString; + } + public void setRankString( String rankString ) { + this.rankString = rankString; + } } diff --git a/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineLinerBuilder.java b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineLinerBuilder.java new file mode 100644 index 000000000..b92f5e580 --- /dev/null +++ b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineLinerBuilder.java @@ -0,0 +1,779 @@ +package tech.mcprison.prison.mines.data; + +import java.util.ArrayList; +import java.util.List; + +import tech.mcprison.prison.Prison; +import tech.mcprison.prison.internal.World; +import tech.mcprison.prison.internal.block.Block; +import tech.mcprison.prison.internal.block.BlockFace; +import tech.mcprison.prison.internal.block.PrisonBlock; +import tech.mcprison.prison.output.Output; +import tech.mcprison.prison.util.BlockType; +import tech.mcprison.prison.util.Bounds; +import tech.mcprison.prison.util.Bounds.Edges; +import tech.mcprison.prison.util.Location; + +public class MineLinerBuilder { + + public static final String REPAIR_LINER = "repair_liner"; + + private Mine mine; + private Bounds liner; + + private LinerPatterns pattern; + + private boolean isForced = false; + + private List>> pattern3d = null; + + + public enum LinerPatterns { + + bright, + white, + + blackAndWhite, + seaEchos, + obby, + glowingPlanks, + darkOakPrismarine, + beacon, + bricked, + + repair + ; + + public static LinerPatterns fromString( String pattern ) { + LinerPatterns results = null; + + if ( pattern != null && pattern.trim().length() > 0 ) { + for ( LinerPatterns lp : values() ) { + if ( lp.name().equalsIgnoreCase( pattern.trim() )) { + results = lp; + } + } + } + + return results; + } + + public static String toStringAll() { + StringBuilder sb = new StringBuilder(); + + for ( LinerPatterns pattern : values() ) + { + if ( sb.length() > 0 ) { + sb.append( " " ); + } + + sb.append( pattern.name() ); + } + + return sb.toString(); + } + + } + + /** + * Use only in jUnit tests. + */ + protected MineLinerBuilder() { + super(); + + this.pattern3d = new ArrayList<>(); + + } + + public MineLinerBuilder( Mine mine, Edges edge, LinerPatterns pattern, boolean isForced ) { + super(); + + this.pattern3d = new ArrayList<>(); + + this.mine = mine; + + // Liner is one larger in walls and depth. + this.liner = + new Bounds( + new Bounds( mine.getBounds(), + Edges.bottom, 1 ), Edges.walls, 1); + + this.pattern = pattern; + + this.isForced = isForced; + + if ( pattern != null ) { + mine.enableTracer(); + + generatePattern( edge ); + } + } + + private void generatePattern( Edges edge ) { + + World world = getLiner().getMin().getWorld(); + + int xMin = getLiner().getxBlockMin(); + int yMin = getLiner().getyBlockMin(); + int zMin = getLiner().getzBlockMin(); + + int xMax = getLiner().getxBlockMax(); + int yMax = getLiner().getyBlockMax(); + int zMax = getLiner().getzBlockMax(); + + switch ( edge ) + { + case walls: + generatePattern( Edges.north ); + generatePattern( Edges.east ); + generatePattern( Edges.south ); + generatePattern( Edges.west ); + + break; + + case top: + + select2DPattern( edge ); + // Top is where yMax is constant (yMin = yMax): + generatePattern( edge, world, xMin, xMax, yMax, yMax, zMin, zMax ); + break; + + case bottom: + + select2DPattern( edge ); + // Bottom is where yMin is constant (yMax = yMin): + generatePattern( edge, world, xMin, xMax, yMin, yMin, zMin, zMax ); + + break; + + case north: + // North is in the direction of negative Z + + select2DPattern( edge ); + // North is where zMin is constant (zMax = zMin): + generatePattern( edge, world, xMin, xMax, yMin, yMax, zMin, zMin ); + + break; + + case south: + // South is in the direction of positive Z + + select2DPattern( edge ); + // South is where zMax is constant (zMin = zMax): + generatePattern( edge, world, xMin, xMax, yMin, yMax, zMax, zMax ); + + break; + + case east: + + select2DPattern( edge ); + // East is where xMax is constant (xMin = xMax): + generatePattern( edge, world, xMax, xMax, yMin, yMax, zMin, zMax ); + + break; + + case west: + + select2DPattern( edge ); + // West is where xMin is constant (xMax = xMin): + generatePattern( edge, world, xMin, xMin, yMin, yMax, zMin, zMax ); + + break; + + default: + break; + } + } + + + + private void generatePattern( Edges edge, World world, int xMin, int xMax, int yMin, int yMax, int zMin, int zMax) { + try { + + boolean useNewBlockModel = Prison.get().getPlatform().getConfigBooleanFalse( "use-new-prison-block-model" ); + + // Output.get().logInfo( "MineRest.resetSynchonouslyInternal() " + getName() ); + +// Output.get().logInfo( "### MineLinerBuilder - xMin=%d, xMax=%d, yMin=%d, yMax=%d, zMin=%d, zMax=%d ", +// xMin, xMax, yMin, yMax, zMin, zMax); + + + boolean isLadderPossible = false; + + + BlockFace blockFace = null; +// BlockFace blockFaceOpposite = null; + switch ( edge ) + { + case north: + blockFace = BlockFace.NORTH; +// blockFaceOpposite = BlockFace.SOUTH; + isLadderPossible = true; + break; + case south: + blockFace = BlockFace.SOUTH; +// blockFaceOpposite = BlockFace.NORTH; + isLadderPossible = true; + break; + case east: + blockFace = BlockFace.EAST; +// blockFaceOpposite = BlockFace.WEST; + isLadderPossible = true; + break; + case west: + blockFace = BlockFace.WEST; +// blockFaceOpposite = BlockFace.EAST; + isLadderPossible = true; + break; + case top: + blockFace = BlockFace.UP; +// blockFaceOpposite = BlockFace.UP; + break; + case bottom: + blockFace = BlockFace.DOWN; +// blockFaceOpposite = BlockFace.DOWN; + break; + + default: + break; + } + + + for (int y = yMin; y <= yMax + (isForced && yMin > yMax ? -1 : 0); y++) { + + for (int x = xMin; x <= xMax; x++) { + + // Get the block-pattern-x position, mapped relative to the 2d pattern: + int x3d = (x - xMin) % getPattern3d().size(); + + // Get the block-pattern-x position, mapped relative to the 2d pattern: + int y3d = (y - yMin) % getPattern3d().get( x3d ).size(); + + + for (int z = zMin; z <= zMax; z++) { + + // Get the block-pattern-z position, mapped relative to the d2 pattern: + int z3d = (z - zMin) % getPattern3d().get( x3d ).get( y3d ).size(); + + String nextBlockName = getPattern3d().get( x3d ).get( y3d ).get( z3d ); + + boolean isLadderBlock = isLadderPossible && y > yMin && ( + isLadderBlock( x, xMin, xMax ) || + isLadderBlock( z, zMin, zMax )); + +// Output.get().logInfo( "### MineLinerBuilder - %s %s %s isLadder=%s x=%d, y=%d, z=%d " + +// " block: %s ", +// (isXPos || isZPos) ? "Y" : "N", (isX1 || isZ1) ? "Y" : "N", (isX2 || isZ2) ? "Y" : "N", +// (isLadderBlock ? "Y" : "N"), x, y, z, nextBlockName); + + Location targetLocation = new Location(world, x, y, z); + Block tBlock = targetLocation.getBlockAt(); + Block tBlockPlus1 = getRelativeBlock( targetLocation, edge, 1 ); + Block tBlockPlus2 = getRelativeBlock( targetLocation, edge, 2 ); + + +// Output.get().logInfo( "### MineLinerBuilder - %s isLadder=%s " + +// "Loc:%s tB:%s tB1:%s tB2:%s " + +// " x=%s y=%d z=%d block: %s ", +// edge, (isLadderBlock ? "Y" : " "), +// targetLocation.toBlockCoordinates(), +// tBlock.getLocation().toBlockCoordinates(), +// tBlockPlus1.getLocation().toBlockCoordinates(), +// tBlockPlus2.getLocation().toBlockCoordinates(), +// x, y, z, nextBlockName); + + if ( useNewBlockModel ) { + + if ( REPAIR_LINER.equalsIgnoreCase( nextBlockName ) ) { + + if ( isLadderBlock ) { + + tBlock.setPrisonBlock( tBlockPlus2.getPrisonBlock() ); + tBlockPlus1.setPrisonBlock( tBlockPlus2.getPrisonBlock() ); + } + else { + + tBlock.setPrisonBlock( tBlockPlus1.getPrisonBlock() ); + } + } + + else if ( isForced || + !tBlock.isEmpty() || + isLadderBlock && !tBlockPlus1.isEmpty() ) { + + PrisonBlock nextBlockType = new PrisonBlock(nextBlockName); + + if ( isLadderBlock ) { + + tBlockPlus1.setPrisonBlock( nextBlockType ); + + PrisonBlock ladderBlockType = new PrisonBlock("ladder"); + tBlock.setPrisonBlock( ladderBlockType ); + tBlock.setBlockFace( blockFace ); + } + else { + + tBlock.setPrisonBlock( nextBlockType ); + } + } + + } + else { + + if ( REPAIR_LINER.equalsIgnoreCase( nextBlockName ) ) { + + +// Output.get().logInfo( "#### repair : isLadderBlock: %s block types: tb: %s tb1: %s tb2: %s", +// (isLadderBlock ? "Y" : "-" ), +// tBlock.getType(), tBlockPlus1.getType(), tBlockPlus2.getType() ); +// + if ( isLadderBlock ) { + + tBlock.setType( tBlockPlus2.getType() ); + tBlockPlus1.setType( tBlockPlus2.getType() ); + } + else { + + tBlock.setType( tBlockPlus1.getType() ); + } + } + + else if ( isForced || + !tBlock.isEmpty() || + isLadderBlock && !tBlockPlus1.isEmpty() ) { + + BlockType nextBlockType = BlockType.fromString( nextBlockName ); +// if ( nextBlockType == null ) { +// nextBlockType = BlockType.fromString( nextBlockName ); +// } + + if ( isLadderBlock ) { + + tBlockPlus1.setType( nextBlockType ); + + BlockType ladderBlockType = BlockType.LADDER; + tBlock.setType( ladderBlockType ); + tBlock.setBlockFace( blockFace ); + } + else { + + tBlock.setType( nextBlockType ); + } + + } + } + } + } + + + } + + + } catch (Exception e) { + Output.get().logError("&cFailed to generate the mine liner " + getMine().getName(), e); + } + + } + + /** + *

This identifies if the curr position should be a ladder block. This + * will identify either two or three ladder points, depending upon + * if the length is odd or even. + *

+ * + *

The center point will always be a ladder point. But if the length + * is even + * then the next block after the mid is also a ladder point. But if + * the length is odd, then include both sides of the center point. + *

+ * + *

Skip checks: if min == max then that's the face we are building... so skip because + * it's the other two dimension that are being processed. Since the liner + * is one block bigger than the mine on each end, skip if curr is also + * equal to min or max (the corners). + *

+ * + *

If the mine on the edge is 3 blocks or less in width, have them all + * be ladders. + * + * @param curr + * @param min + * @param max + * @return + */ + private boolean isLadderBlock( int curr, int min, int max ) { + + boolean results = false; + + // Skip if the face or corners of liner. + if ( min != max && curr != min && curr != max ) { + + int len = max - min + 1; + boolean isEven = len % 2 == 0; + + int mid = (int) Math.floor( len / 2d ) + ( isEven ? -1 : 0); + + // The following is actually 3 blocks since max and min are + // skipped due to being corners. So if the min is 1 to 3 blocks + // wide, always have ladders that wide. + results = len <= 5; + + if ( len > 5 ) { + + + if ( curr == (min + mid) ) { + results = true; + } + else { + results = isEven ? + // if distance is even, then next ladder position is mid - 1 + ( curr == min + mid + 1 ) : + // If odd, then one above and below mid: + ( curr == min + mid + 1 || curr == min + mid - 1); + } + + } + +// Output.get().logInfo( "#### isLadderBlock: curr=%d min=%d max=%d " + +// " len=%d mid=%d " + +// "isEven=%s results=%s " + +// " (min+mid)=%d ", +// curr, min, max, len, mid, +// (isEven ? "true" : "false"), +// (results ? "true" : "false"), (min+mid) ); + + } + + return results; + } + + /** + *

This gets a block that is offset in the direction (edge) that is + * specified. + *

+ * + * @param location + * @param edge + * @param offset + * @return + */ + private Block getRelativeBlock( Location location, Edges edge, int offset ) + { + Location relLoc = new Location( location ); + switch ( edge ) + { + case north: + relLoc.setZ( relLoc.getBlockZ() - offset ); + break; + case south: + relLoc.setZ( relLoc.getBlockZ() + offset ); + break; + case east: + relLoc.setX( relLoc.getBlockX() + offset ); + break; + case west: + relLoc.setX( relLoc.getBlockX() - offset ); + break; + case top: + relLoc.setY( relLoc.getBlockY() + offset ); + break; + case bottom: + relLoc.setY( relLoc.getBlockY() - offset ); + break; + + default: + break; + } + + Block block = relLoc.getBlockAt(); + + return block; + } + + + /** + * The block names that are used in these 2D patterns much match both + * the BlockType enums (the old prison block names) and the Xmaterial names. + * If they don't match both, use the XMaterial names, then add that name to the + * BlockType enum as an XMaterial altName. + * + * @param edge + */ + private void select2DPattern( Edges edge ) { + + String[][] pattern2d = null; + + switch ( getPattern() ) + { + case repair: + String[][] repair = + { + { REPAIR_LINER } + }; + pattern2d = repair; + break; + + + case blackAndWhite: + String[][] baw = + { + { "obsidian", "pillar_quartz_block" }, + { "pillar_quartz_block", "coal_block" } + }; + pattern2d = baw; + break; + + + case seaEchos: + String[][] seaEchos = + { + { "pillar_quartz_block", "pillar_quartz_block", "pillar_quartz_block" }, + { "pillar_quartz_block", "obsidian", "obsidian" }, + { "pillar_quartz_block", "obsidian", "sea_lantern" }, + }; + pattern2d = seaEchos; + break; + + + case beacon: + String[][] beacon = + { + { "beacon", "diamond_block", "diamond_block", "diamond_block" }, + { "diamond_block", "diamond_block", "diamond_block", "diamond_block" }, + { "diamond_block", "diamond_block", "diamond_block", "diamond_block" } + }; + pattern2d = beacon; + break; + + + case obby: + String[][] obby = + { + { "obsidian" } + }; + pattern2d = obby; + break; + + + case glowingPlanks: + String[][] glowingPlanks = + { + { "dark_oak_planks", "spruce_planks", "acacia_planks", "glowstone" }, // dsag + { "birch_planks", "acacia_planks", "jungle_planks", "dark_oak_planks" }, // bajd + { "acacia_planks", "glowstone", "dark_oak_planks", "spruce_planks" }, // dsag + { "jungle_planks", "dark_oak_planks", "birch_planks", "acacia_planks" }, // bajd + + { "dark_oak_planks", "birch_planks", "acacia_planks", "jungle_planks" }, // dbaj + { "spruce_planks", "acacia_planks", "glowstone", "dark_oak_planks" }, // sagd + { "acacia_planks", "jungle_planks", "dark_oak_planks", "birch_planks" }, // dbaj + { "glowstone", "dark_oak_planks", "spruce_planks", "acacia_planks" } // sagd + }; + pattern2d = glowingPlanks; + break; + + + case darkOakPrismarine: + String[][] darkOakPrismarine = + { + { "prismarine_bricks", "dark_prismarine", "dark_oak_planks", "prismarine" }, + { "dark_oak_planks", "prismarine", "prismarine_bricks", "dark_prismarine" } + }; + pattern2d = darkOakPrismarine; + break; + + + case bricked: + String[][] bricked = + { + { "prismarine_bricks", "jungle_planks", "brick_block" }, + { "mossy_stone_bricks", "dark_prismarine", "dark_oak_planks" }, + { "spruce_planks", "nether_bricks", "sea_lantern" } + }; + pattern2d = bricked; + break; + + + case white: + String[][] white = + { + { "iron_block", "chiseled_quartz_block" }, + { "chiseled_quartz_block", "iron_block" } + }; + pattern2d = white; + break; + + + case bright: + default: + + String[][] bright = + { + { "iron_block", "end_stone" }, + { "end_stone", "glowstone" }, + { "iron_block", "end_stone" }, + + { "chiseled_quartz_block", "pillar_quartz_block" }, + { "glowstone", "quartz_block" }, + { "chiseled_quartz_block", "pillar_quartz_block" } + }; + pattern2d = bright; + + break; + } + + apply2Dto3DPattern( edge, pattern2d ); + } + + + protected void apply2Dto3DPattern( Edges edge, String[][] pattern2d ) + { + // This is a 3d nested list: + pattern3d = new ArrayList<>(); + + for ( int a = 0; a < pattern2d.length; a++ ) { + String[] aArray = pattern2d[a]; + + for ( int b = 0; b < aArray.length; b++ ) { + String value = pattern2d[a][b]; + + switch ( edge ) + { + case top: + case bottom: + // Top or bottom requires Y to be zero since that is the unchanging dimension: + { + // For each value of a add X list: + List> xList = null; + if ( pattern3d.size() == a ) { + xList = new ArrayList<>(); + pattern3d.add( xList ); + } + else { + xList = pattern3d.get( a ); + } + + // y is static and always zero: + List yList = null; + if ( xList.size() == 0 ) { + yList = new ArrayList<>(); + xList.add( yList ); + } + else { + yList = xList.get( 0 ); + } + + // Add the Z for each value of b: + yList.add( value ); + } + + break; + + case north: + case south: + // North or south requires z to be zero for the unchanging dimension: + // For each value of a add X list: + { + // For each value of a add X list: + List> xList = null; + if ( pattern3d.size() == a ) { + xList = new ArrayList<>(); + pattern3d.add( xList ); + } + else { + xList = pattern3d.get( a ); + } + + // y is static and always zero: + List yList = null; + if ( xList.size() == b ) { + yList = new ArrayList<>(); + xList.add( yList ); + } + else { + yList = xList.get( b ); + } + + // Add the value for z. It will always be the zeroth element of y: + yList.add( value ); + } + + break; + + case east: + case west: + // east or west requires x to be zero for the unchanging dimension: + { + // For each value of a add X list: + List> xList = null; + if ( pattern3d.size() == 0 ) { + xList = new ArrayList<>(); + pattern3d.add( xList ); + } + else { + xList = pattern3d.get( 0 ); + } + + // y is static and always zero: + List yList = null; + if ( xList.size() == a ) { + yList = new ArrayList<>(); + xList.add( yList ); + } + else { + yList = xList.get( a ); + } + + // Add the value for each value of b: + yList.add( value ); + } + + break; + + + default: + break; + } + + } + } + + + } + + + public List>> getPattern3d() { + return pattern3d; + } + public void setPattern3d( List>> pattern3d ) { + this.pattern3d = pattern3d; + } + + public Mine getMine() { + return mine; + } + public void setMine( Mine mine ) { + this.mine = mine; + } + + public Bounds getLiner() { + return liner; + } + public void setLiner( Bounds liner ) { + this.liner = liner; + } + + public LinerPatterns getPattern() { + return pattern; + } + public void setPattern( LinerPatterns pattern ) { + this.pattern = pattern; + } + + public boolean isForced() { + return isForced; + } + public void setForced( boolean isForced ) { + this.isForced = isForced; + } + +} diff --git a/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineMover.java b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineMover.java new file mode 100644 index 000000000..10898d3e3 --- /dev/null +++ b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineMover.java @@ -0,0 +1,32 @@ +package tech.mcprison.prison.mines.data; + +import tech.mcprison.prison.mines.data.MineLinerBuilder.LinerPatterns; +import tech.mcprison.prison.util.Bounds; +import tech.mcprison.prison.util.Bounds.Edges; + +public class MineMover +{ + + public MineMover() { + + } + + public void moveMine( Mine mine, Edges edge, int amount ) { + + mine.clearMine( false ); + + new MineLinerBuilder( mine, Edges.top, LinerPatterns.repair, false ); + new MineLinerBuilder( mine, Edges.bottom, LinerPatterns.repair, false ); + new MineLinerBuilder( mine, Edges.walls, LinerPatterns.repair, false ); + + while ( amount-- > 0 ) { + + Bounds newBounds = new Bounds( mine.getBounds(), edge, 1 ); + Bounds newerBounds = new Bounds( newBounds, edge.oppositeEdge(), -1 ); + mine.setBounds( newerBounds ); + } + + // Finally trace the mine: + //mine.clearMine( true ); + } +} diff --git a/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineReset.java b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineReset.java index f9d00ae5b..75aa7ba93 100644 --- a/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineReset.java +++ b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineReset.java @@ -14,10 +14,13 @@ import tech.mcprison.prison.internal.block.PrisonBlock; import tech.mcprison.prison.internal.block.PrisonBlockTypes.InternalBlockTypes; import tech.mcprison.prison.mines.PrisonMines; +import tech.mcprison.prison.mines.data.MineLinerBuilder.LinerPatterns; import tech.mcprison.prison.mines.data.MineScheduler.MineJob; import tech.mcprison.prison.mines.events.MineResetEvent; import tech.mcprison.prison.output.Output; import tech.mcprison.prison.util.BlockType; +import tech.mcprison.prison.util.Bounds; +import tech.mcprison.prison.util.Bounds.Edges; import tech.mcprison.prison.util.Location; import tech.mcprison.prison.util.Text; @@ -121,8 +124,11 @@ public MineReset() { protected void initialize() { super.initialize(); - // Once the mine has been loaded, MUST get a count of all air blocks. - refreshBlockBreakCountUponStartup(); + if ( !isVirtual() ) { + + // Once the mine has been loaded, MUST get a count of all air blocks. + refreshBlockBreakCountUponStartup(); + } } /** @@ -163,6 +169,11 @@ protected void resetSynchonously() { private void resetSynchonouslyInternal() { try { + if ( isVirtual() ) { + // Mine is virtual and cannot be reset. Just skip this with no error messages. + return; + } + if ( !isEnabled() ) { Output.get().logError( String.format( "MineReset: Reset failure: Mine is not enabled. " + @@ -389,6 +400,10 @@ private void resetStats() { private long teleportAllPlayersOut(int targetY) { long start = System.currentTimeMillis(); + if ( isVirtual() ) { + return 0; + } + World world = getBounds().getCenter().getWorld(); if ( isEnabled() && world != null ) { @@ -432,7 +447,11 @@ private long teleportAllPlayersOut(int targetY) { * @param player */ public void teleportPlayerOut(Player player) { - + + if ( isVirtual() ) { + // ignore: + } + else if ( !isEnabled() ) { player.sendMessage( String.format( "&7MineReset: Teleport failure: Mine is not enabled. " + @@ -470,7 +489,7 @@ private Location alternativeTpLocation() public int getPlayerCount() { int count = 0; - if ( isEnabled() ) { + if ( !isVirtual() && isEnabled() ) { World world = getWorld().get(); @@ -524,6 +543,10 @@ public int getPlayerCount() { */ protected void generateBlockListAsync() { + if ( isVirtual() ) { + // ignore and generate no error messages: + return; + } if ( !isEnabled() ) { Output.get().logError( String.format( "MineReset: Block count failure: Mine is not enabled. " + @@ -597,8 +620,11 @@ protected void resetAsynchonously() { // Output.get().logInfo( "MineRest.resetAsynchonously() " + getName() ); + if ( isVirtual() ) { + canceled = true; + } - if ( getResetPage() == 0 ) { + if ( !canceled && getResetPage() == 0 ) { generateBlockListAsync(); canceled = resetAsynchonouslyInitiate(); @@ -740,6 +766,10 @@ protected void resetAsynchonously() { private boolean resetAsynchonouslyInitiate() { boolean canceled = false; + if ( isVirtual()) { + canceled = true; + } + else if ( !isEnabled() ) { Output.get().logError( String.format( "MineReset: resetAsynchonouslyInitiate failure: Mine is not enabled. " + @@ -797,7 +827,10 @@ private boolean resetAsynchonouslyInitiate() { * */ private void resetAsynchonouslyUpdate() { - + if ( isVirtual() ) { + // ignore: + } + else if ( !isEnabled() ) { Output.get().logError( String.format( "MineReset: resetAsynchonouslyUpdate failure: Mine is not enabled. " + @@ -948,6 +981,10 @@ protected void refreshAirCountAsyncTask() { boolean useNewBlockModel = Prison.get().getPlatform().getConfigBooleanFalse( "use-new-prison-block-model" ); + if ( isVirtual() ) { + // ignore: + } + else if ( !isEnabled() ) { Output.get().logError( String.format( "MineReset: refreshAirCountAsyncTask failure: Mine is not enabled. " + @@ -1060,6 +1097,9 @@ public int getRemainingBlockCount() { } public double getPercentRemainingBlockCount() { + if ( isVirtual() ) { + return 0; + } int totalCount = getBounds().getTotalBlockCount(); int remainingCount = getRemainingBlockCount(); double percentRemaining = (totalCount == 0d ? 0d : (remainingCount * 100d) / (double) totalCount); @@ -1177,6 +1217,10 @@ private BlockType randomlySelectBlock( Random random ) private void broadcastResetMessageToAllPlayersWithRadius() { long start = System.currentTimeMillis(); + if ( isVirtual() ) { + // ignore: + } + else if ( getNotificationMode() != MineNotificationMode.disabled ) { World world = getBounds().getCenter().getWorld(); @@ -1215,6 +1259,11 @@ private void broadcastResetMessageToAllPlayersWithRadius() { } protected void broadcastPendingResetMessageToAllPlayersWithRadius(MineJob mineJob) { + + if ( isVirtual() ) { + // ignore: + } + else if ( getNotificationMode() != MineNotificationMode.disabled ) { World world = getBounds().getCenter().getWorld(); @@ -1250,6 +1299,76 @@ protected void broadcastPendingResetMessageToAllPlayersWithRadius(MineJob mineJo } } + + /** + * This clears the mine, then provides particle tracers around the outer corners. + */ + public void enableTracer() { + + // First clear the mine: + clearMine( true ); + +// Prison.get().getPlatform().enableMineTracer( +// getWorldName(), +// getBounds().getMin(), +// getBounds().getMax()); + + + + } + + /** + *

This will adjust the size of the existing mine's area. + * Any voids left due to reductions in size will not be auto + * filled. + *

+ * + * @param edge + * @param amount + */ + public void adjustSize( Edges edge, int amount ) { + + // First clear the mine: + clearMine( false ); + + if ( amount < 0 ) { + while ( amount++ < 0 ) { + + new MineLinerBuilder( (Mine) this, edge, LinerPatterns.repair, false ); + + Bounds newBounds = new Bounds( getBounds(), edge, -1 ); + setBounds( newBounds ); + + new MineLinerBuilder( (Mine) this, edge, LinerPatterns.repair, false ); + } + } + else { + new MineLinerBuilder( (Mine) this, edge, LinerPatterns.repair, false ); + + Bounds newBounds = new Bounds( getBounds(), edge, amount ); + setBounds( newBounds ); + } + + + // Finally trace the mine: + clearMine( true ); + } + + + public void moveMine( Edges edge, int amount ) { + + MineMover moveMine = new MineMover(); + moveMine.moveMine( (Mine) this, edge, amount ); + } + + + public void clearMine( boolean tracer ) { + + MineTracerBuilder tracerBuilder = new MineTracerBuilder(); + tracerBuilder.clearMine( (Mine) this, tracer ); + } + + @Deprecated public List getRandomizedBlocks() { diff --git a/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineScheduler.java b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineScheduler.java index bbc130403..67a67276b 100644 --- a/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineScheduler.java +++ b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineScheduler.java @@ -205,6 +205,12 @@ protected List initializeJobWorkflow( double resetTime, boolean include { List workflow = new ArrayList<>(); + // if the mine is virtual, set the resetTime to four hours. It won't reset, but it will stay active + // in the workflow: + if ( isVirtual() ) { + resetTime = 60 * 60 * 4; // one hour * 4 + } + // Determine if the sync or async reset action should be used for this workflow. MineJobAction resetAction = isUsePagingOnReset() ? MineJobAction.RESET_ASYNC : MineJobAction.RESET_SYNC; @@ -348,6 +354,10 @@ public void run() @SuppressWarnings( "unused" ) private void checkWorld() { + if ( isVirtual() ) { + // ignore: + } + else if ( !isEnabled() ) { // Must try to load world again: Optional worldOptional = Prison.get().getPlatform().getWorld( getWorldName() ); @@ -436,7 +446,10 @@ private void submitNextAction(int offset) { * */ public void manualReset() { - manualReset( MineResetType.FORCED, 0 ); + + if ( !isVirtual() ) { + manualReset( MineResetType.FORCED, 0 ); + } } @@ -445,7 +458,8 @@ public boolean checkZeroBlockReset() { // Reset if the mine runs out of blocks: - if ( getRemainingBlockCount() == 0 && !isZeroBlockResetDisabled() || + if ( !isVirtual() && + getRemainingBlockCount() == 0 && !isZeroBlockResetDisabled() || getResetThresholdPercent() > 0 && getRemainingBlockCount() < (getBounds().getTotalBlockCount() * getResetThresholdPercent() / 100.0d)) { @@ -469,6 +483,12 @@ public boolean checkZeroBlockReset() { * */ private void manualReset( MineResetType resetType, double delayActionSec ) { + + if ( isVirtual() ) { + // Nope... nothing to reset... + return; + } + // cancel existing job: if ( getTaskId() != null ) { Prison.get().getPlatform().getScheduler().cancelTask( getTaskId() ); diff --git a/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineTracerBuilder.java b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineTracerBuilder.java new file mode 100644 index 000000000..810abbffb --- /dev/null +++ b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/MineTracerBuilder.java @@ -0,0 +1,133 @@ +package tech.mcprison.prison.mines.data; + +import java.util.Optional; + +import tech.mcprison.prison.Prison; +import tech.mcprison.prison.internal.World; +import tech.mcprison.prison.internal.block.PrisonBlock; +import tech.mcprison.prison.output.Output; +import tech.mcprison.prison.util.BlockType; +import tech.mcprison.prison.util.Location; + +public class MineTracerBuilder +{ + + public enum TracerType { + + pink("PINK_STAINED_GLASS"), + red("REd_STAINED_GLASS"), + + redstone("REDSTONE_BLOCK"), + dust("REDSTONE_wire"), // redstone_wire is the block, redstone is the inventory item + + air("AIR") + + ; + + private final String blockType; + + private TracerType( String blockType ) { + this.blockType = blockType; + } + + public String getBlockType() { + return blockType; + } + + public static TracerType fromString( String type ) { + TracerType results = TracerType.pink; + + for ( TracerType tracerType : values() ) + { + if ( tracerType.name().equalsIgnoreCase( type )) { + results = tracerType; + break; + } + } + + return results; + } + } + + public void clearMine( Mine mine, boolean tracer ) { + + if ( mine == null ) { + Output.get().logError(" #### NPE ###"); + } + try { + + if ( mine.isVirtual() ) { + // Mine is virtual and cannot be reset. Just skip this with no error messages. + return; + } + + + boolean useNewBlockModel = Prison.get().getPlatform().getConfigBooleanFalse( "use-new-prison-block-model" ); + + // Output.get().logInfo( "MineRest.resetSynchonouslyInternal() " + getName() ); + + Optional worldOptional = mine.getWorld(); + World world = worldOptional.get(); + + + PrisonBlock blockAirPB = new PrisonBlock( "AIR" ); + BlockType blockAirBT = BlockType.AIR; + + PrisonBlock blockRedPB = new PrisonBlock( "PINK_STAINED_GLASS" ); + BlockType blockRedBT = BlockType.PINK_STAINED_GLASS; + +// PrisonBlock blockRedstonePB = new PrisonBlock( "REDSTONE_BLOCK" ); +// BlockType blockRedstoneBT = BlockType.REDSTONE_BLOCK; + + + + // Reset the block break count before resetting the blocks: +// setBlockBreakCount( 0 ); +// Random random = new Random(); + + int yMin = mine.getBounds().getyBlockMin(); + int yMax = mine.getBounds().getyBlockMax(); + + int xMin = mine.getBounds().getxBlockMin(); + int xMax = mine.getBounds().getxBlockMax(); + + int zMin = mine.getBounds().getzBlockMin(); + int zMax = mine.getBounds().getzBlockMax(); + + for (int y = yMax; y >= yMin; y--) { +// for (int y = getBounds().getyBlockMin(); y <= getBounds().getyBlockMax(); y++) { + for (int x = xMin; x <= xMax; x++) { + for (int z = zMin; z <= zMax; z++) { + Location targetBlock = new Location(world, x, y, z); + + boolean xEdge = x == xMin || x == xMax; + boolean yEdge = y == yMin || y == yMax; + boolean zEdge = z == zMin || z == zMax; + + boolean isEdge = xEdge && yEdge || xEdge && zEdge || + yEdge && zEdge; + + if ( useNewBlockModel ) { + + targetBlock.getBlockAt().setPrisonBlock( + tracer && isEdge ? blockRedPB : blockAirPB ); + } + else { + + targetBlock.getBlockAt().setType( + tracer && isEdge ? blockRedBT : blockAirBT ); + } + } + } + } + + + } + catch (Exception e) { + Output.get().logError("&cFailed to clear mine " + mine.getName() + + " Error: [" + e.getMessage() + "]", e); + } + } + + +} diff --git a/prison-mines/src/main/java/tech/mcprison/prison/mines/data/PrisonSortableMines.java b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/PrisonSortableMines.java index a2a493948..051457c2c 100644 --- a/prison-mines/src/main/java/tech/mcprison/prison/mines/data/PrisonSortableMines.java +++ b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/PrisonSortableMines.java @@ -8,6 +8,7 @@ import tech.mcprison.prison.mines.PrisonMines; import tech.mcprison.prison.sorting.PrisonSorter; +@Deprecated public class PrisonSortableMines extends PrisonSorter { diff --git a/prison-mines/src/main/java/tech/mcprison/prison/mines/data/PrisonSortableResults.java b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/PrisonSortableResults.java new file mode 100644 index 000000000..1c7817c26 --- /dev/null +++ b/prison-mines/src/main/java/tech/mcprison/prison/mines/data/PrisonSortableResults.java @@ -0,0 +1,73 @@ +package tech.mcprison.prison.mines.data; + +import java.util.ArrayList; +import java.util.List; + +import tech.mcprison.prison.mines.managers.MineManager.MineSortOrder; + +public class PrisonSortableResults { + private List include = new ArrayList<>(); + private List exclude = new ArrayList<>(); + + private MineSortOrder sortOrder; + + public PrisonSortableResults( MineSortOrder sortOrder ) { + this.sortOrder = sortOrder; + } + + /** + *

This function, based upon the provided MineSortOrder, returns + * the correct list of mines either included, or excluded. + *

+ * + * @return + */ + public List getSortedList() { + return sortOrder.isExcluded() ? + getExclude() : + getInclude(); + } + public List getSortedSuppressedList() { + return !sortOrder.isExcluded() ? + getExclude() : + getInclude(); + } + + + public String getSuppressedListSortTypes() { + StringBuilder sb = new StringBuilder(); + + for ( MineSortOrder so : MineSortOrder.values() ) { + if ( so != MineSortOrder.invalid && getSortOrder().isExcluded() != so.isExcluded() ) { + if ( sb.length() > 0 ) { + sb.append( " " ); + } + sb.append( so.name() ); + } + } + + return sb.toString(); + } + + + public List getInclude() { + return include; + } + public void setInclude( List include ) { + this.include = include; + } + + public List getExclude() { + return exclude; + } + public void setExclude( List exclude ) { + this.exclude = exclude; + } + + public MineSortOrder getSortOrder() { + return sortOrder; + } + public void setSortOrder( MineSortOrder sortOrder ) { + this.sortOrder = sortOrder; + } +} diff --git a/prison-mines/src/main/java/tech/mcprison/prison/mines/managers/MineManager.java b/prison-mines/src/main/java/tech/mcprison/prison/mines/managers/MineManager.java index 875340b97..faa6b6bba 100644 --- a/prison-mines/src/main/java/tech/mcprison/prison/mines/managers/MineManager.java +++ b/prison-mines/src/main/java/tech/mcprison/prison/mines/managers/MineManager.java @@ -35,9 +35,11 @@ import tech.mcprison.prison.internal.World; import tech.mcprison.prison.mines.PrisonMines; import tech.mcprison.prison.mines.data.Mine; +import tech.mcprison.prison.mines.data.PrisonSortableResults; import tech.mcprison.prison.output.Output; import tech.mcprison.prison.store.Collection; import tech.mcprison.prison.store.Document; +import tech.mcprison.prison.util.PlaceholdersUtil; /** * Manages the creation, removal, and management of mines. @@ -47,12 +49,6 @@ public class MineManager implements ManagerPlaceholders { - public static final double TIME_SECOND = 1.0; - public static final double TIME_MINUTE = TIME_SECOND * 60.0; - public static final double TIME_HOUR = TIME_MINUTE * 60.0; - public static final double TIME_DAY = TIME_HOUR * 24.0; - - // Base list private List mines; private TreeMap minesByName; @@ -65,6 +61,127 @@ public class MineManager private boolean mineStats = false; + /** + *

These sort orders control how the mines are sorted, and which ones + * are omitted from the result's included list of mines. + *

+ * + *

The type invalid is used to indicate that String value could not be + * converted to a MineSortOrder when using the fromString() function. + *

+ * + *

There are three primary sort orders: sortOrder, alpha, and active. + * Those primary three excludes any mine that has a sortOrder of -1. + * Each of these has a counter sort type that includes the excluded + * mines, and are: xSortOrder, xAplha, and xActive. + *

+ * + * + */ + public enum MineSortOrder { + + /** + * The sort order is based upon the mine's sortOrder field. If more than + * one mine exists within a sortOrder, then they will be sub-sorted by + * alphabetical order. Mines are excluded if they have a sortOrder of -1, + * but are placed within the exclude results set and they are sub-sorted + * alphabetically. + */ + sortOrder, + + /** + * All mines are sorted by alphabetical order. Mines are excluded if they + * have a sortOrder of -1, but are placed within the exclude results set + * and they are sub-sorted alphabetically. + */ + alpha, + + /** + * This provides a list of mines with the most active mines sorted to the + * top of the list. + * + * All mines are sorted alphabetically, with the most active mines being + * placed at the very top of the list. The value of totalBlocksMined is + * used to order the mines. The value of totalBlocksMined resets to zero + * upon server restart. So this provides the most active mines + * since the server started. Mines are excluded if they have a + * sortOrder of -1, but are placed within the exclude results set and + * they are sub-sorted alphabetically. + */ + active, + + /** + * Same as sortOrder but ignores excluded mines. + */ + xSortOrder(true), + + /** + * Same as alpha but ignores excluded mines. + */ + xAlpha(true), + /** + * Same as active but ignores excluded mines. + */ + xActive(true), + + /** + * Not a valid sort order, but is used within the fromString to indicate + * that the parameter sortOrder is invalid. + */ + invalid; + + private final boolean excluded; + + private MineSortOrder( boolean excluded ) { + this.excluded = excluded; + + } + private MineSortOrder() { + this(false); + } + + public boolean isExcluded() { + return excluded; + } + + public static MineSortOrder fromString( String sortOrder ) { + MineSortOrder results = MineSortOrder.invalid; + + if ( sortOrder != null && sortOrder.trim().length() > 0 ) { + for ( MineSortOrder so : values() ) { + if ( so.name().equalsIgnoreCase( sortOrder ) ) { + results = so; + break; + } + } + + } + + return results; + } + + /** + * Returns a space separated list of available sort orders, omitting + * invalid. + * + * @return + */ + static String availableSortOrders() { + StringBuilder sb = new StringBuilder(); + + for ( MineSortOrder so : values() ) { + if ( so != invalid ) { + if ( sb.length() > 0 ) { + sb.append( " " ); + } + sb.append( so.name() ); + } + } + + return sb.toString(); + } + } + /** *

MineManager must be fully instantiated prior to trying to load the mines, * otherwise if the mines cannot find the world they should be, they will be @@ -183,7 +300,7 @@ public boolean removeMine(Mine mine) { boolean success = false; if ( mine != null ) { coll.delete( mine.getName() ); - getMinesByName().remove(mine.getName()); + getMinesByName().remove(mine.getName().toLowerCase()); success = getMines().remove(mine); } return success; @@ -223,6 +340,24 @@ public void saveMines(){ } } + + + + public void rename( Mine mine, String newName ) { + + String oldMineName = mine.getName(); + + // Remove the old mine: + removeMine( oldMineName ); + + // rename the mine: + mine.setName( newName ); + + // Add the mine back with the new name: + add( mine ); + + } + /** * Returns the mine with the specified name. @@ -240,6 +375,50 @@ public Mine getMine(String mineName) { public List getMines() { return mines; } + + public PrisonSortableResults getMines( MineSortOrder sortOrder ) { + return getMines( sortOrder, getMines() ); + } + + protected PrisonSortableResults getMines( MineSortOrder sortOrder, List mines ) { + PrisonSortableResults results = new PrisonSortableResults( sortOrder ); + + + // if invalid, then that's invalid, so default to sortOrder: + if ( sortOrder == MineSortOrder.invalid ) { + sortOrder = MineSortOrder.sortOrder; + } + + + for ( Mine mine : mines ) { + if ( mine.getSortOrder() < 0 ) { + results.getExclude().add( mine ); + } + else { + results.getInclude().add( mine ); + } + } + + // Sort first by name, then by other means if needed: + results.getInclude().sort( (a, b) -> a.getName().compareToIgnoreCase( b.getName()) ); + results.getExclude().sort( (a, b) -> a.getName().compareToIgnoreCase( b.getName()) ); + + if ( sortOrder == MineSortOrder.sortOrder || sortOrder == MineSortOrder.xSortOrder ) { + results.getInclude().sort( (a, b) -> Integer.compare( a.getSortOrder(), b.getSortOrder()) ); + results.getExclude().sort( (a, b) -> Integer.compare( a.getSortOrder(), b.getSortOrder()) ); + } + + // for now hold off on sorting by total blocks mined. + else if ( sortOrder == MineSortOrder.active || sortOrder == MineSortOrder.xActive ) { + results.getInclude().sort( (a, b) -> Long.compare(b.getTotalBlocksMined(), a.getTotalBlocksMined()) ); + results.getExclude().sort( (a, b) -> Long.compare(b.getTotalBlocksMined(), a.getTotalBlocksMined()) ); + } + + return results; + } + + + public TreeMap getMinesByName() { return minesByName; @@ -398,6 +577,20 @@ private String getTranslateMinesPlaceHolder( PlaceHolderKey placeHolderKey, Mine DecimalFormat iFmt = new DecimalFormat("#,##0"); switch ( placeHolderKey.getPlaceholder() ) { + case prison_mn_minename: + case prison_mines_name_minename: + case prison_mn_pm: + case prison_mines_name_playermines: + results = mine.getName(); + break; + + case prison_mt_minename: + case prison_mines_tag_minename: + case prison_mt_pm: + case prison_mines_tag_playermines: + results = mine.getTag() == null ? mine.getName() : mine.getTag(); + break; + case prison_mi_minename: case prison_mines_interval_minename: case prison_mi_pm: @@ -410,7 +603,7 @@ private String getTranslateMinesPlaceHolder( PlaceHolderKey placeHolderKey, Mine case prison_mif_pm: case prison_mines_interval_formatted_playermines: double timeMif = mine.getResetTime(); - results = formattedTime( timeMif ); + results = PlaceholdersUtil.formattedTime( timeMif ); break; case prison_mtl_minename: @@ -436,7 +629,7 @@ private String getTranslateMinesPlaceHolder( PlaceHolderKey placeHolderKey, Mine case prison_mines_timeleft_formatted_playermines: // NOTE: timeleft can vary based upon server loads: double timeMtlf = mine.getRemainingTimeSec(); - results = formattedTime( timeMtlf ); + results = PlaceholdersUtil.formattedTime( timeMtlf ); break; case prison_ms_minename: @@ -599,38 +792,7 @@ private String getRemainingTimeBar( Mine mine ) { } - private String formattedTime( double time ) { - StringBuilder sb = new StringBuilder(); - - long days = (long)(time / TIME_DAY); - time -= (days * TIME_DAY); - if ( days > 0 ) { - sb.append( days ); - sb.append( "d " ); - } - - long hours = (long)(time / TIME_HOUR); - time -= (hours * TIME_HOUR); - if ( sb.length() > 0 || hours > 0 ) { - sb.append( hours ); - sb.append( "h " ); - } - - long mins = (long)(time / TIME_MINUTE); - time -= (mins * TIME_MINUTE); - if ( sb.length() > 0 || mins > 0 ) { - sb.append( mins ); - sb.append( "m " ); - } - - double secs = (double)(time / TIME_SECOND); - time -= (secs * TIME_SECOND); - DecimalFormat dFmt = new DecimalFormat("#0"); - sb.append( dFmt.format( secs )); - sb.append( "s " ); - - return sb.toString(); - } + /** diff --git a/prison-mines/src/test/java/tech/mcprison/prison/mines/data/MineLinerBuilderTest.java b/prison-mines/src/test/java/tech/mcprison/prison/mines/data/MineLinerBuilderTest.java new file mode 100644 index 000000000..6518f47fd --- /dev/null +++ b/prison-mines/src/test/java/tech/mcprison/prison/mines/data/MineLinerBuilderTest.java @@ -0,0 +1,29 @@ +package tech.mcprison.prison.mines.data; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import tech.mcprison.prison.util.Bounds.Edges; + +public class MineLinerBuilderTest + extends + MineLinerBuilder +{ + + @Test + public void apply2Dto3DPattern() + { + String[][] pattern2d = { + { "a", "b" }, + { "c", "d" } + }; + + getPattern3d().clear(); + + apply2Dto3DPattern( Edges.bottom, pattern2d ); + + assertEquals( 2, getPattern3d().size() ); + } + +} diff --git a/prison-mines/src/test/java/tech/mcprison/prison/mines/managers/MineManagerTest.java b/prison-mines/src/test/java/tech/mcprison/prison/mines/managers/MineManagerTest.java new file mode 100644 index 000000000..7851dd110 --- /dev/null +++ b/prison-mines/src/test/java/tech/mcprison/prison/mines/managers/MineManagerTest.java @@ -0,0 +1,201 @@ +package tech.mcprison.prison.mines.managers; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +import tech.mcprison.prison.mines.data.Mine; +import tech.mcprison.prison.mines.data.PrisonSortableResults; + +public class MineManagerTest + extends + MineManager +{ + private List getTestMines() { + List mines = new ArrayList<>(); + + Mine a = new Mine(); + a.setName( "A" ); + Mine b = new Mine(); + b.setName( "b" ); + Mine c = new Mine(); + c.setName( "C" ); + Mine d = new Mine(); + d.setName( "D" ); + + mines.add( d ); + mines.add( b ); + mines.add( a ); + mines.add( c ); + + return mines; + } + + public String toString(List mines, String desc ) { + StringBuilder sb = new StringBuilder(); + + for ( Mine mine : mines ) { + if ( sb.length() > 0 ) { + sb.append( " " ); + } + sb.append( mine.getName() + " : sort= " + mine.getSortOrder() + + " mined= " + mine.getTotalBlocksMined() + ", "); + } + + sb.insert( 0, desc + "\n" ); + sb.append( "\n - - - - \n" ); + return sb.toString(); + } + + @Test + public void testGetMinesMineSortOrderListOfMine() { + List mines = getTestMines(); + + + // check to make sure the mines are in an unsorted order: + assertEquals( "D", mines.get( 0 ).getName() ); + assertEquals( "b", mines.get( 1 ).getName() ); + assertEquals( "A", mines.get( 2 ).getName() ); + assertEquals( "C", mines.get( 3 ).getName() ); + + System.out.println( toString(mines, "Before sort:") ); + + // sort by alpha and confirm: + PrisonSortableResults sorted = getMines( MineSortOrder.alpha, mines ); + System.out.println( toString(sorted.getSortedList(), "After alpha:") ); + + assertEquals( "A", sorted.getSortedList().get( 0 ).getName() ); + assertEquals( "b", sorted.getSortedList().get( 1 ).getName() ); + assertEquals( "C", sorted.getSortedList().get( 2 ).getName() ); + assertEquals( "D", sorted.getSortedList().get( 3 ).getName() ); + + // Set mine b to sortOrder -1 so it is not included in alpha sort: + mines.get( 1 ).setSortOrder( -1 ); + + // Resort with alpha and b should not be included: + sorted = getMines( MineSortOrder.alpha, sorted.getSortedList() ); + System.out.println( toString(sorted.getSortedList(), "After alpha without b:") ); + + // Without mine b: + assertEquals( "A", sorted.getSortedList().get( 0 ).getName() ); + // assertEquals( "b", sorted.getSortedList().get( 1 ).getName() ); + assertEquals( "C", sorted.getSortedList().get( 1 ).getName() ); + assertEquals( "D", sorted.getSortedList().get( 2 ).getName() ); + + + // Reset and now sort with alphaAll: + mines = getTestMines(); // d, b, a, c + mines.get( 1 ).setSortOrder( -1 ); + sorted = getMines( MineSortOrder.xAlpha, mines ); + System.out.println( toString(sorted.getSortedList(), "After xAlpha with only the excluded:") ); + +// assertEquals( "A", sorted.getSortedList().get( 0 ).getName() ); + assertEquals( "b", sorted.getSortedList().get( 0 ).getName() ); +// assertEquals( "C", sorted.getSortedList().get( 2 ).getName() ); +// assertEquals( "D", sorted.getSortedList().get( 3 ).getName() ); + + + // Reset and now sort with active: + mines = getTestMines(); // d, b, a, c + //mines.get( 1 ).setSortOrder( -1 ); + mines.get( 1 ).setTotalBlocksMined( 5 ); // b + mines.get( 3 ).setTotalBlocksMined( 1 ); // C + sorted = getMines( MineSortOrder.active, mines ); + System.out.println( toString(sorted.getSortedList(), "After active:") ); + + assertEquals( "b", sorted.getSortedList().get( 0 ).getName() ); + assertEquals( "C", sorted.getSortedList().get( 1 ).getName() ); + assertEquals( "A", sorted.getSortedList().get( 2 ).getName() ); + assertEquals( "D", sorted.getSortedList().get( 3 ).getName() ); + + + // Reset and now sort with active: + mines = getTestMines(); // d, b, a, c + mines.get( 1 ).setSortOrder( -1 ); + mines.get( 1 ).setTotalBlocksMined( 5 ); + mines.get( 3 ).setTotalBlocksMined( 1 ); + sorted = getMines( MineSortOrder.active, mines ); + System.out.println( toString(sorted.getSortedList(), "After active & suppress:") ); + + // assertEquals( "b", sorted.getSortedList().get( 0 ).getName() ); + assertEquals( "C", sorted.getSortedList().get( 0 ).getName() ); + assertEquals( "A", sorted.getSortedList().get( 1 ).getName() ); + assertEquals( "D", sorted.getSortedList().get( 2 ).getName() ); + + + + // Reset and now sort with allActive: + mines = getTestMines(); // d, b, a, c + mines.get( 1 ).setSortOrder( -1 ); + mines.get( 1 ).setTotalBlocksMined( 5 ); + mines.get( 3 ).setTotalBlocksMined( 1 ); + sorted = getMines( MineSortOrder.xActive, mines ); + System.out.println( toString(sorted.getSortedList(), "After xActive:") ); + + assertEquals( "b", sorted.getSortedList().get( 0 ).getName() ); +// assertEquals( "C", sorted.getSortedList().get( 1 ).getName() ); +// assertEquals( "A", sorted.getSortedList().get( 2 ).getName() ); +// assertEquals( "D", sorted.getSortedList().get( 3 ).getName() ); + + + + + // Reset and now sort with sortOrder and no -1: + mines = getTestMines(); // d, b, a, c + mines.get( 0 ).setSortOrder( 9 ); + mines.get( 1 ).setSortOrder( 7 ); + mines.get( 2 ).setSortOrder( 5 ); + mines.get( 3 ).setSortOrder( 3 ); + //mines.get( 1 ).setSortOrder( -1 ); + mines.get( 1 ).setTotalBlocksMined( 5 ); + mines.get( 3 ).setTotalBlocksMined( 1 ); + sorted = getMines( MineSortOrder.sortOrder, mines ); + System.out.println( toString(sorted.getSortedList(), "After sortOrder:") ); + + assertEquals( "C", sorted.getSortedList().get( 0 ).getName() ); + assertEquals( "A", sorted.getSortedList().get( 1 ).getName() ); + assertEquals( "b", sorted.getSortedList().get( 2 ).getName() ); + assertEquals( "D", sorted.getSortedList().get( 3 ).getName() ); + + + + + // Reset and now sort with sortOrder with a -1 on b: + mines = getTestMines(); // d, b, a, c + mines.get( 0 ).setSortOrder( 9 ); + mines.get( 1 ).setSortOrder( -1 ); + mines.get( 2 ).setSortOrder( 5 ); + mines.get( 3 ).setSortOrder( 3 ); + mines.get( 1 ).setTotalBlocksMined( 5 ); + mines.get( 3 ).setTotalBlocksMined( 1 ); + sorted = getMines( MineSortOrder.sortOrder, mines ); + System.out.println( toString(sorted.getSortedList(), "After sortOrder:") ); + + assertEquals( "C", sorted.getSortedList().get( 0 ).getName() ); + assertEquals( "A", sorted.getSortedList().get( 1 ).getName() ); + // assertEquals( "b", sorted.getSortedList().get( 2 ).getName() ); + assertEquals( "D", sorted.getSortedList().get( 2 ).getName() ); + + + // Reset and now sort with sortOrder with a -1 on b: + mines = getTestMines(); // d, b, a, c + mines.get( 0 ).setSortOrder( 9 ); + mines.get( 1 ).setSortOrder( -1 ); + mines.get( 2 ).setSortOrder( 5 ); + mines.get( 3 ).setSortOrder( 3 ); + mines.get( 3 ).setTotalBlocksMined( 5 ); + mines.get( 0 ).setTotalBlocksMined( 1 ); + sorted = getMines( MineSortOrder.xSortOrder, mines ); + System.out.println( toString(sorted.getSortedList(), "After xSortOrder:") ); + + assertEquals( "b", sorted.getSortedList().get( 0 ).getName() ); +// assertEquals( "C", sorted.getSortedList().get( 1 ).getName() ); +// assertEquals( "A", sorted.getSortedList().get( 2 ).getName() ); +// assertEquals( "D", sorted.getSortedList().get( 3 ).getName() ); + + } + +} 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 7588b0e06..af8cf5e41 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 @@ -144,10 +144,20 @@ public static PrisonRanks getInstance() { // Load up the commands - Prison.get().getCommandHandler().registerCommands(new RankUpCommand()); - Prison.get().getCommandHandler().registerCommands(new CommandCommands()); - Prison.get().getCommandHandler().registerCommands(new RanksCommands()); - Prison.get().getCommandHandler().registerCommands(new LadderCommands()); + CommandCommands rankCommandCommands = new CommandCommands(); + RanksCommands ranksCommands = new RanksCommands(rankCommandCommands ); + RankUpCommand rankupCommands = new RankUpCommand(); + LadderCommands ladderCommands = new LadderCommands(); + + rankManager.setRankCommandCommands( rankCommandCommands ); + rankManager.setRanksCommands( ranksCommands ); + rankManager.setRankupCommands( rankupCommands ); + rankManager.setLadderCommands( ladderCommands ); + + Prison.get().getCommandHandler().registerCommands( rankCommandCommands ); + Prison.get().getCommandHandler().registerCommands( ranksCommands ); + Prison.get().getCommandHandler().registerCommands( rankupCommands ); + Prison.get().getCommandHandler().registerCommands( ladderCommands ); // Load up all else diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/RankConversionAgent.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/RankConversionAgent.java index 26cc2d0e7..940eba67d 100644 --- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/RankConversionAgent.java +++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/RankConversionAgent.java @@ -50,7 +50,7 @@ public class RankConversionAgent implements ConversionAgent { prefix = prefix + "&3]"; } - if(PrisonRanks.getInstance().getRankManager().getRank(name).isPresent()) { + if(PrisonRanks.getInstance().getRankManager().getRank(name) != null) { break; // Already added } @@ -67,15 +67,15 @@ public class RankConversionAgent implements ConversionAgent { break; // It failed } - try { +// try { PrisonRanks.getInstance().getRankManager().saveRank(ourRank.get()); - } catch (IOException e) { - String nonNullName = name == null ? "null" : name; - PrisonRanks.getInstance().getErrorManager().throwError( - new Error("while converting ranks") - .appendStackTrace("while saving rank " + nonNullName, e)); - break; // Skip this... - } +// } catch (IOException e) { +// String nonNullName = name == null ? "null" : name; +// PrisonRanks.getInstance().getErrorManager().throwError( +// new Error("while converting ranks") +// .appendStackTrace("while saving rank " + nonNullName, e)); +// break; // Skip this... +// } rankLadderOptional.get().addRank(ourRank.get()); try { diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/RankUtil.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/RankUtil.java index 3b8fa7187..f71796bb3 100644 --- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/RankUtil.java +++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/RankUtil.java @@ -26,7 +26,6 @@ import tech.mcprison.prison.PrisonAPI; import tech.mcprison.prison.integration.EconomyCurrencyIntegration; import tech.mcprison.prison.integration.EconomyIntegration; -import tech.mcprison.prison.integration.IntegrationType; import tech.mcprison.prison.internal.Player; import tech.mcprison.prison.output.Output; import tech.mcprison.prison.ranks.data.Rank; @@ -98,6 +97,7 @@ public enum RankupTransactions { next_rank_set, set_to_default_rank, + original_rank_is_null, set_to_next_higher_rank, set_to_prior_lower_rank, @@ -124,7 +124,7 @@ public enum RankupTransactions { fireRankupEvent, rankup_successful, - failure_exception_caught_check_server_logs, + failure_exception_caught_check_server_logs ; } @@ -290,8 +290,10 @@ private void rankupPlayerInternal(RankupResults results, Optional currentRankOptional = player.getRank(ladder); + Rank originalRank = currentRankOptional.orElse( null ); + results.addTransaction( RankupTransactions.orginal_rank ); - results.setOriginalRank( currentRankOptional.orElse( null ) ); + results.setOriginalRank( originalRank ); Rank targetRank = null; @@ -312,6 +314,14 @@ private void rankupPlayerInternal(RankupResults results, } results.addTransaction( RankupTransactions.set_to_default_rank ); targetRank = lowestRank.get(); + + // need to set this to a valid value: + originalRank = lowestRank.get(); + } + + if ( originalRank == null ) { + results.addTransaction( RankupTransactions.original_rank_is_null ); + } // If default ladder and rank is null at this point, that means use the "default" rank: @@ -329,10 +339,10 @@ private void rankupPlayerInternal(RankupResults results, } if ( targetRank == null && rankName != null ) { - Optional rankOptional = PrisonRanks.getInstance().getRankManager().getRank( rankName ); - if ( rankOptional.isPresent() ) { - targetRank = rankOptional.get(); + targetRank = PrisonRanks.getInstance().getRankManager().getRank( rankName ); + + if ( targetRank != null ) { if ( !ladder.containsRank( targetRank.id )) { results.addTransaction( RankupStatus.RANKUP_FAILURE_RANK_IS_NOT_IN_LADDER, @@ -397,6 +407,7 @@ private void rankupPlayerInternal(RankupResults results, // We'll check if the player can afford it first, and if so, we'll make the transaction and proceed. double nextRankCost = targetRank.cost; + double currentRankCost = (originalRank == null ? 0 : originalRank.cost); if (pForceCharge != PromoteForceCharge.no_charge ) { @@ -428,11 +439,15 @@ private void rankupPlayerInternal(RankupResults results, if ( pForceCharge == PromoteForceCharge.refund_player) { results.addTransaction( RankupTransactions.player_balance_initial ); - results.setBalanceInitial( currencyEcon.getBalance( prisonPlayer, targetRank.currency ) ); + results.setBalanceInitial( originalRank == null ? 0 : + currencyEcon.getBalance( prisonPlayer, originalRank.currency ) ); results.addTransaction( RankupTransactions.player_balance_increased); - currencyEcon.addBalance(prisonPlayer, nextRankCost, targetRank.currency ); + if ( originalRank != null ) { + currencyEcon.addBalance(prisonPlayer, currentRankCost, originalRank.currency ); + } results.addTransaction( RankupTransactions.player_balance_final ); - results.setBalanceFinal( currencyEcon.getBalance( prisonPlayer, targetRank.currency ) ); + results.setBalanceFinal( originalRank == null ? 0 : + currencyEcon.getBalance( prisonPlayer, originalRank.currency ) ); } else { // Should never hit this code!! } @@ -441,8 +456,8 @@ private void rankupPlayerInternal(RankupResults results, } else { - EconomyIntegration economy = (EconomyIntegration) PrisonAPI.getIntegrationManager() - .getForType(IntegrationType.ECONOMY).orElseThrow(IllegalStateException::new); + EconomyIntegration economy = PrisonAPI.getIntegrationManager().getEconomy(); + if ( pForceCharge == PromoteForceCharge.charge_player) { if (!economy.canAfford(prisonPlayer, nextRankCost)) { //results.setTargetRank( targetRank ); @@ -463,7 +478,7 @@ private void rankupPlayerInternal(RankupResults results, results.addTransaction( RankupTransactions.player_balance_initial ); results.setBalanceInitial( economy.getBalance( prisonPlayer ) ); results.addTransaction( RankupTransactions.player_balance_increased); - economy.addBalance(prisonPlayer, nextRankCost ); + economy.addBalance(prisonPlayer, currentRankCost ); results.addTransaction( RankupTransactions.player_balance_final ); results.setBalanceFinal( economy.getBalance( prisonPlayer ) ); } else { @@ -581,7 +596,7 @@ private void logTransactionResults( RankupResults results ) case player_balance_increased: sb.append( "=" ); - sb.append( tRank == null ? "" : dFmt.format( tRank.cost ) ); + sb.append( tRank == null ? "" : dFmt.format( oRank.cost ) ); break; diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/CommandCommands.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/CommandCommands.java index 5df2a0f5f..54b0fdae5 100644 --- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/CommandCommands.java +++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/CommandCommands.java @@ -1,38 +1,37 @@ package tech.mcprison.prison.ranks.commands; +import java.util.ArrayList; + import tech.mcprison.prison.chat.FancyMessage; import tech.mcprison.prison.commands.Arg; +import tech.mcprison.prison.commands.BaseCommands; import tech.mcprison.prison.commands.Command; import tech.mcprison.prison.commands.Wildcard; import tech.mcprison.prison.internal.CommandSender; -import tech.mcprison.prison.localization.Localizable; -import tech.mcprison.prison.localization.Localizable.Level; import tech.mcprison.prison.output.BulletedListComponent; import tech.mcprison.prison.output.ChatDisplay; import tech.mcprison.prison.output.FancyMessageComponent; +import tech.mcprison.prison.output.LogLevel; import tech.mcprison.prison.output.Output; import tech.mcprison.prison.ranks.PrisonRanks; import tech.mcprison.prison.ranks.data.Rank; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Optional; - /** * @author Faizaan A. Datoo */ -public class CommandCommands { +public class CommandCommands + extends BaseCommands { public CommandCommands() { - super(); + super( "CommandCommands" ); - // Now this is slight strange. Once in a while I've been seeing exceptions that the + // Now this is slightly strange. Once in a while I've been seeing exceptions that the // following class cannot be resolved. So I don't know why it can't, but it was not // being used directly within this Ranks module, so it's being added here just to // allow the compiler to add it, and so hopefully the class loaders at run time can // finally access it consistently. @SuppressWarnings( "unused" ) - Level force = Localizable.Level.ERROR; + LogLevel force = LogLevel.ERROR; } @Command(identifier = "ranks command add", @@ -47,27 +46,26 @@ public void commandAdd(CommandSender sender, command = command.replaceFirst("/", ""); } - Optional rankOptional = PrisonRanks.getInstance().getRankManager().getRank(rankName); - if (!rankOptional.isPresent()) { + Rank rank = PrisonRanks.getInstance().getRankManager().getRank(rankName); + if ( rank == null ) { Output.get().sendError(sender, "The rank '%s' does not exist.", rankName); return; } - Rank rank = rankOptional.get(); if (rank.rankUpCommands == null) { rank.rankUpCommands = new ArrayList<>(); } rank.rankUpCommands.add(command); - try { +// try { PrisonRanks.getInstance().getRankManager().saveRank( rank ); Output.get().sendInfo(sender, "Added command '%s' to the rank '%s'.", command, rank.name); - } catch (IOException e) { - Output.get().sendError(sender, - "The new command for the rank could not be saved to disk. Check the console for details."); - Output.get().logError("Rank could not be written to disk.", e); - } +// } catch (IOException e) { +// Output.get().sendError(sender, +// "The new command for the rank could not be saved to disk. Check the console for details."); +// Output.get().logError("Rank could not be written to disk.", e); +// } } @@ -83,12 +81,11 @@ public void commandRemove(CommandSender sender, command = command.replaceFirst("/", ""); } - Optional rankOptional = PrisonRanks.getInstance().getRankManager().getRank(rankName); - if (!rankOptional.isPresent()) { + Rank rank = PrisonRanks.getInstance().getRankManager().getRank(rankName); + if ( rank == null) { Output.get().sendError(sender, "The rank '%s' does not exist.", rankName); return; } - Rank rank = rankOptional.get(); if (rank.rankUpCommands == null) { rank.rankUpCommands = new ArrayList<>(); @@ -96,16 +93,16 @@ public void commandRemove(CommandSender sender, if ( rank.rankUpCommands.remove(command) ) { - try { +// try { PrisonRanks.getInstance().getRankManager().saveRank( rank ); Output.get() .sendInfo(sender, "Removed command '%s' from the rank '%s'.", command, rank.name); - } catch (IOException e) { - Output.get().sendError(sender, - "The updated rank could not be saved to disk. Check the console for details."); - Output.get().logError("Rank could not be written to disk.", e); - } +// } catch (IOException e) { +// Output.get().sendError(sender, +// "The updated rank could not be saved to disk. Check the console for details."); +// Output.get().logError("Rank could not be written to disk.", e); +// } } else { Output.get() .sendWarn(sender, "The rank doesn't contain that command. Nothing was changed."); @@ -117,12 +114,11 @@ public void commandRemove(CommandSender sender, public void commandList(CommandSender sender, @Arg(name = "rankName") String rankName) { - Optional rankOptional = PrisonRanks.getInstance().getRankManager().getRank(rankName); - if (!rankOptional.isPresent()) { + Rank rank = PrisonRanks.getInstance().getRankManager().getRank(rankName); + if ( rank == null ) { Output.get().sendError(sender, "The rank '%s' does not exist.", rankName); return; } - Rank rank = rankOptional.get(); if (rank.rankUpCommands == null || rank.rankUpCommands.size() == 0) { Output.get().sendInfo(sender, "The rank '%s' contains no commands.", rank.name); diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/LadderCommands.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/LadderCommands.java index 99aede2eb..c28d44c88 100644 --- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/LadderCommands.java +++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/commands/LadderCommands.java @@ -1,6 +1,7 @@ package tech.mcprison.prison.ranks.commands; import tech.mcprison.prison.commands.Arg; +import tech.mcprison.prison.commands.BaseCommands; import tech.mcprison.prison.commands.Command; import tech.mcprison.prison.internal.CommandSender; import tech.mcprison.prison.output.BulletedListComponent; @@ -16,7 +17,12 @@ /** * @author Faizaan A. Datoo */ -public class LadderCommands { +public class LadderCommands + extends BaseCommands { + + public LadderCommands() { + super( "LadderCommands" ); + } @Command(identifier = "ranks ladder create", description = "Creates a new rank ladder.", onlyPlayers = false, permissions = "ranks.ladder") @@ -110,17 +116,22 @@ public void ladderInfo(CommandSender sender, @Arg(name = "ladderName") String la new BulletedListComponent.BulletedListBuilder(); boolean first = true; - for (RankLadder.PositionRank rank : ladder.get().ranks) { - Optional rankOptional = - PrisonRanks.getInstance().getRankManager().getRank(rank.getRankId()); - if(!rankOptional.isPresent()) { - continue; // Skip it - } + for (RankLadder.PositionRank rankPos : ladder.get().ranks) { + Rank rank = PrisonRanks.getInstance().getRankManager().getRank(rankPos.getRankId()); + if ( rank == null ) { + continue; + } + +// Optional rankOptional = +// PrisonRanks.getInstance().getRankManager().getRankOptional(rankPos.getRankId()); +// if(!rankOptional.isPresent()) { +// continue; // Skip it +// } boolean defaultRank = ("default".equalsIgnoreCase( ladderName ) && first); - builder.add("&3#%d &8- &3%s %s", rank.getPosition(), - rankOptional.get().name, + builder.add("&3#%d &8- &3%s %s", rankPos.getPosition(), + rank.name, (defaultRank ? "&b(&9Default Rank&b) &7-" : "") ); first = false; @@ -132,12 +143,31 @@ public void ladderInfo(CommandSender sender, @Arg(name = "ladderName") String la display.send(sender); } + + @Command(identifier = "ranks ladder moveRank", description = "Moves a rank to a new " + + "ladder position or a new ladder.", + onlyPlayers = false, permissions = "ranks.ladder") + public void ladderMoveRank(CommandSender sender, + @Arg(name = "ladderName") String ladderName, + @Arg(name = "rankName") String rankName, + @Arg(name = "position", def = "0", verifiers = "min[0]", + description = "Position where you want the rank to be moved to. " + + "0 is the first position in the ladder.") int position) { + sender.sendMessage( "Attempting to remove the specified rank from it's original ladder, " + + "then it will be added back to the target ladder at the spcified location. The rank " + + "will not be lost." ); + ladderRemoveRank( sender, ladderName, rankName ); + ladderAddRank(sender, ladderName, rankName, position ); + } - @Command(identifier = "ranks ladder addrank", description = "Adds a rank to a ladder.", + @Command(identifier = "ranks ladder addrank", description = "Adds a rank to a ladder, or move a rank.", onlyPlayers = false, permissions = "ranks.ladder") - public void ladderAddRank(CommandSender sender, @Arg(name = "ladderName") String ladderName, - @Arg(name = "rankName") String rankName, - @Arg(name = "position", def = "0", verifiers = "min[0]") int position) { + public void ladderAddRank(CommandSender sender, + @Arg(name = "ladderName") String ladderName, + @Arg(name = "rankName") String rankName, + @Arg(name = "position", def = "0", verifiers = "min[0]", + description = "Position where you want the rank to be added. " + + "0 is the first position in the ladder.") int position) { Optional ladder = PrisonRanks.getInstance().getLadderManager().getLadder(ladderName); if (!ladder.isPresent()) { @@ -145,13 +175,14 @@ public void ladderAddRank(CommandSender sender, @Arg(name = "ladderName") String return; } - Optional rank = PrisonRanks.getInstance().getRankManager().getRank(rankName); - if (!rank.isPresent()) { + Rank rank = PrisonRanks.getInstance().getRankManager().getRank(rankName); +// Optional rank = PrisonRanks.getInstance().getRankManager().getRankOptional(rankName); + if ( rank == null ) { Output.get().sendError(sender, "The rank '%s' doesn't exist.", rankName); return; } - if (ladder.get().containsRank(rank.get().id)) { + if (ladder.get().containsRank(rank.id)) { Output.get() .sendError(sender, "The ladder '%s' already contains the rank '%s'.", ladderName, rankName); @@ -159,16 +190,16 @@ public void ladderAddRank(CommandSender sender, @Arg(name = "ladderName") String } if (position > 0) { - ladder.get().addRank(position, rank.get()); + ladder.get().addRank(position, rank); } else { - ladder.get().addRank(rank.get()); + ladder.get().addRank(rank); } try { PrisonRanks.getInstance().getLadderManager().saveLadder(ladder.get()); - Output.get().sendInfo(sender, "Added rank '%s' to ladder '%s'.", rank.get().name, - ladder.get().name); + Output.get().sendInfo(sender, "Added rank '%s' to ladder '%s' in position %s.", + rank.name, ladder.get().name, Integer.toString( position )); } catch (IOException e) { Output.get().sendError(sender, "An error occurred while adding a rank to your ladder. &8Check the console for details."); @@ -187,18 +218,19 @@ public void ladderRemoveRank(CommandSender sender, @Arg(name = "ladderName") Str return; } - Optional rank = PrisonRanks.getInstance().getRankManager().getRank(rankName); - if (!rank.isPresent()) { + Rank rank = PrisonRanks.getInstance().getRankManager().getRank(rankName); +// Optional rank = PrisonRanks.getInstance().getRankManager().getRankOptional(rankName); + if ( rank == null ) { Output.get().sendError(sender, "The rank '%s' doesn't exist.", rankName); return; } - ladder.get().removeRank(ladder.get().getPositionOfRank(rank.get())); + ladder.get().removeRank(ladder.get().getPositionOfRank(rank)); try { PrisonRanks.getInstance().getLadderManager().saveLadder(ladder.get()); - Output.get().sendInfo(sender, "Removed rank '%s' from ladder '%s'.", rank.get().name, + Output.get().sendInfo(sender, "Removed rank '%s' from ladder '%s'.", rank.name, ladder.get().name); } catch (IOException e) { Output.get().sendError(sender, 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 998ecebd6..19da1e5e3 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 @@ -24,9 +24,9 @@ import tech.mcprison.prison.Prison; import tech.mcprison.prison.PrisonAPI; import tech.mcprison.prison.commands.Arg; +import tech.mcprison.prison.commands.BaseCommands; import tech.mcprison.prison.commands.Command; import tech.mcprison.prison.integration.EconomyIntegration; -import tech.mcprison.prison.integration.IntegrationType; import tech.mcprison.prison.internal.CommandSender; import tech.mcprison.prison.internal.Player; import tech.mcprison.prison.output.Output; @@ -40,7 +40,6 @@ import tech.mcprison.prison.ranks.data.RankLadder; import tech.mcprison.prison.ranks.data.RankPlayer; import tech.mcprison.prison.ranks.managers.LadderManager; -import tech.mcprison.prison.util.ChatColor; /** * The commands for this module. @@ -49,8 +48,13 @@ * @author GABRYCA * @author RoyalBlueRanger */ -public class RankUpCommand { +public class RankUpCommand + extends BaseCommands { + public RankUpCommand() { + super( "RankUpCommand" ); + } + /* * /rankup command */ @@ -62,21 +66,21 @@ public class RankUpCommand { permissions = "ranks.user", altPermissions = "ranks.rankupmax.[ladderName] ranks.rankupmax.prestige", onlyPlayers = false) - public void rankUpMax(Player sender, + public void rankUpMax(CommandSender sender, @Arg(name = "ladder", description = "The ladder to rank up on.", def = "default") String ladder ) { rankUpPrivate(sender, ladder, RankupModes.MAX_RANKS, "ranks.rankupmax." ); } @Command(identifier = "rankup", description = "Ranks up to the next rank.", - permissions = "ranks.user", altPermissions = "ranks.rankup.[ladderName]", onlyPlayers = false) - public void rankUp(Player sender, + permissions = "ranks.user", altPermissions = "ranks.rankup.[ladderName]", onlyPlayers = true) + public void rankUp(CommandSender sender, @Arg(name = "ladder", description = "The ladder to rank up on.", def = "default") String ladder ) { rankUpPrivate(sender, ladder, RankupModes.ONE_RANK, "ranks.rankup." ); } - private void rankUpPrivate(Player sender, String ladder, RankupModes mode, String permission ) { + private void rankUpPrivate(CommandSender sender, String ladder, RankupModes mode, String permission ) { // RETRIEVE THE LADDER @@ -98,26 +102,32 @@ private void rankUpPrivate(Player sender, String ladder, RankupModes mode, Strin return; } - UUID playerUuid = sender.getUUID(); + Player player = getPlayer( sender, null ); + + //UUID playerUuid = player.getUUID(); ladder = confirmLadder( sender, ladder ); + if ( ladder == null ) { + // ladder cannot be null, + return; + } - RankPlayer rankPlayer = getPlayer( sender, playerUuid, sender.getName() ); + RankPlayer rankPlayer = getPlayer( sender, player.getUUID(), player.getName() ); Rank pRank = rankPlayer.getRank( ladder ); Rank pRankSecond = rankPlayer.getRank("default"); Rank pRankAfter = null; LadderManager lm = PrisonRanks.getInstance().getLadderManager(); - boolean WillPrestige = false; + boolean willPrestige = false; // If the ladder's the prestige one, it'll execute all of this - if (ladder.equalsIgnoreCase("prestiges")) { + if ( ladder!= null && ladder.equalsIgnoreCase("prestiges")) { if (!(lm.getLadder("default").isPresent())){ - sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&c[ERROR] There isn't a default ladder! Please report this to an admin!")); + sender.sendMessage("&c[ERROR] There isn't a default ladder! Please report this to an admin!"); return; } if (!(lm.getLadder("default").get().getLowestRank().isPresent())){ - sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&c[ERROR] Can't get the lowest rank! Please report this to an admin!")); + sender.sendMessage("&c[ERROR] Can't get the lowest rank! Please report this to an admin!"); return; } @@ -128,11 +138,11 @@ private void rankUpPrivate(Player sender, String ladder, RankupModes mode, Strin } if (!(rank == pRankSecond)) { - sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cYou aren't at the last rank!")); + sender.sendMessage("&cYou aren't at the last rank!"); return; } // IF everything's ready, this will be true and the prestige method will start - WillPrestige = true; + willPrestige = true; } // Get currency if it exists, otherwise it will be null if the Rank has no currency: @@ -145,7 +155,8 @@ private void rankUpPrivate(Player sender, String ladder, RankupModes mode, Strin processResults( sender, null, results, true, null, ladder, currency ); - if (results.getStatus() == RankupStatus.RANKUP_SUCCESS && mode == RankupModes.MAX_RANKS && !ladder.equals("prestiges")) { + if (results.getStatus() == RankupStatus.RANKUP_SUCCESS && mode == RankupModes.MAX_RANKS && + !ladder.equals("prestiges")) { rankUpPrivate( sender, ladder, mode, permission ); } if (results.getStatus() == RankupStatus.RANKUP_SUCCESS){ @@ -155,29 +166,39 @@ private void rankUpPrivate(Player sender, String ladder, RankupModes mode, Strin // Get the player rank after pRankAfter = rankPlayer.getRank(ladder); + + // Prestige method + prestigePlayer(player, rankPlayer, pRank, pRankAfter, lm, willPrestige, rankupWithSuccess); } - - // Prestige method - prestigePlayer(sender, rankPlayer, pRank, pRankAfter, lm, WillPrestige, rankupWithSuccess); } - private void prestigePlayer(Player sender, RankPlayer rankPlayer, Rank pRank, Rank pRankAfter, LadderManager lm, boolean willPrestige, boolean rankupWithSuccess) { + private void prestigePlayer(Player player, RankPlayer rankPlayer, Rank pRank, Rank pRankAfter, + LadderManager lm, boolean willPrestige, boolean rankupWithSuccess) { + // Get the player rank after, just to check if it has success Rank pRankSecond; // Conditions if (willPrestige && rankupWithSuccess && pRankAfter != null && pRank != pRankAfter) { // Set the player rank to the first one of the default ladder - PrisonAPI.dispatchCommand("ranks set rank " + sender.getName() + " " + lm.getLadder("default").get().getLowestRank().get().name + " default"); + PrisonAPI.dispatchCommand("ranks set rank " + player.getName() + " " + + lm.getLadder("default").get().getLowestRank().get().name + " default"); // Get that rank pRankSecond = rankPlayer.getRank("default"); // Check if the ranks match if (pRankSecond == lm.getLadder("default").get().getLowestRank().get()) { // Get economy - EconomyIntegration economy = (EconomyIntegration) PrisonAPI.getIntegrationManager().getForType(IntegrationType.ECONOMY).orElseThrow(IllegalStateException::new); - // Set the player balance to 0 (reset) - economy.setBalance(sender, 0); - // Send a message to the player because he did prestige! - sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&7[&3Congratulations&7] &3You've &6Prestige&3 to " + pRankAfter.tag + "&c!")); + EconomyIntegration economy = PrisonAPI.getIntegrationManager().getEconomy(); + + if ( economy != null ) { + + // Set the player balance to 0 (reset) + economy.setBalance(player, 0); + // Send a message to the player because he did prestige! + player.sendMessage("&7[&3Congratulations&7] &3You've &6Prestige&3 to " + pRankAfter.tag + "&c!"); + } + else { + player.sendMessage( "&3No economy is available. Cannot perform action." ); + } } } } @@ -292,8 +313,7 @@ public void setRank(CommandSender sender, } - private void setPlayerRank( Player player, String rank, String ladder, CommandSender sender ) - { + private void setPlayerRank( Player player, String rank, String ladder, CommandSender sender ) { UUID playerUuid = player.getUUID(); ladder = confirmLadder( sender, ladder ); @@ -315,15 +335,18 @@ private void setPlayerRank( Player player, String rank, String ladder, CommandSe public String confirmLadder( CommandSender sender, String ladderName ) { + String results = null; Optional ladderOptional = PrisonRanks.getInstance().getLadderManager().getLadder(ladderName); // The ladder doesn't exist if (!ladderOptional.isPresent()) { Output.get().sendError(sender, "The ladder '%s' does not exist.", ladderName); - ladderName = null; } - return ladderName; + else { + results = ladderOptional.get().name; + } + return results; } @@ -416,34 +439,6 @@ public void processResults( CommandSender sender, Player player, } } - /** - *

Gets a player by name. If the player is not online, then try to get them from - * the offline player list. If not one is found, then return a null. - *

- * - * @param sender - * @param playerName is optional, if not supplied, then sender will be used - * @return Player if found, or null. - */ - private Player getPlayer( CommandSender sender, String playerName ) { - Player result = null; - - playerName = playerName != null ? playerName : sender != null ? sender.getName() : null; - - //Output.get().logInfo("RanksCommands.getPlayer :: playerName = " + playerName ); - - if ( playerName != null ) { - Optional opt = Prison.get().getPlatform().getPlayer( playerName ); - if ( !opt.isPresent() ) { - opt = Prison.get().getPlatform().getOfflinePlayer( playerName ); - } - if ( opt.isPresent() ) { - result = opt.get(); - } - } - return result; - } - private void broadcastToWholeServer( CommandSender sender, String message ) { 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 bdea7aef7..5e91c344f 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 @@ -6,16 +6,22 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.TreeMap; import java.util.stream.Collectors; import tech.mcprison.prison.Prison; import tech.mcprison.prison.PrisonAPI; +import tech.mcprison.prison.PrisonCommand.RegisteredPluginsData; import tech.mcprison.prison.chat.FancyMessage; import tech.mcprison.prison.commands.Arg; +import tech.mcprison.prison.commands.BaseCommands; import tech.mcprison.prison.commands.Command; +import tech.mcprison.prison.commands.Wildcard; import tech.mcprison.prison.integration.EconomyCurrencyIntegration; import tech.mcprison.prison.internal.CommandSender; import tech.mcprison.prison.internal.Player; +import tech.mcprison.prison.modules.ModuleElement; +import tech.mcprison.prison.modules.ModuleElementType; import tech.mcprison.prison.output.BulletedListComponent; import tech.mcprison.prison.output.ChatDisplay; import tech.mcprison.prison.output.FancyMessageComponent; @@ -32,29 +38,50 @@ /** * @author Faizaan A. Datoo */ -public class RanksCommands { +public class RanksCommands + extends BaseCommands { + + private CommandCommands rankCommandCommands = null; + + public RanksCommands( CommandCommands rankCommandCommands ) { + super( "RanksCommands" ); + + this.rankCommandCommands = rankCommandCommands; + } + + public CommandCommands getRankCommandCommands() { + return rankCommandCommands; + } + public void setRankCommandCommands( CommandCommands rankCommandCommands ) { + this.rankCommandCommands = rankCommandCommands; + } + - @Command(identifier = "ranks create", description = "Creates a new rank", - onlyPlayers = false, permissions = "ranks.create") - public void createRank(CommandSender sender, + @Command(identifier = "ranks create", description = "Creates a new rank", + onlyPlayers = false, permissions = "ranks.create") + public boolean createRank(CommandSender sender, @Arg(name = "rankName", description = "The name of this rank.") String name, @Arg(name = "cost", description = "The cost of this rank.") double cost, @Arg(name = "ladder", description = "The ladder to put this rank on.", def = "default") String ladder, - @Arg(name = "tag", description = "The tag to use for this rank.", def = "none") - String tag) { + @Wildcard(join=true) + @Arg(name = "tag", description = "The tag to use for this rank.", def = "none") + String tag) { + + boolean success = false; // Ensure a rank with the name doesn't already exist - if (PrisonRanks.getInstance().getRankManager().getRank(name).isPresent()) { + if (PrisonRanks.getInstance().getRankManager().getRank(name) != null) { Output.get() - .sendWarn(sender, "A rank by this name already exists. Try a different name."); - return; + .sendWarn(sender, + String.format( "&3The rank named &7%s &3already exists. Try a different name.", name) ); + return success; } // Ensure a rank with the name doesn't already exist if (name == null || name.trim().length() == 0 || name.contains( "&" )) { - Output.get().sendWarn(sender, "A rank name is required and cannot contain formatting codes."); - return; + Output.get().sendWarn(sender, "&3A rank name is required and cannot contain formatting codes."); + return success; } // Fetch the ladder first, so we can see if it exists @@ -62,8 +89,8 @@ public void createRank(CommandSender sender, Optional rankLadderOptional = PrisonRanks.getInstance().getLadderManager().getLadder(ladder); if (!rankLadderOptional.isPresent()) { - Output.get().sendWarn(sender, "A ladder by the name of '%s' does not exist.", ladder); - return; + Output.get().sendWarn(sender, "&3A ladder by the name of '&7%s&3' does not exist.", ladder); + return success; } // Set a default tag if necessary @@ -77,20 +104,20 @@ public void createRank(CommandSender sender, // Ensure it was created if (!newRankOptional.isPresent()) { - Output.get().sendError(sender, "The rank could not be created."); - return; + Output.get().sendError(sender, "&3The rank could not be created."); + return success; } Rank newRank = newRankOptional.get(); // Save the rank - try { +// try { PrisonRanks.getInstance().getRankManager().saveRank(newRank); - } catch (IOException e) { - Output.get().sendError(sender, - "The new rank could not be saved to disk. Check the console for details."); - Output.get().logError("Rank could not be written to disk.", e); - } +// } catch (IOException e) { +// Output.get().sendError(sender, +// "The new rank could not be saved to disk. Check the console for details."); +// Output.get().logError("Rank could not be written to disk.", e); +// } // Add the ladder @@ -98,30 +125,279 @@ public void createRank(CommandSender sender, try { PrisonRanks.getInstance().getLadderManager().saveLadder(rankLadderOptional.get()); + success = true; + // Tell the player the good news! Output.get() - .sendInfo(sender, "Your new rank, '%s', was created in the ladder '%s'", name, ladder); + .sendInfo(sender, "&3Your new rank, '&7%s&3', was created in the ladder '&7%s&3', " + + "using the tag value of '&7%s&3'", name, ladder, tag); } catch (IOException e) { Output.get().sendError(sender, - "The '%s' ladder could not be saved to disk. Check the console for details.", + "&3The '&7%s&3' ladder could not be saved to disk. Check the console for details.", rankLadderOptional.get().name); - Output.get().logError("Ladder could not be written to disk.", e); + Output.get().logError("&3Ladder could not be written to disk.", e); } + return success; } + + @Command(identifier = "ranks autoConfigure", description = "Auto configures Ranks and Mines using " + + "single letters A through Z for both the rank and mine names. If both ranks and mines are " + + "generated, they will also be linked together automatically. To set the starting price use " + + "price=x. To set multiplier mult=x. " + + "Default values [full price=50000 mult=1.5]", + onlyPlayers = false, permissions = "ranks.set") + public void autoConfigureRanks(CommandSender sender, + @Wildcard(join=true) + @Arg(name = "options", + description = "Options: [full ranks mines price=x mult=x]", + def = "full") String options + ) { + + int rankCount = PrisonRanks.getInstance().getRankManager().getRanks().size(); + int mineCount = Prison.get().getPlatform().getModuleElementCount( ModuleElementType.MINE ); + + if ( rankCount > 0 || mineCount > 0 ) { + String message = String.format( "&3Cannot run &7/ranks autoConfigure &3 with any " + + "ranks or mines already setup. Rank count = &7%d&3. Mine count = &7%d", + rankCount, mineCount ); + Output.get().logWarn( message ); + return; + } + + + String optionHelp = "&b[&7full ranks mines price=&dx &7mult=&dx&b]"; + boolean ranks = false; + boolean mines = false; + double startingPrice = 50000; + double percentMultipler = 1.5; + + options = (options == null ? "" : options.replaceAll( "/s*", " " )); + if ( options.trim().length() == 0 ) { + Output.get().sendError(sender, + "&3Invalid options. Use %s&3. Was: &3%s", + optionHelp, options ); + return; + } + + if ( options.contains( "full" ) ) { + ranks = true; + mines = true; + options = options.replace( "full", "" ); + } + if ( options.contains( "ranks" ) ) { + ranks = true; + options = options.replace( "ranks", "" ); + } + if ( options.contains( "mines" ) ) { + mines = true; + options = options.replace( "mines", "" ); + } + + String priceStr = extractParameter("price=", options); + if ( priceStr != null ) { + options = options.replace( priceStr, "" ); + priceStr = priceStr.replace( "price=", "" ).trim(); + + try { + startingPrice = Double.parseDouble( priceStr ); + } + catch ( NumberFormatException e ) { + // Not a valid double number, or price: + } + } + + + String multStr = extractParameter("mult=", options); + if ( multStr != null ) { + options = options.replace( multStr, "" ); + multStr = multStr.replace( "mult=", "" ).trim(); + + try { + percentMultipler = Double.parseDouble( multStr ); + } + catch ( NumberFormatException e ) { + // Not a valid double number, or price: + } + } + + + // What's left over, if not just a blank string, must be an error: + options = (options == null ? "" : options.replaceAll( "/s*", " " )); + if ( options.trim().length() != 0 ) { + Output.get().sendError(sender, + "Invalid options.. Use either %s&3. Was: [%s]", + optionHelp, + options == null ? "null" : options ); + return; + } + + TreeMap plugins = + Prison.get().getPrisonCommands().getRegisteredPluginData(); + +// + String permCmdAdd = null; + String permCmdDel = null; + String perm1 = "mines."; + String perm2 = "mines.tp."; + + if ( plugins.containsKey("LuckPerms") ){ + permCmdAdd = "lp user {player} permission set "; + permCmdDel = "lp user {player} permission unset "; + } + else if ( plugins.containsKey("PermissionsEx") ){ + permCmdAdd = "pex user {player} add "; + permCmdDel = "pex user {player} add -"; + } + else if ( plugins.containsKey("UltraPermissions") ){ + permCmdAdd = "upc addplayerpermission {player} "; + permCmdDel = "upc removeplayerpermission {player} "; + } + else if ( plugins.containsKey("GroupManager") ){ + permCmdAdd = "manuaddp {player} "; + permCmdDel = "manudelp {player} "; + } + else if ( plugins.containsKey("zPermissions") ){ + permCmdAdd = "permissions player {player} set "; + permCmdDel = "permissions player {player} unset "; + } + else if ( plugins.containsKey("PowerfulPerms") ){ + permCmdAdd = "pp user {player} add "; + permCmdAdd = "pp user {player} remove "; + } + + + + int countRanks = 0; + int countRankCmds = 0; + int countMines = 0; + int countLinked = 0; + + if ( ranks ) { + + int colorID = 1; + double price = 0; + + + for ( char cRank = 'A'; cRank <= 'Z'; cRank++) { + String rankName = Character.toString( cRank ); + String tag = "&7[&" + Integer.toHexString((colorID++ % 15) + 1) + rankName + "&7]"; + + char cRankNext = (char) (cRank + 1); + String rankNameNext = Character.toString( cRankNext ); + + if ( createRank(sender, rankName, price, "default", tag) ) { + countRanks++; + + if ( permCmdAdd != null ) { + getRankCommandCommands().commandAdd( sender, rankName, permCmdAdd + perm1 + rankName.toLowerCase()); + countRankCmds++; + getRankCommandCommands().commandAdd( sender, rankName, permCmdAdd + perm2 + rankName.toLowerCase()); + countRankCmds++; + + if ( cRankNext <= 'Z' ) { + getRankCommandCommands().commandAdd( sender, rankName, permCmdDel + perm1 + rankNameNext.toLowerCase()); + countRankCmds++; + getRankCommandCommands().commandAdd( sender, rankName, permCmdDel + perm2 + rankNameNext.toLowerCase()); + countRankCmds++; + } + + } + + if ( mines ) { + + // Creates a virtual mine: + ModuleElement mine = Prison.get().getPlatform().createModuleElement( + sender, ModuleElementType.MINE, rankName, tag ); + + if ( mine != null ) { + countMines++; + + // Links the virtual mine to generated rank: + if ( Prison.get().getPlatform().linkModuleElements( mine, ModuleElementType.RANK, rankName ) ) { + countLinked++; + } + } + } + } + + if (price == 0){ + price += startingPrice; + } else { + price *= percentMultipler; + } + + } + } + + // If mines were created, go ahead and auto assign blocks to the mines: + if ( countMines > 0 ) { + Prison.get().getPlatform().autoCreateMineBlockAssignment(); + } + + if ( countRanks == 0 ) { + Output.get().logInfo( "Ranks autoConfigure: No ranks were created."); + } + else { + Output.get().logInfo( "Ranks autoConfigure: %d ranks were created.", countRanks); + + if ( countRankCmds == 0 ) { + Output.get().logInfo( "Ranks autoConfigure: No rank commandss were created."); + } + else { + Output.get().logInfo( "Ranks autoConfigure: %d rank commands were created.", countRanks); + Output.get().logInfo( "Ranks autoConfigure: The permission %s and " + + "%s was " + + "created for each rank. Make sure you add every permission to your " + + "permission plugin or they may not work. ", + perm1, perm2 ); + } + } + + if ( countMines == 0 ) { + Output.get().logInfo( "Ranks autoConfigure: No mines were created."); + } + else { + Output.get().logInfo( "Ranks autoConfigure: %d mines were created.", countMines); + + if ( countLinked == 0 ) { + Output.get().logInfo( "Ranks autoConfigure: No mines and no ranks were linked."); + } + else { + Output.get().logInfo( "Ranks autoConfigure: %d ranks and mines were linked.", countLinked); + } + } + + Output.get().logInfo( ""); + + + } + + private String extractParameter( String key, String options ) { + String results = null; + int idx = options.indexOf( key ); + if ( idx != -1 ) { + int idxEnd = options.indexOf( " ", idx ); + if ( idxEnd == -1 ) { + idxEnd = options.length(); + } + results = options.substring( idx, idxEnd ); + } + return results; + } + + @Command(identifier = "ranks delete", description = "Removes a rank, and deletes its files.", - onlyPlayers = false, permissions = "ranks.delete") + onlyPlayers = false, permissions = "ranks.delete") public void removeRank(CommandSender sender, @Arg(name = "rankName") String rankName) { // Check to ensure the rank exists - Optional rankOptional = PrisonRanks.getInstance().getRankManager().getRank(rankName); - if (!rankOptional.isPresent()) { + Rank rank = PrisonRanks.getInstance().getRankManager().getRank(rankName); + if ( rank == null ) { Output.get().sendError(sender, "The rank '%s' does not exist.", rankName); return; } - Rank rank = rankOptional.get(); - if (PrisonRanks.getInstance().getDefaultLadder().containsRank(rank.id) && PrisonRanks.getInstance().getDefaultLadder().ranks.size() == 1) { Output.get().sendError(sender, @@ -139,10 +415,14 @@ public void removeRank(CommandSender sender, @Arg(name = "rankName") String rank } @Command(identifier = "ranks list", description = "Lists all the ranks on the server.", - onlyPlayers = false, permissions = "ranks.list") + onlyPlayers = false, altPermissions = "ranks.list" + ) public void listRanks(CommandSender sender, @Arg(name = "ladderName", def = "default") String ladderName) { + boolean hasPerm = sender.hasPermission("ranks.list") || + sender.isOp(); + Optional ladderOpt = PrisonRanks.getInstance().getLadderManager().getLadder(ladderName); @@ -162,8 +442,15 @@ public void listRanks(CommandSender sender, } - ChatDisplay display = new ChatDisplay("Ranks in " + ladderName); - display.text("&7Click on a rank's name to view more info."); + String rankHeader = "Ranks" + + ( hasPerm || !hasPerm && !ladderName.equalsIgnoreCase( "default" ) ? + " in " + ladderName : ""); + ChatDisplay display = new ChatDisplay( rankHeader ); + + if ( hasPerm ) { + display.text("&7Click on a rank's name to view more info."); + } + BulletedListComponent.BulletedListBuilder builder = new BulletedListComponent.BulletedListBuilder(); @@ -173,20 +460,34 @@ public void listRanks(CommandSender sender, boolean defaultRank = ("default".equalsIgnoreCase( ladderName ) && first); + String textRankName = ( hasPerm ? + String.format( "&3%s " , rank.name ) + : ""); + String textCmdCount = ( hasPerm ? + String.format( " &7- Commands: &3%d", rank.rankUpCommands.size()) + : "" ); + String text = - String.format("&3%s &9[&3%s&9] &7- %s&7%s%s &7- Commands: &3%d", - rank.name, rank.tag, - (defaultRank ? "&b(&9Default&b) &7-" : ""), + String.format("%s &9[&3%s&9] &7- %s&7%s%s%s", + textRankName, rank.tag, + (defaultRank ? "&b(&9Default&b) &7- " : ""), Text.numberToDollars(rank.cost), (rank.currency == null ? "" : " &7Currency: &3" + rank.currency), - rank.rankUpCommands.size()); + textCmdCount ); String rankName = rank.name; if ( rankName.contains( "&" ) ) { rankName = rankName.replace( "&", "-" ); } - FancyMessage msg = new FancyMessage(text).command("/ranks info " + rankName) - .tooltip("&7Click to view info."); + FancyMessage msg = null; + if ( hasPerm ) { + msg = new FancyMessage(text).command("/ranks info " + rankName) + .tooltip("&7Click to view info."); + } + else { + msg = new FancyMessage(text); + } + builder.add(msg); rank = rank.rankNext; @@ -215,34 +516,38 @@ public void listRanks(CommandSender sender, // } display.addComponent(builder.build()); - display.addComponent(new FancyMessageComponent( - new FancyMessage("&7[&a+&7] Add").suggest("/ranks create ") - .tooltip("&7Create a new rank."))); - - List others = new ArrayList<>(); - for (RankLadder other : PrisonRanks.getInstance().getLadderManager().getLadders()) { - if (!other.name.equals(ladderName) && (other.name.equals("default") || sender - .hasPermission("ranks.rankup." + other.name.toLowerCase()))) { - if (sender.hasPermission("ranks.admin")) { - others.add("/ranks list " + other.name); - } else { - others.add("/ranks " + other.name); - } - } - } - - if (others.size() != 0) { - FancyMessage msg = new FancyMessage("&8You may also try "); - int i = 0; - for (String other : others) { - i++; - if (i == others.size() && others.size() > 1) { - msg.then(" &8and "); - } - msg.then("&7" + other).tooltip("&7Click to view.").command(other); - msg.then(i == others.size() ? "&8." : "&8,"); - } - display.addComponent(new FancyMessageComponent(msg)); + + if ( hasPerm ) { + display.addComponent(new FancyMessageComponent( + new FancyMessage("&7[&a+&7] Add").suggest("/ranks create ") + .tooltip("&7Create a new rank."))); + + List others = new ArrayList<>(); + for (RankLadder other : PrisonRanks.getInstance().getLadderManager().getLadders()) { + if (!other.name.equals(ladderName) && (other.name.equals("default") || sender + .hasPermission("ranks.rankup." + other.name.toLowerCase()))) { + if (sender.hasPermission("ranks.admin")) { + others.add("/ranks list " + other.name); + } else { + others.add("/ranks " + other.name); + } + } + } + + if (others.size() != 0) { + FancyMessage msg = new FancyMessage("&8You may also try "); + int i = 0; + for (String other : others) { + i++; + if (i == others.size() && others.size() > 1) { + msg.then(" &8and "); + } + msg.then("&7" + other).tooltip("&7Click to view.").command(other); + msg.then(i == others.size() ? "&8." : "&8,"); + } + display.addComponent(new FancyMessageComponent(msg)); + } + } display.send(sender); @@ -250,21 +555,19 @@ public void listRanks(CommandSender sender, } @Command(identifier = "ranks info", description = "Information about a rank.", - onlyPlayers = false, permissions = "ranks.info", - altPermissions = "ranks.admin" ) + onlyPlayers = false, permissions = "ranks.info", + altPermissions = "ranks.admin" ) public void infoCmd(CommandSender sender, @Arg(name = "rankName") String rankName) { - Optional rankOpt = PrisonRanks.getInstance().getRankManager().getRank(rankName); - if (!rankOpt.isPresent()) { - rankOpt = PrisonRanks.getInstance().getRankManager().getRankEscaped(rankName); - if (!rankOpt.isPresent()) { + Rank rank = PrisonRanks.getInstance().getRankManager().getRank(rankName); + if ( rank == null ) { +// rankOpt = PrisonRanks.getInstance().getRankManager().getRankEscaped(rankName); +// if (!rankOpt.isPresent()) { Output.get().sendError(sender, "The rank '%s' doesn't exist.", rankName); return; - } +// } } - Rank rank = rankOpt.get(); - List ladders = PrisonRanks.getInstance().getLadderManager().getLaddersWithRank(rank.id); @@ -277,10 +580,27 @@ public void infoCmd(CommandSender sender, @Arg(name = "rankName") String rankNam display.text("&3%s: &7%s", Text.pluralize("Ladder", ladders.size()), Text.implodeCommaAndDot( ladders.stream().map(rankLadder -> rankLadder.name).collect(Collectors.toList()))); + + if ( rank.getMines().size() == 0 ) { + display.text( "&3This rank is not linked to any mines" ); + } + else { + StringBuilder sb = new StringBuilder(); + + for ( ModuleElement mine : rank.getMines() ) { + if ( sb.length() > 0 ) { + sb.append( "&3, " ); + } + sb.append( "&7" ); + sb.append( mine.getName() ); + } + + display.text( "&3Mines linked to this rank: %s", sb.toString() ); + } display.text("&3Cost: &7%s", Text.numberToDollars(rank.cost)); - display.text("&3Currency: &7<&a%s&7>", (rank.currency == null ? "&cnone" : rank.currency) ); + display.text("&3Currency: &7<&a%s&7>", (rank.currency == null ? "&cdefault" : rank.currency) ); List players = PrisonRanks.getInstance().getPlayerManager().getPlayers().stream() @@ -307,29 +627,28 @@ public void infoCmd(CommandSender sender, @Arg(name = "rankName") String rankNam // set commands @Command(identifier = "ranks set cost", description = "Modifies a ranks cost", - onlyPlayers = false, permissions = "ranks.set") + onlyPlayers = false, permissions = "ranks.set") public void setCost(CommandSender sender, @Arg(name = "rankName") String rankName, @Arg(name = "cost", description = "The cost of this rank.") double cost){ - Optional rankOptional = PrisonRanks.getInstance().getRankManager().getRank(rankName); - if (!rankOptional.isPresent()) { + Rank rank = PrisonRanks.getInstance().getRankManager().getRank(rankName); + if ( rank == null ) { Output.get().sendError(sender, "The rank '%s' doesn't exist.", rankName); return; } - Rank rank = rankOptional.get(); rank.cost = cost; // Save the rank - try { +// try { PrisonRanks.getInstance().getRankManager().saveRank(rank); Output.get().sendInfo(sender,"Successfully set the cost of rank '%s' to "+cost,rankName); - } catch (IOException e) { - Output.get().sendError(sender, - "The rank could not be saved to disk. The change in rank cost has not been saved. Check the console for details."); - Output.get().logError("Rank could not be written to disk (setCost).", e); - } +// } catch (IOException e) { +// Output.get().sendError(sender, +// "The rank could not be saved to disk. The change in rank cost has not been saved. Check the console for details."); +// Output.get().logError("Rank could not be written to disk (setCost).", e); +// } } // set commands @@ -339,8 +658,8 @@ public void setCurrency(CommandSender sender, @Arg(name = "rankName") String rankName, @Arg(name = "currency", description = "The currency to use with this rank.") String currency){ - Optional rankOptional = PrisonRanks.getInstance().getRankManager().getRank(rankName); - if (!rankOptional.isPresent()) { + Rank rank = PrisonRanks.getInstance().getRankManager().getRank(rankName); + if ( rank == null ) { Output.get().sendError(sender, "The rank '%s' doesn't exist.", rankName); return; } @@ -360,46 +679,66 @@ public void setCurrency(CommandSender sender, } - Rank rank = rankOptional.get(); rank.currency = currency; // Save the rank - try { +// try { PrisonRanks.getInstance().getRankManager().saveRank(rank); Output.get().sendInfo(sender,"Successfully set the currency for the rank '%s' to %s", rankName, currency); - } catch (IOException e) { - Output.get().sendError(sender, - "The rank could not be saved to disk. The change in rank currency has not been saved. Check the console for details."); - Output.get().logError("Rank could not be written to disk (setCurrency).", e); - } +// } catch (IOException e) { +// Output.get().sendError(sender, +// "The rank could not be saved to disk. The change in rank currency has not been saved. Check the console for details."); +// Output.get().logError("Rank could not be written to disk (setCurrency).", e); +// } } @Command(identifier = "ranks set tag", description = "Modifies a ranks tag", - onlyPlayers = false, permissions = "ranks.set") + onlyPlayers = false, permissions = "ranks.set") public void setTag(CommandSender sender, @Arg(name = "rankName") String rankName, - @Arg(name = "tag", description = "The desired tag.") String tag){ - Optional rankOptional = PrisonRanks.getInstance().getRankManager().getRank(rankName); - if (!rankOptional.isPresent()) { + @Wildcard(join=true) + @Arg(name = "tag", description = "Tag value for the Rank. Use [null] to remove.") String tag){ + + Rank rank = PrisonRanks.getInstance().getRankManager().getRank(rankName); + if ( rank == null ) { Output.get().sendError(sender, "The rank '%s' doesn't exist.", rankName); return; } - Rank rank = rankOptional.get(); - rank.tag = tag; + + if ( tag == null || tag.trim().length() == 0 ) { + sender.sendMessage( "&cTag name must be a valid value. To remove use a value of &anull&c." ); + return; + } - // Save the rank - try { - PrisonRanks.getInstance().getRankManager().saveRank(rank); + if ( tag.equalsIgnoreCase( "null" ) ) { + tag = null; + } - Output.get().sendInfo(sender,"Successfully set the tag of rank '%s' to "+tag,rankName); - } catch (IOException e) { - Output.get().sendError(sender, - "The rank could not be saved to disk. The tag change for the rank has not been saved. Check the console for details."); - Output.get().logError("Rank could not be written to disk.", e); + + if ( tag == null && rank.getTag() == null || + rank.getTag() != null && + rank.getTag().equalsIgnoreCase( tag )) { + + sender.sendMessage( "&cThe new tag name is the same as what it was. No change was made." ); + return; } + rank.tag = tag; + + PrisonRanks.getInstance().getRankManager().saveRank(rank); + + if ( tag == null ) { + sender.sendMessage( + String.format( "&cThe tag name was cleared for the rank %s.", + rank.getName() ) ); + } + else { + sender.sendMessage( + String.format( "&cThe tag name was changed to %s for the rank %s.", + tag, rank.getName() ) ); + } } @Command(identifier = "ranks player", description = "Shows a player their rank", onlyPlayers = false) @@ -448,6 +787,13 @@ public void rankPlayer(CommandSender sender, sendToPlayerAndConsole( sender, messageRank ); } + // Print out the player's balance: + double balance = getPlayerBalance( player ); + String message = String.format( "&7The current balance for &b%s &7is &b%s", + player.getName(), dFmt.format( balance ) ); + sendToPlayerAndConsole( sender, message ); + + if (sender.hasPermission("ranks.admin") && rankPlayer.names.size() > 1) { // This is admin-exclusive content @@ -606,33 +952,5 @@ public void rankPlayers(CommandSender sender, // } // } - - /** - *

Gets a player by name. If the player is not online, then try to get them from - * the offline player list. If not one is found, then return a null. - *

- * - * @param sender - * @param playerName is optional, if not supplied, then sender will be used - * @return Player if found, or null. - */ - private Player getPlayer( CommandSender sender, String playerName ) { - Player result = null; - - playerName = playerName != null ? playerName : sender != null ? sender.getName() : null; - - //Output.get().logInfo("RanksCommands.getPlayer :: playerName = " + playerName ); - - if ( playerName != null ) { - Optional opt = Prison.get().getPlatform().getPlayer( playerName ); - if ( !opt.isPresent() ) { - opt = Prison.get().getPlatform().getOfflinePlayer( playerName ); - } - if ( opt.isPresent() ) { - result = opt.get(); - } - } - return result; - } - + } diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/Rank.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/Rank.java index 1ab0ec6b9..397df4490 100644 --- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/Rank.java +++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/Rank.java @@ -17,20 +17,24 @@ package tech.mcprison.prison.ranks.data; +import java.util.ArrayList; +import java.util.List; + +import tech.mcprison.prison.modules.ModuleElement; +import tech.mcprison.prison.modules.ModuleElementType; import tech.mcprison.prison.output.Output; import tech.mcprison.prison.ranks.RankUtil; import tech.mcprison.prison.sorting.PrisonSortable; import tech.mcprison.prison.store.Document; -import java.util.List; - /** * Represents a single rank. * * @author Faizaan A. Datoo */ public class Rank - implements PrisonSortable { + implements PrisonSortable, + ModuleElement { /* * Fields & Constants @@ -64,11 +68,22 @@ public class Rank public transient Rank rankPrior; public transient Rank rankNext; + + private List mines; + private List mineStrings; + + /* * Document-related */ public Rank() { + super(); + + this.rankUpCommands = new ArrayList<>(); + + this.mines = new ArrayList<>(); + this.mineStrings = new ArrayList<>(); } /** @@ -92,10 +107,25 @@ public Rank(Document document) { this.name = (String) document.get("name"); this.tag = (String) document.get("tag"); this.cost = (double) document.get("cost"); + String currency = (String) document.get("currency"); this.currency = (currency == null || "null".equalsIgnoreCase( currency ) ? null : currency); - this.rankUpCommands = (List) document.get("commands"); + + getRankUpCommands().clear(); + Object cmds = document.get("commands"); + if ( cmds != null ) { + this.rankUpCommands = (List) cmds; + } + + getMines().clear(); + getMineStrings().clear(); + Object minesObj = document.get("mines"); + if ( minesObj != null ) { + List mineStrings = (List) minesObj; + setMineStrings( mineStrings ); + } + } catch ( Exception e ) { @@ -105,6 +135,7 @@ public Rank(Document document) { Integer.toString( this.id ), (this.name == null ? "null" : this.name ), e.getMessage()) ); + } } @@ -116,6 +147,17 @@ public Document toDocument() { ret.put("cost", this.cost); ret.put("currency", this.currency); ret.put("commands", this.rankUpCommands); + + List mineStrings = new ArrayList<>(); + if ( getMines() != null ) { + for ( ModuleElement mine : getMines() ) { + String mineString = mine.getModuleElementType() + "," + mine.getName() + "," + + mine.getId() + "," + mine.getTag(); + mineStrings.add( mineString ); + } + } + ret.put("mines", mineStrings); + return ret; } @@ -129,12 +171,13 @@ public String filename() { return "rank_" + id; } - + /* * equals() and hashCode() */ - @Override public boolean equals(Object o) { + @Override + public boolean equals(Object o) { if (this == o) { return true; } @@ -163,7 +206,8 @@ public String filename() { return tag != null ? tag.equals(rank.tag) : rank.tag == null; } - @Override public int hashCode() { + @Override + public int hashCode() { int result; long temp; result = id; @@ -175,4 +219,89 @@ public String filename() { return result; } + public int getId() { + return id; + } + public void setId( int id ) { + this.id = id; + } + + public String getName() { + return name; + } + public void setName( String name ) { + this.name = name; + } + + public String getTag() { + return tag; + } + public void setTag( String tag ) { + this.tag = tag; + } + + public double getCost() { + return cost; + } + public void setCost( double cost ) { + this.cost = cost; + } + + public String getCurrency() { + return currency; + } + public void setCurrency( String currency ) { + this.currency = currency; + } + + public List getRankUpCommands() { + if ( rankUpCommands == null ) { + rankUpCommands = new ArrayList<>(); + } + return rankUpCommands; + } + public void setRankUpCommands( List rankUpCommands ) { + this.rankUpCommands = rankUpCommands; + } + + public Rank getRankPrior() { + return rankPrior; + } + public void setRankPrior( Rank rankPrior ) { + this.rankPrior = rankPrior; + } + + public Rank getRankNext() { + return rankNext; + } + public void setRankNext( Rank rankNext ) { + this.rankNext = rankNext; + } + + @Override + public ModuleElementType getModuleElementType() { + return ModuleElementType.RANK; + } + + public List getMines() { + if ( mines == null ) { + this.mines = new ArrayList<>(); + } + return mines; + } + public void setMines( List mines ) { + this.mines = mines; + } + + public List getMineStrings() { + if ( mineStrings == null ) { + this.mineStrings = new ArrayList<>(); + } + return mineStrings; + } + public void setMineStrings( List mineStrings ) { + this.mineStrings = mineStrings; + } + + } diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/RankLadder.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/RankLadder.java index dfe95e6e7..cde070c17 100644 --- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/RankLadder.java +++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/RankLadder.java @@ -78,9 +78,9 @@ public RankLadder(Document document, PrisonRanks prisonRanks) { Rank rankPrison = null; if ( rankManager != null && - rankManager.getRank( rRankId ).isPresent() ) { + rankManager.getRank( rRankId ) != null) { - rankPrison = rankManager.getRank( rRankId ).get(); + rankPrison = rankManager.getRank( rRankId ); // if null look it up from loaded ranks: if ( rRankName == null ) { @@ -118,9 +118,9 @@ public List getRanks() { for ( PositionRank rank : ranks ) { - if ( rank.rank == null ) { - - Rank rnk = rankManager.getRank( rank.rankId ).get(); + if ( rank != null && rank.rank == null ) { + // + Rank rnk = rankManager.getRank( rank.rankId ); if ( rnk != null ) { rank.rank = rnk; } @@ -288,7 +288,7 @@ public Optional getPrevious(int before) { public Optional getByPosition(int position) { for (PositionRank posRank : ranks) { if (posRank.getPosition() == position) { - return PrisonRanks.getInstance().getRankManager().getRank(posRank.getRankId()); + return PrisonRanks.getInstance().getRankManager().getRankOptional(posRank.getRankId()); } } @@ -314,7 +314,7 @@ public Optional getLowestRank() { } } - return PrisonRanks.getInstance().getRankManager().getRank(lowest.getRankId()); + return PrisonRanks.getInstance().getRankManager().getRankOptional(lowest.getRankId()); } /** diff --git a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/RankPlayer.java b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/RankPlayer.java index 49b5385cf..6036ccfbd 100644 --- a/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/RankPlayer.java +++ b/prison-ranks/src/main/java/tech/mcprison/prison/ranks/data/RankPlayer.java @@ -243,7 +243,7 @@ public Optional getRank(RankLadder ladder) { return Optional.empty(); } int id = ranks.get(ladder.name); - return PrisonRanks.getInstance().getRankManager().getRank(id); + return PrisonRanks.getInstance().getRankManager().getRankOptional(id); } /** @@ -256,10 +256,7 @@ public Rank getRank(String ladder) { Rank results = null; if (ladder != null && ranks.containsKey(ladder)) { int id = ranks.get(ladder); - Optional ladderOpt = PrisonRanks.getInstance().getRankManager().getRank(id); - if ( ladderOpt.isPresent() ) { - results = ladderOpt.get(); - } + results = PrisonRanks.getInstance().getRankManager().getRank(id); } return results; } @@ -278,13 +275,12 @@ public Map getRanks() { continue; // Skip it } - Optional rank = - PrisonRanks.getInstance().getRankManager().getRank(entry.getValue()); - if (!rank.isPresent()) { + Rank rank = PrisonRanks.getInstance().getRankManager().getRank(entry.getValue()); + if ( rank == null ) { continue; // Skip it } - ret.put(ladder.get(), rank.get()); + ret.put(ladder.get(), rank); } return ret; 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 c7083010b..0603aa263 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 @@ -50,6 +50,7 @@ import tech.mcprison.prison.ranks.events.FirstJoinEvent; import tech.mcprison.prison.store.Collection; import tech.mcprison.prison.store.Document; +import tech.mcprison.prison.util.PlaceholdersUtil; /** * Manages all the players in the records. @@ -296,7 +297,7 @@ public List getPlayerNextRanks( RankPlayer rankPlayer ) { return results; } - public String getPlayerNextRankCost( RankPlayer rankPlayer, String ladderName ) { + public String getPlayerNextRankCost( RankPlayer rankPlayer, String ladderName, boolean formatted ) { StringBuilder sb = new StringBuilder(); if ( !rankPlayer.getRanks().isEmpty()) { @@ -312,7 +313,12 @@ public String getPlayerNextRankCost( RankPlayer rankPlayer, String ladderName ) } double cost = key.getNext(key.getPositionOfRank(entry.getValue())).get().cost; - sb.append( dFmt.format( cost )); + if ( formatted ) { + sb.append( PlaceholdersUtil.formattedSize( cost )); + } + else { + sb.append( dFmt.format( cost )); + } } } } @@ -320,7 +326,7 @@ public String getPlayerNextRankCost( RankPlayer rankPlayer, String ladderName ) return sb.toString(); } - + public String getPlayerNextRankCostPercent( RankPlayer rankPlayer, String ladderName ) { StringBuilder sb = new StringBuilder(); @@ -399,7 +405,7 @@ public String getPlayerNextRankCostBar( RankPlayer rankPlayer, String ladderName return sb.toString(); } - public String getPlayerNextRankCostRemaining( RankPlayer rankPlayer, String ladderName ) { + public String getPlayerNextRankCostRemaining( RankPlayer rankPlayer, String ladderName, boolean formatted ) { StringBuilder sb = new StringBuilder(); Player prisonPlayer = PrisonAPI.getPlayer(rankPlayer.uid).orElse(null); @@ -431,7 +437,12 @@ public String getPlayerNextRankCostRemaining( RankPlayer rankPlayer, String ladd remaining = 0; } - sb.append( dFmt.format( remaining )); + if ( formatted ) { + sb.append( PlaceholdersUtil.formattedSize( remaining )); + } + else { + sb.append( dFmt.format( remaining )); + } } } } @@ -440,6 +451,45 @@ public String getPlayerNextRankCostRemaining( RankPlayer rankPlayer, String ladd return sb.toString(); } + private String getPlayerBalance( RankPlayer rankPlayer, String ladderName, boolean formatted ) { + StringBuilder sb = new StringBuilder(); + + Player prisonPlayer = PrisonAPI.getPlayer(rankPlayer.uid).orElse(null); + if( prisonPlayer == null ) { + Output.get().logError( String.format( "getPlayerBalance: " + + "Could not load player: %s", rankPlayer.uid) ); + return "0"; + } + + if ( !rankPlayer.getRanks().isEmpty()) { + DecimalFormat dFmt = new DecimalFormat("#,##0.00"); + for (Map.Entry entry : rankPlayer.getRanks().entrySet()) { + RankLadder key = entry.getKey(); + if ( ladderName == null || + ladderName != null && key.name.equalsIgnoreCase( ladderName )) { + + if(key.getNext(key.getPositionOfRank(entry.getValue())).isPresent()) { + if ( sb.length() > 0 ) { + sb.append(", "); + } + + Rank rank = key.getNext(key.getPositionOfRank(entry.getValue())).get(); + double balance = getPlayerBalance(prisonPlayer,rank); + + if ( formatted ) { + sb.append( PlaceholdersUtil.formattedSize( balance )); + } + else { + sb.append( dFmt.format( balance )); + } + } + } + } + } + + return sb.toString(); + } + private double getPlayerBalance(Player player, Rank rank) { double playerBalance = 0; @@ -457,8 +507,8 @@ private double getPlayerBalance(Player player, Rank rank) { } else { - EconomyIntegration economy = (EconomyIntegration) PrisonAPI.getIntegrationManager() - .getForType(IntegrationType.ECONOMY).orElse(null); + EconomyIntegration economy = PrisonAPI.getIntegrationManager().getEconomy(); + if ( economy != null ) { playerBalance = economy.getBalance( player ); } else { @@ -570,7 +620,14 @@ public String getTranslatePlayerPlaceHolder( UUID playerUuid, String playerName, case prison_rankup_cost: case prison_rc_laddername: case prison_rankup_cost_laddername: - results = getPlayerNextRankCost( rankPlayer, ladderName ); + results = getPlayerNextRankCost( rankPlayer, ladderName, false ); + break; + + case prison_rcf: + case prison_rankup_cost_formatted: + case prison_rcf_laddername: + case prison_rankup_cost_formatted_laddername: + results = getPlayerNextRankCost( rankPlayer, ladderName, true ); break; case prison_rcp: @@ -591,7 +648,14 @@ public String getTranslatePlayerPlaceHolder( UUID playerUuid, String playerName, case prison_rankup_cost_remaining: case prison_rcr_laddername: case prison_rankup_cost_remaining_laddername: - results = getPlayerNextRankCostRemaining( rankPlayer, ladderName ); + results = getPlayerNextRankCostRemaining( rankPlayer, ladderName, false ); + break; + + case prison_rcrf: + case prison_rankup_cost_remaining_formatted: + case prison_rcrf_laddername: + case prison_rankup_cost_remaining_formatted_laddername: + results = getPlayerNextRankCostRemaining( rankPlayer, ladderName, true ); break; case prison_rr: @@ -608,6 +672,12 @@ public String getTranslatePlayerPlaceHolder( UUID playerUuid, String playerName, results = getPlayerNextRankTag( rankPlayer, ladderName ); break; + case prison_pb: + case prison_player_balance: + case prison_pb_laddername: + case prison_player_balance_laddername: + results = getPlayerBalance( rankPlayer, ladderName, false ); + default: break; } 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 12b1df02b..2cca4dfe3 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 @@ -22,6 +22,7 @@ import java.util.Comparator; import java.util.List; import java.util.Optional; +import java.util.TreeMap; import java.util.stream.Collectors; import tech.mcprison.prison.PrisonAPI; @@ -29,10 +30,14 @@ import tech.mcprison.prison.internal.CommandSender; import tech.mcprison.prison.output.Output; import tech.mcprison.prison.ranks.PrisonRanks; +import tech.mcprison.prison.ranks.commands.CommandCommands; +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.Rank; import tech.mcprison.prison.ranks.data.RankLadder; -import tech.mcprison.prison.ranks.data.RankPlayer; import tech.mcprison.prison.ranks.data.RankLadder.PositionRank; +import tech.mcprison.prison.ranks.data.RankPlayer; import tech.mcprison.prison.store.Collection; import tech.mcprison.prison.store.Document; @@ -48,8 +53,17 @@ public class RankManager { */ private Collection collection; + private List loadedRanks; + private TreeMap ranksByName; + private TreeMap ranksById; + + private CommandCommands rankCommandCommands; + private RanksCommands ranksCommands; + private RankUpCommand rankupCommands; + private LadderCommands ladderCommands; + /* * Constructor */ @@ -59,13 +73,35 @@ public class RankManager { */ public RankManager(Collection collection) { this.collection = collection; + this.loadedRanks = new ArrayList<>(); + this.ranksByName = new TreeMap<>(); + this.ranksById = new TreeMap<>(); } /* * Methods & Getters & Setters */ + + private void addRank( Rank rank ) { + if ( rank != null ) { + getLoadedRanks().add( rank ); + getRanksByName().put( rank.getName(), rank ); + getRanksById().put( rank.id, rank ); + } + } + + private void removeRankFromCollections( Rank rank ) { + if ( rank != null ) { + getLoadedRanks().remove( rank ); + getRanksByName().remove( rank.getName() ); + getRanksById().remove( rank.id ); + } + + } + + /** * Loads a rank from a file into the loaded ranks list. * After this method is called, the rank will be ready for use in the server. @@ -75,7 +111,9 @@ public RankManager(Collection collection) { */ public void loadRank(String rankFile) throws IOException { Document document = collection.get(rankFile).orElseThrow(IOException::new); - loadedRanks.add(new Rank(document)); + + addRank( new Rank(document) ); +// loadedRanks.add(new Rank(document)); } /** @@ -86,7 +124,8 @@ public void loadRank(String rankFile) throws IOException { */ public void loadRanks() throws IOException { List ranks = collection.getAll(); - ranks.forEach(document -> loadedRanks.add(new Rank(document))); + ranks.forEach(document -> addRank(new Rank(document))); +// ranks.forEach(document -> loadedRanks.add(new Rank(document))); } /** @@ -94,9 +133,8 @@ public void loadRanks() throws IOException { * * @param rank The {@link Rank} to save. * @param saveFile The key to write the rank as. Case sensitive. - * @throws IOException If the rank could not be serialized, or if the rank could not be saved to the file. */ - public void saveRank(Rank rank, String saveFile) throws IOException { + public void saveRank(Rank rank, String saveFile) { collection.save(saveFile, rank.toDocument()); } @@ -104,18 +142,16 @@ public void saveRank(Rank rank, String saveFile) throws IOException { * Saves a rank to its save file. * * @param rank The {@link Rank} to save. - * @throws IOException If the rank could not be serialized, or if the rank could not be saved to the file. */ - public void saveRank(Rank rank) throws IOException { + public void saveRank(Rank rank) { this.saveRank(rank, rank.filename()); } /** * Saves all the loaded ranks to their own files within a directory. * - * @throws IOException If the rankFolder does not exist, or if one of the ranks could not be saved. */ - public void saveRanks() throws IOException { + public void saveRanks() { for (Rank rank : loadedRanks) { saveRank(rank); } @@ -141,7 +177,8 @@ public Optional createRank(String name, String tag, double cost) { newRank.rankUpCommands = new ArrayList<>(); // ... add it to the list... - loadedRanks.add(newRank); + addRank(newRank); +// loadedRanks.add(newRank); // Reset the rank relationships: connectRanks(); @@ -157,28 +194,52 @@ public Optional createRank(String name, String tag, double cost) { * @return The next available rank's ID. */ private int getNextAvailableId() { - // Set the highest to -1 for now, since we'll add one at the end - int highest = -1; - - // If anything's higher, it's now the highest... - for (Rank rank : loadedRanks) { - if (highest < rank.id) { - highest = rank.id; - } - } - - return highest + 1; + + int current = (getRanksById().size() == 0 ? + -1 : getRanksById().lastKey().intValue()); + + return current + 1; + +// // Set the highest to -1 for now, since we'll add one at the end +// int highest = -1; +// +// // If anything's higher, it's now the highest... +// for (Rank rank : loadedRanks) { +// if (highest < rank.id) { +// highest = rank.id; +// } +// } +// +// return highest + 1; } /** - * Returns the rank with the specified name. + *

Returns the rank with the specified name. + *

+ * + *

Deprecated: use the non-Optional getRank() instead. + *

* * @param name The rank's name, case-sensitive. * @return An optional containing either the {@link Rank} if it could be found, or empty if it does not exist by the specified name. */ - public Optional getRank(String name) { + @Deprecated + public Optional getRankOptional(String name) { return loadedRanks.stream().filter(rank -> rank.name.equals(name)).findFirst(); } + + /** + *

The preferred way to get a rank by name. This has better performance. + *

+ * + * @param name + * @return + */ + public Rank getRank(String name) { + return getRanksByName().get( name ); + } + + /** * Returns the first rank that has an escaped name that has the & replaced with -. @@ -243,7 +304,8 @@ public boolean removeRank(Rank rank) { } // Remove it from the list... - loadedRanks.remove(rank); + removeRankFromCollections( rank ); +// loadedRanks.remove(rank); // Reset the rank relationships: connectRanks(); @@ -259,10 +321,15 @@ public boolean removeRank(Rank rank) { * @param id The rank's ID. * @return An optional containing either the {@link Rank} if it could be found, or empty if it does not exist by the specified id. */ - public Optional getRank(int id) { + @Deprecated + public Optional getRankOptional(int id) { return loadedRanks.stream().filter(rank -> rank.id == id).findFirst(); } + public Rank getRank( int id ) { + return getRanksById().get( id ); + } + /** * Returns a list of all the loaded ranks on the server. * @@ -445,5 +512,50 @@ private void rankByLadderOutput( CommandSender sender, String ranksByLadder ) { sender.sendMessage( ranksByLadder ); } } + + + + + + private List getLoadedRanks() { + return loadedRanks; + } + + private TreeMap getRanksByName() { + return ranksByName; + } + + private TreeMap getRanksById() { + return ranksById; + } + + + public CommandCommands getRankCommandCommands() { + return rankCommandCommands; + } + public void setRankCommandCommands( CommandCommands rankCommandCommands ) { + this.rankCommandCommands = rankCommandCommands; + } + + public RanksCommands getRanksCommands() { + return ranksCommands; + } + public void setRanksCommands( RanksCommands ranksCommands ) { + this.ranksCommands = ranksCommands; + } + + public RankUpCommand getRankupCommands() { + return rankupCommands; + } + public void setRankupCommands( RankUpCommand rankupCommands ) { + this.rankupCommands = rankupCommands; + } + + public LadderCommands getLadderCommands() { + return ladderCommands; + } + public void setLadderCommands( LadderCommands ladderCommands ) { + this.ladderCommands = ladderCommands; + } } diff --git a/prison-spigot/build.gradle b/prison-spigot/build.gradle index 09b87d968..4b908bd7c 100644 --- a/prison-spigot/build.gradle +++ b/prison-spigot/build.gradle @@ -50,7 +50,8 @@ dependencies { implementation 'me.lucko.luckperms:luckperms-api:4.0' - implementation 'com.github.cryptomorin:XSeries:7.2.1' + implementation 'com.github.cryptomorin:XSeries:7.5.4' +// implementation 'com.github.cryptomorin:XSeries:7.2.1' // implementation 'com.github.cryptomorin:XSeries:6.3.2.1' @@ -68,8 +69,12 @@ dependencies { } // compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.1' - compileOnly fileTree(dir: 'lib', include: ['*.jar'], exclude: ['TokenEnchantAPI-15.3.2.jar']) - compile fileTree(dir: 'lib', include: ['TokenEnchantAPI-15.3.2.jar']) + + compileOnly fileTree(dir: 'lib', include: ['*.jar'], exclude: ['TokenEnchantAPI-15.5.0.jar']) + compile fileTree(dir: 'lib', include: ['TokenEnchantAPI-18.5.0.jar']) + +// compileOnly fileTree(dir: 'lib', include: ['*.jar'], exclude: ['TokenEnchantAPI-15.3.2.jar']) +// compile fileTree(dir: 'lib', include: ['TokenEnchantAPI-15.3.2.jar']) } @@ -97,7 +102,7 @@ shadowJar { include(dependency('org.bstats:bstats-bukkit:1.5')) include(dependency('me.clip:placeholderapi:2.9.1')) include(dependency('org.inventivetalent.spiget-update:bukkit:1.4.2-SNAPSHOT')) - include(dependency('com.github.cryptomorin:XSeries:7.2.1')) + include(dependency('com.github.cryptomorin:XSeries:7.5.4')) include(project(':prison-core')) include(project(':prison-mines')) include(project(':prison-ranks')) diff --git a/prison-spigot/lib/TokenEnchantAPI-18.5.0.jar b/prison-spigot/lib/TokenEnchantAPI-18.5.0.jar new file mode 100644 index 000000000..77abde9ea Binary files /dev/null and b/prison-spigot/lib/TokenEnchantAPI-18.5.0.jar differ diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotListener.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotListener.java index 625ff9f21..e1f2dec97 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotListener.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotListener.java @@ -18,7 +18,6 @@ package tech.mcprison.prison.spigot; -import org.bukkit.Bukkit; import org.bukkit.event.Cancellable; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -61,11 +60,14 @@ public class SpigotListener implements Listener { public SpigotListener() { + super(); } - public void init() { - Bukkit.getServer().getPluginManager().registerEvents(this, SpigotPrison.getInstance()); - } + // Do not use this init() function since it is non-standard in how + // prison is registering events. See SpigotPrison.onEnable(). +// public void init() { +// Bukkit.getServer().getPluginManager().registerEvents(this, SpigotPrison.getInstance()); +// } @EventHandler public void onPlayerJoin(PlayerJoinEvent e) { Prison.get().getEventBus().post( @@ -194,5 +196,4 @@ private void doCancelIfShould(Cancelable ours, Cancellable theirs) { theirs.setCancelled(true); } } - } 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 ec8e45dce..5e036d942 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPlatform.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPlatform.java @@ -42,6 +42,7 @@ import org.bukkit.plugin.Plugin; import com.cryptomorin.xseries.XBlock; +import com.cryptomorin.xseries.XMaterial; import com.cryptomorin.xseries.messages.Titles; import tech.mcprison.prison.Prison; @@ -51,7 +52,6 @@ import tech.mcprison.prison.convert.ConversionResult; import tech.mcprison.prison.file.FileStorage; import tech.mcprison.prison.file.YamlFileIO; -import tech.mcprison.prison.gui.GUI; import tech.mcprison.prison.internal.Player; import tech.mcprison.prison.internal.Scheduler; import tech.mcprison.prison.internal.World; @@ -60,41 +60,65 @@ import tech.mcprison.prison.internal.platform.Platform; import tech.mcprison.prison.internal.scoreboard.ScoreboardManager; import tech.mcprison.prison.mines.PrisonMines; +import tech.mcprison.prison.mines.data.Mine; import tech.mcprison.prison.mines.managers.MineManager; import tech.mcprison.prison.modules.Module; +import tech.mcprison.prison.modules.ModuleElement; +import tech.mcprison.prison.modules.ModuleElementType; import tech.mcprison.prison.output.BulletedListComponent; import tech.mcprison.prison.output.ChatDisplay; import tech.mcprison.prison.output.LogLevel; import tech.mcprison.prison.output.Output; +import tech.mcprison.prison.ranks.PrisonRanks; +import tech.mcprison.prison.ranks.data.Rank; +import tech.mcprison.prison.ranks.managers.RankManager; import tech.mcprison.prison.spigot.game.SpigotCommandSender; import tech.mcprison.prison.spigot.game.SpigotOfflinePlayer; import tech.mcprison.prison.spigot.game.SpigotPlayer; import tech.mcprison.prison.spigot.game.SpigotWorld; -import tech.mcprison.prison.spigot.gui.SpigotGUI; import tech.mcprison.prison.spigot.placeholder.SpigotPlaceholders; import tech.mcprison.prison.spigot.scoreboard.SpigotScoreboardManager; import tech.mcprison.prison.spigot.util.ActionBarUtil; import tech.mcprison.prison.spigot.util.SpigotYamlFileIO; import tech.mcprison.prison.store.Storage; +import tech.mcprison.prison.util.BlockType; import tech.mcprison.prison.util.Location; import tech.mcprison.prison.util.Text; /** * @author Faizaan A. Datoo */ -class SpigotPlatform implements Platform { +class SpigotPlatform + implements Platform { private SpigotPrison plugin; private List commands = new ArrayList<>(); private Map worlds = new HashMap<>(); - private List players = new ArrayList<>(); + +// @Deprecated +// private List players = new ArrayList<>(); private ScoreboardManager scoreboardManager; private Storage storage; private SpigotPlaceholders placeholders; - SpigotPlatform(SpigotPrison plugin) { + /** + * This is only for junit testing. + */ + protected SpigotPlatform() { + super(); + + this.plugin = null; + //this.scoreboardManager = new SpigotScoreboardManager(); + //this.storage = initStorage(); + + //this.placeholders = new SpigotPlaceholders(); + + //ActionBarUtil.init(plugin); + } + + public SpigotPlatform(SpigotPrison plugin) { this.plugin = plugin; this.scoreboardManager = new SpigotScoreboardManager(); this.storage = initStorage(); @@ -118,6 +142,11 @@ private Storage initStorage() { return storage; } + + public org.bukkit.World getBukkitWorld(String name ) { + return Bukkit.getWorld(name); + } + @Override public Optional getWorld(String name) { if (name != null && worlds.containsKey(name)) { @@ -165,31 +194,45 @@ public void getWorldLoadErrors( ChatDisplay display ) { } @Override public Optional getPlayer(String name) { - return Optional.ofNullable( - players.stream().filter(player -> player.getName().equalsIgnoreCase( name)).findFirst() - .orElseGet(() -> { - org.bukkit.entity.Player playerBukkit = Bukkit.getPlayer(name); - if (playerBukkit == null) { - return null; - } - SpigotPlayer player = new SpigotPlayer(playerBukkit); - players.add(player); - return player; - })); + + org.bukkit.entity.Player playerBukkit = Bukkit.getPlayer(name); + + return Optional.ofNullable( playerBukkit == null ? null : new SpigotPlayer(playerBukkit) ); + +// return Optional.ofNullable( +// players.stream().filter(player -> player.getName().equalsIgnoreCase( name)).findFirst() +// .orElseGet(() -> { +// +// // ### getting the bukkit player here! +// org.bukkit.entity.Player playerBukkit = Bukkit.getPlayer(name); +// if (playerBukkit == null) { +// return null; +// } +// SpigotPlayer player = new SpigotPlayer(playerBukkit); +// players.add(player); +// return player; +// })); } @Override public Optional getPlayer(UUID uuid) { - return Optional.ofNullable( - players.stream().filter(player -> player.getUUID().equals(uuid)).findFirst() - .orElseGet(() -> { - org.bukkit.entity.Player playerBukkit = Bukkit.getPlayer(uuid); - if (playerBukkit == null) { - return null; - } - SpigotPlayer player = new SpigotPlayer(playerBukkit); - players.add(player); - return player; - })); + org.bukkit.entity.Player playerBukkit = Bukkit.getPlayer(uuid); + + return Optional.ofNullable( playerBukkit == null ? null : new SpigotPlayer(playerBukkit) ); + +// return Optional.ofNullable( +// players.stream().filter(player -> player.getUUID().equals(uuid)).findFirst() +// .orElseGet(() -> { +// +// +// // ### getting the bukkit player here! +// org.bukkit.entity.Player playerBukkit = Bukkit.getPlayer(uuid); +// if (playerBukkit == null) { +// return null; +// } +// SpigotPlayer player = new SpigotPlayer(playerBukkit); +// players.add(player); +// return player; +// })); } @Override public List getOnlinePlayers() { @@ -209,16 +252,47 @@ public Optional getOfflinePlayer(UUID uuid) { private Optional getOfflinePlayer(String name, UUID uuid) { SpigotOfflinePlayer player = null; - for ( OfflinePlayer offP : Bukkit.getOfflinePlayers() ) { - if ( name != null && offP.getName().equalsIgnoreCase( name) || - uuid != null && offP.getUniqueId().equals(uuid) ) { - player = new SpigotOfflinePlayer( offP ); - - players.add(player); - break; - } - } + if ( uuid != null ) { + OfflinePlayer oPlayer = Bukkit.getOfflinePlayer( uuid ); + player = (oPlayer == null ? null : new SpigotOfflinePlayer( oPlayer ) ); + + } + + if ( player == null && name != null && name.trim().length() > 0 ) { + + // No hits on uuid so only compare names: + for ( OfflinePlayer oPlayer : Bukkit.getOfflinePlayers() ) { + if ( oPlayer != null && oPlayer.getName() != null && + oPlayer.getName().equalsIgnoreCase( name.trim() ) ) { + + player = new SpigotOfflinePlayer( oPlayer ); + break; + } + else if ( oPlayer == null || oPlayer.getName() == null ) { + Output.get().logWarn( "SpigotPlatform.getOfflinePlayer: Bukkit return a " + + "bad player: OfflinePlayer == null? " + (oPlayer == null) + + ( oPlayer == null ? "" : + " name= " + (oPlayer.getName() == null ? "null" : + oPlayer.getName()))); + + } + } + } + + return Optional.ofNullable( player ); + +// for ( OfflinePlayer offP : Bukkit.getOfflinePlayers() ) { +// if ( name != null && offP.getName().equalsIgnoreCase( name) || +// uuid != null && offP.getUniqueId().equals(uuid) ) { +// +// // ### getting the offline bukkit player here! +// player = new SpigotOfflinePlayer( offP ); +// players.add(player); +// break; +// } +// } +// // List olPlayers = Arrays.asList( Bukkit.getOfflinePlayers() ); // for ( OfflinePlayer offlinePlayer : olPlayers ) { // if ( name != null && offlinePlayer.getName().equals(name) || @@ -228,7 +302,7 @@ private Optional getOfflinePlayer(String name, UUID uuid) { // break; // } // } - return Optional.ofNullable( player ); +// return Optional.ofNullable( player ); } @Override public String getPluginVersion() { @@ -241,45 +315,59 @@ private Optional getOfflinePlayer(String name, UUID uuid) { @Override public void registerCommand(PluginCommand command) { try { - Command cmd = new Command(command.getLabel(), command.getDescription(), command.getUsage(), - Collections.emptyList()) { - - @Override public boolean execute(CommandSender sender, String commandLabel, - String[] args) { - if (sender instanceof org.bukkit.entity.Player) { - return Prison.get().getCommandHandler() - .onCommand(new SpigotPlayer((org.bukkit.entity.Player) sender), - command, commandLabel, args); - } + Command cmd = new Command( + command.getLabel(), + command.getDescription(), + command.getUsage(), + Collections.emptyList() ) { + + @Override + public boolean execute(CommandSender sender, String commandLabel, String[] args) { + if (sender instanceof org.bukkit.entity.Player) { return Prison.get().getCommandHandler() - .onCommand(new SpigotCommandSender(sender), command, commandLabel, - args); - - /* - * ###Tab-Complete### - * - * Disabled for now until a full solution can be implemented for tab complete. - * - // Output.get().logInfo( "SpigotPlatform.registerCommand: Command: %s :: %s", - // command.getLabel(), command.getUsage() ); - @Override - public List tabComplete( CommandSender sender, String[] args ) - { - Output.get().logInfo( "SpigotPlatform.registerCommand: Command.tabComplete 1" ); - // TODO Auto-generated method stub - return super.tabComplete( sender, args ); - } + .onCommand(new SpigotPlayer((org.bukkit.entity.Player) sender), + command, commandLabel, args); + } + + return Prison.get().getCommandHandler() + .onCommand(new SpigotCommandSender(sender), command, commandLabel, args); + } + + + @Override + public List tabComplete( CommandSender sender, String alias, String[] args ) + throws IllegalArgumentException + { + + List results = Prison.get().getCommandHandler().getTabCompleaterData().check( alias, args ); + + +// StringBuilder sb = new StringBuilder(); +// for ( String arg : args ) { +// sb.append( "[" ).append( arg ).append( "] " ); +// } +// +// StringBuilder sbR = new StringBuilder(); +// for ( String result : results ) { +// sbR.append( "[" ).append( result ).append( "] " ); +// } +// +// plugin.logDebug( "### registerCommand: Command.tabComplete() : alias= %s args= %s results= %s", +// alias, sb.toString(), sbR.toString() ); + + + return results; + } + + + //@Override + public List tabComplete( CommandSender sender, String alias, String[] args, + org.bukkit.Location location ) + throws IllegalArgumentException + { + return tabComplete( sender, alias, args ); + } - @Override - public List tabComplete( CommandSender sender, String alias, String[] args ) - throws IllegalArgumentException - { - Output.get().logInfo( "SpigotPlatform.registerCommand: Command.tabComplete 2" ); - // TODO Auto-generated method stub - return super.tabComplete( sender, alias, args ); - } - */ - } }; @SuppressWarnings( "unused" ) @@ -287,7 +375,12 @@ public List tabComplete( CommandSender sender, String alias, String[] ar ((SimpleCommandMap) plugin.commandMap.get(Bukkit.getServer())) .register(command.getLabel(), "prison", cmd ); - commands.add(command); + // Always record the registered label: + if ( cmd != null ) { + command.setLabelRegistered( cmd.getLabel() ); + } + + getCommands().add(command); // if ( !success ) { // Output.get().logInfo( "SpigotPlatform.registerCommand: %s " + @@ -299,16 +392,42 @@ public List tabComplete( CommandSender sender, String alias, String[] ar } } - @SuppressWarnings("unchecked") @Override public void unregisterCommand(String command) { + @SuppressWarnings("unchecked") @Override + public void unregisterCommand(String command) { try { ((Map) plugin.knownCommands .get(plugin.commandMap.get(Bukkit.getServer()))).remove(command); - this.commands.removeIf(pluginCommand -> pluginCommand.getLabel().equals(command)); + getCommands().removeIf(pluginCommand -> pluginCommand.getLabel().equals(command)); } catch (IllegalAccessException e) { e.printStackTrace(); // This should only happen if something's wrong up there. } } + + @Override + public void unregisterAllCommands() { + List cmds = new ArrayList<>(); + for ( PluginCommand pluginCommand : getCommands() ) { + cmds.add( pluginCommand.getLabel() ); + } + + for ( String lable : cmds ) { + unregisterCommand( lable ); + } + } + + public PluginCommand findCommand( String label ) { + PluginCommand results = null; + + for ( PluginCommand command : getCommands() ) { + if (command.getLabel().equalsIgnoreCase(label)) { + results = command; + break; + } + } + return results; + } + @Override public List getCommands() { return commands; } @@ -325,9 +444,10 @@ public List tabComplete( CommandSender sender, String alias, String[] ar return plugin.scheduler; } - @Override public GUI createGUI(String title, int numRows) { - return new SpigotGUI(title, numRows); - } + // Old method removed + // @Override public GUI createGUI(String title, int numRows) { + // return new SpigotGUI(title, numRows); + // } // @SuppressWarnings( "deprecation" ) public void toggleDoor(Location doorLocation) { @@ -352,30 +472,38 @@ public void toggleDoor(Location doorLocation) { .playIronDoorSound(block.getLocation()); } - @Override public void log(String message, Object... format) { + @Override + public void log(String message, Object... format) { message = Text.translateAmpColorCodes(String.format(message, format)); - ConsoleCommandSender sender = Bukkit.getConsoleSender(); + logCore( message ); + } + + @Override + public void logCore( String message ) + { + ConsoleCommandSender sender = Bukkit.getConsoleSender(); if (sender == null) { Bukkit.getLogger().info(ChatColor.stripColor(message)); } else { sender.sendMessage(message); } - } + } @Override public void debug(String message, Object... format) { if (!plugin.debug) { return; } - log(Output.get().gen("&eDebug") + " &7", message, format); + log( Output.get().format( message, LogLevel.DEBUG), format ); } @Override public String runConverter() { File file = new File(plugin.getDataFolder().getParent(), "Prison.old"); if (!file.exists()) { return Output.get().format( - "I could not find a 'Prison.old' folder to convert. You probably haven't had Prison 2 installed before, so you don't need to convert :)", + "Could not find a 'Prison.old' folder to convert. Prison 2 may not have been installed " + + "before, so there is nothing that can be converted :)", LogLevel.WARNING); } @@ -464,6 +592,8 @@ public void identifyRegisteredPlugins() { // Finally print the version after loading the prison plugin: // PrisonCommand cmdVersion = Prison.get().getPrisonCommands(); + + boolean isPlugManPresent = false; // Store all loaded plugins within the PrisonCommand for later inclusion: for ( Plugin plugin : server.getPluginManager().getPlugins() ) { @@ -473,11 +603,31 @@ public void identifyRegisteredPlugins() { cmdVersion.getRegisteredPlugins().add( value ); cmdVersion.addRegisteredPlugin( name, version ); + + if ( "PlugMan".equalsIgnoreCase( name ) ) { + isPlugManPresent = true; + } } + + if ( isPlugManPresent ) { + ChatDisplay chatDisplay = new ChatDisplay("&d* &d* &5WARNING: &dPlugMan &5Detected! &d* &d*"); + chatDisplay.text( "&7The use of PlugMan on this Prison server will corrupt internals" ); + chatDisplay.text( "&7of Prison and may lead to a non-functional state, or even total" ); + chatDisplay.text( "&7corruption of the internal settings, the saved files, and maybe" ); + chatDisplay.text( "&7even the mines and surrounding areas too." ); + chatDisplay.text( "&7The only safe way to restart Prison is through a server restart." ); + chatDisplay.text( "&7Use of PlugMan at your own risk. You have been warned. " ); + chatDisplay.text( "&7Prison support team has no obligation to help recover, or repair," ); + chatDisplay.text( "&7any troubles that may result of the use of PlugMan." ); + chatDisplay.text( "&bPlease Note: &3The &7/prison reload&3 commands are safe to use anytime." ); + chatDisplay.text( "&d* &d* &5WARNING &d* &d* &5WARNING &d* &d* &5WARNING &d* &d*" ); + + chatDisplay.sendtoOutputLogInfo();; + } // NOTE: The following code does not actually get all of the commands that have been // registered with the bukkit plugin registry. So commenting this out and may revisit - // in the future. Only tested with 1.8.8 so may work better with more cent version. + // in the future. Only tested with 1.8.8 so may work better with more recent version. // SimplePluginManager spm = (SimplePluginManager) Bukkit.getPluginManager(); // // try { @@ -562,7 +712,7 @@ public String getConfigString( String key ) { /** *

This returns the boolean value that is associated with the key. * It has to match on true to return a true value. If the key does - * not exist, then it returns a value of false. + * not exist, then it returns a value of false. Default value is false. *

* * @param key @@ -578,8 +728,8 @@ public boolean getConfigBooleanFalse( String key ) { /** *

This returns the boolean value that is associated with the key. - * It has to match on true to return a true value. If the key does - * not exist, then it returns a value of true. + * It has to match on true to return a true value, but if the key does + * not exist, then it returns a value of true. Default value is true. *

* * @param key @@ -610,4 +760,438 @@ public PrisonBlock getPrisonBlock( String blockName ) { return SpigotUtil.getPrisonBlock( blockName ); } + + + /** + * ModuleElements are Mines or Ranks, and sometimes maybe even ladders. + * + * The purpose of this function is to link together Mines and rank (and maybe even + * ladders) when they cannot reference each other within their native modules. So + * this external linking is required. + * + * Currently, the only linkage that is supported are: + * + * Mine to one rank + * rank has many mines + * + * + */ + @Override + public boolean linkModuleElements( ModuleElement sourceElement, + ModuleElementType targetElementType, String name ) { + boolean results = false; + + if ( sourceElement != null) { + + if ( sourceElement.getModuleElementType() == ModuleElementType.MINE && + sourceElement instanceof Mine ) { + // If we have an instance of a mine, then we know that module has been + // enabled. + + // We need to confirm targetElementType is ranks, then we need to check to + // ensure the rank module is active, then search for a rank with the given + // name. If found, then link. + if ( targetElementType != null && targetElementType == ModuleElementType.RANK && + PrisonRanks.getInstance() != null && PrisonRanks.getInstance().isEnabled() ) { + + RankManager rm = PrisonRanks.getInstance().getRankManager(); + if ( rm != null ) { + Rank rank = rm.getRank( name ); + + if ( rank != null ) { + Mine mine = (Mine) sourceElement; + + // Add the mine to the rank, and the rank to the mine: + mine.setRank( rank ); + rank.getMines().add( mine ); + + // save both the mine and the rank: + MineManager mm = PrisonMines.getInstance().getMineManager(); + mm.saveMine( mine ); + rm.saveRank( rank ); + + results = true; + } + } + } + } + + else if ( sourceElement.getModuleElementType() == ModuleElementType.RANK && + sourceElement instanceof Rank ) { + // If we have an instance of a mine, then we know that module has been + // enabled. + + // We need to confirm targetElementType is ranks, then we need to check to + // ensure the rank module is active, then search for a rank with the given + // name. If found, then link. + if ( targetElementType != null && targetElementType == ModuleElementType.MINE && + PrisonMines.getInstance() != null && PrisonMines.getInstance().isEnabled() ) { + MineManager mm = PrisonMines.getInstance().getMineManager(); + if ( mm != null ) { + Mine mine = mm.getMine( name ); + + if ( mine != null ) { + Rank rank = (Rank) sourceElement; + + mine.setRank( rank ); + rank.getMines().add( mine ); + + // save both the mine and the rank: + RankManager rm = PrisonRanks.getInstance().getRankManager(); + mm.saveMine( mine ); + rm.saveRank( rank ); + + results = true; + } + + } + } + } + } + + return results; + } + + + @Override + public boolean unlinkModuleElements( ModuleElement elementA, ModuleElement elementB ) { + boolean results = false; + + unlinkModuleElement( elementA, elementB ); + + return results; + } + + + private boolean unlinkModuleElement( ModuleElement elementA, ModuleElement elementB ) { + boolean results = false; + + + if ( elementA != null) { + + if ( elementA.getModuleElementType() == ModuleElementType.MINE && + elementA instanceof Mine ) { + + // We need to confirm targetElementType is ranks, then we need to check to + // ensure the rank module is active, then search for a rank with the given + // name. If found, then link. + if ( elementB != null && elementB.getModuleElementType() == ModuleElementType.RANK ) { + + RankManager rm = PrisonRanks.getInstance().getRankManager(); + if ( rm != null ) { + // To remove the rank from the mine, just set the value to null: + Mine mine = (Mine) elementA; + mine.setRank( null ); + + Rank rank = (Rank) elementB; + rank.getMines().remove( mine ); + + // save both the mine and the rank: + MineManager mm = PrisonMines.getInstance().getMineManager(); + mm.saveMine( mine ); + rm.saveRank( rank ); + + } + } + } + + else if ( elementA.getModuleElementType() == ModuleElementType.RANK && + elementA instanceof Rank ) { + // If we have an instance of a mine, then we know that module has been + // enabled. + + // We need to confirm targetElementType is ranks, then we need to check to + // ensure the rank module is active, then search for a rank with the given + // name. If found, then link. + if ( elementB != null && elementB.getModuleElementType() == ModuleElementType.MINE ) { + MineManager mm = PrisonMines.getInstance().getMineManager(); + if ( mm != null ) { + Mine mine = (Mine) elementB; + + if ( mine != null ) { + Rank rank = (Rank) elementA; + + mine.setRank( rank ); + rank.getMines().remove( mine ); + + // save both the mine and the rank: + RankManager rm = PrisonRanks.getInstance().getRankManager(); + mm.saveMine( mine ); + rm.saveRank( rank ); + + results = true; + } + + } + } + } + } + + + return results; + } + + /** + *

This function will create the specified ModuleElement. It will create the minimal + * possible element, of which, the settings can then be changed. If the create was + * successful, then it will return the element, otherwise it will return a null. + *

+ * + *

Minimal mines will be a virtual mine, but with the tag set. + *

+ * + *

Minimal rank will be placed on the default ladder with a cost of zero. + *

+ * + */ + public ModuleElement createModuleElement( tech.mcprison.prison.internal.CommandSender sender, + ModuleElementType elementType, String name, String tag ) { + ModuleElement results = null; + + if ( elementType == ModuleElementType.MINE ) { + MineManager mm = PrisonMines.getInstance().getMineManager(); + Mine mine = mm.getMine( name ); + if ( mine == null ) { + PrisonMines.getInstance().getMinesCommands().createCommand( sender, "virtual", name ); + mine = mm.getMine( name ); + mine.setTag( tag ); + + results = mine; + } + } + else if ( elementType == ModuleElementType.RANK ) { + RankManager rm = PrisonRanks.getInstance().getRankManager(); + rm.getRanksCommands().createRank( sender, name, 0, "default", tag ); + + Rank rank = rm.getRank( name ); + + results = rank; + } + + return results; + } + + @Override + public int getModuleElementCount( ModuleElementType elementType ) { + int results = 0; + + if ( elementType == ModuleElementType.MINE ) { + MineManager mm = PrisonMines.getInstance().getMineManager(); + results = mm.getMines().size(); + } + else if ( elementType == ModuleElementType.RANK ) { + RankManager rm = PrisonRanks.getInstance().getRankManager(); + results = rm.getRanks().size(); + } + + return results; + } + + + /** + *

This function assigns blocks to all of the generated mines. It is intended that + * these mines were just created by the autoCreate function which will ensure that + * no blocks have yet been assigned to any mines. Because it is assumed that no + * blocks are in any of these mines, no check is performed to eliminate possible + * duplicates or to prevent total chance from exceeding 100.0%. + *

+ * + *

This function uses a sliding window of X number of block types to assign. + * The number of block types is defined by the percents List in both the number of + * blocks, but also the percentage for each block. + * The current List has 6 types per mine, with the first few and last few having less. + * The percents are assigned to the most valuable to the least valuable blocks: + * 5%, 10%, 20%, 20%, 20%, and 25%. + *

+ * + *

This function works with the old and new prison block models, and uses the + * exact same blocks for consistency. + *

+ * + */ + @Override + public void autoCreateMineBlockAssignment() { + List blockList = null; + + if ( Prison.get().getPlatform().getConfigBooleanFalse( "use-new-prison-block-model" ) ) { + blockList = buildBlockListXMaterial(); + } + else { + blockList = buildBlockListBlockType(); + } + + MineManager mm = PrisonMines.getInstance().getMineManager(); + List mines = mm.getMines(); + + List percents = new ArrayList<>(); + percents.add(5d); + percents.add(10d); + percents.add(20d); + percents.add(20d); + percents.add(20d); + percents.add(25d); + int mineBlockSize = percents.size(); + + int startPos = 1; + for ( Mine mine : mines ) { + + List mBlocks = mineBlockList( blockList, startPos++, mineBlockSize ); + + // If startPos > percents.size(), which means we are past the initial + // ramp up to the full variety of blocks per mine. At that point, if + // percents is grater than mBlocks, then we must trim the first entry + // from percents so that the most valuable block is able to have more + // than just 5% allocation. + // This should only happen at the tail end of processing and will only + // have a decrease by one per mine so there should never be a need to + // to check more than once, or remove more than one. + if ( startPos > percents.size() && percents.size() > mBlocks.size() ) { + percents.remove( 0 ); + } + + double total = 0; + for ( int i = 0; i < mBlocks.size(); i++ ) + { + + tech.mcprison.prison.mines.data.Block block = + new tech.mcprison.prison.mines.data.Block( + mBlocks.get( i ), percents.get( i ) ); + + mine.getBlocks().add( block ); + + total += block.getChance(); + + // If this is the last block and the totals are not 100%, then + // add the balance to the last block. + if ( i == (mBlocks.size() - 1) && total < 100.0d ) { + double remaining = 100.0d - total; + block.setChance( remaining + block.getChance() ); + } + + } + + mm.saveMine( mine ); + + String mineBlockListing = mine.getBlockListString(); + Output.get().logInfo( mineBlockListing ); + } + } + + /** + * This function grabs a rolling sub set of blocks from the startPos and working backwards + * up to the specified length. The result set will be less than the specified length if at + * the beginning of the list, or at the end. + * + * @param blockList + * @param startPos + * @param length + * @return + */ + protected List mineBlockList( List blockList, int startPos, int length ) { + + List results = new ArrayList<>(); + for (int i = (startPos >= blockList.size() ? blockList.size() - 1 : startPos); i >= 0 && i >= startPos - length + 1; i--) { + results.add( blockList.get( i ) ); + } + + return results; + } + + /** + * This listing of blocks is based strictly upon XMaterial. + * This is the preferred list to use with the new block model. + * + * @return + */ + protected List buildBlockListXMaterial() { + List blockList = new ArrayList<>(); + + blockList.add( XMaterial.COBBLESTONE.name() ); + blockList.add( XMaterial.ANDESITE.name() ); + blockList.add( XMaterial.DIORITE.name() ); + blockList.add( XMaterial.COAL_ORE.name() ); + + blockList.add( XMaterial.GRANITE.name() ); + blockList.add( XMaterial.STONE.name() ); + blockList.add( XMaterial.IRON_ORE.name() ); + blockList.add( XMaterial.POLISHED_ANDESITE.name() ); + +// blockList.add( XMaterial.POLISHED_DIORITE.name() ); +// blockList.add( XMaterial.POLISHED_GRANITE.name() ); + blockList.add( XMaterial.GOLD_ORE.name() ); + + + blockList.add( XMaterial.MOSSY_COBBLESTONE.name() ); + blockList.add( XMaterial.COAL_BLOCK.name() ); + blockList.add( XMaterial.NETHER_QUARTZ_ORE.name() ); + blockList.add( XMaterial.IRON_BLOCK.name() ); + + blockList.add( XMaterial.LAPIS_ORE.name() ); + blockList.add( XMaterial.REDSTONE_ORE.name() ); + blockList.add( XMaterial.DIAMOND_ORE.name() ); + + blockList.add( XMaterial.QUARTZ_BLOCK.name() ); + blockList.add( XMaterial.EMERALD_ORE.name() ); + + blockList.add( XMaterial.GOLD_BLOCK.name() ); + blockList.add( XMaterial.LAPIS_BLOCK.name() ); + blockList.add( XMaterial.REDSTONE_BLOCK.name() ); + +// blockList.add( XMaterial.SLIME_BLOCK.name() ); + blockList.add( XMaterial.DIAMOND_BLOCK.name() ); + blockList.add( XMaterial.EMERALD_BLOCK.name() ); + + return blockList; + } + + /** + * This listing of blocks is based strictly upon the old prison's block + * model. + * + * Please note, that right now these names match exactly with XMaterial only + * because I renamed a few of them to make them match. But if more are added + * in the future, then there may be mismatches. + * + * @return + */ + protected List buildBlockListBlockType() { + List blockList = new ArrayList<>(); + + blockList.add( BlockType.COBBLESTONE.name() ); + blockList.add( BlockType.ANDESITE.name() ); + blockList.add( BlockType.DIORITE.name() ); + blockList.add( BlockType.COAL_ORE.name() ); + + blockList.add( BlockType.GRANITE.name() ); + blockList.add( BlockType.STONE.name() ); + blockList.add( BlockType.IRON_ORE.name() ); + blockList.add( BlockType.POLISHED_ANDESITE.name() ); + +// blockList.add( BlockType.POLISHED_DIORITE.name() ); +// blockList.add( BlockType.POLISHED_GRANITE.name() ); + blockList.add( BlockType.GOLD_ORE.name() ); + + + blockList.add( BlockType.MOSSY_COBBLESTONE.name() ); + blockList.add( BlockType.COAL_BLOCK.name() ); + blockList.add( BlockType.NETHER_QUARTZ_ORE.name() ); + blockList.add( BlockType.IRON_BLOCK.name() ); + + blockList.add( BlockType.LAPIS_ORE.name() ); + blockList.add( BlockType.REDSTONE_ORE.name() ); + blockList.add( BlockType.DIAMOND_ORE.name() ); + + blockList.add( BlockType.QUARTZ_BLOCK.name() ); + blockList.add( BlockType.EMERALD_ORE.name() ); + + blockList.add( BlockType.GOLD_BLOCK.name() ); + blockList.add( BlockType.LAPIS_BLOCK.name() ); + blockList.add( BlockType.REDSTONE_BLOCK.name() ); + +// blockList.add( BlockType.SLIME_BLOCK.name() ); + blockList.add( BlockType.DIAMOND_BLOCK.name() ); + blockList.add( BlockType.EMERALD_BLOCK.name() ); + + return blockList; + } } 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 7bbdd404f..67170a3e6 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 @@ -41,26 +41,34 @@ import tech.mcprison.prison.alerts.Alerts; import tech.mcprison.prison.integration.Integration; import tech.mcprison.prison.mines.PrisonMines; +import tech.mcprison.prison.mines.data.Mine; +import tech.mcprison.prison.mines.managers.MineManager; import tech.mcprison.prison.modules.Module; +import tech.mcprison.prison.modules.ModuleElementType; import tech.mcprison.prison.output.ChatDisplay; import tech.mcprison.prison.output.LogLevel; import tech.mcprison.prison.output.Output; import tech.mcprison.prison.ranks.PrisonRanks; +import tech.mcprison.prison.ranks.data.Rank; +import tech.mcprison.prison.ranks.managers.RankManager; import tech.mcprison.prison.spigot.autofeatures.AutoManager; import tech.mcprison.prison.spigot.autofeatures.AutoManagerFeatures; import tech.mcprison.prison.spigot.block.OnBlockBreakEventListener; -import tech.mcprison.prison.spigot.commands.PrisonShortcutCommands; import tech.mcprison.prison.spigot.commands.PrisonSpigotCommands; +import tech.mcprison.prison.spigot.commands.PrisonSpigotMinesCommands; +import tech.mcprison.prison.spigot.commands.PrisonSpigotPrestigeCommands; +import tech.mcprison.prison.spigot.commands.PrisonSpigotRanksCommands; import tech.mcprison.prison.spigot.compat.Compatibility; import tech.mcprison.prison.spigot.compat.Spigot113; import tech.mcprison.prison.spigot.compat.Spigot18; import tech.mcprison.prison.spigot.compat.Spigot19; +import tech.mcprison.prison.spigot.configs.GuiConfig; +import tech.mcprison.prison.spigot.configs.MessagesConfig; +import tech.mcprison.prison.spigot.configs.SellAllConfig; import tech.mcprison.prison.spigot.economies.EssentialsEconomy; import tech.mcprison.prison.spigot.economies.GemsEconomy; import tech.mcprison.prison.spigot.economies.SaneEconomy; import tech.mcprison.prison.spigot.economies.VaultEconomy; -import tech.mcprison.prison.spigot.gui.GUIListener; -import tech.mcprison.prison.spigot.gui.GuiConfig; import tech.mcprison.prison.spigot.gui.ListenersPrisonManager; import tech.mcprison.prison.spigot.permissions.LuckPermissions; import tech.mcprison.prison.spigot.permissions.LuckPerms5; @@ -69,7 +77,6 @@ import tech.mcprison.prison.spigot.placeholder.PlaceHolderAPIIntegration; import tech.mcprison.prison.spigot.player.SlimeBlockFunEventListener; import tech.mcprison.prison.spigot.sellall.SellAllCommands; -import tech.mcprison.prison.spigot.sellall.SellAllConfig; import tech.mcprison.prison.spigot.spiget.BluesSpigetSemVerComparator; /** @@ -91,6 +98,10 @@ public class SpigotPrison extends JavaPlugin { private AutoManagerFeatures autoFeatures = null; // private FileConfiguration autoFeaturesConfig = null; + + private MessagesConfig messagesConfig; + private GuiConfig guiConfig; + private SellAllConfig sellAllConfig; private static SpigotPrison config; @@ -144,57 +155,44 @@ public void onEnable() { initCommandMap(); initCompatibility(); initUpdater(); - this.scheduler = new SpigotScheduler(this); + this.scheduler = new SpigotScheduler(this); + Prison.get().init(new SpigotPlatform(this), Bukkit.getVersion()); Prison.get().getLocaleManager().setDefaultLocale(getConfig().getString("default-language", "en_US")); - - new GuiConfig(); - GUIListener.get().init(this); + Bukkit.getPluginManager().registerEvents(new ListenersPrisonManager(),this); - Bukkit.getPluginManager().registerEvents(new PrisonSpigotCommands(), this); - Bukkit.getPluginManager().registerEvents(new AutoManager(), this); Bukkit.getPluginManager().registerEvents(new OnBlockBreakEventListener(), this); Bukkit.getPluginManager().registerEvents(new SlimeBlockFunEventListener(), this); - getCommand("prisonmanager").setExecutor(new PrisonSpigotCommands()); - - // Only register the command if not enabled so it will not conflict with other sellall plugins: - if ( SellAllCommands.isEnabled() ) { - new SellAllConfig(); - - getCommand("sellall").setExecutor(new SellAllCommands()); - } - - - new SpigotListener().init(); + Bukkit.getPluginManager().registerEvents(new SpigotListener(), this); - Prison.get().getCommandHandler().registerCommands(new PrisonShortcutCommands()); initIntegrations(); - initModules(); - applyDeferredIntegrationInitializations(); - extractCommandsForAutoComplete(); + // NOTE: Put all commands within the initModulesAndCommands() function. + initModulesAndCommands(); + applyDeferredIntegrationInitializations(); initMetrics(); + + Prison.get().getPlatform().getPlaceholders().printPlaceholderStats(); + + PrisonCommand cmdVersion = Prison.get().getPrisonCommands(); + + + // if (doAlertAboutConvert) { // Alerts.getInstance().sendAlert( // "&7An old installation of Prison has been detected. &3Type /prison convert to convert your old data automatically. &7If you already converted, delete the 'Prison.old' folder so that we stop nagging you."); // } - - - Prison.get().getPlatform().getPlaceholders().printPlaceholderStats(); - - - + // Finally print the version after loading the prison plugin: - PrisonCommand cmdVersion = Prison.get().getPrisonCommands(); - + // // Store all loaded plugins within the PrisonCommand for later inclusion: // for ( Plugin plugin : Bukkit.getPluginManager().getPlugins() ) { // String name = plugin.getName(); @@ -212,7 +210,6 @@ public void onEnable() { } Output.get().logInfo( "Prison - Finished loading." ); - } @Override @@ -220,17 +217,33 @@ public void onDisable() { if (this.scheduler != null ) { this.scheduler.cancelAll(); } - Prison.get().deinit(); + + Prison.get().getPlatform().unregisterAllCommands(); + + Prison.get().deinit(); + } + + public FileConfiguration getGuiConfig() { + if ( guiConfig == null ) { + guiConfig = new GuiConfig(); + } + return guiConfig.getFileGuiConfig(); } - public static FileConfiguration getGuiConfig(){ - GuiConfig messages = new GuiConfig(); - return messages.getFileGuiConfig(); + public FileConfiguration getSellAllConfig() { + if (sellAllConfig == null && SellAllCommands.isEnabled() ) { + + sellAllConfig = new SellAllConfig(); + } + return sellAllConfig == null ? null : sellAllConfig.getFileSellAllConfig(); } - public static FileConfiguration getSellAllConfig(){ - SellAllConfig configs = new SellAllConfig(); - return configs.getFileSellAllConfig(); + public FileConfiguration getMessagesConfig() { + if (messagesConfig == null) { + messagesConfig = new MessagesConfig(); + } + + return messagesConfig.getFileGuiMessagesConfig(); } public AutoManagerFeatures getAutoFeatures() { @@ -240,14 +253,17 @@ public AutoManagerFeatures getAutoFeatures() { public void setAutoFeatures( AutoManagerFeatures autoFeatures ) { this.autoFeatures = autoFeatures; } - - - - + public static String format(String format){ - return ChatColor.translateAlternateColorCodes('&', format); + return format == null ? "" : ChatColor.translateAlternateColorCodes('&', format); } + public static String stripColor(String format){ + format = format(format); + + return format == null ? null : ChatColor.stripColor(format); + } + private void initMetrics() { if (!getConfig().getBoolean("send-metrics", true)) { return; // Don't check if they don't want it @@ -314,7 +330,6 @@ public void upToDate() { // Plugin is up-to-date } }); - } private void initDataDir() { @@ -383,29 +398,37 @@ public void reloadIntegrationsPlaceholders() { MVdWPlaceholderIntegration ph1 = new MVdWPlaceholderIntegration(); PlaceHolderAPIIntegration ph2 = new PlaceHolderAPIIntegration(); - registerIntegration( ph1 ); - registerIntegration( ph2 ); + registerIntegration(ph1); + registerIntegration(ph2); ph1.deferredInitialization(); ph2.deferredInitialization(); } private void registerIntegration(Integration integration) { - integration.setRegistered( - Bukkit.getPluginManager().isPluginEnabled(integration.getProviderName()) ); + integration.setRegistered(Bukkit.getPluginManager().isPluginEnabled(integration.getProviderName())); integration.integrate(); - PrisonAPI.getIntegrationManager().register(integration); } - private void initModules() { + /** + * This function registers all of the modules in prison. It should also manage + * the registration of "extra" commands that are outside of the modules, such + * as gui related commands. + * + */ + private void initModulesAndCommands() { + YamlConfiguration modulesConf = loadConfig("modules.yml"); // TODO: This business logic needs to be moved to the Module Manager: if (modulesConf.getBoolean("mines")) { Prison.get().getModuleManager() .registerModule(new PrisonMines(getDescription().getVersion())); + + Prison.get().getCommandHandler().registerCommands( new PrisonSpigotMinesCommands() ); + } else { Output.get().logInfo("&7Modules: &cPrison Mines are disabled and were not Loaded. "); Output.get().logInfo("&7 Prison Mines have been disabled in &2plugins/Prison/modules.yml&7."); @@ -415,14 +438,83 @@ private void initModules() { if (modulesConf.getBoolean("ranks")) { Prison.get().getModuleManager() .registerModule(new PrisonRanks(getDescription().getVersion())); + + Prison.get().getCommandHandler().registerCommands( new PrisonSpigotRanksCommands() ); + + // NOTE: If ranks module is enabled, then try to register prestiges commands if enabled: + if ( !isPrisonConfig( "prestiges") ) { + // Enable the setup of the prestige related commands only if prestiges is enabled: + Prison.get().getCommandHandler().registerCommands( new PrisonSpigotPrestigeCommands() ); + } + } else { Output.get().logInfo("&3Modules: &cPrison Ranks, Ladders, and Players are disabled and were not Loaded. "); + Output.get().logInfo("&7 Prestiges cannot be enabled without ranks being enabled. "); Output.get().logInfo("&7 Prison Ranks have been disabled in &2plugins/Prison/modules.yml&7."); Prison.get().getModuleManager().getDisabledModules().add( PrisonRanks.MODULE_NAME ); } + + // Try to load the mines and ranks that have the ModuleElement placeholders: + // Both the mine and ranks modules must be enabled. + if (modulesConf.getBoolean("mines") && modulesConf.getBoolean("ranks")) { + linkMinesAndRanks(); + } + + // Only register the command if it is enabled so it will not conflict with other sellall plugins if they are used: + if ( SellAllCommands.isEnabled() ) { + + // Do not hit this function here. It will lazy initialize if needed: + //getSellAllConfig(); + getCommand("sellall").setExecutor(new SellAllCommands()); + } + + // This registers the admin's /gui commands + Prison.get().getCommandHandler().registerCommands( new PrisonSpigotCommands() ); + } - private void applyDeferredIntegrationInitializations() { + private void linkMinesAndRanks() { + + + if (PrisonRanks.getInstance() != null && PrisonRanks.getInstance().isEnabled() && PrisonMines.getInstance() != null && PrisonMines.getInstance().isEnabled()) { + + RankManager rm = PrisonRanks.getInstance().getRankManager(); + MineManager mm = PrisonMines.getInstance().getMineManager(); + + // go through all mines and link them to the Ranks and link that + // rank back to the mine. + // So just by linking mines, will also link all of the ranks too. + // It's important to understand the primary source is within the Mine + // since a mine can only have one rank. + rm.getRanks(); + mm.getMines(); + + int count = 0; + for (Mine mine : mm.getMines()) { + if ( mine.getRank() == null && mine.getRankString() != null ) { + String[] rParts = mine.getRankString().split( "," ); + + if (rParts.length > 2) { + ModuleElementType meType = ModuleElementType.fromString( rParts[0] ); + String rankName = rParts[1]; + + if (meType == ModuleElementType.RANK) { + Rank rank = rm.getRank(rankName); + + if (rank != null) { + mine.setRank(rank); + rank.getMines().add(mine); + count++; + } + } + } + } + } + Output.get().logInfo("A total of %s Mines and Ranks have been linked together.", Integer.toString(count)); + } + } + + private void applyDeferredIntegrationInitializations() { for ( Integration deferredIntegration : PrisonAPI.getIntegrationManager().getDeferredIntegrations() ) { deferredIntegration.deferredInitialization(); } @@ -449,69 +541,10 @@ File getDataDirectory() { return dataDirectory; } + public boolean isPrisonConfig( String configId ) { - /** - *

This function will register any missing "command" and will - * set the usable onTabComplete to the one within this class, - * that follows this function. - *

- * - */ - private void extractCommandsForAutoComplete() { -/* - * ###Tab-Complete### (search for other occurrences of this tag) - * - * The following works up to a certain point, but is disabled until - * a full solution can be implemented. - * - List commandKeys = Prison.get().getCommandHandler().getRootCommandKeys(); - - registeredCommands.clear(); - registeredCommands.addAll( commandKeys ); - - // commands are already broken down to elements with roots: Keep the following - // just in case we need to expand with other uses: - for ( String cmdKey : commandKeys ) { - - Output.get().logInfo( "SpigotPrison.extractCommandsForAutoComplete: Command: %s", cmdKey ); - - Optional registeredCommand = Prison.get().getPlatform().getCommand(cmdKey); - if ( !registeredCommand.isPresent() ) { - tech.mcprison.prison.commands.PluginCommand rootPcommand = new tech.mcprison.prison.commands.PluginCommand(cmdKey, "--", "/" + cmdKey); - Prison.get().getPlatform().registerCommand(rootPcommand); - } - - PluginCommand pCommand = this.getCommand(cmdKey); - if ( pCommand != null ) { - pCommand.setTabCompleter(this); - } else { - Output.get().logInfo( "SpigotPrison.extractCommandsForAutoComplete: " + - "## Error not found ## Command: %s ", cmdKey ); - } - } - */ - - } -/* - * ###Tab-Complete### - * - * This function is disabled until tab complete can be fully implemented. - * - * @see org.bukkit.plugin.java.JavaPlugin#onTabComplete(org.bukkit.command.CommandSender, org.bukkit.command.Command, java.lang.String, java.lang.String[]) - * - * // Not being used... - @Override - public List onTabComplete( CommandSender sender, Command command, String alias, String[] args ) - { - List results = new ArrayList<>(); - Output.get().logInfo( "SpigotPrison.onTabComplete: Command: %s :: %s", command.getLabel(), command.getName() ); - - // Map> cmds = getDescription().getCommands(); - -// registeredCommands - - return results; - } - */ - + String config = SpigotPrison.getInstance().getConfig().getString( configId ); + boolean results = config != null && config.equalsIgnoreCase( "true" ); + return results; + } } 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 abc852914..a0f593e53 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 @@ -21,9 +21,11 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.Material; +import org.bukkit.OfflinePlayer; import org.bukkit.block.Block; import org.bukkit.inventory.InventoryView; import org.bukkit.inventory.ItemStack; @@ -81,6 +83,13 @@ public static XMaterial getXMaterial( BlockType prisonBlockType ) { return xMat; } + public static XMaterial getXMaterial( PrisonBlock prisonBlock ) { + + XMaterial xMat = getXMaterial( prisonBlock.getBlockName()); + + return xMat; + } + public static Material getMaterial( BlockType prisonBlockType ) { XMaterial xMat = getXMaterial( prisonBlockType ); @@ -106,6 +115,13 @@ public static BlockType blockToBlockType( Block spigotBlock ) { return results; } + + public static BlockType prisonBlockToBlockType( PrisonBlock prisonBlock ) { + + BlockType results = BlockType.getBlock( prisonBlock.getBlockName() ); + + return results; + } /** *

Returns a stack of BlockType or a stack of air. @@ -143,19 +159,45 @@ public static ItemStack getItemStack( XMaterial xMaterial, int amount ) { return bukkitStack; } + /** + * Note that XMaterial.parseMaterial() may work well for v1.13.x and higher, + * but it does not represent the correct block types in lower versions, + * such as with 1.8.x. This has everything to do with magic numbers. + * Instead convert it to an ItemStack. + * + * @param blockTypes + */ public static void getAllPlatformBlockTypes( List blockTypes ) { for ( XMaterial xMat : XMaterial.values() ) { if ( xMat.isSupported() ) { - Material mat = xMat.parseMaterial(); - if ( mat != null ) { - if ( mat.isBlock() ) { - PrisonBlock block = new PrisonBlock( mat.name() ); + ItemStack itemStack = xMat.parseItem(); + if ( itemStack != null ) { + + if ( itemStack.getType().isBlock() ) { + + PrisonBlock block = new PrisonBlock( xMat.name().toLowerCase() ); + + block.setValid( true ); + block.setBlock( itemStack.getType().isBlock() ); blockTypes.add( block ); } } + +// Material mat = xMat.parseMaterial(); +// if ( mat != null ) { +// if ( mat.isBlock() ) { +// +// PrisonBlock block = new PrisonBlock( xMat.name().toLowerCase() ); +// +// block.setValid( true ); +// block.setBlock( mat.isBlock() ); +// +// blockTypes.add( block ); +// } +// } else { Output.get().logWarn( "### SpigotUtil.testAllPrisonBlockTypes: " + "Possible XMaterial FAIL: XMaterial " + xMat.name() + @@ -210,6 +252,7 @@ public static void testAllPrisonBlockTypes() { StringBuilder sbNoMap = new StringBuilder(); StringBuilder sbNotSupported = new StringBuilder(); + StringBuilder sbSpigotNotSupported = new StringBuilder(); int supportedBlockCountPrison = 0; int supportedBlockCountXMaterial = 0; @@ -259,6 +302,28 @@ else if ( !xMat.isSupported() ) { } } + + for ( Material spigotMaterial : Material.values() ) { + + if ( spigotMaterial.isBlock() && + BlockType.getBlock( spigotMaterial.name() ) == null ) { + + String name = spigotMaterial.name().toLowerCase(); + if ( !name.contains( "banner" ) && !name.contains( "button" ) && + !name.contains( "pressure_plate" ) && !name.contains( "potted_" ) && + !name.contains( "_head" ) && !name.contains( "_skull" ) && + !name.contains( "_bed" ) && !name.contains( "_trapdoor" ) && + !name.contains( "stem" ) && !name.contains( "stairs" ) && + !name.contains( "_slab" ) ) { + + sbSpigotNotSupported.append( spigotMaterial.name() ); + sbSpigotNotSupported.append( " " ); + } + + } + + } + // Next test all of the spigot/bukkit Materials: BlockTestStats stats = SpigotPrison.getInstance().getCompatibility() .testCountAllBlockTypes(); @@ -273,22 +338,28 @@ else if ( !xMat.isSupported() ) { logTestBlocks( sbNoMap, "### SpigotUtil.testAllPrisonBlockTypes: " + "Prison Blocks no maps to XMaterial: " ); logTestBlocks( sbNotSupported, "### SpigotUtil.testAllPrisonBlockTypes: " + - "Prison Blocks not supported with version: " ); + "Prison Blocks not supported: " ); + + + Output.get().logWarn( "### SpigotUtil.testAllPrisonBlockTypes: Spigot blocks ignored: " + + "banner, button, pressure_plate, potted, head, skull, bed, trapdoor, stem, stairs, slab " ); + logTestBlocks( sbSpigotNotSupported, "### SpigotUtil.testAllPrisonBlockTypes: " + + "Spigot blocks not supported: " ); } private static void logTestBlocks( StringBuilder sb, String message ) { int start = 0; - int end = 150; + int end = 100; while ( sb.length() > end ) { - end = sb.indexOf( " ", end ); + end = sb.lastIndexOf( " ", end ); Output.get().logWarn( message + (end < 0 ? sb.substring( start ) : sb.substring( start, end ))); start = end; - end += 150; + end += 100; } Output.get().logWarn( message + sb.substring( start )); @@ -498,4 +569,27 @@ public static InventoryView.Property prisonPropertyToBukkit(Viewable.Property pr return InventoryView.Property.valueOf(property.name()); } + + /** + *

Vault economy requires the parameter of bukkit's OfflinePlayer. + * That was never exposed for good reasons, and do not want to use + * bukkit/spigot specific code within that integration. So, this is + * where this code will live since it is a Spigot untility. + *

+ * + * @param uuid + * @return OfflinePlayer + */ + public static OfflinePlayer getBukkitOfflinePlayer( UUID uuid ) { + OfflinePlayer results = null; + + for ( OfflinePlayer offP : Bukkit.getOfflinePlayers() ) { + if ( uuid != null && offP.getUniqueId().equals(uuid) ) { + results = offP; + break; + } + } + + return results; + } } 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 new file mode 100644 index 000000000..d80063c4c --- /dev/null +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/api/PrisonSpigotAPI.java @@ -0,0 +1,180 @@ +package tech.mcprison.prison.spigot.api; + +import java.util.ArrayList; +import java.util.List; + +import tech.mcprison.prison.Prison; +import tech.mcprison.prison.internal.block.PrisonBlock; +import tech.mcprison.prison.mines.PrisonMines; +import tech.mcprison.prison.mines.data.Mine; +import tech.mcprison.prison.mines.data.PrisonSortableResults; +import tech.mcprison.prison.mines.managers.MineManager; +import tech.mcprison.prison.mines.managers.MineManager.MineSortOrder; +import tech.mcprison.prison.ranks.PrisonRanks; +import tech.mcprison.prison.ranks.data.Rank; +import tech.mcprison.prison.ranks.managers.RankManager; +import tech.mcprison.prison.util.BlockType; +import tech.mcprison.prison.util.MaterialType; + +/** + *

These are some api end points to help access some core components within prison. + *

+ * + *

Use of these are at your own risk. Misuse can result in corruption of Prison's + * internal data. + *

+ * + */ +public class PrisonSpigotAPI { + + /** + *

This returns all mines that are within prison. + *

+ * + * @return + */ + public List getMines() { + List results = new ArrayList<>(); + + if ( PrisonMines.getInstance() != null && PrisonMines.getInstance().isEnabled() ) { + MineManager mm = PrisonMines.getInstance().getMineManager(); + + results = mm.getMines(); + } + + return results; + } + + /** + *

Returns all mines within prison, but sorted by the specified sort order. + * Because some sort types omit mines, there are two different collections within the + * PrisonSortableResults. There is an include and exclude list. + *

+ * + *

All sort types that omit mines from the result type has a counter sort type + * that will include all mines and will not omit any. Those begin with an "x". + *

+ * + * @param sortOrder + * @return + */ + public PrisonSortableResults getMines( MineSortOrder sortOrder ) { + PrisonSortableResults results = null; + + if ( PrisonMines.getInstance() != null && PrisonMines.getInstance().isEnabled() ) { + MineManager mm = PrisonMines.getInstance().getMineManager(); + + results = mm.getMines(sortOrder); + } + + return results; + } + + + /** + *

This returns a list of all ranks. + *

+ * + * @return + */ + public List getRanks() { + List results = new ArrayList<>(); + + if ( PrisonRanks.getInstance() != null && PrisonRanks.getInstance().isEnabled() + ) { + RankManager rm = PrisonRanks.getInstance().getRankManager(); + + results = rm.getRanks(); + } + + return results; + } + + /** + *

This function verifies that the block name that you are trying to use is + * actually a valid block name within prison. If it is invalid then a null value + * will be returned. + *

+ * + *

There are a lot of cross references that occur that ensures that the best + * match occurs to fit the requested block name to an actual prison block. + * Since prison supports minecraft 1.8 through 1.16 (and soon to be 1.17), there + * are various possible names for some blocks since their names have changed + * between versions. This also takes in to consideration prison block name + * variations. + *

+ * + * @param blockName The name of a block that is intended to b validated + * @return The name of a valid block within prison + */ + public String getPrisonBlockName( String blockName ) { + String results = null; + + if ( Prison.get().getPlatform().getConfigBooleanFalse( "use-new-prison-block-model" ) ) { + + PrisonBlock prisonBlock = Prison.get().getPlatform().getPrisonBlock( blockName ); + if ( prisonBlock != null && prisonBlock.isBlock() ) { + results = prisonBlock.getBlockName(); + } + } + else { + + BlockType blockType = BlockType.getBlock(blockName); + if (blockType != null && blockType.getMaterialType() == MaterialType.BLOCK ) { + results = blockType.getMaterialType().name(); + } + } + + return results; + } + + /** + *

Provides a list of all mines that contains the specfied block. + *

+ * + * @param prisonBlockName The prison block name + * @return List of all mines that contains the specified block name + */ + public List getMines( String prisonBlockName ) { + List results = new ArrayList<>(); + + if ( prisonBlockName != null && prisonBlockName.trim().length() > 0 ) { + + PrisonBlock prisonBlock = null; + BlockType blockType = null; + + if ( Prison.get().getPlatform().getConfigBooleanFalse( "use-new-prison-block-model" ) ) { + + prisonBlock = Prison.get().getPlatform().getPrisonBlock( prisonBlockName ); + if ( prisonBlock != null && !prisonBlock.isBlock() ) { + prisonBlock = null; + } + } + else { + + blockType = BlockType.getBlock( prisonBlockName ); + if (blockType != null && blockType.getMaterialType() != MaterialType.BLOCK ) { + blockType = null; + } + } + + if ( prisonBlock != null || blockType != null ) { + if ( PrisonMines.getInstance() != null && PrisonMines.getInstance().isEnabled() ) { + MineManager mm = PrisonMines.getInstance().getMineManager(); + + List mines = mm.getMines(); + for ( Mine mine : mines ) { + if ( prisonBlock != null && mine.isInMine( blockType ) || + blockType != null && mine.isInMine( blockType ) ) { + results.add( mine ); + break; + } + } + } + } + } + + return results; + } + +} 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 785151224..e7950c53e 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,12 +8,14 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.EntityType; +import org.bukkit.entity.ExperienceOrb; import org.bukkit.entity.Player; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.inventory.ItemStack; @@ -511,16 +513,39 @@ private int itemCount(XMaterial source, Player player) { private void dropExtra( HashMap extra, Player player, Block block ) { if ( extra != null && extra.size() > 0 ) { for ( ItemStack itemStack : extra.values() ) { - player.getWorld().dropItem( player.getLocation(), itemStack ); - notifyPlayerThatInventoryIsFull( player, block ); + if ( isBoolean( AutoFeatures.dropItemsIfInventoryIsFull ) ) { + + Location dropPoint = player.getLocation().add( player.getLocation().getDirection()); + + player.getWorld().dropItem( dropPoint, itemStack ); + notifyPlayerThatInventoryIsFull( player, block ); + } + else { + notifyPlayerThatInventoryIsFullLosingItems( player, block ); + } + } } } private void notifyPlayerThatInventoryIsFull( Player player, Block block ) { + notifyPlayerWithSound( player, block, AutoFeatures.inventoryIsFull ); + } + + @SuppressWarnings( "unused" ) + private void notifyPlayerThatInventoryIsFullDroppingItems( Player player, Block block ) { + notifyPlayerWithSound( player, block, AutoFeatures.inventoryIsFullDroppingItems ); + } + + private void notifyPlayerThatInventoryIsFullLosingItems( Player player, Block block ) { + notifyPlayerWithSound( player, block, AutoFeatures.inventoryIsFullLosingItems ); + + } + + private void notifyPlayerWithSound( Player player, Block block, AutoFeatures messageId ) { - String message = autoFeaturesConfig.getFeatureMessage( AutoFeatures.inventoryIsFull ); + String message = autoFeaturesConfig.getFeatureMessage( messageId ); // Play sound when full if ( isBoolean( AutoFeatures.playSoundIfInventoryIsFull ) ) { @@ -732,11 +757,15 @@ protected int autoFeaturePickup( BlockBreakEvent e, Player p ) { default: count += autoPickup( isBoolean( AutoFeatures.autoPickupAllBlocks ), p, itemInHand, e ); break; - } + } } + // Calculate XP on block break if enabled: + calculateXP( p, blockName, count ); + + // Output.get().logInfo( "In mine: %s blockName= [%s] %s drops= %s count= %s dropNumber= %s ", // mine.getName(), blockName, Integer.toString( dropNumber ), // (e.getBlock().getDrops(itemInHand) != null ? e.getBlock().getDrops(itemInHand).size() : "-=null=-"), @@ -1061,6 +1090,86 @@ else if ( durabilityResistance > 0 ) { } } + private void calculateXP( Player player, String blockName, int count ) { + + if ( isBoolean( AutoFeatures.isCalculateXPEnabled )) { + + int xp = 0; + for ( int i = 0; i < count; i++ ) { + xp += calculateXP( blockName ); + } + + if ( xp > 0 ) { + + if ( isBoolean( AutoFeatures.givePlayerXPAsOrbDrops )) { + + Location dropPoint = player.getLocation().add( player.getLocation().getDirection()); + + ((ExperienceOrb) player.getWorld().spawn(dropPoint, ExperienceOrb.class)).setExperience(xp); + } + else { + + player.giveExp( xp ); + } + + } + } + } + /** + *

This calculate xp based upon the block that is broken. + * Fortune does not increase XP that a block drops. + *

+ * + *
    + *
  • Coal Ore: 0 - 2
  • + *
  • Nether Gold Ore: 0 - 1
  • + *
  • Diamond Ore, Emerald Ore: 3 - 7
  • + *
  • Lapis Luzuli Ore, Nether Quartz Ore: 2 - 5
  • + *
  • Redstone Ore: 1 - 5
  • + *
  • Monster Spawner: 15 - 43
  • + *
+ * + * @param Block + * @return + */ + private int calculateXP( String blockName ) { + int xp = 0; + + switch ( blockName.toLowerCase() ) + { + case "coal_ore": + xp = getRandom().nextInt( 2 ); + break; + + case "nether_gold_ore": + xp = getRandom().nextInt( 1 ); + break; + + case "diamond_ore": + case "emerald_ore": + xp = getRandom().nextInt( 4 ) + 3; + break; + + case "lapis_ore": + case "nether_quartz_ore": + xp = getRandom().nextInt( 3 ) + 2; + break; + + case "redstone_ore": + xp = getRandom().nextInt( 4 ) + 1; + break; + + case "spawn": + xp = getRandom().nextInt( 28 ) + 15; + break; + + default: + break; + } + + return xp; + } + /** *

This function is based upon the following wiki page. *

diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/SpigotBlock.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/SpigotBlock.java index 58b5895dc..b700e7cb4 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/SpigotBlock.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/block/SpigotBlock.java @@ -47,7 +47,10 @@ public SpigotBlock(org.bukkit.block.Block bBlock) { } @Override public Block getRelative(BlockFace face) { - return new SpigotBlock(bBlock.getRelative(org.bukkit.block.BlockFace.valueOf(face.name()))); + return new SpigotBlock( + bBlock.getRelative( + org.bukkit.block.BlockFace.valueOf( + face.name()))); } @Override public BlockType getType() { @@ -66,6 +69,11 @@ public void setPrisonBlock( PrisonBlock prisonBlock ) { updateSpigotBlock( prisonBlock, bBlock ); } + public void setBlockFace( BlockFace blockFace ) { + + SpigotPrison.getInstance().getCompatibility() + .setBlockFace( bBlock, blockFace ); + } /** *

When setting the Data and Type, turn off apply physics which will reduce the over head on block updates * by about 1/3. Really do not need to apply physics in the mines especially if no air blocks and nothing diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonShortcutCommands.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonShortcutCommands.java deleted file mode 100644 index 66af76131..000000000 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonShortcutCommands.java +++ /dev/null @@ -1,98 +0,0 @@ -package tech.mcprison.prison.spigot.commands; - -import org.bukkit.event.Listener; -import tech.mcprison.prison.Prison; -import tech.mcprison.prison.commands.Arg; -import tech.mcprison.prison.commands.Command; -import tech.mcprison.prison.internal.CommandSender; -import tech.mcprison.prison.spigot.SpigotPrison; - -import java.util.Objects; - -/** - * @author RoyalBlueRanger - * @author GABRYCA - */ -public class PrisonShortcutCommands implements Listener { - - /** - *

This command, /Prison gui and many others are more of convenience commands which - * allows access to the gui from the base /prison commands. This will allow - * the players to find it easier, and it will also be easier to recall. - *

- * - *

The actual gui command, which is /prisonmanager gui is not able to - * be integrated in to the main prison command sets due to the requirement of - * the gui being native spigot. Cannot mix the two. But can have /prison gui - * internally call /prisonmanger gui to give the illusion they are connected. - *

- * - * @param sender - */ - - @Command(identifier = "prison gui", description = "Opens the Prison GUI menus.", - permissions = "prison.gui", onlyPlayers = true) - public void prisonGui(CommandSender sender) { - - if (!(Objects.requireNonNull(SpigotPrison.getInstance().getConfig().getString("prison-gui-enabled")).equalsIgnoreCase("true"))){ - sender.sendMessage(SpigotPrison.format("&cThe GUI's disabled, if you want to use it, edit the config.yml!")); - return; - } - - - String formatted = "prisonmanager gui"; - Prison.get().getPlatform().dispatchCommand(sender, formatted); - } - - @Command(identifier = "mines", onlyPlayers = false, - altPermissions = {"-none-", "mines.admin"}) - public void minesGUICommand(CommandSender sender) { - if (!sender.hasPermission("mines.admin") && Objects.requireNonNull(SpigotPrison.getInstance().getConfig().getString("mines-gui-enabled")).equalsIgnoreCase("true")) { - sender.dispatchCommand("prisonmanager mines"); - } else { - sender.dispatchCommand("mines help"); - } - } - - @Command(identifier = "ranks", onlyPlayers = false, - altPermissions = {"-none-", "ranks.admin"}) - public void ranksGUICommand(CommandSender sender, - @Arg(name = "ladder", def = "default", - description = "If player has no permission to /ranks then /ranks list will be ran instead.") - String ladderName) { - if (!sender.hasPermission("ranks.admin")) { - if ((ladderName.equalsIgnoreCase("default") || ladderName.equalsIgnoreCase("ranks")) && Objects.requireNonNull(SpigotPrison.getInstance().getConfig().getString("ranks-gui-enabled")).equalsIgnoreCase("true")){ - sender.dispatchCommand("prisonmanager ranks"); - } else if (ladderName.equalsIgnoreCase("prestiges") && Objects.requireNonNull(SpigotPrison.getInstance().getConfig().getString("ranks-gui-prestiges-enabled")).equalsIgnoreCase("true")){ - sender.dispatchCommand("prisonmanager prestiges"); - } else { - sender.dispatchCommand("ranks list " + ladderName); - } - } else { - sender.dispatchCommand("ranks help"); - } - } - - @Command(identifier = "prestiges", onlyPlayers = true, altPermissions = {"-none-", "prison.admin"}) - public void prestigesGUICommand(CommandSender sender){ - - if (!(Objects.requireNonNull(SpigotPrison.getInstance().getConfig().getString("prestiges")).equalsIgnoreCase("true"))) { - sender.sendMessage(SpigotPrison.format("&cPrestiges are disabled by default, please edit it in your config.yml!")); - return; - } - - if (Objects.requireNonNull(SpigotPrison.getInstance().getConfig().getString("prestiges-gui-enabled")).equalsIgnoreCase("true")) { - sender.dispatchCommand( "prisonmanager prestiges"); - } else { - sender.dispatchCommand( "ranks list prestiges"); - } - } - - @Command(identifier = "prestige", onlyPlayers = true, altPermissions = "-none-") - public void prestigesPrestigeCommand(CommandSender sender) { - if (Objects.requireNonNull(SpigotPrison.getInstance().getConfig().getString("prestiges")).equalsIgnoreCase("true")) { - sender.dispatchCommand("prisonmanager prestige"); - } - } - -} diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotBaseCommands.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotBaseCommands.java new file mode 100644 index 000000000..783b61462 --- /dev/null +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotBaseCommands.java @@ -0,0 +1,65 @@ +package tech.mcprison.prison.spigot.commands; + +import org.bukkit.configuration.Configuration; +import org.bukkit.entity.Player; + +import tech.mcprison.prison.internal.CommandSender; +import tech.mcprison.prison.spigot.SpigotPrison; +import tech.mcprison.prison.spigot.game.SpigotCommandSender; + +public class PrisonSpigotBaseCommands { + + private final Configuration messages = SpigotPrison.getInstance().getMessagesConfig(); + + public Configuration getMessages() { + return messages; + } + + protected boolean isConfig( String configId ) { + + String config = getConfig().getString( configId ); + boolean results = config != null && config.equalsIgnoreCase( "true" ); + + return results; + } + + protected boolean isPrisonConfig( String configId ) { + + return SpigotPrison.getInstance().isPrisonConfig( configId ); + } + + protected String getConfig( String configId ) { + + String config = getConfig().getString( configId ); + + return config == null ? "" : config; + } + + + protected String getPrisonConfig( String configId ) { + + String config = SpigotPrison.getInstance().getConfig().getString( configId ); + + return config; + } + + protected Configuration getConfig() { + Configuration guiConfig = SpigotPrison.getInstance().getGuiConfig(); + return guiConfig; + } + + protected Player getSpigotPlayer( CommandSender sender ) { + Player player = null; + + if ( sender instanceof SpigotCommandSender ) { + SpigotCommandSender cmdSender = (SpigotCommandSender) sender; + + if (cmdSender.getWrapper() instanceof Player) { + player = (Player) cmdSender.getWrapper(); + } + } + return player; + } + + +} diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotCommands.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotCommands.java index 330c027c2..596a82667 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotCommands.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotCommands.java @@ -1,227 +1,40 @@ package tech.mcprison.prison.spigot.commands; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.configuration.Configuration; import org.bukkit.entity.Player; - -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import tech.mcprison.prison.Prison; -import tech.mcprison.prison.modules.Module; -import tech.mcprison.prison.modules.ModuleManager; -import tech.mcprison.prison.ranks.PrisonRanks; -import tech.mcprison.prison.ranks.managers.LadderManager; -import tech.mcprison.prison.spigot.SpigotPrison; -import tech.mcprison.prison.spigot.gui.SpigotPrisonGUI; -import tech.mcprison.prison.spigot.gui.mine.SpigotPlayerMinesGUI; -import tech.mcprison.prison.spigot.gui.rank.SpigotConfirmPrestigeGUI; -import tech.mcprison.prison.spigot.gui.rank.SpigotPlayerPrestigesGUI; -import tech.mcprison.prison.spigot.gui.rank.SpigotPlayerRanksGUI; -import java.util.Objects; +import tech.mcprison.prison.commands.Command; +import tech.mcprison.prison.internal.CommandSender; +import tech.mcprison.prison.spigot.gui.SpigotPrisonGUI; /** * @author GABRYCA * @author RoyalBlueRanger */ -public class PrisonSpigotCommands implements CommandExecutor, Listener { - - boolean isChatEventActive; - int id; - - @EventHandler(priority = EventPriority.LOWEST) - public void onChat(AsyncPlayerChatEvent e) { - if (isChatEventActive){ - Player p = e.getPlayer(); - String message = e.getMessage(); - Bukkit.getScheduler().cancelTask(id); - if (message.equalsIgnoreCase("cancel")){ - isChatEventActive = false; - p.sendMessage(SpigotPrison.format("&cPrestige cancelled")); - e.setCancelled(true); - } else if (message.equalsIgnoreCase("confirm")){ - Bukkit.getScheduler().runTask(SpigotPrison.getInstance(), () -> Bukkit.getServer().dispatchCommand(p, "rankup prestiges")); - e.setCancelled(true); - isChatEventActive = false; - } - } - } - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - - if (!(Objects.requireNonNull(SpigotPrison.getInstance().getConfig().getString("prison-gui-enabled")).equalsIgnoreCase("true"))){ - sender.sendMessage(SpigotPrison.format("&cThe GUI's disabled, if you want to use it, edit the config.yml!")); - return true; - } - - if(!(sender instanceof Player || sender instanceof tech.mcprison.prison.internal.Player)){ - sender.sendMessage(SpigotPrison.format("&cLooks like you aren't a player")); - return true; - } - - Player p = null; - if (sender instanceof Player) { - p = (Player) sender; - } - - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - - if (args.length == 0) { - sender.sendMessage(SpigotPrison.format("&cIncorrect usage, the command should be /prisonmanager -gui-ranks-mines-prestiges-prestige")); - return true; - } - - - if (args[0].equalsIgnoreCase("ranks")){ - return prisonmanagerRanks(sender, p, GuiConfig); - } else if (args[0].equalsIgnoreCase("mines")){ - return prisonmanagerMines(sender, p, GuiConfig); - } else if (args[0].equalsIgnoreCase("prestiges")) { - return prisonmanagerPrestiges(sender, p, GuiConfig); - } else if (args[0].equalsIgnoreCase("prestige")){ - return prisonmanagerPrestige(sender, p); - } else if (args[0].equalsIgnoreCase("gui")){ - return prisonmanagerGUI(sender, p); - - } - - return true; - } - - private boolean prisonmanagerPrestige(CommandSender sender, Player p) { - if (SpigotPrison.getInstance().getConfig().getBoolean("prestiges")) { - - if (!(PrisonRanks.getInstance().getLadderManager().getLadder("prestiges").isPresent())) { - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "ranks ladder create prestiges"); - } - - PrisonRanks rankPlugin; - - ModuleManager modMan = Prison.get().getModuleManager(); - Module module = modMan == null ? null : modMan.getModule( PrisonRanks.MODULE_NAME ).orElse( null ); - - rankPlugin = (PrisonRanks) module; - - LadderManager lm = null; - if (rankPlugin != null) { - lm = rankPlugin.getLadderManager(); - } - - if (lm != null && (!(lm.getLadder("default").isPresent()) || - !(lm.getLadder("default").get().getLowestRank().isPresent()) || - lm.getLadder("default").get().getLowestRank().get().name == null)) { - sender.sendMessage(SpigotPrison.format("&cThere aren't ranks in the default ladder")); - return true; - } - - if (lm != null && (!(lm.getLadder("prestiges").isPresent()) || - !(lm.getLadder("prestiges").get().getLowestRank().isPresent()) || - lm.getLadder("prestiges").get().getLowestRank().get().name == null)) { - sender.sendMessage(SpigotPrison.format("&cThere aren't prestiges in the prestige ladder")); - return true; - } - - if (Objects.requireNonNull(SpigotPrison.getInstance().getConfig().getString("prestige-confirm-gui")).equalsIgnoreCase("true")) { - try { - SpigotConfirmPrestigeGUI gui = new SpigotConfirmPrestigeGUI(p); - gui.open(); - } catch (Exception ex) { - prestigeByChat(sender, p); - } - } else { - prestigeByChat(sender, p); - } - - } - return true; - } - - private void prestigeByChat(CommandSender sender, Player p) { - isChatEventActive = true; - sender.sendMessage(SpigotPrison.format(SpigotPrison.getGuiConfig().getString("Gui.Lore.PrestigeWarning") + SpigotPrison.getGuiConfig().getString("Gui.Lore.PrestigeWarning2") + SpigotPrison.getGuiConfig().getString("Gui.Lore.PrestigeWarning3"))); - sender.sendMessage(SpigotPrison.format("&aConfirm&3: Type the word &aconfirm &3 to confirm")); - sender.sendMessage(SpigotPrison.format("&cCancel&3: Type the word &ccancel &3to cancel, &cyou've 15 seconds!")); - Player finalP = p; - id = Bukkit.getScheduler().scheduleSyncDelayedTask(SpigotPrison.getInstance(), () -> { - isChatEventActive = false; - finalP.sendMessage(SpigotPrison.format("&cYou ran out of time, prestige cancelled.")); - }, 20L * 15); - } - - private boolean prisonmanagerPrestiges(CommandSender sender, Player p, Configuration guiConfig) { - if (!(Objects.requireNonNull(SpigotPrison.getInstance().getConfig().getString("prestiges")).equalsIgnoreCase("true"))) { - sender.sendMessage(SpigotPrison.format("&cPrestiges are disabled by default, please edit it in your config.yml!")); - return true; - } - if (!(Objects.requireNonNull(guiConfig.getString("Options.Prestiges.GUI_Enabled")).equalsIgnoreCase("true"))) { - sender.sendMessage(SpigotPrison.format("&cSorry, but this GUI's disabled in your GuiConfig.yml")); - return true; - } - if (Objects.requireNonNull(guiConfig.getString("Options.Prestiges.Permission_GUI_Enabled")).equalsIgnoreCase("true")) { - if (!(sender.hasPermission(Objects.requireNonNull(guiConfig.getString("Options.Prestiges.Permission_GUI"))))){ - sender.sendMessage(SpigotPrison.format("&cSorry, but you're missing the permission to open this GUI [" + guiConfig.getString("Options.Prestiges.Permission_GUI") + "]")); - return true; - } - SpigotPlayerPrestigesGUI gui = new SpigotPlayerPrestigesGUI(p); - gui.open(); - } else { - SpigotPlayerPrestigesGUI gui = new SpigotPlayerPrestigesGUI(p); - gui.open(); - } - return true; - } - - private boolean prisonmanagerMines(CommandSender sender, Player p, Configuration guiConfig) { - if (!(Objects.requireNonNull(guiConfig.getString("Options.Mines.GUI_Enabled")).equalsIgnoreCase("true"))){ - sender.sendMessage(SpigotPrison.format("&cSorry, but this GUI's disabled in your GuiConfig.yml")); - return true; - } - if (Objects.requireNonNull(guiConfig.getString("Options.Mines.Permission_GUI_Enabled")).equalsIgnoreCase("true")){ - if (!(sender.hasPermission(Objects.requireNonNull(guiConfig.getString("Options.Mines.Permission_GUI"))))){ - sender.sendMessage(SpigotPrison.format("&cSorry, but you're missing the permission to open this GUI [" + guiConfig.getString("Options.Mines.Permission_GUI") + "]")); - return true; - } - SpigotPlayerMinesGUI gui = new SpigotPlayerMinesGUI(p); - gui.open(); - } else { - SpigotPlayerMinesGUI gui = new SpigotPlayerMinesGUI(p); - gui.open(); - } - return true; - } - - private boolean prisonmanagerRanks(CommandSender sender, Player p, Configuration guiConfig) { - if (!(Objects.requireNonNull(guiConfig.getString("Options.Ranks.GUI_Enabled")).equalsIgnoreCase("true"))) { - sender.sendMessage(SpigotPrison.format("&cSorry, but this GUI's disabled in your GuiConfig.yml")); - return true; - } - if (Objects.requireNonNull(guiConfig.getString("Options.Ranks.Permission_GUI_Enabled")).equalsIgnoreCase("true")) { - if (!(sender.hasPermission(Objects.requireNonNull(guiConfig.getString("Options.Ranks.Permission_GUI"))))) { - sender.sendMessage(SpigotPrison.format("&cSorry, but you're missing the permission to open this GUI [" + guiConfig.getString("Options.Ranks.Permission_GUI") + "]")); - return true; - } - SpigotPlayerRanksGUI gui = new SpigotPlayerRanksGUI(p); - gui.open(); - } else { - SpigotPlayerRanksGUI gui = new SpigotPlayerRanksGUI(p); - gui.open(); - } - return true; - } - - private boolean prisonmanagerGUI(CommandSender sender, Player p) { - if ((sender.hasPermission("prison.admin") || sender.hasPermission("prison.prisonmanagergui"))){ - SpigotPrisonGUI gui = new SpigotPrisonGUI(p); - gui.open(); - return true; - } - return false; +public class PrisonSpigotCommands + extends PrisonSpigotBaseCommands + implements Listener { + + /** + * NOTE: onlyPlayers needs to be false so players can use /gui help on the command, even from console. + * + * @param sender + */ + @Command( identifier = "gui", description = "The GUI", + aliases = {"prisonmanager gui", "gui admin"}, + permissions = {"prison.admin", "prison.prisonmanagergui"}, + onlyPlayers = false + ) + private void prisonManagerGUI(CommandSender sender) { + + Player player = getSpigotPlayer(sender); + + if (player == null) { + sender.sendMessage( getMessages().getString("Message.CantRunGUIFromConsole")); + return; + } + + SpigotPrisonGUI gui = new SpigotPrisonGUI(player); + gui.open(); } } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotMinesCommands.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotMinesCommands.java new file mode 100644 index 000000000..5e1a0e34c --- /dev/null +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotMinesCommands.java @@ -0,0 +1,58 @@ +package tech.mcprison.prison.spigot.commands; + +import org.bukkit.entity.Player; + +import tech.mcprison.prison.commands.Command; +import tech.mcprison.prison.internal.CommandSender; +import tech.mcprison.prison.spigot.gui.mine.SpigotPlayerMinesGUI; + +public class PrisonSpigotMinesCommands + extends PrisonSpigotBaseCommands { + + @Command(identifier = "mines", onlyPlayers = false, + altPermissions = {"-none-", "mines.admin"}) + public void minesGUICommand(CommandSender sender) { + if (!sender.hasPermission("mines.admin") && isPrisonConfig("mines-gui-enabled") ) { + + prisonManagerMines( sender ); +// sender.dispatchCommand("gui mines"); + } + else { + sender.dispatchCommand("mines help"); + } + } + + + @Command( identifier = "gui mines", description = "GUI Mines", + aliases = {"prisonmanager mines"}, + onlyPlayers = true ) + private void prisonManagerMines(CommandSender sender) { + + Player player = getSpigotPlayer(sender); + + if (player == null) { + sender.sendMessage( getMessages().getString("Message.CantRunGUIFromConsole")); + return; + } + + if ( !isPrisonConfig("prison-gui-enabled") || !isConfig("Options.Mines.GUI_Enabled") ){ + sender.sendMessage( getMessages().getString("Message.mineOrGuiDisabled")); + return; + } + + + if ( isConfig("Options.Mines.Permission_GUI_Enabled") ){ + String perm = getConfig( "Options.Mines.Permission_GUI"); + + if ( !sender.hasPermission( perm ) ){ + sender.sendMessage( getMessages().getString("Message.mineMissingGuiPermission") + " [" + + perm + "]"); + return; + } + } + + SpigotPlayerMinesGUI gui = new SpigotPlayerMinesGUI( player ); + gui.open(); + } + +} 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 new file mode 100644 index 000000000..9b066c1df --- /dev/null +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotPrestigeCommands.java @@ -0,0 +1,167 @@ +package tech.mcprison.prison.spigot.commands; + +import org.bukkit.Bukkit; +import org.bukkit.configuration.Configuration; +import org.bukkit.entity.Player; + +import tech.mcprison.prison.Prison; +import tech.mcprison.prison.commands.Command; +import tech.mcprison.prison.internal.CommandSender; +import tech.mcprison.prison.modules.Module; +import tech.mcprison.prison.modules.ModuleManager; +import tech.mcprison.prison.ranks.PrisonRanks; +import tech.mcprison.prison.ranks.managers.LadderManager; +import tech.mcprison.prison.spigot.SpigotPrison; +import tech.mcprison.prison.spigot.gui.ListenersPrisonManager; +import tech.mcprison.prison.spigot.gui.rank.SpigotConfirmPrestigeGUI; +import tech.mcprison.prison.spigot.gui.rank.SpigotPlayerPrestigesGUI; + +public class PrisonSpigotPrestigeCommands + extends PrisonSpigotBaseCommands { + + private final Configuration messages = SpigotPrison.getInstance().getMessagesConfig(); + + @Command(identifier = "prestiges", onlyPlayers = true, altPermissions = {"-none-", "prison.admin"}) + public void prestigesGUICommand(CommandSender sender) { + + if ( !isPrisonConfig( "prestiges") ) { + sender.sendMessage(SpigotPrison.format(messages.getString("Message.PrestigesDisabledDefault"))); + return; + } + + if ( isConfig( "prestiges-gui-enabled") ) { + sender.dispatchCommand( "gui prestiges"); + } + else { + sender.dispatchCommand( "ranks list prestiges"); + } + } + + + @Command(identifier = "prestige", onlyPlayers = true, altPermissions = "-none-") + public void prestigesPrestigeCommand(CommandSender sender) { + + if ( isPrisonConfig( "prestiges" ) ) { + sender.dispatchCommand("gui prestige"); + } + } + + + + @Command( identifier = "gui prestige", description = "GUI Prestige", + aliases = {"prisonmanager prestige"} ) + public void prisonManagerPrestige(CommandSender sender ) { + + if ( isPrisonConfig("prestiges") ) { + + if (!(PrisonRanks.getInstance().getLadderManager().getLadder("prestiges").isPresent())) { + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "ranks ladder create prestiges"); + } + + PrisonRanks rankPlugin; + + ModuleManager modMan = Prison.get().getModuleManager(); + Module module = modMan == null ? null : modMan.getModule( PrisonRanks.MODULE_NAME ).orElse( null ); + + if ( module != null ) { + + rankPlugin = (PrisonRanks) module; + + LadderManager lm = null; + if (rankPlugin != null) { + lm = rankPlugin.getLadderManager(); + } + + if (lm != null && (!(lm.getLadder("default").isPresent()) || + !(lm.getLadder("default").get().getLowestRank().isPresent()) || + lm.getLadder("default").get().getLowestRank().get().name == null)) { + sender.sendMessage(SpigotPrison.format(messages.getString("Message.DefaultLadderEmpty"))); + return; + } + + if (lm != null && (!(lm.getLadder("prestiges").isPresent()) || + !(lm.getLadder("prestiges").get().getLowestRank().isPresent()) || + lm.getLadder("prestiges").get().getLowestRank().get().name == null)) { + sender.sendMessage(SpigotPrison.format(messages.getString("Message.CantFindPrestiges"))); + return; + } + + if ( isPrisonConfig( "prestige-confirm-gui") ) { + try { + + Player player = getSpigotPlayer( sender ); + + SpigotConfirmPrestigeGUI gui = new SpigotConfirmPrestigeGUI( player ); + gui.open(); + } catch (Exception ex) { + prestigeByChat( sender ); + } + } + else { + prestigeByChat( sender ); + } + + } + } + } + + private void prestigeByChat(CommandSender sender) { + + ListenersPrisonManager listenersPrisonManager = ListenersPrisonManager.get(); + listenersPrisonManager.chatEventActivator(); + + sender.sendMessage(SpigotPrison.format(getPrisonConfig("Lore.PrestigeWarning") + + getPrisonConfig("Lore.PrestigeWarning2") + + getPrisonConfig("Lore.PrestigeWarning3"))); + + sender.sendMessage(SpigotPrison.format(messages.getString("Message.ConfirmPrestige"))); + sender.sendMessage(SpigotPrison.format(messages.getString("Message.CancelPrestige"))); + + final Player player = getSpigotPlayer( sender ); + + listenersPrisonManager.addMode("prestige"); + listenersPrisonManager.addChatEventPlayer(player); + listenersPrisonManager.id = Bukkit.getScheduler().scheduleSyncDelayedTask(SpigotPrison.getInstance(), () -> { + if (listenersPrisonManager.chatEventCheck()) { + listenersPrisonManager.chatEventDeactivate(); + player.sendMessage(SpigotPrison.format(messages.getString("Message.PrestigeRanOutOfTime"))); + listenersPrisonManager.removeChatEventPlayer(player); + listenersPrisonManager.removeMode(); + } + }, 20L * 30); + } + + + @Command( identifier = "gui prestiges", description = "GUI Prestiges", + aliases = {"prisonmanager prestiges"}, + onlyPlayers = true ) + private void prisonManagerPrestiges( CommandSender sender ) { + + if ( !isPrisonConfig("prestiges") ) { + sender.sendMessage(SpigotPrison.format(messages.getString("Message.PrestigesAreDisabled"))); + return; + } + + + if ( !isPrisonConfig("prison-gui-enabled") || !isConfig("Options.Prestiges.GUI_Enabled")){ + sender.sendMessage(SpigotPrison.format(messages.getString("Message.GuiOrPrestigesDisabled"))); + return; + } + + if ( isConfig("Options.Prestiges.Permission_GUI_Enabled") ){ + String perm = getConfig( "Options.Prestiges.Permission_GUI"); + + if ( !sender.hasPermission( perm ) ){ + sender.sendMessage(SpigotPrison.format(messages.getString("Message.missingGuiPrestigesPermission") + " [" + + perm + "]")); + return; + } + } + + Player player = getSpigotPlayer( sender ); + SpigotPlayerPrestigesGUI gui = new SpigotPlayerPrestigesGUI( player ); + gui.open(); + } + + +} 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 new file mode 100644 index 000000000..9d5f3230b --- /dev/null +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/commands/PrisonSpigotRanksCommands.java @@ -0,0 +1,75 @@ +package tech.mcprison.prison.spigot.commands; + +import org.bukkit.entity.Player; + +import tech.mcprison.prison.commands.Arg; +import tech.mcprison.prison.commands.Command; +import tech.mcprison.prison.internal.CommandSender; +import tech.mcprison.prison.spigot.gui.rank.SpigotPlayerRanksGUI; + +public class PrisonSpigotRanksCommands + extends PrisonSpigotBaseCommands { + + @Command(identifier = "ranks", onlyPlayers = false, + altPermissions = {"-none-", "ranks.admin"}) + public void ranksGUICommand(CommandSender sender, + @Arg(name = "ladder", def = "default", + description = "If player has no permission to /ranks then /ranks list will be ran instead.") + String ladderName) { + if (!sender.hasPermission("ranks.admin")) { + + if ((ladderName.equalsIgnoreCase("default") || ladderName.equalsIgnoreCase("ranks")) && + isPrisonConfig("ranks-gui-enabled") ) { + + prisonManagerRanks( sender ); +// sender.dispatchCommand("gui ranks"); + } + else if (ladderName.equalsIgnoreCase("prestiges") && + isPrisonConfig( "ranks-gui-prestiges-enabled") ) { + + sender.dispatchCommand("gui prestiges"); + } + else { + sender.dispatchCommand("ranks list " + ladderName); + } + } + else { + sender.dispatchCommand("ranks help"); + } + } + + + @Command( identifier = "gui ranks", description = "GUI Ranks", + aliases = {"prisonmanager ranks"}, + onlyPlayers = true ) + private void prisonManagerRanks(CommandSender sender) { + + Player player = getSpigotPlayer(sender); + + if (player == null) { + sender.sendMessage( getMessages().getString("Message.CantRunGUIFromConsole")); + return; + } + + if (!isPrisonConfig("prison-gui-enabled") || !isConfig("Options.Ranks.GUI_Enabled")) { + sender.sendMessage(String.format(String.format( + getMessages().getString("Message.rankGuiDisabledOrAllGuiDisabled"), + getPrisonConfig("prison-gui-enabled"), getConfig("Options.Ranks.GUI_Enabled") ))); + return; + } + + if (isConfig("Options.Ranks.Permission_GUI_Enabled")) { + String perm = getConfig( "Options.Ranks.Permission_GUI"); + if (!sender.hasPermission(perm)) { + + sender.sendMessage( getMessages().getString("Message.rankGuiMissingPermission") + " [" + + perm + "]"); + return; + } + } + + SpigotPlayerRanksGUI gui = new SpigotPlayerRanksGUI( player ); + gui.open(); + } + +} 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 6eead633d..56a07c417 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 @@ -5,6 +5,7 @@ import com.cryptomorin.xseries.XMaterial; +import tech.mcprison.prison.internal.block.BlockFace; import tech.mcprison.prison.internal.block.PrisonBlock; import tech.mcprison.prison.util.BlockType; @@ -36,4 +37,6 @@ public interface CompatibilityBlocks { public void setDurability( ItemStack itemInHand, int newDurability ); + public void setBlockFace( Block bBlock, BlockFace blockFace ); + } 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 3ddbf8f0c..924d24955 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 @@ -36,20 +36,17 @@ public CompatibilityCache() { this.xMaterialCache = new TreeMap<>(); } - - public BlockType getCachedBlockType( Block spigotBlock, byte data ) { String key = spigotBlock.getType().name() + ( data <= 0 ? "" : ":" +data); BlockType blockType = blockTypeCache.get( key ); -// return blockType == BlockType.NULL_BLOCK ? null : blockType; - return blockType; + return blockType; //blockType == BlockType.NULL_BLOCK ? null : blockType; } public void putCachedBlockType( Block spigotBlock, byte data, BlockType blockType ) { if ( spigotBlock != null ) { - String key = spigotBlock.getType().name() + ( data <= 0 ? "" : ":" +data); + String key = spigotBlock.getType().name() + ( data <= 0 ? "" : ":" + data); if ( !blockTypeCache.containsKey( key ) ) { blockTypeCache.put( key, blockType == null ? BlockType.NULL_BLOCK : blockType ); @@ -59,16 +56,15 @@ public void putCachedBlockType( Block spigotBlock, byte data, BlockType blockTyp public BlockType getCachedBlockType( ItemStack spigotStack, byte data ) { - String key = spigotStack.getType().name() + ( data <= 0 ? "" : ":" +data); + String key = spigotStack.getType().name() + ( data <= 0 ? "" : ":" + data); BlockType blockType = blockTypeCache.get( key ); -// return blockType == BlockType.NULL_BLOCK ? null : blockType; - return blockType; + return blockType; // blockType == BlockType.NULL_BLOCK ? null : blockType; } public void putCachedBlockType( ItemStack spigotStack, byte data, BlockType blockType ) { if ( spigotStack != null ) { - String key = spigotStack.getType().name() + ( data <= 0 ? "" : ":" +data); + String key = spigotStack.getType().name() + ( data <= 0 ? "" : ":" + data); if ( !blockTypeCache.containsKey( key ) ) { blockTypeCache.put( key, blockType == null ? BlockType.NULL_BLOCK : blockType ); @@ -86,14 +82,13 @@ public XMaterial getCachedXMaterial( PrisonBlock prisonBlock ) XMaterial xMat = xMaterialCache.get( key ); // Using VOID_AIR as temp placeholder for null values: -// return xMat == XMaterial.VOID_AIR ? null : xMat; - return xMat; + return xMat; // xMat == XMaterial.VOID_AIR ? null : xMat; } public void putCachedXMaterial( PrisonBlock prisonBlock, XMaterial xMat ) { String key = prisonBlock.getBlockName(); - + if ( !xMaterialCache.containsKey( key ) ) { // Using VOID_AIR as temp placeholder for null values: xMaterialCache.put( key, xMat == null ? XMaterial.VOID_AIR : xMat ); @@ -106,12 +101,11 @@ public XMaterial getCachedXMaterial( Block spigotBlock, byte data ) { XMaterial xMat = xMaterialCache.get( key ); // Using VOID_AIR as temp placeholder for null values: -// return xMat == XMaterial.VOID_AIR ? null : xMat; - return xMat; + return xMat; // xMat == XMaterial.VOID_AIR ? null : xMat; } public void putCachedXMaterial( Block spigotBlock, byte data, XMaterial xMat ) { String key = spigotBlock.getType().name() + ( data <= 0 ? "" : ":" +data); - + if ( !xMaterialCache.containsKey( key ) ) { // Using VOID_AIR as temp placeholder for null values: xMaterialCache.put( key, xMat == null ? XMaterial.VOID_AIR : xMat ); @@ -124,13 +118,12 @@ public XMaterial getCachedXMaterial( BlockType blockType, byte data ) { XMaterial xMat = xMaterialCache.get( key ); // Using VOID_AIR as temp placeholder for null values: -// return xMat == XMaterial.VOID_AIR ? null : xMat; - return xMat; + return xMat; // xMat == XMaterial.VOID_AIR ? null : xMat; } public void putCachedXMaterial( BlockType blockType, byte data, XMaterial xMat ) { - String key = blockType.name() + ( data <= 0 ? "" : ":" +data); - - if ( !xMaterialCache.containsKey( key ) ) { + String key = blockType.name() + ( data <= 0 ? "" : ":" +data); + + if ( !xMaterialCache.containsKey( key ) ) { // Using VOID_AIR as temp placeholder for null values: xMaterialCache.put( key, xMat == null ? XMaterial.VOID_AIR : xMat ); } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot113Blocks.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot113Blocks.java index 973b80a06..f01632ae0 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot113Blocks.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/compat/Spigot113Blocks.java @@ -2,11 +2,14 @@ import org.bukkit.Material; import org.bukkit.block.Block; +import org.bukkit.block.BlockState; +import org.bukkit.block.data.Directional; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.Damageable; import com.cryptomorin.xseries.XMaterial; +import tech.mcprison.prison.internal.block.BlockFace; import tech.mcprison.prison.internal.block.PrisonBlock; import tech.mcprison.prison.internal.block.PrisonBlockTypes.InternalBlockTypes; import tech.mcprison.prison.util.BlockType; @@ -20,8 +23,16 @@ public BlockType getBlockType(Block spigotBlock) { if ( results == null ) { if ( spigotBlock != null ) { - + results = BlockType.getBlock( spigotBlock.getType().name() ); + +// if ( results == null ) { +// Output.get().logInfo( "#### 1.13 getBlockType() Cannot map block from spigot to prison:" + +// " spigotBlock.getType().name() = %s " + +// " BlockType.getBlock() = %s ", +// spigotBlock.getType().name(), +// (results == null ? "" : results.name() )); +// } putCachedBlockType( spigotBlock, NO_DATA_VALUE, results ); } @@ -230,4 +241,56 @@ public void setDurability( ItemStack itemInHand, int newDamage ) { Damageable damage = (Damageable) itemInHand.getItemMeta(); damage.setDamage( newDamage ); } + + /** + * This is called setBlockFace, but it is really intended for use with ladders. + * The block face is the face in which to place the ladder. So when + * BlockFace.NORTH is specified, it needs to set the + * org.bukkit.block.BlockFace.SOUTH. Not sure why it has to be the + * opposite, which is unlike v1.8.8? + */ + public void setBlockFace( Block spigotBlock, BlockFace blockFace ) { + + + org.bukkit.block.BlockFace spigotBlockFace = null; + + switch ( blockFace ) + { + case TOP: + spigotBlockFace = org.bukkit.block.BlockFace.UP; + break; + case BOTTOM: + spigotBlockFace = org.bukkit.block.BlockFace.DOWN; + break; + case NORTH: + spigotBlockFace = org.bukkit.block.BlockFace.SOUTH; + break; + case EAST: + spigotBlockFace = org.bukkit.block.BlockFace.WEST; + break; + case SOUTH: + spigotBlockFace = org.bukkit.block.BlockFace.NORTH; + break; + case WEST: + spigotBlockFace = org.bukkit.block.BlockFace.EAST; + break; + + default: + break; + } + + if ( spigotBlockFace != null ) { + + BlockState state = spigotBlock.getState(); + + if ( state.getBlockData() instanceof Directional ) { + + Directional bukkitDirectional = (Directional) state.getBlockData(); + bukkitDirectional.setFacing( spigotBlockFace ); + state.setBlockData(bukkitDirectional); + state.update( true, false ); + } + + } + } } 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 b4f48703d..f2cf461b5 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 @@ -7,8 +7,8 @@ import com.cryptomorin.xseries.XMaterial; +import tech.mcprison.prison.internal.block.BlockFace; import tech.mcprison.prison.internal.block.PrisonBlock; -import tech.mcprison.prison.internal.block.PrisonBlockTypes.InternalBlockTypes; import tech.mcprison.prison.output.Output; import tech.mcprison.prison.util.BlockType; @@ -54,12 +54,18 @@ public BlockType getBlockType(Block spigotBlock) { results = BlockType.getBlock(id, data); if ( results == null ) { - Output.get().logWarn( "Spigot1.8Blocks.getBlockType() : " + - "Spigot block cannot be mapped to a prison BlockType : " + - spigotBlock.getType().name() + - " id = " + id + " data = " + data + - " BlockType = " + ( results == null ? "null" : results.name())); + results = BlockType.getBlock( spigotBlock.getType().name() ); + + if ( results == null ) { + + Output.get().logWarn( "Spigot1.8Blocks.getBlockType() : " + + "Spigot block cannot be mapped to a prison BlockType : " + + spigotBlock.getType().name() + + " id = " + id + " data = " + data + + " BlockType = " + ( results == null ? "null" : results.name())); + + } } putCachedBlockType( spigotBlock, (byte) data, results ); @@ -246,7 +252,7 @@ public void updateSpigotBlock( BlockType blockType, Block spigotBlock ) { public void updateSpigotBlock( PrisonBlock prisonBlock, Block spigotBlock ) { if ( prisonBlock != null && - !prisonBlock.getBlockName().equalsIgnoreCase( InternalBlockTypes.IGNORE.name() ) && + !prisonBlock.equals( PrisonBlock.IGNORE ) && spigotBlock != null ) { XMaterial xMat = getXMaterial( prisonBlock ); @@ -268,7 +274,7 @@ public void updateSpigotBlock( XMaterial xMat, Block spigotBlock ) { BlockState bState = spigotBlock.getState(); // Set the block state with the new type and rawData: - bState.setType( newType );; + bState.setType( newType ); bState.setRawData( xMat.getData() ); // Force the update but don't apply the physics: @@ -360,4 +366,55 @@ public void setDurability( ItemStack itemInHand, int newDurability ) { } + + public void setBlockFace( Block spigotBlock, BlockFace blockFace ) { + + + if ( spigotBlock.getType() == Material.LADDER ) { + + + org.bukkit.block.BlockFace spigotBlockFace = null; + + switch ( blockFace ) + { + case TOP: + spigotBlockFace = org.bukkit.block.BlockFace.UP; + break; + case BOTTOM: + spigotBlockFace = org.bukkit.block.BlockFace.DOWN; + break; + case NORTH: + spigotBlockFace = org.bukkit.block.BlockFace.NORTH; + break; + case EAST: + spigotBlockFace = org.bukkit.block.BlockFace.EAST; + break; + case SOUTH: + spigotBlockFace = org.bukkit.block.BlockFace.SOUTH; + break; + case WEST: + spigotBlockFace = org.bukkit.block.BlockFace.WEST; + break; + + default: + break; + } + + if ( spigotBlockFace != null ) { + + BlockState state = spigotBlock.getState(); + + org.bukkit.material.Ladder ladder = (org.bukkit.material.Ladder) state.getData(); + + ladder.setFacingDirection( spigotBlockFace ); + + state.setData( ladder ); + + // turn off physics so the ladders will "stick" to glowstone and other blocks. + state.update( true, false ); + + } + } + + } } 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 new file mode 100644 index 000000000..d8b0cc776 --- /dev/null +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/GuiConfig.java @@ -0,0 +1,85 @@ +package tech.mcprison.prison.spigot.configs; + +import java.io.File; +import java.io.IOException; +import java.util.Objects; + +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; + +import tech.mcprison.prison.output.Output; +import tech.mcprison.prison.spigot.SpigotPrison; + +/** + * @author GABRYCA + */ +public class GuiConfig extends SpigotConfigComponents{ + + // Declaring parameters and variables + private FileConfiguration conf; + private int changeCount = 0; + + // Check if the GuiConfig's enabled + public GuiConfig() { + if (Objects.requireNonNull(SpigotPrison.getInstance().getConfig().getString("prison-gui-enabled")).equalsIgnoreCase("true")){ + initialize(); + } + } + + public void initialize() { + + // Filepath + File file = new File(SpigotPrison.getInstance().getDataFolder() + "/GuiConfig.yml"); + + fileMaker(file); + + conf = YamlConfiguration.loadConfiguration(file); + + // Everything's here (not anymore...) + values(); + + if (changeCount > 0) { + try { + conf.save(file); + Output.get().logInfo("&aThere were &b%d &anew values added to the GuiConfig.yml file located at &b%s", + changeCount, file.getAbsoluteFile()); + } + catch (IOException e) { + Output.get().logInfo("&4Failed to save &b%d &4new values to the GuiConfig.yml file located at " + + "&b%s&4. " + "&a %s", changeCount, file.getAbsoluteFile(), e.getMessage()); + } + } + } + + private void dataConfig(String key, String value){ + if (conf.getString(key) == null) { + conf.set(key, value); + changeCount++; + } + } + + // All the strings of the config should be here + private void values(){ + dataConfig("Options.Ranks.GUI_Enabled","true"); + dataConfig("Options.Ranks.Permission_GUI_Enabled","false"); + dataConfig("Options.Ranks.Permission_GUI","prison.gui.ranks"); + dataConfig("Options.Mines.GUI_Enabled","true"); + dataConfig("Options.Mines.Permission_GUI_Enabled","false"); + dataConfig("Options.Mines.Permission_GUI","prison.gui.mines"); + dataConfig("Options.Prestiges.GUI_Enabled","true"); + dataConfig("Options.Prestiges.Permission_GUI_Enabled","false"); + dataConfig("Options.Prestiges.Permission_GUI","prison.gui.prestiges"); + dataConfig("Options.Ranks.Ladder","default"); + dataConfig("Options.Ranks.Item_gotten_rank","TRIPWIRE_HOOK"); + dataConfig("Options.Ranks.Item_not_gotten_rank","REDSTONE_BLOCK"); + dataConfig("Options.Ranks.Enchantment_effect_current_rank","true"); + dataConfig("Options.Mines.PermissionWarpPlugin","mines.tp."); + dataConfig("Options.Mines.CommandWarpPlugin","mines tp"); + dataConfig("Options.Setup.EnabledGUI", "true"); + } + + // Return method to call the config, you can use this or the global one in the main class + public FileConfiguration getFileGuiConfig(){ + return conf; + } +} diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/MessagesConfig.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/MessagesConfig.java new file mode 100644 index 000000000..8ca5b365b --- /dev/null +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/MessagesConfig.java @@ -0,0 +1,212 @@ +package tech.mcprison.prison.spigot.configs; + +import java.io.File; +import java.io.IOException; + +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; + +import tech.mcprison.prison.output.Output; +import tech.mcprison.prison.spigot.SpigotPrison; + +/** + * @author GABRYCA + **/ + +public class MessagesConfig extends SpigotConfigComponents{ + + // Initialize parameters and variables + private FileConfiguration conf; + private int changeCount = 0; + + public MessagesConfig() { + initialize(); + } + + public void initialize() { + + // Filepath + File file = new File(SpigotPrison.getInstance().getDataFolder() + "/configs/" + SpigotPrison.getInstance().getConfig().getString("default-language") + ".yml"); + + // Check if the config exists + fileMaker(file); + + // Get the config + conf = YamlConfiguration.loadConfiguration(file); + + // Call method + values(); + + if (changeCount > 0) { + try { + conf.save(file); + Output.get().logInfo( "&aThere were &b%d &anew values added for the language files " + "used by the GuiConfig.yml file located at &b%s", changeCount, file.getAbsoluteFile() ); + } + catch (IOException e) { + Output.get().logInfo( "&4Failed to save &b%d &4new values for the language files " + "used by the GuiConfig.yml file located at &b%s&4. " + "&a %s", changeCount, file.getAbsoluteFile(), e.getMessage() ); + } + } + } + + private void dataConfig(String key, String value){ + if (conf.getString(key) == null) { + conf.set(key, value); + changeCount++; + } + } + + // All the strings should be here + private void values(){ + dataConfig("Lore.ActivateWithinMode","&8Activate Within mode."); + dataConfig("Lore.ActivateRadiusMode","&8Activate Radius mode."); + dataConfig("Lore.AutoPickupGuiManager","&8AutoPickup Manager."); + dataConfig("Lore.AutoSmeltGuiManager","&8AutoSmelt Manager."); + dataConfig("Lore.AutoBlockGuiManager","&8AutoBlock Manager."); + dataConfig("Lore.BlockType","&3BlockType: "); + dataConfig("Lore.Blocks","&3Blocks:"); + dataConfig("Lore.Blocks2","&8Manage blocks of the Mine."); + dataConfig("Lore.ClickToChoose","&8Click to choose."); + dataConfig("Lore.ClickToConfirm","&8Click to confirm."); + dataConfig("Lore.ClickToCancel","&8Click to cancel."); + dataConfig("Lore.ClickToDecrease","&8Click to decrease."); + dataConfig("Lore.ClickToIncrease","&8Click to increase."); + dataConfig("Lore.ClickToManageRank","&8Manage this rank."); + dataConfig("Lore.ClickToManageCommands","&8Manage RankUPCommands."); + dataConfig("Lore.ClickToOpen","&8Click to open."); + dataConfig("Lore.ClickToRename", "&8Click to rename."); + dataConfig("Lore.ClickToTeleport","&8Click to teleport."); + dataConfig("Lore.ClickToUse","&8Click to use."); + dataConfig("Lore.ClickToRankup","&8Click to rankup"); + dataConfig("Lore.ClickToEditBlock", "&8Click to edit percentage."); + dataConfig("Lore.ClickToClose", "&cClick to close the GUI."); + dataConfig("Lore.ClickToPriorPage", "&aClick to see the prior page."); + dataConfig("Lore.ClickToNextPage", "&aClick to see the next page."); + dataConfig("Lore.ClickToStartBlockSetup", "&aClick to setup block."); + dataConfig("Lore.ClickToAddBlock", "&aClick to add a block."); + dataConfig("Lore.Chance","&3Chance: "); + dataConfig("Lore.Command","&3Command: &7"); + dataConfig("Lore.ContainsTheRank","&3The Rank "); + dataConfig("Lore.ContainsNoCommands"," &3contains no commands."); + dataConfig("Lore.DisableNotifications","&8Disable notifications."); + dataConfig("Lore.EnabledAll","&aAll features ON"); + dataConfig("Lore.DisabledAll","&aAll features OFF"); + dataConfig("Lore.FullSoundEnabled","&aFull Inv., notify with sound ON"); + dataConfig("Lore.FullSoundDisabled","&cFull Inv., notify with sound OFF"); + dataConfig("Lore.FullHologramEnabled","&aFull Inv., notify with hologram ON"); + dataConfig("Lore.FullHologramDisabled","&cFull Inv., notify with hologram OFF"); + dataConfig("Lore.Id","&3Rank id: &7"); + dataConfig("Lore.Info","&8&l|&3Info&8|"); + dataConfig("Lore.IfYouHaveEnoughMoney","&8If you have enough money"); + dataConfig("Lore.LadderThereAre","&8There're &3"); + dataConfig("Lore.LadderCommands"," &3Commands at ladder:"); + dataConfig("Lore.LeftClickToConfirm","&aLeft-Click to confirm."); + dataConfig("Lore.LeftClickToOpen","&8Left Click to open."); + dataConfig("Lore.LeftClickToReset","&aLeft Click to reset"); + dataConfig("Lore.ManageResetTime","&8Manage the reset time of Mine."); + dataConfig("Lore.MinesButton","&8Mines GUI manager."); + dataConfig("Lore.MineName", "&3Mine Name: &f"); + dataConfig("Lore.Name","&3Rank Name: &7"); + dataConfig("Lore.Notifications","&8Edit Mines notifications."); + dataConfig("Lore.PlayersWithTheRank","&3Players at rank: &7"); + dataConfig("Lore.PrestigeWarning", "&3Prestige will reset: "); + dataConfig("Lore.PrestigeWarning2", "&3 - &bRank"); + dataConfig("Lore.PrestigeWarning3", "&3 - &bBalance"); + dataConfig("Lore.Price","&3Price: &a$"); + dataConfig("Lore.Price2","&8Price: &a$"); + dataConfig("Lore.Price3","&3Rank Price: &a$"); + dataConfig("Lore.Percentage", "&8Percentage: "); + dataConfig("Lore.PrisonTasksButton","&8Prison Tasks Manager."); + dataConfig("Lore.ResetTime","&3Reset time(s): &7"); + dataConfig("Lore.Radius","&8Radius: "); + dataConfig("Lore.RankupCommands","&8&l|&3RankUPCommands&8| &8&l- &3"); + dataConfig("Lore.Rankup","&aRankup"); + dataConfig("Lore.RanksButton","&8Ranks GUI manager."); + dataConfig("Lore.ResetButton","&8Resets the mine."); + dataConfig("Lore.RightClickToCancel","&cRight-Click to cancel."); + dataConfig("Lore.RightClickToEnable","&aRight click to enable"); + dataConfig("Lore.RightClickToToggle","&cRight click to toggle"); + dataConfig("Lore.SpawnPoint","&3Spawnpoint: &7"); + dataConfig("Lore.StatusLockedMine","&8Status: &cLocked"); + dataConfig("Lore.StatusUnlockedMine","&8Status: &aUnlocked"); + dataConfig("Lore.SpawnPoint2","&8Set the mine spawn point."); + dataConfig("Lore.SizeOfMine","&3Size of Mine: &7"); + dataConfig("Lore.Selected","&3Selected"); + dataConfig("Lore.ShiftAndRightClickToDelete","&cShift + Right click to delete."); + dataConfig("Lore.ShiftAndRightClickToDisable","&cShift + Right click to disable"); + dataConfig("Lore.ShiftAndRightClickToToggle","&cShift + Right click to toggle"); + dataConfig("Lore.StatusEnabled","&8Enabled"); + dataConfig("Lore.StatusDisabled","&8Disabled"); + dataConfig("Lore.SkipReset1","&8Skip the reset if "); + dataConfig("Lore.SkipReset2","&8not enough blocks "); + dataConfig("Lore.SkipReset3","&8have been mined."); + dataConfig("Lore.Tp","&8Tp to the mine."); + dataConfig("Lore.Tag","&3Tag: &8"); + dataConfig("Lore.Tag2","&3Rank Tag: &7"); + dataConfig("Lore.Time","&8Time: "); + dataConfig("Lore.Volume","&3Volume: &7"); + dataConfig("Lore.Value", "&3Value: &a$"); + dataConfig("Lore.World","&3World: &7"); + dataConfig("Lore.noRanksFoundSetup", "&3There aren't Ranks!"); + dataConfig("Lore.noRanksFoundSetup2", "&3If you want continue the setup."); + dataConfig("Lore.noRanksFoundSetup3", "&3All Ranks and Mines from A to Z will be made"); + dataConfig("Lore.noRanksFoundSetup4", "&3With &adefault &3values!"); + dataConfig("Lore.noRanksFoundSetup5", "&3You can do the same by command:"); + dataConfig("Lore.noRanksFoundSetup6", "&1/ranks autoConfigure full !"); + dataConfig("Lore.noRanksFoundSetup7", "&3Please replace the X with the starting price and"); + dataConfig("Lore.noRanksFoundSetup8", "&3multiplier, default price = 50000, multiplier = 1.5."); + dataConfig("Message.CantGetRanksAdmin", "&3[PRISON WARN] &cCan't get Ranks, there might be no ranks or the Ranks module's disabled."); + dataConfig("Message.CantRunGUIFromConsole", "&7[&3Info&7] You cannot run the GUI from the console."); + dataConfig("Message.DefaultLadderEmpty", "&7[&cError&7] &cThe default ladder has no rank."); + dataConfig("Message.NoSellAllItems", "&cSorry but there aren't SellAll Items to show."); + dataConfig("Message.EmptyGui","&cSorry, the GUI looks empty."); + dataConfig("Message.NoBlocksMine","&cSorry but there aren't blocks inside this Mine."); + dataConfig("Message.NoMines", "&cSorry but there aren't Mines to show."); + dataConfig("Message.NoRankupCommands", "&cSorry, but there aren't rankUpCommands for this ranks, please create one to use this GUI!"); + dataConfig("Message.NoLadders", "&cSorry but there aren't ladders to show."); + dataConfig("Message.NoRanksPrestigesLadder", "&3[PRISON WARN] &cThere aren't ranks in the -prestiges- ladder!"); + dataConfig("Message.NoRanksFoundAdmin", "&cSorry, but before using this GUI you should create a Rank in this ladder!"); + dataConfig("Message.NoRanksFound", "&cSorry, but there aren't Ranks in the default or selected ladder!"); + dataConfig("Message.NoRanksFoundHelp1", "&cSorry, but there aren't Ranks in the default or selected ladder or the ladder &3["); + dataConfig("Message.NoRanksFoundHelp2", "]&c isn't found!"); + dataConfig("Message.LadderPrestigesNotFound", "&3[PRISON WARN] &cLadder -prestiges- not found!"); + dataConfig("Message.TooManyBlocks","&cSorry, but there're too many Blocks and the max's 54 for the GUI"); + dataConfig("Message.TooManyLadders","&cSorry, but there're too many ladders and the max's 54 for the GUI"); + dataConfig("Message.TooManyMines","&cSorry, but there're too many mines and the max's 54 for the GUI"); + dataConfig("Message.TooManyRankupCommands","&cSorry, but there're too many RankupCommands and the max's 54 for the GUI"); + dataConfig("Message.TooManyRanks", "&cSorry, but there're too many ranks and the max's 54 for the GUI"); + dataConfig("Message.TooManySellAllItems", "&3[PRISON WARN] &cThere are too many items and the MAX for the GUI's 54!"); + dataConfig("Message.ZeroBlocksReset1","&8Set a mine's delay "); + dataConfig("Message.ZeroBlocksReset2","&8before reset when it "); + dataConfig("Message.ZeroBlocksReset3","&8reaches zero blocks."); + dataConfig("Message.mineNameRename", "&7[&3Info&7] &3Please write the &6mineName &3you'd like to use and &6submit&3."); + dataConfig("Message.mineNameRenameClose", "&7[&3Info&7] &3Input &cclose &3to cancel or wait &c30 seconds&3."); + dataConfig("Message.mineNameRenameClosed", "&7[&3Info&7] &cRename mine closed, nothing got changed!"); + dataConfig("Message.mineOrGuiDisabled", "&7[&3Info&7] &cGUI and/or GUI Mines is not enabled. Check GuiConfig.yml."); + dataConfig("Message.mineMissingGuiPermission", "&7[&3Info&7] &cYou lack the permissions to use GUI mines"); + dataConfig("Message.OutOfTimeNoChanges", "&cYou ran out of time, nothing changed."); + dataConfig("Message.PrestigeCancelled", "&7[&3Info&7] &cPrestige cancelled!"); + dataConfig("Message.PrestigeCancelledWrongKeyword", "&7[&3Info&7] &cPrestige cancelled, you didn't type the word: confirm"); + dataConfig("Message.PrestigeRanOutOfTime", "&7[&3Info&7] &cYou ran out of time, prestige cancelled."); + dataConfig("Message.PrestigesDisabledDefault", "&7[&3Info&7] &cPrestiges are disabled by default, please edit it in your config.yml!"); + dataConfig("Message.ConfirmPrestige", "&7[&3Info&7] &aConfirm&3: Type the word &aconfirm &3 to confirm"); + dataConfig("Message.CancelPrestige", "&7[&3Info&7] &cCancel&3: Type the word &ccancel &3to cancel, &cyou've 30 seconds."); + dataConfig("Message.PrestigesAreDisabled", "&7[&3Info&7] &cPrestiges are disabled. Check config.yml."); + dataConfig("Message.GuiOrPrestigesDisabled", "&7[&3Info&7] &cGUI and/or GUI Prestiges is not enabled. Check GuiConfig.yml."); + dataConfig("Message.CantFindPrestiges", "&7[&cError&7] &cThe prestige ladder has no prestiges!"); + dataConfig("Message.missingGuiPrestigesPermission", "&7[&3Info&7] &cYou lack the permissions to use GUI prestiges"); + dataConfig("Message.rankTagRename", "&7[&3Info&7] &3Please write the &6tag &3you'd like to use and &6submit&3."); + dataConfig("Message.rankTagRenameClose", "&7[&3Info&7] &3Input &cclose &3to cancel or wait &c30 seconds&3."); + dataConfig("Message.rankTagRenameClosed", "&7[&3Info&7] &cRename tag closed, nothing got changed!"); + dataConfig("Message.rankGuiDisabledOrAllGuiDisabled", "&7[&3Info&7] &cGUI and/or GUI ranks is not enabled. Check GuiConfig.yml (%s %s)"); + dataConfig("Message.rankGuiMissingPermission", "&7[&3Info&7] &cYou lack the permissions to use GUI ranks"); + dataConfig("Setup.Message.MissingPermission", "&7[&cError&7] &cSorry but you don't have the permission [-prison.setup- or -prison.admin-]!"); + dataConfig("Setup.Message.WrongFormat", "&7[&cError&7] &cYou're missing the last argument -mines- or -ranks-, / setup -mines- or -ranks- !"); + dataConfig("Setup.Message.WelcomeToRanksSetup", "&7[&3Info&7] &3Hi and welcome to the ranks setup, please wait until it'll be completed!"); + dataConfig("Setup.Message.SuccessRanksSetup", "&7[&3Info&7] &3The ranks setup got completed with &asuccess&3 and the ranks got added to the default ladder,\n please check the logs if something's missing!"); + dataConfig("Setup.Message.Aborted", "&7[&3Info&7] &3Prison Setup Cancelled."); + } + + public FileConfiguration getFileGuiMessagesConfig(){ + return conf; + } +} diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/sellall/SellAllConfig.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/SellAllConfig.java similarity index 56% rename from prison-spigot/src/main/java/tech/mcprison/prison/spigot/sellall/SellAllConfig.java rename to prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/SellAllConfig.java index 9c1766690..82836f56a 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/sellall/SellAllConfig.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/SellAllConfig.java @@ -1,70 +1,64 @@ -package tech.mcprison.prison.spigot.sellall; +package tech.mcprison.prison.spigot.configs; + +import java.io.File; +import java.io.IOException; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; -import tech.mcprison.prison.spigot.SpigotPrison; -import java.io.File; -import java.io.IOException; -import java.util.Objects; +import tech.mcprison.prison.Prison; +import tech.mcprison.prison.output.Output; +import tech.mcprison.prison.spigot.SpigotPrison; /** * @author GABRYCA */ -public class SellAllConfig { +public class SellAllConfig extends SpigotConfigComponents { private FileConfiguration conf; + private int changeCount = 0; public SellAllConfig(){ - if (!Objects.requireNonNull(SpigotPrison.getInstance().getConfig().getString("sellall")).equalsIgnoreCase("true")){ - return; - } + // Do not use requireNonNull. Should never throw an exception if they don't have + // it configured. + if ( Prison.get().getPlatform().getConfigBooleanFalse( "sellall" ) ) { + + initialize(); + } + + } + + private void initialize(){ // Filepath File file = new File(SpigotPrison.getInstance().getDataFolder() + "/SellAllConfig.yml"); - // Everything's here - values(); + // Check if the config exists + fileMaker(file); - // Get the final config + // Get the config conf = YamlConfiguration.loadConfiguration(file); - } - - private void dataConfig(String path, String string){ - // Filepath - File file = new File(SpigotPrison.getInstance().getDataFolder() + "/SellAllConfig.yml"); + // Call method + values(); - // Check if the config exists - if(!file.exists()){ + if (changeCount > 0) { try { - file.createNewFile(); - conf = YamlConfiguration.loadConfiguration(file); - conf.set(path, SpigotPrison.format(string)); conf.save(file); - } catch (IOException e) { - e.printStackTrace(); + Output.get().logInfo( "&aThere were &b%d &anew values added for the language files " + "used by the SellAllConfig.yml file located at &b%s", changeCount, file.getAbsoluteFile() ); } - } else { - try { - boolean newValue = false; - conf = YamlConfiguration.loadConfiguration(file); - if (getFileSellAllConfig().getString(path) == null){ - conf.set(path, SpigotPrison.format(string)); - newValue = true; - } - if (newValue) { - conf.save(file); - } - } catch (IOException e2){ - e2.printStackTrace(); + catch (IOException e) { + Output.get().logInfo( "&4Failed to save &b%d &4new values for the language files " + "used by the SellAllConfig.yml file located at &b%s&4. " + "&a %s", changeCount, file.getAbsoluteFile(), e.getMessage() ); } } + } - // Get the final config - conf = YamlConfiguration.loadConfiguration(file); - + public void dataConfig(String key, String value){ + if (conf.getString(key) == null) { + conf.set(key, value); + changeCount++; + } } private void values(){ @@ -89,5 +83,4 @@ private void values(){ public FileConfiguration getFileSellAllConfig(){ return conf; } - } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/SpigotConfigComponents.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/SpigotConfigComponents.java new file mode 100644 index 000000000..4d40bebd0 --- /dev/null +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/configs/SpigotConfigComponents.java @@ -0,0 +1,22 @@ +package tech.mcprison.prison.spigot.configs; + +import java.io.File; +import java.io.IOException; + +public abstract class SpigotConfigComponents { + + protected void fileMaker(File file) { + if(!file.exists()) { + try { + File parentDir = file.getParentFile(); + parentDir.mkdirs(); + file.createNewFile(); + } + catch (IOException e) { + e.printStackTrace(); + } + } + } + + +} diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/economies/VaultEconomy.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/economies/VaultEconomy.java index 590bc2321..25d10cc40 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/economies/VaultEconomy.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/economies/VaultEconomy.java @@ -41,7 +41,7 @@ public void integrate() { addDebugInfo( "2" ); try { addDebugInfo( "3" ); - this.econWrapper = new VaultEconomyWrapper(); + this.econWrapper = new VaultEconomyWrapper( getProviderName() ); addDebugInfo( "4" ); } catch ( java.lang.NoClassDefFoundError | Exception e ) { diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/economies/VaultEconomyWrapper.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/economies/VaultEconomyWrapper.java index 08bf023ef..79dad7c90 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/economies/VaultEconomyWrapper.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/economies/VaultEconomyWrapper.java @@ -1,26 +1,79 @@ package tech.mcprison.prison.spigot.economies; import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; import org.bukkit.plugin.RegisteredServiceProvider; -import net.milkbowl.vault.economy.EconomyResponse; import tech.mcprison.prison.internal.Player; +import tech.mcprison.prison.output.Output; +import tech.mcprison.prison.spigot.SpigotUtil; +import tech.mcprison.prison.spigot.spiget.BluesSpigetSemVerComparator; +/** + *

Prison does not support banks since the only way to identify a bank is through + * the player's name. Not even sure if it was implemented correctly in the past. + * If there is a need to reenable this code, then bank support can be added + * back in the future, and at that time, it can be verified to be correct. + * I honestly don't think it is correct the way it was being used before. + *

+ * + */ public class VaultEconomyWrapper { private net.milkbowl.vault.economy.Economy economy = null; - public VaultEconomyWrapper() { + private String providerName; + private String vaultVersion; + + private boolean preV1dot4 = false; + + public VaultEconomyWrapper(String providerName ) { super(); + this.providerName = providerName; + RegisteredServiceProvider economyProvider = Bukkit.getServer().getServicesManager() .getRegistration(net.milkbowl.vault.economy.Economy.class); if (economyProvider != null) { economy = economyProvider.getProvider(); + + + this.vaultVersion = + Bukkit.getPluginManager().getPlugin( getProviderName() ) + .getDescription().getVersion(); + + this.preV1dot4 = ( new BluesSpigetSemVerComparator().compareTo( getVaultVersion(), + "1.4.0" ) < 0 ); + + Output.get().logInfo( "### VaultEconomyWrapper : vaultVersion = " + getVaultVersion() + + " is pre1_4= " + isPreV1_4() ); } } + + public String getProviderName() { + return providerName; + } + public void setProviderName( String providerName ) { + this.providerName = providerName; + } + + public String getVaultVersion() { + return vaultVersion; + } + public void setVaultVersion( String vaultVersion ) { + this.vaultVersion = vaultVersion; + } + + public boolean isPreV1_4() { + return preV1dot4; + } + public void setPreV1_4( boolean preV1_4 ) { + this.preV1dot4 = preV1_4; + } + + public boolean isEnabled() { return economy != null && economy.isEnabled(); @@ -30,67 +83,169 @@ public String getName() { return economy == null ? "not enabled" : economy.getName(); } + private OfflinePlayer getOfflinePlayer(Player player) { + + return SpigotUtil.getBukkitOfflinePlayer( player.getUUID() ); + } + + @SuppressWarnings( "deprecation" ) public double getBalance(Player player) { double results = 0; if (economy != null) { - if ( economy.hasBankSupport() ) { - EconomyResponse bnkBal = economy.bankBalance( player.getName() ); - if ( bnkBal.transactionSuccess() ) { - results = bnkBal.balance; - } - } else { + if ( isPreV1_4() ) { results = economy.getBalance(player.getName()); } + else { + OfflinePlayer oPlayer = getOfflinePlayer( player ); + if ( oPlayer == null ) { + Output.get().logInfo( "VaultEconomyWrapper.getBalance(): Error: " + + "Cannot get economy for player %s so returning a value of 0.", + player.getName()); + results = 0; + } + else { + results = economy.getBalance(oPlayer); + } + + } +// if ( economy.hasBankSupport() ) { +// +// EconomyResponse bnkBal = economy.bankBalance( player.getName() ); +// if ( bnkBal.transactionSuccess() ) { +// results = bnkBal.balance; +// } +// +// +// } else { +// results = economy.getBalance(player.getName()); +// } } return results; } @SuppressWarnings( "deprecation" ) - public void setBalance(Player player, double amount) { + public boolean setBalance(Player player, double amount) { + boolean results = false; if (economy != null) { - if ( economy.hasBankSupport() ) { - economy.bankWithdraw(player.getName(), getBalance(player)); - economy.bankDeposit(player.getName(), amount); - } else { - economy.withdrawPlayer( player.getName(), getBalance( player ) ); - economy.depositPlayer( player.getName(), amount ); + + if ( isPreV1_4() ) { + economy.withdrawPlayer( player.getName(), getBalance( player ) ); + economy.depositPlayer( player.getName(), amount ); + results = true; + } + else { + OfflinePlayer oPlayer = getOfflinePlayer( player ); + if ( oPlayer == null ) { + Output.get().logInfo( "VaultEconomyWrapper.setBalance(): Error: " + + "Cannot get economy for player %s so cannot set balance to %s.", + player.getName(), Double.toString( amount )); + } + else { + economy.withdrawPlayer( oPlayer, getBalance( player ) ); + economy.depositPlayer( oPlayer, amount ); + results = true; + } } + +// if ( economy.hasBankSupport() ) { +// economy.bankWithdraw(player.getName(), getBalance(player)); +// economy.bankDeposit(player.getName(), amount); +// } else { +// economy.withdrawPlayer( player.getName(), getBalance( player ) ); +// economy.depositPlayer( player.getName(), amount ); +// } } + return results; } @SuppressWarnings( "deprecation" ) - public void addBalance(Player player, double amount) { + public boolean addBalance(Player player, double amount) { + boolean results = false; if (economy != null) { - if ( economy.hasBankSupport() ) { - economy.bankDeposit(player.getName(), amount); - } else { + if ( isPreV1_4() ) { economy.depositPlayer( player.getName(), amount ); + results = true; + } + else { + OfflinePlayer oPlayer = getOfflinePlayer( player ); + if ( oPlayer == null ) { + Output.get().logInfo( "VaultEconomyWrapper.addBalance(): Error: " + + "Cannot get economy for player %s so cannot add a balance of %s.", + player.getName(), Double.toString( amount )); + } + else { + economy.depositPlayer( oPlayer, amount ); + results = true; + } } +// if ( economy.hasBankSupport() ) { +// economy.bankDeposit(player.getName(), amount); +// } else { +// economy.depositPlayer( player.getName(), amount ); +// } } + return results; } @SuppressWarnings( "deprecation" ) - public void removeBalance(Player player, double amount) { - if (economy != null) { - if ( economy.hasBankSupport() ) { - economy.bankWithdraw(player.getName(), amount); - } else { - economy.withdrawPlayer( player.getName(), amount ); - } - } + public boolean removeBalance(Player player, double amount) { + boolean results = false; + if (economy != null) { + if ( isPreV1_4() ) { + economy.withdrawPlayer( player.getName(), amount ); + results = true; + } + else { + OfflinePlayer oPlayer = getOfflinePlayer( player ); + if ( oPlayer == null ) { + Output.get().logInfo( "VaultEconomyWrapper.removeBalance(): Error: " + + "Cannot get economy for player %s so cannot remove a balance of %s.", + player.getName(), Double.toString( amount )); + } + else { + economy.withdrawPlayer( oPlayer, amount ); + results = true; + } + } + +// if (economy != null) { +// if ( economy.hasBankSupport() ) { +// economy.bankWithdraw(player.getName(), amount); +// } else { +// economy.withdrawPlayer( player.getName(), amount ); +// } +// } + } + return results; } @SuppressWarnings( "deprecation" ) public boolean canAfford(Player player, double amount) { boolean results = false; if (economy != null) { - if ( economy.hasBankSupport() ) { - results = economy.bankHas(player.getName(), amount).transactionSuccess(); - } else { - results = economy.has(player.getName(), amount); - } + if ( isPreV1_4() ) { + results = economy.has(player.getName(), amount); + } + else { + OfflinePlayer oPlayer = getOfflinePlayer( player ); + if ( oPlayer == null ) { + Output.get().logInfo( "VaultEconomyWrapper.canAfford(): Error: " + + "Cannot get economy for player %s so cannot tell if " + + "player can afford the amount of %s.", + player.getName(), Double.toString( amount )); + } + else { + results = economy.has(oPlayer, amount); + } + } + +// if ( economy.hasBankSupport() ) { +// results = economy.bankHas(player.getName(), amount).transactionSuccess(); +// } else { +// results = economy.has(player.getName(), amount); +// } } return results; } 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 786609f86..9c943b7fa 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 @@ -129,4 +129,8 @@ public Inventory getInventory() { return null; } + @Override + public void printDebugInventoryInformationToConsole() { + + } } 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 b375bb454..792f9b0f6 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 @@ -18,9 +18,16 @@ package tech.mcprison.prison.spigot.game; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Optional; +import java.util.UUID; + import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.event.player.PlayerTeleportEvent; + import tech.mcprison.prison.internal.ItemStack; import tech.mcprison.prison.internal.Player; import tech.mcprison.prison.internal.inventory.Inventory; @@ -32,12 +39,6 @@ import tech.mcprison.prison.util.Gamemode; import tech.mcprison.prison.util.Location; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Optional; -import java.util.UUID; - /** * @author Faizaan A. Datoo */ @@ -221,4 +222,84 @@ private static Class getNmsClass(String className) throws ClassNotFoundExcept } + @SuppressWarnings( "deprecation" ) + public void printDebugInventoryInformationToConsole() { + + try { + printDebugInfo( bukkitPlayer.getInventory().getContents(), "Inventory Contents"); + } + catch ( java.lang.NoSuchMethodError | Exception e ) { + // Ignore: Not supported with that version of spigot: + } + + try { + printDebugInfo( bukkitPlayer.getInventory().getExtraContents(), "Inventory Extra Contents"); + } + catch ( java.lang.NoSuchMethodError | Exception e ) { + // Ignore: Not supported with that version of spigot: + } + + try { + printDebugInfo( bukkitPlayer.getInventory().getArmorContents(), "Inventory Armor Contents"); + } + catch ( java.lang.NoSuchMethodError | Exception e ) { + // Ignore: Not supported with that version of spigot: + } + try { + printDebugInfo( bukkitPlayer.getInventory().getStorageContents(), "Inventory Storage Contents"); + } + catch ( java.lang.NoSuchMethodError | Exception e ) { + // Ignore: Not supported with that version of spigot: + } + + try { + printDebugInfo( bukkitPlayer.getInventory().getItemInHand(), "Inventory Item In Hand (pre 1.13)"); + } + catch ( java.lang.NoSuchMethodError | Exception e ) { + // Ignore: Not supported with that version of spigot: + } + + try { + printDebugInfo( bukkitPlayer.getInventory().getItemInMainHand(), "Inventory Item in Main Hand"); + } + catch ( java.lang.NoSuchMethodError | Exception e ) { + // Ignore: Not supported with that version of spigot: + } + + try { + printDebugInfo( bukkitPlayer.getInventory().getItemInOffHand(), "Inventory Item in Off Hand"); + } + catch ( java.lang.NoSuchMethodError | Exception e ) { + // Ignore: Not supported with that version of spigot: + } + } + + private void printDebugInfo( org.bukkit.inventory.ItemStack[] iStacks, String title ) { + + Output.get().logInfo( "&7%s:", title ); + for ( int i = 0; i < iStacks.length; i++ ) { + org.bukkit.inventory.ItemStack iStack = iStacks[i]; + + if ( iStack != null ) { + + ItemStack pItemStack = SpigotUtil.bukkitItemStackToPrison(iStack); + + Output.get().logInfo( " i=%d &3%s &3%d &a[&3%s&a]", + i, iStack.getType().name(), iStack.getAmount(), + (pItemStack == null ? "" : + (pItemStack.getDisplayName() == null ? "" : + pItemStack.getDisplayName())) ); + } + } + } + + private void printDebugInfo( org.bukkit.inventory.ItemStack iStack, String title ) { + + Output.get().logInfo( "&7%s:", title ); + if ( iStack != null ) { + + Output.get().logInfo( " &3%s &3%d", + iStack.getType().name(), iStack.getAmount() ); + } + } } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/GUIListener.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/GUIListener.java deleted file mode 100644 index f0645e7f1..000000000 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/GUIListener.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017-2020 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 . - */ - -package tech.mcprison.prison.spigot.gui; - -import org.bukkit.Bukkit; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.InventoryCloseEvent; -import tech.mcprison.prison.gui.GUI; -import tech.mcprison.prison.spigot.SpigotPrison; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Faizaan A. Datoo - */ -// From GABRYCA, I don't know if this's still needed, I won't remove it for now, but might be in the future -public class GUIListener implements Listener { - - private static GUIListener instance; - private List inventories = new ArrayList<>(); - - public static GUIListener get() { - if (instance == null) { - instance = new GUIListener(); - } - return instance; - } - - public void init(SpigotPrison prison) { - Bukkit.getServer().getPluginManager().registerEvents(this, prison); - } - - public void registerInventory(GUI inv) { - inventories.add(inv); - } - - @EventHandler public void closeInventory(InventoryCloseEvent e) { - // Remove it if found - inventories.removeIf(gui -> gui.getTitle().equals( - SpigotPrison.getInstance().getCompatibility().getGUITitle( e ) - )); -// inventories.removeIf(gui -> gui.getTitle().equals(e.getInventory().getTitle())); - } - -} diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/GuiConfig.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/GuiConfig.java deleted file mode 100644 index 344495f14..000000000 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/GuiConfig.java +++ /dev/null @@ -1,201 +0,0 @@ -package tech.mcprison.prison.spigot.gui; - -import org.bukkit.Color; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import tech.mcprison.prison.spigot.SpigotPrison; - -import java.io.File; -import java.io.IOException; -import java.util.Objects; - -/** - * @author GABRYCA - */ -public class GuiConfig { - - private FileConfiguration conf; - - public GuiConfig() { - - if (!Objects.requireNonNull(SpigotPrison.getInstance().getConfig().getString("prison-gui-enabled")).equalsIgnoreCase("true")){ - return; - } - - // Filepath - File file = new File(SpigotPrison.getInstance().getDataFolder() + "/GuiConfig.yml"); - - // Everything's here - values(); - - // Get the final config - conf = YamlConfiguration.loadConfiguration(file); - } - - private void dataConfig(String path, String string){ - - // Filepath - File file = new File(SpigotPrison.getInstance().getDataFolder() + "/GuiConfig.yml"); - - // Check if the config exists - if(!file.exists()){ - try { - file.createNewFile(); - conf = YamlConfiguration.loadConfiguration(file); - conf.set(path, SpigotPrison.format(string)); - conf.save(file); - } catch (IOException e) { - e.printStackTrace(); - } - } else { - try { - boolean newValue = false; - int editedItems = 0; - conf = YamlConfiguration.loadConfiguration(file); - if (getFileGuiConfig().getString(path) == null){ - conf.set(path, SpigotPrison.format(string)); - editedItems++; - newValue = true; - } - if (newValue) { - conf.save(file); - System.out.println(Color.AQUA + "[Prison - GuiConfig.yml]" + Color.GREEN + " Added " + editedItems + " new values to the GuiConfig.yml"); - } - } catch (IOException e2){ - e2.printStackTrace(); - } - } - - // Get the final config - conf = YamlConfiguration.loadConfiguration(file); - - - } - - private void values(){ - dataConfig("Options.Ranks.GUI_Enabled","true"); - dataConfig("Options.Ranks.Permission_GUI_Enabled","false"); - dataConfig("Options.Ranks.Permission_GUI","prison.gui.ranks"); - dataConfig("Options.Mines.GUI_Enabled","true"); - dataConfig("Options.Mines.Permission_GUI_Enabled","false"); - dataConfig("Options.Mines.Permission_GUI","prison.gui.mines"); - dataConfig("Options.Prestiges.GUI_Enabled","true"); - dataConfig("Options.Prestiges.Permission_GUI_Enabled","false"); - dataConfig("Options.Prestiges.Permission_GUI","prison.gui.prestiges"); - dataConfig("Options.Ranks.Ladder","default"); - dataConfig("Options.Ranks.Item_gotten_rank","TRIPWIRE_HOOK"); - dataConfig("Options.Ranks.Item_not_gotten_rank","REDSTONE_BLOCK"); - dataConfig("Options.Ranks.Enchantment_effect_current_rank","true"); - dataConfig("Options.Mines.PermissionWarpPlugin","mines.tp."); - dataConfig("Options.Mines.CommandWarpPlugin","mines tp"); - dataConfig("Gui.Lore.ActivateWithinMode","&8Activate Within mode."); - dataConfig("Gui.Lore.ActivateRadiusMode","&8Activate Radius mode."); - dataConfig("Gui.Lore.AutoPickupGuiManager","&8AutoPickup Manager."); - dataConfig("Gui.Lore.AutoSmeltGuiManager","&8AutoSmelt Manager."); - dataConfig("Gui.Lore.AutoBlockGuiManager","&8AutoBlock Manager."); - dataConfig("Gui.Lore.BlockType","&3BlockType: "); - dataConfig("Gui.Lore.Blocks","&3Blocks:"); - dataConfig("Gui.Lore.Blocks2","&8Manage blocks of the Mine."); - dataConfig("Gui.Lore.ClickToChoose","&8Click to choose."); - dataConfig("Gui.Lore.ClickToConfirm","&8Click to confirm."); - dataConfig("Gui.Lore.ClickToCancel","&8Click to cancel."); - dataConfig("Gui.Lore.ClickToDecrease","&8Click to decrease."); - dataConfig("Gui.Lore.ClickToIncrease","&8Click to increase."); - dataConfig("Gui.Lore.ClickToManageRank","&8Manage this rank."); - dataConfig("Gui.Lore.ClickToManageCommands","&8Manage RankUPCommands."); - dataConfig("Gui.Lore.ClickToOpen","&8Click to open."); - dataConfig("Gui.Lore.ClickToTeleport","&8Click to teleport."); - dataConfig("Gui.Lore.ClickToUse","&8Click to use."); - dataConfig("Gui.Lore.ClickToRankup","&8Click to rankup"); - dataConfig("Gui.Lore.ClickToEditBlock", "&8Click to edit percentage."); - dataConfig("Gui.Lore.Chance","&3Chance: "); - dataConfig("Gui.Lore.Command","&3Command: &7"); - dataConfig("Gui.Lore.ContainsTheRank","&3The Rank "); - dataConfig("Gui.Lore.ContainsNoCommands"," &3contains no commands."); - dataConfig("Gui.Lore.DisableNotifications","&8Disable notifications."); - dataConfig("Gui.Lore.EnabledAll","&aAll features ON"); - dataConfig("Gui.Lore.DisabledAll","&aAll features OFF"); - dataConfig("Gui.Lore.FullSoundEnabled","&aFull Inv., notify with sound ON"); - dataConfig("Gui.Lore.FullSoundDisabled","&cFull Inv., notify with sound OFF"); - dataConfig("Gui.Lore.FullHologramEnabled","&aFull Inv., notify with hologram ON"); - dataConfig("Gui.Lore.FullHologramDisabled","&cFull Inv., notify with hologram OFF"); - dataConfig("Gui.Lore.Id","&3Rank id: &7"); - dataConfig("Gui.Lore.Info","&8&l|&3Info&8|"); - dataConfig("Gui.Lore.IfYouHaveEnoughMoney","&8If you have enough money"); - dataConfig("Gui.Lore.LadderThereAre","&8There're &3"); - dataConfig("Gui.Lore.LadderCommands"," &3Commands at ladder:"); - dataConfig("Gui.Lore.LeftClickToConfirm","&aLeft-Click to confirm."); - dataConfig("Gui.Lore.LeftClickToOpen","&8Left Click to open."); - dataConfig("Gui.Lore.LeftClickToReset","&aLeft Click to reset"); - dataConfig("Gui.Lore.ManageResetTime","&8Manage the reset time of Mine."); - dataConfig("Gui.Lore.MinesButton","&8Mines GUI manager."); - dataConfig("Gui.Lore.Name","&3Rank Name: &7"); - dataConfig("Gui.Lore.Notifications","&8Edit Mines notifications."); - dataConfig("Gui.Lore.PlayersWithTheRank","&3Players at rank: &7"); - dataConfig("Gui.Lore.PrestigeWarning", "&3Prestige will reset: "); - dataConfig("Gui.Lore.PrestigeWarning2", "&3 - &bRank"); - dataConfig("Gui.Lore.PrestigeWarning3", "&3 - &bBalance"); - dataConfig("Gui.Lore.Price","&3Price: &a$"); - dataConfig("Gui.Lore.Price2","&8Price: &a$"); - dataConfig("Gui.Lore.Price3","&3Rank Price: &a$"); - dataConfig("Gui.Lore.Percentage", "&8Percentage: "); - dataConfig("Gui.Lore.PrisonTasksButton","&8Prison Tasks Manager."); - dataConfig("Gui.Lore.ResetTime","&3Reset time(s): &7"); - dataConfig("Gui.Lore.Radius","&8Radius: "); - dataConfig("Gui.Lore.RankupCommands","&8&l|&3RankUPCommands&8| &8&l- &3"); - dataConfig("Gui.Lore.Rankup","&aRankup"); - dataConfig("Gui.Lore.RanksButton","&8Ranks GUI manager."); - dataConfig("Gui.Lore.ResetButton","&8Resets the mine."); - dataConfig("Gui.Lore.RightClickToCancel","&cRight-Click to cancel."); - dataConfig("Gui.Lore.RightClickToEnable","&aRight click to enable"); - dataConfig("Gui.Lore.RightClickToToggle","&cRight click to toggle"); - dataConfig("Gui.Lore.SpawnPoint","&3Spawnpoint: &7"); - dataConfig("Gui.Lore.StatusLockedMine","&8Status: &cLocked"); - dataConfig("Gui.Lore.StatusUnlockedMine","&8Status: &aUnlocked"); - dataConfig("Gui.Lore.SpawnPoint2","&8Set the mine spawn point."); - dataConfig("Gui.Lore.SizeOfMine","&3Size of Mine: &7"); - dataConfig("Gui.Lore.Selected","&3Selected"); - dataConfig("Gui.Lore.ShiftAndRightClickToDelete","&cShift + Right click to delete."); - dataConfig("Gui.Lore.ShiftAndRightClickToDisable","&cShift + Right click to disable"); - dataConfig("Gui.Lore.ShiftAndRightClickToToggle","&cShift + Right click to toggle"); - dataConfig("Gui.Lore.StatusEnabled","&8Enabled"); - dataConfig("Gui.Lore.StatusDisabled","&8Disabled"); - dataConfig("Gui.Lore.SkipReset1","&8Skip the reset if "); - dataConfig("Gui.Lore.SkipReset2","&8not enough blocks "); - dataConfig("Gui.Lore.SkipReset3","&8have been mined."); - dataConfig("Gui.Lore.Tp","&8Tp to the mine."); - dataConfig("Gui.Lore.Tag","&3Tag: &8"); - dataConfig("Gui.Lore.Tag2","&3Rank Tag: &7"); - dataConfig("Gui.Lore.Time","&8Time: "); - dataConfig("Gui.Lore.Volume","&3Volume: &7"); - dataConfig("Gui.Lore.Value", "&3Value: &a$"); - dataConfig("Gui.Lore.World","&3World: &7"); - dataConfig("Gui.Message.CantGetRanksAdmin", "&3[PRISON WARN] &cCan't get Ranks, there might be no ranks or the Ranks module's disabled."); - dataConfig("Gui.Message.NoSellAllItems", "&cSorry but there aren't SellAll Items to show."); - dataConfig("Gui.Message.EmptyGui","&cSorry, the GUI looks empty."); - dataConfig("Gui.Message.NoBlocksMine","&cSorry but there aren't blocks inside this Mine."); - dataConfig("Gui.Message.NoMines", "&cSorry but there aren't Mines to show."); - dataConfig("Gui.Message.NoRankupCommands", "&cSorry, but there aren't rankUpCommands for this ranks, please create one to use this GUI!"); - dataConfig("Gui.Message.NoLadders", "&cSorry but there aren't ladders to show."); - dataConfig("Gui.Message.NoRanksPrestigesLadder", "&3[PRISON WARN] &cThere aren't ranks in the -prestiges- ladder!"); - dataConfig("Gui.Message.NoRanksFoundAdmin", "&cSorry, but before using this GUI you should create a Rank in this ladder!"); - dataConfig("Gui.Message.NoRanksFound", "&cSorry, but there aren't Ranks in the default or selected ladder!"); - dataConfig("Gui.Message.NoRanksFoundHelp1", "&cSorry, but there aren't Ranks in the default or selected ladder or the ladder &3["); - dataConfig("Gui.Message.NoRanksFoundHelp2", "]&c isn't found!"); - dataConfig("Gui.Message.LadderPrestigesNotFound", "&3[PRISON WARN] &cLadder -prestiges- not found!"); - dataConfig("Gui.Message.TooManyBlocks","&cSorry, but there're too many Blocks and the max's 54 for the GUI"); - dataConfig("Gui.Message.TooManyLadders","&cSorry, but there're too many ladders and the max's 54 for the GUI"); - dataConfig("Gui.Message.TooManyMines","&cSorry, but there're too many mines and the max's 54 for the GUI"); - dataConfig("Gui.Message.TooManyRankupCommands","&cSorry, but there're too many RankupCommands and the max's 54 for the GUI"); - dataConfig("Gui.Message.TooManyRanks", "&cSorry, but there're too many ranks and the max's 54 for the GUI"); - dataConfig("Gui.Message.TooManySellAllItems", "&3[PRISON WARN] &cThere are too many items and the MAX for the GUI's 54!"); - dataConfig("Gui.Message.ZeroBlocksReset1","&8Set a mine's delay "); - dataConfig("Gui.Message.ZeroBlocksReset2","&8before reset when it "); - dataConfig("Gui.Message.ZeroBlocksReset3","&8reaches zero blocks."); - } - - public FileConfiguration getFileGuiConfig(){ - return conf; - } - -} 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 0a653b13a..5fda3d537 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 @@ -3,7 +3,6 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import java.util.Objects; import java.util.Optional; import org.bukkit.Bukkit; @@ -18,13 +17,11 @@ import org.bukkit.event.inventory.InventoryAction; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; -import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; import tech.mcprison.prison.Prison; import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig; import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig.AutoFeatures; -import tech.mcprison.prison.gui.GUI; import tech.mcprison.prison.mines.PrisonMines; import tech.mcprison.prison.mines.data.Mine; import tech.mcprison.prison.modules.Module; @@ -37,6 +34,7 @@ import tech.mcprison.prison.spigot.gui.autofeatures.SpigotAutoFeaturesGUI; import tech.mcprison.prison.spigot.gui.autofeatures.SpigotAutoPickupGUI; import tech.mcprison.prison.spigot.gui.autofeatures.SpigotAutoSmeltGUI; +import tech.mcprison.prison.spigot.gui.mine.SpigotBlocksListGUI; import tech.mcprison.prison.spigot.gui.mine.SpigotMineBlockPercentageGUI; import tech.mcprison.prison.spigot.gui.mine.SpigotMineInfoGUI; import tech.mcprison.prison.spigot.gui.mine.SpigotMineNotificationRadiusGUI; @@ -53,7 +51,6 @@ import tech.mcprison.prison.spigot.gui.sellall.SellAllAdminGUI; import tech.mcprison.prison.spigot.gui.sellall.SellAllPriceGUI; - /** * @author GABRYCA * @author RoyalBlueRanger @@ -62,12 +59,25 @@ public class ListenersPrisonManager implements Listener { private static ListenersPrisonManager instance; public static List activeGui = new ArrayList<>(); + public static List chatEventPlayer = new ArrayList<>(); public boolean isChatEventActive = false; public int id; - public String rankNameOfChat; + public String rankNameOfChat = null; + public String mineNameOfChat = null; + private final Configuration config = SpigotPrison.getInstance().getConfig(); + private final Configuration guiConfig = SpigotPrison.getInstance().getGuiConfig(); + + // NOTE: sellAllConfig will be null if sellall is not enbled. + @SuppressWarnings( "unused" ) + private final Configuration sellAllConfig = SpigotPrison.getInstance().getSellAllConfig(); + + private final Configuration messages = SpigotPrison.getInstance().getMessagesConfig(); + boolean guiNotEnabled = !(config.getString("prison-gui-enabled").equalsIgnoreCase("true")); + public String mode; + private Optional ladder; - public ListenersPrisonManager(){} + public ListenersPrisonManager(){} public static ListenersPrisonManager get() { if (instance == null) { @@ -76,42 +86,147 @@ public static ListenersPrisonManager get() { return instance; } + public void chatEventActivator(){ + isChatEventActive = true; + } + public void chatEventDeactivate(){ + isChatEventActive = false; + } + public boolean chatEventCheck(){ + return isChatEventActive; + } + public void addMode(String modex){ + mode = modex; + } + public void removeMode(){ + mode = null; + } + public void addChatEventPlayer(Player p){ + + if (!isChatEventActive){ + return; + } + + if (!chatEventPlayer.contains(p.getName())){ + chatEventPlayer.add(p.getName()); + } + } + + public void removeChatEventPlayer(Player p){ + chatEventPlayer.remove(p.getName()); + } + @EventHandler public void onGuiClosing(InventoryCloseEvent e){ - if (!(Objects.requireNonNull(SpigotPrison.getInstance().getConfig().getString("prison-gui-enabled")).equalsIgnoreCase("true"))){ + // If the GUI's disabled then return + if (guiNotEnabled){ return; } + // Get the player and remove him from the list Player p = (Player) e.getPlayer(); - activeGui.remove(p.getName()); } public void addToGUIBlocker(Player p){ - if(!activeGui.contains(p.getName())) + + // If the GUI's disabled then return + if (guiNotEnabled){ + return; + } + + // If the player isn't already added to the list, then add him + if(!activeGui.contains(p.getName())) { activeGui.add(p.getName()); + } } // On chat event to rename the a Rank Tag @EventHandler (priority = EventPriority.LOWEST) public void onChat(AsyncPlayerChatEvent e) { - if (isChatEventActive){ + + // Check if the boolean is true, this's set manually + if (isChatEventActive) { + // Get the player Player p = e.getPlayer(); - String message = e.getMessage(); - Bukkit.getScheduler().cancelTask(id); - if (message.equalsIgnoreCase("close")){ - isChatEventActive = false; - p.sendMessage(SpigotPrison.format("&cRename tag closed, nothing got changed")); - e.setCancelled(true); - } else { - Bukkit.getScheduler().runTask(SpigotPrison.getInstance(), () -> Bukkit.getServer().dispatchCommand(p, "ranks set tag " + rankNameOfChat + " " + message)); - e.setCancelled(true); - isChatEventActive = false; + // Check if the player's in the list to not use another one for mistake/conflicting + if (chatEventPlayer.contains(p.getName())){ + chatActions(e, p); } } } + private void chatActions(AsyncPlayerChatEvent e, Player p) { + // Get the chat message + String message = e.getMessage(); + // Cancel the task, this has been added before manually + Bukkit.getScheduler().cancelTask(id); + modeAction(e, p, message); + removeChatEventPlayer(p); + removeMode(); + } + + private void modeAction(AsyncPlayerChatEvent e, Player p, String message) { + + // Check the mode + if (mode == null) { + + // Check which one to use + if (rankNameOfChat != null) { + rankAction(e, p, message); + } else if (mineNameOfChat != null) { + mineAction(e, p, message); + } + // If the mode's prestige will execute this + } else if (mode.equalsIgnoreCase("prestige")){ + prestigeAction(e, p, message); + } + } + + private void prestigeAction(AsyncPlayerChatEvent e, Player p, String message) { + + // Check the chat message and do the actions + if (message.equalsIgnoreCase("cancel")) { + p.sendMessage(SpigotPrison.format(messages.getString("Message.PrestigeCancelled"))); + } else if (message.equalsIgnoreCase("confirm")) { + Bukkit.getScheduler().runTask(SpigotPrison.getInstance(), () -> Bukkit.getServer().dispatchCommand(p, "rankup prestiges")); + } else { + p.sendMessage(SpigotPrison.format(messages.getString("Message.PrestigeCancelledWrongKeyword"))); + } + // Cancel the event + e.setCancelled(true); + // Set the event to false, because it got deactivated + isChatEventActive = false; + } + + private void mineAction(AsyncPlayerChatEvent e, Player p, String message) { + + // Check the chat message and do the action + if (message.equalsIgnoreCase("close")) { + p.sendMessage(SpigotPrison.format(messages.getString("Message.mineNameRenameClosed"))); + } else { + Bukkit.getScheduler().runTask(SpigotPrison.getInstance(), () -> Bukkit.getServer().dispatchCommand(p, "mines rename " + mineNameOfChat + " " + message)); + } + // Cancel the event and deactivate the chat event, set boolean to false + e.setCancelled(true); + isChatEventActive = false; + mineNameOfChat = null; + } + + private void rankAction(AsyncPlayerChatEvent e, Player p, String message) { + // Check the chat message and do the action + if (message.equalsIgnoreCase("close")) { + p.sendMessage(SpigotPrison.format(messages.getString("Message.rankTagRenameClosed"))); + } else { + Bukkit.getScheduler().runTask(SpigotPrison.getInstance(), () -> Bukkit.getServer().dispatchCommand(p, "ranks set tag " + rankNameOfChat + " " + message)); + } + // Cancel the event and set the boolean to false, so it can be deactivated + e.setCancelled(true); + isChatEventActive = false; + rankNameOfChat = null; + } + // Cancel the events of the active GUI opened from the player private void activeGuiEventCanceller(Player p, InventoryClickEvent e){ if(activeGui.contains(p.getName())) { @@ -119,80 +234,38 @@ private void activeGuiEventCanceller(Player p, InventoryClickEvent e){ } } - // InventoryClickEvent @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onClick(InventoryClickEvent e){ // Check if GUIs are enabled - if (!(Objects.requireNonNull(SpigotPrison.getInstance().getConfig().getString("prison-gui-enabled")).equalsIgnoreCase("true"))){ + if (!(SpigotPrison.getInstance().getConfig().getString("prison-gui-enabled").equalsIgnoreCase("true"))){ return; } // Get the player Player p = (Player) e.getWhoClicked(); - - // If you click an empty slot, this should avoid the error. - // Also if there is no button that was clicked, then it may not be a Prison GUI on click event? - if(e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR || - e.getCurrentItem().getItemMeta() == null || !e.getCurrentItem().hasItemMeta() || - e.getCurrentItem().getItemMeta().getDisplayName() == null) { - activeGuiEventCanceller(p, e); - return; - } else { - e.getCurrentItem().getItemMeta().getDisplayName(); - } + // GUIs must have the good conditions to work + if (guiConditions(e, p)) return; - // Get action of the Inventory from the event - InventoryAction action = e.getAction(); - - // If an action equals one of these, and the inventory is open from the player equals - // one of the Prison Title, it'll cancel the event - if (action.equals(InventoryAction.MOVE_TO_OTHER_INVENTORY) || action.equals(InventoryAction.HOTBAR_SWAP) || - action.equals(InventoryAction.HOTBAR_MOVE_AND_READD) || action.equals(InventoryAction.NOTHING) || - action.equals(InventoryAction.CLONE_STACK) || action.equals(InventoryAction.COLLECT_TO_CURSOR) || - action.equals(InventoryAction.DROP_ONE_SLOT) || action.equals(InventoryAction.DROP_ONE_CURSOR) || - action.equals(InventoryAction.DROP_ALL_SLOT) || action.equals(InventoryAction.DROP_ALL_CURSOR) || - action.equals(InventoryAction.PICKUP_ALL) || action.equals(InventoryAction.PICKUP_HALF) || - action.equals(InventoryAction.PICKUP_ONE) || action.equals(InventoryAction.PICKUP_SOME) || - action.equals(InventoryAction.PLACE_ALL) || action.equals(InventoryAction.PLACE_ONE) || - action.equals(InventoryAction.PLACE_SOME) || action.equals(InventoryAction.SWAP_WITH_CURSOR) || - action.equals(InventoryAction.UNKNOWN)) { - activeGuiEventCanceller(p, e); - } - - // ensure the item has itemMeta and a display name - if (!e.getCurrentItem().hasItemMeta()){ - return; - } -// WARNING DO NOT USE Objects.requireNonNull() since it will throw a NullPointerException!! -// NEVER should we want that to happen. If displayName is null then this is not our event -// and we should not be screwing with it! -// else { -// Objects.requireNonNull(e.getCurrentItem().getItemMeta()).getDisplayName(); -// } - - // Get the button name + // Get parameters String buttonNameMain = e.getCurrentItem().getItemMeta().getDisplayName(); - - // If the buttonmain have a name longer than 2 characters (should be with colors), it won't take care about the color ids - if ( buttonNameMain.length() > 2 ) { - buttonNameMain = buttonNameMain.substring(2); - } - - // Split the button name in parts + buttonNameMain = SpigotPrison.stripColor(buttonNameMain); String[] parts = buttonNameMain.split(" "); - - // Get ranks module Module module = Prison.get().getModuleManager().getModule( PrisonRanks.MODULE_NAME ).orElse( null ); - - // Get compat Compatibility compat = SpigotPrison.getInstance().getCompatibility(); - - // Get title String title = compat.getGUITitle(e).substring(2); + if (activeGui.contains(p.getName())) { + // Close GUI button globally + if (buttonNameMain.equalsIgnoreCase("Close")) { + p.closeInventory(); + e.setCancelled(true); + return; + } + } + // Check if the GUI have the right title and do the actions switch (title) { @@ -200,7 +273,7 @@ public void onClick(InventoryClickEvent e){ case "PrisonManager": // Call the method - PrisonManagerGUI(e, p, buttonNameMain); + prisonManagerGUI(e, p, buttonNameMain); break; @@ -208,7 +281,7 @@ public void onClick(InventoryClickEvent e){ case "RanksManager -> Ladders": { // Call the method - LaddersGUI(e, p, buttonNameMain, module); + laddersGUI(e, p, buttonNameMain, module); break; } @@ -217,7 +290,7 @@ public void onClick(InventoryClickEvent e){ case "Ladders -> Ranks": { // Call the method - RanksGUI(e, p, buttonNameMain); + ranksGUI(e, p, buttonNameMain); break; } @@ -225,7 +298,7 @@ public void onClick(InventoryClickEvent e){ case "Prestiges -> PlayerPrestiges": { // Call the method - PlayerPrestigesGUI(e, p, buttonNameMain); + playerPrestigesGUI(e, p, buttonNameMain); break; } @@ -233,7 +306,7 @@ public void onClick(InventoryClickEvent e){ case "Prestige -> Confirmation": { // Call the method - PrestigeConfirmationGUI(e, p, buttonNameMain); + prestigeConfirmationGUI(e, p, buttonNameMain); break; } @@ -241,7 +314,7 @@ public void onClick(InventoryClickEvent e){ case "Ranks -> RankManager": { // Call the method - RankManagerGUI(e, p, parts); + rankManagerGUI(e, p, parts); break; } @@ -249,7 +322,7 @@ public void onClick(InventoryClickEvent e){ case "Ranks -> PlayerRanks":{ // Call the method - PlayerRanksGUI(e, p, buttonNameMain); + playerRanksGUI(e, p, buttonNameMain); break; } @@ -257,7 +330,7 @@ public void onClick(InventoryClickEvent e){ case "RankManager -> RankUPCommands": { // Call the method - RankUPCommandsGUI(e, p, buttonNameMain); + rankUPCommandsGUI(e, p, buttonNameMain); break; } @@ -265,7 +338,7 @@ public void onClick(InventoryClickEvent e){ case "RankManager -> RankPrice": { // Call the method - RankPriceGUI(e, p, parts); + rankPriceGUI(e, p, parts); break; } @@ -273,7 +346,7 @@ public void onClick(InventoryClickEvent e){ case "MinesManager -> Mines": { // Call the method - MinesGUI(e, p, buttonNameMain); + minesGUI(e, p, buttonNameMain); break; } @@ -281,14 +354,14 @@ public void onClick(InventoryClickEvent e){ case "Mines -> PlayerMines": { // Call the method - PlayerMinesGUI(p, buttonNameMain); + playerMinesGUI(p, buttonNameMain); break; } case "Mines -> MineInfo": { // Call the method - MineInfoGUI(e, p, parts); + mineInfoGUI(e, p, parts); break; } @@ -297,7 +370,7 @@ public void onClick(InventoryClickEvent e){ case "Mines -> Delete": { // Call the method - MinesDeleteGUI(p, parts); + minesDeleteGUI(p, parts); break; } @@ -306,7 +379,15 @@ public void onClick(InventoryClickEvent e){ case "MineInfo -> Blocks": { // Call the method - BlocksGUI(e, p, parts); + blocksGUI(e, p, parts); + + break; + } + + // Check the inventory name and do the actions + case "Mines -> BlocksList":{ + + blocksListGUI(e, p, parts); break; } @@ -315,7 +396,7 @@ public void onClick(InventoryClickEvent e){ case "MineInfo -> ResetTime": { // Call the method - ResetTimeGUI(e, p, parts); + resetTimeGUI(e, p, parts); break; } @@ -324,7 +405,7 @@ public void onClick(InventoryClickEvent e){ case "MineInfo -> MineNotifications": { // Call the method - MineNotificationsGUI(e, p, parts); + mineNotificationsGUI(e, p, parts); break; } @@ -340,7 +421,7 @@ public void onClick(InventoryClickEvent e){ case "MineNotifications -> Radius": { // Call the method - RadiusGUI(e, p, parts); + radiusGUI(e, p, parts); break; } @@ -348,7 +429,7 @@ public void onClick(InventoryClickEvent e){ case "PrisonManager -> AutoFeatures": { // Call the method - AutoFeaturesGUI(e, p, parts); + autoFeaturesGUI(e, p, parts); break; } @@ -357,7 +438,7 @@ public void onClick(InventoryClickEvent e){ case "AutoFeatures -> AutoPickup":{ // Call the method - AutoPickupGUI(e, p, parts); + autoPickupGUI(e, p, parts); break; } @@ -366,7 +447,7 @@ public void onClick(InventoryClickEvent e){ case "AutoFeatures -> AutoSmelt":{ // Call the method - AutoSmeltGUI(e, p, parts); + autoSmeltGUI(e, p, parts); break; } @@ -375,7 +456,7 @@ public void onClick(InventoryClickEvent e){ case "AutoFeatures -> AutoBlock":{ // Call the method - AutoBlockGUI(e, p, parts); + autoBlockGUI(e, p, parts); break; } @@ -383,7 +464,7 @@ public void onClick(InventoryClickEvent e){ // Check the title and do the actions case "PrisonManager -> SellAll-Admin":{ - SellAllAdminGUI(e, p, buttonNameMain); + sellAllAdminGUI(e, p, buttonNameMain); break; } @@ -391,7 +472,7 @@ public void onClick(InventoryClickEvent e){ // Check the title and do the actions case "SellAll -> ItemValue":{ - SellAllItemValue(e, p, parts); + sellAllItemValue(e, p, parts); break; } @@ -404,7 +485,78 @@ public void onClick(InventoryClickEvent e){ break; } + // Check the title and do the actions + case "Prison Setup -> Confirmation":{ + + prisonSetupConfirmGUI(e, p, parts); + + break; + } + } + } + + private boolean guiConditions(InventoryClickEvent e, Player p) { + + // If you click an empty slot, this should avoid the error. + // Also if there is no button that was clicked, then it may not be a Prison GUI on click event? + if(e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR || + e.getCurrentItem().getItemMeta() == null || !e.getCurrentItem().hasItemMeta() || + e.getCurrentItem().getItemMeta().getDisplayName() == null) { + activeGuiEventCanceller(p, e); + return true; + } + + // Get action of the Inventory from the event + InventoryAction action = e.getAction(); + + // If an action equals one of these, and the inventory is open from the player equals + // one of the Prison Title, it'll cancel the event + if (action != null) { + activeGuiEventCanceller(p, e); + } + + // ensure the item has itemMeta and a display name + if (!e.getCurrentItem().hasItemMeta()){ + return true; + } + return false; + } + + private void prisonSetupConfirmGUI(InventoryClickEvent e, Player p, String[] parts) { + + if (parts[0].equalsIgnoreCase("Confirm:")){ + Bukkit.dispatchCommand(p, "ranks autoConfigure"); + } else if (parts[0].equalsIgnoreCase("Cancel:")){ + p.sendMessage(SpigotPrison.format(messages.getString("Setup.Message.Aborted"))); + } + p.closeInventory(); + e.setCancelled(true); + } + + private void blocksListGUI(InventoryClickEvent e, Player p, String[] parts) { + String positionStr = ( parts.length > 2 ? parts[2] : "0" ); + int position = 0; + try { + position = Integer.parseInt( positionStr ); + } + catch(NumberFormatException ignored) {} + + if (parts[0].equalsIgnoreCase("Next") || parts[0].equalsIgnoreCase("Prior")){ + + SpigotBlocksListGUI gui = new SpigotBlocksListGUI(p, parts[1], position); + + p.closeInventory(); + + gui.open(); + } else { + SpigotMineBlockPercentageGUI gui = new SpigotMineBlockPercentageGUI(p, 0.00, parts[1], parts[0], position); + + p.closeInventory(); + + gui.open(); } + + e.setCancelled(true); } private void mineBlockPercentage(InventoryClickEvent e, Player p, String[] parts) { @@ -413,16 +565,41 @@ private void mineBlockPercentage(InventoryClickEvent e, Player p, String[] parts String part1 = parts[0]; String part2 = parts[1]; String part3 = parts[2]; + + // If Close, part 4 won't be defined so handle the close first. + if (part1.equalsIgnoreCase( "Close" )) { + int pos = 0; + try { + pos = Integer.parseInt( part3 ); + } + catch(NumberFormatException ignored) {} + + SpigotBlocksListGUI gui = new SpigotBlocksListGUI(p, part2, pos); + + p.closeInventory(); + + gui.open(); + return; + } + String part4 = parts[3]; // Initialize the variable double decreaseOrIncreaseValue = 0; // If there're enough parts init another variable - if (parts.length == 5){ + if (parts.length > 4 ){ decreaseOrIncreaseValue = Double.parseDouble(parts[4]); } + + String positionStr = ( parts.length > 5 ? parts[5] : "0" ); + int position = 0; + try { + position = Integer.parseInt( positionStr ); + } + catch(NumberFormatException ignored) {} + // Check the button name and do the actions if (part1.equalsIgnoreCase("Confirm:")) { @@ -489,7 +666,7 @@ private void mineBlockPercentage(InventoryClickEvent e, Player p, String[] parts } // Open an updated GUI after the value changed - SpigotMineBlockPercentageGUI gui = new SpigotMineBlockPercentageGUI(p, val, part1, part2); + SpigotMineBlockPercentageGUI gui = new SpigotMineBlockPercentageGUI(p, val, part1, part2, position); gui.open(); // Check the calculator symbol @@ -517,7 +694,7 @@ private void mineBlockPercentage(InventoryClickEvent e, Player p, String[] parts } // Open a new updated GUI with new values - SpigotMineBlockPercentageGUI gui = new SpigotMineBlockPercentageGUI(p, val, part1, part2); + SpigotMineBlockPercentageGUI gui = new SpigotMineBlockPercentageGUI(p, val, part1, part2, position); gui.open(); // Cancel the event @@ -525,7 +702,7 @@ private void mineBlockPercentage(InventoryClickEvent e, Player p, String[] parts } } - private void SellAllItemValue(InventoryClickEvent e, Player p, String[] parts) { + private void sellAllItemValue(InventoryClickEvent e, Player p, String[] parts) { // Rename the parts String part1 = parts[0]; @@ -629,7 +806,7 @@ private void SellAllItemValue(InventoryClickEvent e, Player p, String[] parts) { } } - private void SellAllAdminGUI(InventoryClickEvent e, Player p, String buttonNameMain) { + private void sellAllAdminGUI(InventoryClickEvent e, Player p, String buttonNameMain) { if (e.isRightClick()){ @@ -641,7 +818,7 @@ private void SellAllAdminGUI(InventoryClickEvent e, Player p, String buttonNameM File file = new File(SpigotPrison.getInstance().getDataFolder() + "/SellAllConfig.yml"); FileConfiguration conf = YamlConfiguration.loadConfiguration(file); - SellAllPriceGUI gui = new SellAllPriceGUI(p,Double.parseDouble(Objects.requireNonNull(conf.getString("Items." + buttonNameMain + ".ITEM_VALUE"))), buttonNameMain); + SellAllPriceGUI gui = new SellAllPriceGUI(p,Double.parseDouble(conf.getString("Items." + buttonNameMain + ".ITEM_VALUE")), buttonNameMain); gui.open(); } @@ -649,7 +826,7 @@ private void SellAllAdminGUI(InventoryClickEvent e, Player p, String buttonNameM e.setCancelled(true); } - private void PrisonManagerGUI(InventoryClickEvent e, Player p, String buttonNameMain) { + private void prisonManagerGUI(InventoryClickEvent e, Player p, String buttonNameMain) { // Check the Item display name and do open the right GUI switch (buttonNameMain) { @@ -685,7 +862,7 @@ private void PrisonManagerGUI(InventoryClickEvent e, Player p, String buttonName e.setCancelled(true); } - private void LaddersGUI(InventoryClickEvent e, Player p, String buttonNameMain, Module module) { + private void laddersGUI(InventoryClickEvent e, Player p, String buttonNameMain, Module module) { // Check if the Ranks module's loaded if(!(module instanceof PrisonRanks)){ @@ -696,7 +873,7 @@ private void LaddersGUI(InventoryClickEvent e, Player p, String buttonNameMain, } // Get the ladder by the name of the button got before - Optional ladder = PrisonRanks.getInstance().getLadderManager().getLadder(buttonNameMain); + ladder = PrisonRanks.getInstance().getLadderManager().getLadder(buttonNameMain); // Check if the ladder exist, everything can happen but this shouldn't if (!ladder.isPresent()) { @@ -726,20 +903,17 @@ private void LaddersGUI(InventoryClickEvent e, Player p, String buttonNameMain, e.setCancelled(true); } - private void RanksGUI(InventoryClickEvent e, Player p, String buttonNameMain) { + private void ranksGUI(InventoryClickEvent e, Player p, String buttonNameMain) { // Get the rank - Optional rankOptional = PrisonRanks.getInstance().getRankManager().getRank(buttonNameMain); + Rank rank = PrisonRanks.getInstance().getRankManager().getRank(buttonNameMain); // Check if the rank exist - if (!rankOptional.isPresent()) { + if (rank == null) { p.sendMessage(SpigotPrison.format("&cThe rank " + buttonNameMain + " does not exist.")); return; } - // Get the rank - Rank rank = rankOptional.get(); - // Check clicks if (e.isShiftClick() && e.isRightClick()) { @@ -747,6 +921,8 @@ private void RanksGUI(InventoryClickEvent e, Player p, String buttonNameMain) { Bukkit.dispatchCommand(p, "ranks delete " + buttonNameMain); e.setCancelled(true); p.closeInventory(); + SpigotRanksGUI gui = new SpigotRanksGUI(p, ladder); + gui.open(); return; } else { @@ -761,7 +937,7 @@ private void RanksGUI(InventoryClickEvent e, Player p, String buttonNameMain) { e.setCancelled(true); } - private void PlayerPrestigesGUI(InventoryClickEvent e, Player p, String buttonNameMain) { + private void playerPrestigesGUI(InventoryClickEvent e, Player p, String buttonNameMain) { // Check the button name and do the actions if (buttonNameMain.equalsIgnoreCase("Prestige")){ @@ -775,7 +951,7 @@ private void PlayerPrestigesGUI(InventoryClickEvent e, Player p, String buttonNa e.setCancelled(true); } - private void PrestigeConfirmationGUI(InventoryClickEvent e, Player p, String buttonNameMain) { + private void prestigeConfirmationGUI(InventoryClickEvent e, Player p, String buttonNameMain) { // Check the button name and do the actions if (buttonNameMain.equalsIgnoreCase("Confirm: Prestige")){ @@ -794,28 +970,25 @@ private void PrestigeConfirmationGUI(InventoryClickEvent e, Player p, String but e.setCancelled(true); } - private void RankManagerGUI(InventoryClickEvent e, Player p, String[] parts) { + private void rankManagerGUI(InventoryClickEvent e, Player p, String[] parts) { - // Output finally the buttonname and the minename explicit out of the array - String buttonname = parts[0]; + // Output finally the buttonName and the minename explicit out of the array + String buttonName = parts[0]; String rankName = parts[1]; // Get the rank - Optional rankOptional = PrisonRanks.getInstance().getRankManager().getRank(rankName); + Rank rank = PrisonRanks.getInstance().getRankManager().getRank(rankName); // Check the button name and do the actions - if (buttonname.equalsIgnoreCase("RankupCommands")){ + if (buttonName.equalsIgnoreCase("RankupCommands")){ // Check if the rank exist - if (!rankOptional.isPresent()) { + if (rank == null) { // Send a message to the player p.sendMessage(SpigotPrison.format("&c[ERROR] The rank " + rankName + " does not exist.")); return; } - // Get the rank - Rank rank = rankOptional.get(); - // Check the rankupCommand of the Rank if (rank.rankUpCommands == null) { // Send a message to the player @@ -829,26 +1002,30 @@ private void RankManagerGUI(InventoryClickEvent e, Player p, String[] parts) { } // Check the button name and do the actions - } else if (buttonname.equalsIgnoreCase("RankPrice")){ + } else if (buttonName.equalsIgnoreCase("RankPrice")){ // Check and open a GUI - if(rankOptional.isPresent()) { - SpigotRankPriceGUI gui = new SpigotRankPriceGUI(p, (int) rankOptional.get().cost, rankOptional.get().name); + if(rank != null) { + SpigotRankPriceGUI gui = new SpigotRankPriceGUI(p, (int) rank.cost, rank.name); gui.open(); } // Check the button name and do the actions - } else if (buttonname.equalsIgnoreCase("RankTag")){ + } else if (buttonName.equalsIgnoreCase("RankTag")){ // Send messages to the player - p.sendMessage(SpigotPrison.format("&7[&3Info&7] &3Please write the &6tag &3you'd like to use and &6submit&3.")); - p.sendMessage(SpigotPrison.format("&7[&3Info&7] &3Input &cclose &3to cancel or wait &c30 seconds&3.")); + p.sendMessage(SpigotPrison.format(messages.getString("Message.rankTagRename"))); + p.sendMessage(SpigotPrison.format(messages.getString("Message.rankTagRenameClose"))); // Start the async task isChatEventActive = true; rankNameOfChat = rankName; + addChatEventPlayer(p); id = Bukkit.getScheduler().scheduleSyncDelayedTask(SpigotPrison.getInstance(), () -> { - isChatEventActive = false; - p.sendMessage(SpigotPrison.format("&cYou ran out of time, tag not changed.")); + if (isChatEventActive) { + removeChatEventPlayer(p); + p.sendMessage(SpigotPrison.format(messages.getString("Message.OutOfTimeNoChanges"))); + isChatEventActive = false; + } }, 20L * 30); p.closeInventory(); } @@ -857,14 +1034,11 @@ private void RankManagerGUI(InventoryClickEvent e, Player p, String[] parts) { e.setCancelled(true); } - private void PlayerRanksGUI(InventoryClickEvent e, Player p, String buttonNameMain) { - - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); + private void playerRanksGUI(InventoryClickEvent e, Player p, String buttonNameMain) { // Check the buttonName and do the actions - if (buttonNameMain.equals(SpigotPrison.format(Objects.requireNonNull(GuiConfig.getString("Gui.Lore.Rankup")).substring(2)))){ - Bukkit.dispatchCommand(p, "rankup " + GuiConfig.getString("Options.Ranks.Ladder")); + if (buttonNameMain.equals(SpigotPrison.format(messages.getString("Lore.Rankup").substring(2)))){ + Bukkit.dispatchCommand(p, "rankup " + guiConfig.getString("Options.Ranks.Ladder")); p.closeInventory(); } @@ -872,7 +1046,7 @@ private void PlayerRanksGUI(InventoryClickEvent e, Player p, String buttonNameMa e.setCancelled(true); } - private void RankUPCommandsGUI(InventoryClickEvent e, Player p, String buttonNameMain) { + private void rankUPCommandsGUI(InventoryClickEvent e, Player p, String buttonNameMain) { // Check the clickType if (e.isShiftClick() && e.isRightClick()) { @@ -891,7 +1065,7 @@ private void RankUPCommandsGUI(InventoryClickEvent e, Player p, String buttonNam e.setCancelled(true); } - private void RankPriceGUI(InventoryClickEvent e, Player p, String[] parts) { + private void rankPriceGUI(InventoryClickEvent e, Player p, String[] parts) { // Rename the parts String part1 = parts[0]; @@ -995,7 +1169,7 @@ private void RankPriceGUI(InventoryClickEvent e, Player p, String[] parts) { } } - private void MinesGUI(InventoryClickEvent e, Player p, String buttonNameMain) { + private void minesGUI(InventoryClickEvent e, Player p, String buttonNameMain) { // Variables PrisonMines pMines = PrisonMines.getInstance(); @@ -1023,25 +1197,23 @@ private void MinesGUI(InventoryClickEvent e, Player p, String buttonNameMain) { e.setCancelled(true); } - private void PlayerMinesGUI(Player p, String buttonNameMain) { + private void playerMinesGUI(Player p, String buttonNameMain) { - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - String permission = SpigotPrison.format(GuiConfig.getString("Options.Mines.PermissionWarpPlugin")); + String permission = SpigotPrison.format(guiConfig.getString("Options.Mines.PermissionWarpPlugin")); if (p.hasPermission(permission + buttonNameMain) || p.hasPermission(permission.substring(0, permission.length() - 1))){ - Bukkit.dispatchCommand(p, SpigotPrison.format(GuiConfig.getString("Options.Mines.CommandWarpPlugin") + " " + buttonNameMain)); + Bukkit.dispatchCommand(p, SpigotPrison.format(guiConfig.getString("Options.Mines.CommandWarpPlugin") + " " + buttonNameMain)); } } - private void MineInfoGUI(InventoryClickEvent e, Player p, String[] parts) { + private void mineInfoGUI(InventoryClickEvent e, Player p, String[] parts) { - // Output finally the buttonname and the minename explicit out of the array - String buttonname = parts[0]; + // Output finally the buttonName and the mineName explicit out of the array + String buttonName = parts[0]; String mineName = parts[1]; // Check the name of the button and do the actions - switch (buttonname) { + switch (buttonName) { case "Blocks_of_the_Mine:": // Open the GUI @@ -1113,10 +1285,29 @@ private void MineInfoGUI(InventoryClickEvent e, Player p, String[] parts) { gui2.open(); break; + case "Mine_Name:": { + + // Send messages to the player + p.sendMessage(SpigotPrison.format(messages.getString("Message.mineNameRename"))); + p.sendMessage(SpigotPrison.format(messages.getString("Message.mineNameRenameClose"))); + // Start the async task + isChatEventActive = true; + mineNameOfChat = mineName; + addChatEventPlayer(p); + id = Bukkit.getScheduler().scheduleSyncDelayedTask(SpigotPrison.getInstance(), () -> { + if (isChatEventActive) { + removeChatEventPlayer(p); + p.sendMessage(SpigotPrison.format(messages.getString("Message.OutOfTimeNoChanges"))); + isChatEventActive = false; + } + }, 20L * 30); + p.closeInventory(); + break; + } } } - private void MinesDeleteGUI(Player p, String[] parts) { + private void minesDeleteGUI(Player p, String[] parts) { // Output finally the buttonname and the minename explicit out of the array String buttonname = parts[0]; @@ -1143,12 +1334,20 @@ private void MinesDeleteGUI(Player p, String[] parts) { } } - private void BlocksGUI(InventoryClickEvent e, Player p, String[] parts) { + private void blocksGUI(InventoryClickEvent e, Player p, String[] parts) { // Output finally the buttonname and the minename explicit out of the array String buttonname = parts[0]; String mineName = parts[1]; - double percentage = Double.parseDouble(parts[2]); + + if (buttonname.equalsIgnoreCase("Add")){ + SpigotBlocksListGUI gui = new SpigotBlocksListGUI(p, mineName, 0); + + p.closeInventory(); + + gui.open(); + return; + } // Check the click Type and do the actions if (e.isShiftClick() && e.isRightClick()) { @@ -1166,14 +1365,22 @@ private void BlocksGUI(InventoryClickEvent e, Player p, String[] parts) { SpigotMinesBlocksGUI gui = new SpigotMinesBlocksGUI(p, mineName); gui.open(); } else { + + String positionStr = ( parts.length > 2 ? parts[2] : "0" ); + int position = 0; + try { + position = Integer.parseInt( positionStr ); + } + catch(NumberFormatException ignored) {} - SpigotMineBlockPercentageGUI gui = new SpigotMineBlockPercentageGUI(p, percentage, mineName, buttonname); + double percentage = Double.parseDouble(parts[2]); + SpigotMineBlockPercentageGUI gui = new SpigotMineBlockPercentageGUI(p, percentage, mineName, buttonname, position); gui.open(); } } - private void ResetTimeGUI(InventoryClickEvent e, Player p, String[] parts) { + private void resetTimeGUI(InventoryClickEvent e, Player p, String[] parts) { // Rename the parts String part1 = parts[0]; @@ -1291,7 +1498,7 @@ private void ResetTimeGUI(InventoryClickEvent e, Player p, String[] parts) { } } - private void MineNotificationsGUI(InventoryClickEvent e, Player p, String[] parts) { + private void mineNotificationsGUI(InventoryClickEvent e, Player p, String[] parts) { // Output finally the buttonname and the minename explicit out of the array String buttonname = parts[0]; @@ -1345,7 +1552,7 @@ private void MineNotificationsGUI(InventoryClickEvent e, Player p, String[] part } } - private void RadiusGUI(InventoryClickEvent e, Player p, String[] parts) { + private void radiusGUI(InventoryClickEvent e, Player p, String[] parts) { // Rename the variables String part1 = parts[0]; @@ -1466,7 +1673,7 @@ private void RadiusGUI(InventoryClickEvent e, Player p, String[] parts) { } } - private void AutoFeaturesGUI(InventoryClickEvent e, Player p, String[] parts) { + private void autoFeaturesGUI(InventoryClickEvent e, Player p, String[] parts) { // Get the config AutoFeaturesFileConfig afConfig = SpigotPrison.getInstance().getAutoFeatures().getAutoFeaturesConfig(); @@ -1532,13 +1739,16 @@ private void AutoFeaturesGUI(InventoryClickEvent e, Player p, String[] parts) { } } - private void AutoPickupGUI(InventoryClickEvent e, Player p, String[] parts) { + private void autoPickupGUI(InventoryClickEvent e, Player p, String[] parts) { // Get the config AutoFeaturesFileConfig afConfig = SpigotPrison.getInstance().getAutoFeatures().getAutoFeaturesConfig(); // Output finally the buttonname and the mode explicit out of the array String buttonname = parts[0]; + + + String mode = parts[1]; boolean enabled = mode.equalsIgnoreCase("Enabled"); @@ -1611,7 +1821,7 @@ private void AutoPickupGUI(InventoryClickEvent e, Player p, String[] parts) { } - private void AutoSmeltGUI(InventoryClickEvent e, Player p, String[] parts) { + private void autoSmeltGUI(InventoryClickEvent e, Player p, String[] parts) { // Get the config AutoFeaturesFileConfig afConfig = SpigotPrison.getInstance().getAutoFeatures().getAutoFeaturesConfig(); @@ -1644,7 +1854,7 @@ private void AutoSmeltGUI(InventoryClickEvent e, Player p, String[] parts) { } } - private void AutoBlockGUI(InventoryClickEvent e, Player p, String[] parts) { + private void autoBlockGUI(InventoryClickEvent e, Player p, String[] parts) { // Get the config AutoFeaturesFileConfig afConfig = SpigotPrison.getInstance().getAutoFeatures().getAutoFeaturesConfig(); diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/PrisonSetupGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/PrisonSetupGUI.java new file mode 100644 index 000000000..0b43b2fcb --- /dev/null +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/PrisonSetupGUI.java @@ -0,0 +1,74 @@ +package tech.mcprison.prison.spigot.gui; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.configuration.Configuration; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import tech.mcprison.prison.spigot.SpigotPrison; + +import java.util.List; + +public class PrisonSetupGUI extends SpigotGUIComponents{ + + private final Player p; + private final Configuration messages = messages(); + + public PrisonSetupGUI(Player p) { + this.p = p; + } + + public void open(){ + + // Create the inventory + int dimension = 9; + Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3Prison Setup -> Confirmation")); + + if (guiBuilder(inv)) return; + + // Open the inventory + openGUI(p, inv); + } + + private boolean guiBuilder(Inventory inv) { + try { + buttonsSetup(inv); + } catch (NullPointerException ex){ + p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); + ex.printStackTrace(); + return true; + } + return false; + } + + private void buttonsSetup(Inventory inv) { + + + // Blocks of the mine + List confirmLore = createLore( + messages.getString("Lore.ClickToConfirm"), + messages.getString("Lore.noRanksFoundSetup"), + messages.getString("Lore.noRanksFoundSetup1"), + messages.getString("Lore.noRanksFoundSetup2"), + messages.getString("Lore.noRanksFoundSetup3"), + messages.getString("Lore.noRanksFoundSetup4"), + messages.getString("Lore.noRanksFoundSetup5"), + messages.getString("Lore.noRanksFoundSetup6"), + messages.getString("Lore.noRanksFoundSetup7"), + messages.getString("Lore.noRanksFoundSetup8") + ); + + // Blocks of the mine + List cancelLore = createLore( + messages.getString("Lore.ClickToCancel")); + + // Create the button, set up the material, amount, lore and name + ItemStack confirm = createButton(Material.EMERALD_BLOCK, 1, confirmLore, SpigotPrison.format("&3" + "Confirm: Setup")); + ItemStack cancel = createButton(Material.REDSTONE_BLOCK, 1, cancelLore, SpigotPrison.format("&3" + "Cancel: Setup")); + + // Position of the button + inv.setItem(2, confirm); + inv.setItem(6, cancel); + } +} diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotGUI.java deleted file mode 100644 index 515496635..000000000 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotGUI.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017-2020 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 . - */ - -package tech.mcprison.prison.spigot.gui; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import tech.mcprison.prison.gui.Button; -import tech.mcprison.prison.gui.GUI; -import tech.mcprison.prison.internal.Player; -import tech.mcprison.prison.spigot.SpigotUtil; -import tech.mcprison.prison.spigot.inventory.SpigotInventory; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Faizaan A. Datoo - */ -// From GABRYCA, I don't know if this's still needed, I won't remove it for now, but might be in the future -public class SpigotGUI implements GUI { - - private Map buttons; - private String title; - private int numSlots; - - private Inventory bukkitInventory; - - public SpigotGUI(String title, int numSlots) { - this.buttons = new HashMap<>(); - this.title = title; - this.numSlots = numSlots; - } - - @Override public void show(Player... players) { - for (Player player : players) { - org.bukkit.entity.Player bPlayer = Bukkit.getServer().getPlayer(player.getName()); - bPlayer.openInventory(bukkitInventory); - } - GUIListener.get().registerInventory(this); - } - - @Override public GUI build() { - bukkitInventory = Bukkit.getServer() - .createInventory(null, numSlots, ChatColor.translateAlternateColorCodes('&', title)); - for (Map.Entry button : buttons.entrySet()) { - bukkitInventory.setItem(button.getKey(), buttonToItemStack(button.getValue())); - } - - return this; - } - - private ItemStack buttonToItemStack(Button button) { - ItemStack stack = SpigotUtil.getItemStack( button.getItem(), 1 ); -// new ItemStack(button.getItem().getLegacyId(), 1, button.getItem().getData()); - ItemMeta meta = stack.getItemMeta(); - meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&r" + button.getName())); - meta.setLore(button.getLore()); - stack.setItemMeta(meta); - return stack; - } - - @Override public String getTitle() { - return title; - } - - @Override public int getNumRows() { - return numSlots / 9; - } - - @Override public Map getButtons() { - return buttons; - } - - @Override public GUI addButton(int slot, Button button) { - buttons.put(slot, button); - return this; - } - - @Override public tech.mcprison.prison.internal.inventory.Inventory getInventory() { - return new SpigotInventory(bukkitInventory); - } - - public Inventory getWrapper() { - return bukkitInventory; - } - -} diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotGUIComponents.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotGUIComponents.java index 08725924a..57aadb16b 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotGUIComponents.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotGUIComponents.java @@ -4,11 +4,14 @@ import java.util.List; import org.bukkit.Material; +import org.bukkit.configuration.Configuration; import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import tech.mcprison.prison.Prison; +import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig; import tech.mcprison.prison.modules.Module; import tech.mcprison.prison.ranks.PrisonRanks; import tech.mcprison.prison.spigot.SpigotPrison; @@ -24,15 +27,31 @@ protected ItemStack createButton(Material id, int amount, List lore, Str ItemStack item = new ItemStack(id, amount); ItemMeta meta = item.getItemMeta(); - meta.setDisplayName(display); - try { - meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); - } catch (NoClassDefFoundError ignored){} - meta.setLore(lore); - item.setItemMeta(meta); + if ( meta != null ) { + meta.setDisplayName(SpigotPrison.format(display)); + try { + meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); + } catch (NoClassDefFoundError ignored){} + meta.setLore(lore); + item.setItemMeta(meta); + } return item; } + protected ItemStack createButton(ItemStack item, List lore, String display) { + + ItemMeta meta = item.getItemMeta(); + if ( meta != null ) { + meta.setDisplayName(SpigotPrison.format(display)); + try { + meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); + } catch (NoClassDefFoundError ignored){} + meta.setLore(lore); + item.setItemMeta(meta); + } + + return item; + } // createLore method (create a lore for the button) protected List createLore( String... lores ) { @@ -54,4 +73,27 @@ protected boolean checkRanks(Player p){ } + protected static Configuration messages(){ + return SpigotPrison.getInstance().getMessagesConfig(); + } + + protected static Configuration sellAll(){ + return SpigotPrison.getInstance().getSellAllConfig(); + } + + protected static Configuration guiConfig(){ + return SpigotPrison.getInstance().getGuiConfig(); + } + + protected static AutoFeaturesFileConfig AutoFeaturesFileConfig() { + return SpigotPrison.getInstance().getAutoFeatures().getAutoFeaturesConfig(); + } + + protected void openGUI(Player p, Inventory inv){ + + // Open the inventory + p.openInventory(inv); + ListenersPrisonManager.get().addToGUIBlocker(p); + } + } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotPrisonGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotPrisonGUI.java index ab77720fe..d0bb6d744 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotPrisonGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/SpigotPrisonGUI.java @@ -8,6 +8,9 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; + +import com.cryptomorin.xseries.XMaterial; + import tech.mcprison.prison.spigot.SpigotPrison; /** @@ -16,6 +19,7 @@ public class SpigotPrisonGUI extends SpigotGUIComponents { private final Player p; + private final Configuration messages = messages(); public SpigotPrisonGUI(Player p){ this.p = p; @@ -27,19 +31,15 @@ public void open() { int dimension = 27; Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3PrisonManager")); - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); + if (guiBuilder(inv)) return; - if (guiBuilder(inv, GuiConfig)) return; - - // Open the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + // Open the inventory, I don't remember why I did add the this.p + openGUI(p,inv); } - private boolean guiBuilder(Inventory inv, Configuration guiConfig) { + private boolean guiBuilder(Inventory inv) { try { - buttonsSetup(inv, guiConfig); + buttonsSetup(inv); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -48,49 +48,37 @@ private boolean guiBuilder(Inventory inv, Configuration guiConfig) { return false; } - private void buttonsSetup(Inventory inv, Configuration guiConfig) { - // Lore of the button - List rankslore = createLore( - guiConfig.getString("Gui.Lore.RanksButton"), - guiConfig.getString("Gui.Lore.ClickToOpen")); - - // Lore of the button - List prisontaskslore = createLore( - guiConfig.getString("Gui.Lore.PrisonTasksButton"), - guiConfig.getString("Gui.Lore.ClickToOpen")); + private void buttonsSetup(Inventory inv) { - // Lore of the button - List mineslore = createLore( - guiConfig.getString("Gui.Lore.MinesButton"), - guiConfig.getString("Gui.Lore.ClickToOpen")); - // Lore of the button - List sellallLore = createLore( - guiConfig.getString("Gui.Lore.ClickToOpen")); + List ranksLore = createLore( + messages.getString("Lore.RanksButton"), + messages.getString("Lore.ClickToOpen")); + List prisonTasksLore = createLore( + messages.getString("Lore.PrisonTasksButton"), + messages.getString("Lore.ClickToOpen")); + List minesLore = createLore( + messages.getString("Lore.MinesButton"), + messages.getString("Lore.ClickToOpen")); + List sellAllLore = createLore( + messages.getString("Lore.ClickToOpen")); + List closeGUILore = createLore( + messages.getString("Lore.ClickToClose") + ); - // Create the button, set up the material, amount, lore and name - ItemStack ranks = createButton(Material.TRIPWIRE_HOOK, 1, rankslore, SpigotPrison.format("&3" + "Ranks")); - - // Create the button, set up the material, amount, lore and name - ItemStack prisontasks = createButton(Material.IRON_PICKAXE, 1, prisontaskslore, SpigotPrison.format("&3" + "AutoManager")); + ItemStack closeGUI = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), closeGUILore, SpigotPrison.format("&c" + "Close")); // Create the button, set up the material, amount, lore and name - ItemStack mines = createButton(Material.DIAMOND_ORE, 1, mineslore, SpigotPrison.format("&3" + "Mines")); + ItemStack ranks = createButton(Material.TRIPWIRE_HOOK, 1, ranksLore, SpigotPrison.format("&3" + "Ranks")); + ItemStack autoManager = createButton(Material.IRON_PICKAXE, 1, prisonTasksLore, SpigotPrison.format("&3" + "AutoManager")); + ItemStack mines = createButton(Material.DIAMOND_ORE, 1, minesLore, SpigotPrison.format("&3" + "Mines")); + ItemStack sellAll = createButton(Material.CHEST, 1 , sellAllLore, SpigotPrison.format("&3" + "SellAll")); - // Create the button, set up the material, amount, lore and name - ItemStack sellall = createButton(Material.CHEST, 1 , sellallLore, SpigotPrison.format("&3" + "SellAll")); - - //Position of the button + // Position of the button inv.setItem(10, ranks); - - //Position of the button - inv.setItem(12, prisontasks); - - //Position of the button + inv.setItem(12, autoManager); inv.setItem(14, mines); - - //Position of the button - inv.setItem(16, sellall); + inv.setItem(16, sellAll); + inv.setItem(26, closeGUI); } - } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoBlockGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoBlockGUI.java index 4ea903bec..5c1c5df44 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoBlockGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoBlockGUI.java @@ -1,5 +1,8 @@ package tech.mcprison.prison.spigot.gui.autofeatures; +import java.util.List; + +import com.cryptomorin.xseries.XMaterial; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.configuration.Configuration; @@ -10,18 +13,17 @@ import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig; import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig.AutoFeatures; import tech.mcprison.prison.spigot.SpigotPrison; -import tech.mcprison.prison.spigot.gui.GUIListener; import tech.mcprison.prison.spigot.gui.ListenersPrisonManager; import tech.mcprison.prison.spigot.gui.SpigotGUIComponents; -import java.util.List; - /** * @author GABRYCA */ public class SpigotAutoBlockGUI extends SpigotGUIComponents { private final Player p; + private final Configuration messages = messages(); + private final AutoFeaturesFileConfig afConfig = AutoFeaturesFileConfig(); public SpigotAutoBlockGUI(Player p){ this.p = p; @@ -29,25 +31,18 @@ public SpigotAutoBlockGUI(Player p){ public void open() { - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - // Create the inventory and set up the owner, dimensions or number of slots, and title - int dimension = 27; + int dimension = 36; Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3AutoFeatures -> AutoBlock")); - // Config - AutoFeaturesFileConfig afConfig = SpigotPrison.getInstance().getAutoFeatures().getAutoFeaturesConfig(); - - if (guiBuilder(GuiConfig, inv, afConfig)) return; + if (guiBuilder(inv)) return; - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Configuration guiConfig, Inventory inv, AutoFeaturesFileConfig afConfig) { + private boolean guiBuilder(Inventory inv) { try { - buttonsSetup(guiConfig, inv, afConfig); + buttonsSetup(inv); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -56,20 +51,27 @@ private boolean guiBuilder(Configuration guiConfig, Inventory inv, AutoFeaturesF return false; } - private void buttonsSetup(Configuration guiConfig, Inventory inv, AutoFeaturesFileConfig afConfig) { + private void buttonsSetup(Inventory inv) { + + List enabledLore = createLore( - guiConfig.getString("Gui.Lore.ShiftAndRightClickToDisable") + messages.getString("Lore.ShiftAndRightClickToDisable") ); - List disabledLore = createLore( - guiConfig.getString("Gui.Lore.RightClickToEnable") + messages.getString("Lore.RightClickToEnable") ); + List closeGUILore = createLore( + messages.getString("Lore.ClickToClose") + ); + + ItemStack closeGUI = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), closeGUILore, SpigotPrison.format("&c" + "Close")); + inv.setItem(35, closeGUI); if ( afConfig.isFeatureBoolean( AutoFeatures.autoBlockAllBlocks ) ) { - ItemStack Enabled = createButton(Material.EMERALD_BLOCK, 1, enabledLore, SpigotPrison.format("&a" + "All_Blocks Enabled")); + ItemStack Enabled = createButton(XMaterial.LIME_STAINED_GLASS_PANE.parseItem(), enabledLore, SpigotPrison.format("&a" + "All_Blocks Enabled")); inv.addItem(Enabled); } else { - ItemStack Disabled = createButton(Material.REDSTONE_BLOCK, 1, disabledLore, SpigotPrison.format("&c" + "All_Blocks Disabled")); + ItemStack Disabled = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), disabledLore, SpigotPrison.format("&c" + "All_Blocks Disabled")); inv.addItem(Disabled); } @@ -161,5 +163,4 @@ private void buttonsSetup(Configuration guiConfig, Inventory inv, AutoFeaturesFi inv.addItem(Disabled); } } - } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoFeaturesGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoFeaturesGUI.java index 43d4227e4..cb4553814 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoFeaturesGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoFeaturesGUI.java @@ -1,26 +1,29 @@ package tech.mcprison.prison.spigot.gui.autofeatures; +import java.util.List; + import org.bukkit.Bukkit; -import org.bukkit.Material; import org.bukkit.configuration.Configuration; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; +import com.cryptomorin.xseries.XMaterial; + import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig; import tech.mcprison.prison.autofeatures.AutoFeaturesFileConfig.AutoFeatures; import tech.mcprison.prison.spigot.SpigotPrison; import tech.mcprison.prison.spigot.gui.ListenersPrisonManager; import tech.mcprison.prison.spigot.gui.SpigotGUIComponents; -import java.util.List; - /** * @author GABRYCA */ public class SpigotAutoFeaturesGUI extends SpigotGUIComponents { private final Player p; + private final AutoFeaturesFileConfig afConfig = AutoFeaturesFileConfig(); + private final Configuration messages = messages(); public SpigotAutoFeaturesGUI(Player p){ this.p = p; @@ -29,25 +32,19 @@ public SpigotAutoFeaturesGUI(Player p){ public void open() { // Create the inventory and set up the owner, dimensions or number of slots, and title - int dimension = 27; + int dimension = 54; Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3PrisonManager -> AutoFeatures")); - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - // Config - AutoFeaturesFileConfig afConfig = SpigotPrison.getInstance().getAutoFeatures().getAutoFeaturesConfig(); - - if (guiBuilder(inv, GuiConfig, afConfig)) return; + if (guiBuilder(inv)) return; // Open the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Inventory inv, Configuration guiConfig, AutoFeaturesFileConfig afConfig) { + private boolean guiBuilder(Inventory inv) { try { - buttonsSetup(inv, guiConfig, afConfig); + buttonsSetup(inv); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -56,7 +53,8 @@ private boolean guiBuilder(Inventory inv, Configuration guiConfig, AutoFeaturesF return false; } - private void buttonsSetup(Inventory inv, Configuration guiConfig, AutoFeaturesFileConfig afConfig) { + private void buttonsSetup(Inventory inv) { + // Declare buttons ItemStack autoPickup; @@ -66,129 +64,120 @@ private void buttonsSetup(Inventory inv, Configuration guiConfig, AutoFeaturesFi ItemStack playSound; ItemStack hologram; + List closeGUILore = createLore( + messages.getString("Lore.ClickToClose") + ); + + ItemStack closeGUI = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), closeGUILore, SpigotPrison.format("&c" + "Close")); + if ( afConfig.isFeatureBoolean( AutoFeatures.playSoundIfInventoryIsFull ) ){ List EnabledOrDisabledLore = createLore( - guiConfig.getString("Gui.Lore.FullSoundEnabled"), - guiConfig.getString("Gui.Lore.ShiftAndRightClickToDisable")); - playSound = createButton(Material.EMERALD_BLOCK, 1, EnabledOrDisabledLore, SpigotPrison.format("&a" + "Full_Inv_Play_Sound Enabled")); + messages.getString("Lore.FullSoundEnabled"), + messages.getString("Lore.ShiftAndRightClickToDisable")); + playSound = createButton(XMaterial.LIME_STAINED_GLASS_PANE.parseItem(), EnabledOrDisabledLore, SpigotPrison.format("&a" + "Full_Inv_Play_Sound Enabled")); } else { List EnabledOrDisabledLore = createLore( - guiConfig.getString("Gui.Lore.FullSoundDisabled"), - guiConfig.getString("Gui.Lore.RightClickToEnable")); - playSound = createButton(Material.REDSTONE_BLOCK, 1, EnabledOrDisabledLore, SpigotPrison.format("&c" + "Full_Inv_Play_Sound Disabled")); + messages.getString("Lore.FullSoundDisabled"), + messages.getString("Lore.RightClickToEnable")); + playSound = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), EnabledOrDisabledLore, SpigotPrison.format("&c" + "Full_Inv_Play_Sound Disabled")); } if ( afConfig.isFeatureBoolean( AutoFeatures.hologramIfInventoryIsFull ) ){ List EnabledOrDisabledLore = createLore( - guiConfig.getString("Gui.Lore.FullHologramEnabled"), - guiConfig.getString("Gui.Lore.ShiftAndRightClickToDisable")); - hologram = createButton(Material.EMERALD_BLOCK, 1, EnabledOrDisabledLore, SpigotPrison.format("&a" + "Full_Inv_Hologram Enabled")); + messages.getString("Lore.FullHologramEnabled"), + messages.getString("Lore.ShiftAndRightClickToDisable")); + hologram = createButton(XMaterial.LIME_STAINED_GLASS_PANE.parseItem(), EnabledOrDisabledLore, SpigotPrison.format("&a" + "Full_Inv_Hologram Enabled")); } else { List EnabledOrDisabledLore = createLore( - guiConfig.getString("Gui.Lore.FullHologramDisabled"), - guiConfig.getString("Gui.Lore.RightClickToEnable")); - hologram = createButton(Material.REDSTONE_BLOCK, 1, EnabledOrDisabledLore, SpigotPrison.format("&c" + "Full_Inv_Hologram Disabled")); + messages.getString("Lore.FullHologramDisabled"), + messages.getString("Lore.RightClickToEnable")); + hologram = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), EnabledOrDisabledLore, SpigotPrison.format("&c" + "Full_Inv_Hologram Disabled")); } if ( afConfig.isFeatureBoolean( AutoFeatures.isAutoManagerEnabled ) ){ List EnabledOrDisabledLore = createLore( - guiConfig.getString("Gui.Lore.EnabledAll"), - guiConfig.getString("Gui.Lore.ShiftAndRightClickToDisable")); - enabledOrDisabled = createButton(Material.EMERALD_BLOCK, 1, EnabledOrDisabledLore, SpigotPrison.format("&a" + "All Enabled")); + messages.getString("Lore.EnabledAll"), + messages.getString("Lore.ShiftAndRightClickToDisable")); + enabledOrDisabled = createButton(XMaterial.LIME_STAINED_GLASS_PANE.parseItem(), EnabledOrDisabledLore, SpigotPrison.format("&a" + "All Enabled")); } else { List EnabledOrDisabledLore = createLore( - guiConfig.getString("Gui.Lore.DisabledAll"), - guiConfig.getString("Gui.Lore.RightClickToEnable")); - enabledOrDisabled = createButton(Material.REDSTONE_BLOCK, 1, EnabledOrDisabledLore, SpigotPrison.format("&c" + "All Disabled")); + messages.getString("Lore.DisabledAll"), + messages.getString("Lore.RightClickToEnable")); + enabledOrDisabled = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), EnabledOrDisabledLore, SpigotPrison.format("&c" + "All Disabled")); } if ( afConfig.isFeatureBoolean( AutoFeatures.autoPickupEnabled ) ) { // Lore of the button List autoPickupLore = createLore( - guiConfig.getString("Gui.Lore.AutoPickupGuiManager"), - guiConfig.getString("Gui.Lore.ShiftAndRightClickToDisable"), - guiConfig.getString("Gui.Lore.LeftClickToOpen")); - autoPickup = createButton(Material.EMERALD_BLOCK, 1, autoPickupLore, SpigotPrison.format("&3" + "AutoPickup Enabled")); + messages.getString("Lore.AutoPickupGuiManager"), + messages.getString("Lore.ShiftAndRightClickToDisable"), + messages.getString("Lore.LeftClickToOpen")); + autoPickup = createButton(XMaterial.LIME_STAINED_GLASS_PANE.parseItem(), autoPickupLore, SpigotPrison.format("&3" + "AutoPickup Enabled")); } else { // Lore of the button List autoPickupLore = createLore( - guiConfig.getString("Gui.Lore.AutoPickupGuiManager"), - guiConfig.getString("Gui.Lore.RightClickToEnable"), - guiConfig.getString("Gui.Lore.LeftClickToOpen")); - autoPickup = createButton(Material.REDSTONE_BLOCK, 1, autoPickupLore, SpigotPrison.format("&c" + "AutoPickup Disabled")); + messages.getString("Lore.AutoPickupGuiManager"), + messages.getString("Lore.RightClickToEnable"), + messages.getString("Lore.LeftClickToOpen")); + autoPickup = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), autoPickupLore, SpigotPrison.format("&c" + "AutoPickup Disabled")); } if ( afConfig.isFeatureBoolean( AutoFeatures.autoSmeltEnabled ) ) { // Lore of the button List autoSmeltLore = createLore( - guiConfig.getString("Gui.Lore.AutoSmeltGuiManager"), - guiConfig.getString("Gui.Lore.ShiftAndRightClickToDisable"), - guiConfig.getString("Gui.Lore.LeftClickToOpen")); - autoSmelt = createButton(Material.EMERALD_BLOCK, 1, autoSmeltLore, SpigotPrison.format("&3" + "AutoSmelt Enabled")); + messages.getString("Lore.AutoSmeltGuiManager"), + messages.getString("Lore.ShiftAndRightClickToDisable"), + messages.getString("Lore.LeftClickToOpen")); + autoSmelt = createButton(XMaterial.LIME_STAINED_GLASS_PANE.parseItem(), autoSmeltLore, SpigotPrison.format("&3" + "AutoSmelt Enabled")); } else { // Lore of the button List autoSmeltLore = createLore( - guiConfig.getString("Gui.Lore.AutoSmeltGuiManager"), - guiConfig.getString("Gui.Lore.RightClickToEnable"), - guiConfig.getString("Gui.Lore.LeftClickToOpen")); - autoSmelt = createButton(Material.REDSTONE_BLOCK, 1, autoSmeltLore, SpigotPrison.format("&c" + "AutoSmelt Disabled")); + messages.getString("Lore.AutoSmeltGuiManager"), + messages.getString("Lore.RightClickToEnable"), + messages.getString("Lore.LeftClickToOpen")); + autoSmelt = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), autoSmeltLore, SpigotPrison.format("&c" + "AutoSmelt Disabled")); } if ( afConfig.isFeatureBoolean( AutoFeatures.autoBlockEnabled ) ) { // Lore of the button List autoBlockLore = createLore( - guiConfig.getString("Gui.Lore.AutoBlockGuiManager"), - guiConfig.getString("Gui.Lore.ShiftAndRightClickToDisable"), - guiConfig.getString("Gui.Lore.LeftClickToOpen")); - autoBlock = createButton(Material.EMERALD_BLOCK, 1, autoBlockLore, SpigotPrison.format("&3" + "AutoBlock Enabled")); + messages.getString("Lore.AutoBlockGuiManager"), + messages.getString("Lore.ShiftAndRightClickToDisable"), + messages.getString("Lore.LeftClickToOpen")); + autoBlock = createButton(XMaterial.LIME_STAINED_GLASS_PANE.parseItem(), autoBlockLore, SpigotPrison.format("&3" + "AutoBlock Enabled")); } else { // Lore of the button List autoBlockLore = createLore( - guiConfig.getString("Gui.Lore.AutoBlockGuiManager"), - guiConfig.getString("Gui.Lore.RightClickToEnable"), - guiConfig.getString("Gui.Lore.LeftClickToOpen")); - autoBlock = createButton(Material.REDSTONE_BLOCK, 1, autoBlockLore, SpigotPrison.format("&c" + "AutoBlock Disabled")); + messages.getString("Lore.AutoBlockGuiManager"), + messages.getString("Lore.RightClickToEnable"), + messages.getString("Lore.LeftClickToOpen")); + autoBlock = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), autoBlockLore, SpigotPrison.format("&c" + "AutoBlock Disabled")); } - //Position of the button - inv.setItem(2, playSound); - - //Position of the button - inv.setItem(6, hologram); - - //Position of the button - inv.setItem(10, autoPickup); - - //Position of the button - inv.setItem(13, autoSmelt); - - //Position of the button - inv.setItem(16, autoBlock); - - //Position of the button - inv.setItem(19, enabledOrDisabled); - - //Position of the button - inv.setItem(22, enabledOrDisabled); - - //Position of the button - inv.setItem(25, enabledOrDisabled); + // Position of the button + inv.setItem(11, playSound); + inv.setItem(15, hologram); + inv.setItem(28, autoPickup); + inv.setItem(31, autoSmelt); + inv.setItem(34, autoBlock); + inv.setItem(37, enabledOrDisabled); + inv.setItem(40, enabledOrDisabled); + inv.setItem(43, enabledOrDisabled); + inv.setItem(53, closeGUI); } - - } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoPickupGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoPickupGUI.java index ad07e8aff..090c6882c 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoPickupGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoPickupGUI.java @@ -1,5 +1,6 @@ package tech.mcprison.prison.spigot.gui.autofeatures; +import com.cryptomorin.xseries.XMaterial; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.configuration.Configuration; @@ -21,6 +22,8 @@ public class SpigotAutoPickupGUI extends SpigotGUIComponents { private final Player p; + private final Configuration messages = messages(); + private final AutoFeaturesFileConfig afConfig = AutoFeaturesFileConfig(); public SpigotAutoPickupGUI(Player p){ this.p = p; @@ -29,24 +32,17 @@ public SpigotAutoPickupGUI(Player p){ public void open() { // Create the inventory and set up the owner, dimensions or number of slots, and title - int dimension = 27; + int dimension = 36; Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3AutoFeatures -> AutoPickup")); - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); + if (guiBuilder(inv)) return; - // Config - AutoFeaturesFileConfig afConfig = SpigotPrison.getInstance().getAutoFeatures().getAutoFeaturesConfig(); - - if (guiBuilder(inv, GuiConfig, afConfig)) return; - - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Inventory inv, Configuration guiConfig, AutoFeaturesFileConfig afConfig) { + private boolean guiBuilder(Inventory inv) { try { - buttonsSetup(inv, guiConfig, afConfig); + buttonsSetup(inv); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -55,21 +51,29 @@ private boolean guiBuilder(Inventory inv, Configuration guiConfig, AutoFeaturesF return false; } - private void buttonsSetup(Inventory inv, Configuration guiConfig, AutoFeaturesFileConfig afConfig) { + private void buttonsSetup(Inventory inv) { + List enabledLore = createLore( - guiConfig.getString("Gui.Lore.ShiftAndRightClickToDisable") + messages.getString("Lore.ShiftAndRightClickToDisable") ); List disabledLore = createLore( - guiConfig.getString("Gui.Lore.RightClickToEnable") + messages.getString("Lore.RightClickToEnable") ); + List closeGUILore = createLore( + messages.getString("Lore.ClickToClose") + ); + + ItemStack closeGUI = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), closeGUILore, SpigotPrison.format("&c" + "Close")); + inv.setItem(35, closeGUI); + if ( afConfig.isFeatureBoolean( AutoFeatures.autoPickupAllBlocks ) ) { - ItemStack Enabled = createButton(Material.EMERALD_BLOCK, 1, enabledLore, SpigotPrison.format("&a" + "All_Blocks Enabled")); + ItemStack Enabled = createButton(XMaterial.LIME_STAINED_GLASS_PANE.parseItem(), enabledLore, SpigotPrison.format("&a" + "All_Blocks Enabled")); inv.addItem(Enabled); } else { - ItemStack Disabled = createButton(Material.REDSTONE_BLOCK, 1, disabledLore, SpigotPrison.format("&c" + "All_Blocks Disabled")); + ItemStack Disabled = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), disabledLore, SpigotPrison.format("&c" + "All_Blocks Disabled")); inv.addItem(Disabled); } @@ -177,5 +181,4 @@ private void buttonsSetup(Inventory inv, Configuration guiConfig, AutoFeaturesFi inv.addItem(Disabled); } } - } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoSmeltGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoSmeltGUI.java index 86970674e..e48e937c5 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoSmeltGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/autofeatures/SpigotAutoSmeltGUI.java @@ -1,5 +1,6 @@ package tech.mcprison.prison.spigot.gui.autofeatures; +import com.cryptomorin.xseries.XMaterial; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.configuration.Configuration; @@ -21,6 +22,8 @@ public class SpigotAutoSmeltGUI extends SpigotGUIComponents { private final Player p; + private final AutoFeaturesFileConfig afConfig = AutoFeaturesFileConfig(); + private final Configuration messages = messages(); public SpigotAutoSmeltGUI(Player p){ this.p = p; @@ -29,24 +32,17 @@ public SpigotAutoSmeltGUI(Player p){ public void open() { // Create the inventory and set up the owner, dimensions or number of slots, and title - int dimension = 27; + int dimension = 36; Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3AutoFeatures -> AutoSmelt")); - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); + if (guiBuilder(inv)) return; - // Config - AutoFeaturesFileConfig afConfig = SpigotPrison.getInstance().getAutoFeatures().getAutoFeaturesConfig(); - - if (guiBuilder(inv, GuiConfig, afConfig)) return; - - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Inventory inv, Configuration guiConfig, AutoFeaturesFileConfig afConfig) { + private boolean guiBuilder(Inventory inv) { try { - buttonsSetup(inv, guiConfig, afConfig); + buttonsSetup(inv); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -55,20 +51,26 @@ private boolean guiBuilder(Inventory inv, Configuration guiConfig, AutoFeaturesF return false; } - private void buttonsSetup(Inventory inv, Configuration guiConfig, AutoFeaturesFileConfig afConfig) { + private void buttonsSetup(Inventory inv) { + List enabledLore = createLore( - guiConfig.getString("Gui.Lore.ShiftAndRightClickToDisable") + messages.getString("Lore.ShiftAndRightClickToDisable") ); - List disabledLore = createLore( - guiConfig.getString("Gui.Lore.RightClickToEnable") + messages.getString("Lore.RightClickToEnable") ); + List closeGUILore = createLore( + messages.getString("Lore.ClickToClose") + ); + + ItemStack closeGUI = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), closeGUILore, SpigotPrison.format("&c" + "Close")); + inv.setItem(35, closeGUI); if ( afConfig.isFeatureBoolean( AutoFeatures.autoSmeltAllBlocks ) ) { - ItemStack Enabled = createButton(Material.EMERALD_BLOCK, 1, enabledLore, SpigotPrison.format("&a" + "All_Ores Enabled")); + ItemStack Enabled = createButton(XMaterial.LIME_STAINED_GLASS_PANE.parseItem(), enabledLore, SpigotPrison.format("&a" + "All_Ores Enabled")); inv.addItem(Enabled); } else { - ItemStack Disabled = createButton(Material.REDSTONE_BLOCK, 1, disabledLore, SpigotPrison.format("&c" + "All_Ores Disabled")); + ItemStack Disabled = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), disabledLore, SpigotPrison.format("&c" + "All_Ores Disabled")); inv.addItem(Disabled); } @@ -88,5 +90,4 @@ private void buttonsSetup(Inventory inv, Configuration guiConfig, AutoFeaturesFi inv.addItem(Disabled); } } - } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotBlocksListGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotBlocksListGUI.java new file mode 100644 index 000000000..e451ca6b8 --- /dev/null +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotBlocksListGUI.java @@ -0,0 +1,121 @@ +package tech.mcprison.prison.spigot.gui.mine; + +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.configuration.Configuration; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import com.cryptomorin.xseries.XMaterial; + +import tech.mcprison.prison.Prison; +import tech.mcprison.prison.internal.block.PrisonBlock; +import tech.mcprison.prison.spigot.SpigotPrison; +import tech.mcprison.prison.spigot.SpigotUtil; +import tech.mcprison.prison.spigot.gui.ListenersPrisonManager; +import tech.mcprison.prison.spigot.gui.SpigotGUIComponents; + +public class SpigotBlocksListGUI extends SpigotGUIComponents { + + private final Player p; + private final String mineName; + private int counter; + + private final Configuration messages = messages(); + + public SpigotBlocksListGUI(Player p, String mineName, int counter){ + this.p = p; + this.mineName = mineName; + this.counter = counter; + } + + public void open(){ + + // Get the dimensions and if needed increases them + int dimension = 54; // , inventorySlot = 0, secondCounter = 0; + int pageSize = 45; + + // Create the inventory + Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3Mines -> BlocksList")); + + // Lore of block setup + List blockLoreSetup = createLore( + messages.getString("Lore.ClickToStartBlockSetup") + ); + + // This will skip all BlockTypes that are invalid for the versions of MC that the server is running: + List blockTypes = Prison.get().getPrisonBlockTypes().getBlockTypes(); + + // Only loop over the blocks that we need to show: + int i = counter; + for ( ; i < blockTypes.size() && i < counter + pageSize; i++ ) { + PrisonBlock prisonBlock = blockTypes.get( i ); + + XMaterial xMat = SpigotUtil.getXMaterial( prisonBlock ); + + if ( PrisonBlock.IGNORE.equals( prisonBlock )) { + xMat = XMaterial.BARRIER; + } + if ( xMat == null ) { + xMat = XMaterial.STONE; + } + + ItemStack button = createButton( xMat.parseItem(), blockLoreSetup, SpigotPrison.format("&a" + + prisonBlock.getBlockName().toUpperCase() + " &0" + mineName + " " + counter)); + inv.addItem(button); + } + if ( i < blockTypes.size() ) { + List nextPageLore = createLore( messages.getString("Lore.ClickToNextPage") ); + + ItemStack nextPageButton = createButton(Material.BOOK, 1, nextPageLore, "&7Next &0" + mineName + " " + (i + 1) ); + inv.setItem(53, nextPageButton); + } + if ( i >= (pageSize * 2) ) { + List priorPageLore = createLore( messages.getString("Lore.ClickToPriorPage") ); + + ItemStack priorPageButton = createButton(Material.BOOK, 1, priorPageLore, + "&7Prior &0" + mineName + " " + (i - (pageSize * 2) - 1) ); + inv.setItem(51, priorPageButton); + } + + +// for (PrisonBlock prisonBlock : blockTypes){ +// +// BlockType block = SpigotUtil.prisonBlockToBlockType( prisonBlock ); +// +// try { +// if (secondCounter >= counter) { +// Material material = ( block == BlockType.IGNORE ? +// Material.BARRIER : SpigotUtil.getXMaterial( block ).parseMaterial() ); +// if ( material == null ) { +// material = XMaterial.STONE.parseMaterial(); +// } +// ItemStack button = createButton(material, 1, blockLoreSetup, SpigotPrison.format("&a" + block.name().toUpperCase() + " " + mineName)); +// inv.addItem(button); +// } +// } catch (NullPointerException ignored){} +// +// secondCounter++; +// counter++; +// +// if (counter >= counter + 44){ +// +// List nextPageLore = createLore( +// messages.getString("Lore.ClickToNextPage") +// ); +// +// ItemStack nextPageButton = createButton(Material.BOOK, 1, nextPageLore, "Next " + mineName + " " + counter); +// inv.setItem(53, nextPageButton); +// +// } +// +// } + + // Open the inventory + openGUI(p, inv); + } +} + diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineBlockPercentageGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineBlockPercentageGUI.java index 2e51bde5d..630de9709 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineBlockPercentageGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineBlockPercentageGUI.java @@ -6,7 +6,12 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; + +import com.cryptomorin.xseries.XMaterial; + +import tech.mcprison.prison.internal.block.PrisonBlock; import tech.mcprison.prison.spigot.SpigotPrison; +import tech.mcprison.prison.spigot.SpigotUtil; import tech.mcprison.prison.spigot.gui.ListenersPrisonManager; import tech.mcprison.prison.spigot.gui.SpigotGUIComponents; @@ -21,12 +26,15 @@ public class SpigotMineBlockPercentageGUI extends SpigotGUIComponents { private final String mineName; private final Double val; private final String blockName; + private final Configuration messages = messages(); + private int counter; - public SpigotMineBlockPercentageGUI(Player p, Double val, String mineName, String blockName){ + public SpigotMineBlockPercentageGUI(Player p, Double val, String mineName, String blockName, int counter){ this.p = p; this.val = val; this.mineName = mineName; this.blockName = blockName; + this.counter = counter; } public void open() { @@ -35,19 +43,15 @@ public void open() { int dimension = 45; Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3MineInfo -> BlockPercentage")); - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - - if (guiBuilder(inv, GuiConfig)) return; + if (guiBuilder(inv)) return; // Open the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Inventory inv, Configuration guiConfig) { + private boolean guiBuilder(Inventory inv) { try { - buttonsSetup(inv, guiConfig); + buttonsSetup(inv); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -56,43 +60,33 @@ private boolean guiBuilder(Inventory inv, Configuration guiConfig) { return false; } - private void buttonsSetup(Inventory inv, Configuration guiConfig) { + private void buttonsSetup(Inventory inv) { + + // Create a new lore List changeDecreaseValueLore = createLore( - guiConfig.getString("Gui.Lore.ClickToDecrease") + messages.getString("Lore.ClickToDecrease") ); - - // Create a new lore List confirmButtonLore = createLore( - guiConfig.getString("Gui.Lore.LeftClickToConfirm"), - guiConfig.getString("Gui.Lore.Percentage") + val, - guiConfig.getString("Gui.Lore.RightClickToCancel") + messages.getString("Lore.LeftClickToConfirm"), + messages.getString("Lore.Percentage") + val, + messages.getString("Lore.RightClickToCancel") ); - - // Create a new lore List changeIncreaseValueLore = createLore( - guiConfig.getString("Gui.Lore.ClickToIncrease") + messages.getString("Lore.ClickToIncrease") ); // Decrease button - ItemStack decreaseOf1 = createButton(Material.REDSTONE_BLOCK, 1, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " - 1" )); + ItemStack decreaseOf1 = createButton(Material.REDSTONE_BLOCK, 1, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " - 1" + " &0" + counter)); inv.setItem(1, decreaseOf1); - - // Decrease button - ItemStack decreaseOf5 = createButton(Material.REDSTONE_BLOCK, 5, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " - 5")); + ItemStack decreaseOf5 = createButton(Material.REDSTONE_BLOCK, 5, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " - 5" + " &0" + counter)); inv.setItem(10, decreaseOf5); - - // Decrease button - ItemStack decreaseOf10 = createButton(Material.REDSTONE_BLOCK, 10, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " - 10")); + ItemStack decreaseOf10 = createButton(Material.REDSTONE_BLOCK, 10, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " - 10" + " &0" + counter)); inv.setItem(19, decreaseOf10); - - // Decrease button - ItemStack decreaseOf50 = createButton(Material.REDSTONE_BLOCK, 50, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " - 50")); + ItemStack decreaseOf50 = createButton(Material.REDSTONE_BLOCK, 50, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " - 50" + " &0" + counter)); inv.setItem(28, decreaseOf50); - - // Decrease button - ItemStack decreaseOf100 = createButton(Material.REDSTONE_BLOCK, 1, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " - 100")); + ItemStack decreaseOf100 = createButton(Material.REDSTONE_BLOCK, 1, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " - 100" + " &0" + counter)); inv.setItem(37, decreaseOf100); @@ -103,29 +97,37 @@ private void buttonsSetup(Inventory inv, Configuration guiConfig) { } if ( watch == null ) { watch = Material.matchMaterial( "clock" ); } - ItemStack confirmButton = createButton(watch, 1, confirmButtonLore, SpigotPrison.format("&3" + "Confirm: " + mineName + " " + blockName + " " + val)); + ItemStack confirmButton = createButton(watch, 1, confirmButtonLore, SpigotPrison.format("&3" + "Confirm: " + mineName + " " + blockName + " " + val + " &0" + counter)); inv.setItem(22, confirmButton); // Increase button - ItemStack increseOf1 = createButton(Material.EMERALD_BLOCK, 1, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " + 1" )); + ItemStack increseOf1 = createButton(Material.EMERALD_BLOCK, 1, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " + 1" + " &0" + counter )); inv.setItem(7, increseOf1); - - // Increase button - ItemStack increaseOf5 = createButton(Material.EMERALD_BLOCK, 5, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " + 5")); + ItemStack increaseOf5 = createButton(Material.EMERALD_BLOCK, 5, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " + 5" + " &0" + counter)); inv.setItem(16, increaseOf5); - - // Increase button - ItemStack increaseOf10 = createButton(Material.EMERALD_BLOCK, 10, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " + 10")); + ItemStack increaseOf10 = createButton(Material.EMERALD_BLOCK, 10, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " + 10" + " &0" + counter)); inv.setItem(25, increaseOf10); - - // Increase button - ItemStack increaseOf50 = createButton(Material.EMERALD_BLOCK, 50, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " + 50")); + ItemStack increaseOf50 = createButton(Material.EMERALD_BLOCK, 50, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " + 50" + " &0" + counter)); inv.setItem(34, increaseOf50); - - // Increase button - ItemStack increaseOf100 = createButton(Material.EMERALD_BLOCK, 1, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " + 100")); + ItemStack increaseOf100 = createButton(Material.EMERALD_BLOCK, 1, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + blockName + " " + val + " + 100" + " &0" + counter)); inv.setItem(43, increaseOf100); + + // Return to prior screen: + List closeGUILore = createLore( messages.getString("Lore.ClickToClose") ); + ItemStack closeGUI = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), closeGUILore, SpigotPrison.format("&c" + "Close" + " &0" + mineName + " " + counter)); + inv.setItem(40, closeGUI); + + + // Show the selected block at the top center position: + XMaterial xMat = SpigotUtil.getXMaterial( blockName ); + if ( PrisonBlock.IGNORE.getBlockName().equalsIgnoreCase( blockName )) { + xMat = XMaterial.BARRIER; + } + if ( xMat == null ) { + xMat = XMaterial.STONE; + } + inv.setItem(4, xMat.parseItem()); + } - } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineInfoGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineInfoGUI.java index b47837d73..a11b559f7 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineInfoGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineInfoGUI.java @@ -2,6 +2,7 @@ import java.util.List; +import com.cryptomorin.xseries.XMaterial; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.configuration.Configuration; @@ -22,6 +23,7 @@ public class SpigotMineInfoGUI extends SpigotGUIComponents { private final Player p; private final Mine mine; private final String mineName; + private final Configuration messages = messages(); public SpigotMineInfoGUI(Player p, Mine mine, String mineName){ this.p = p; @@ -34,19 +36,15 @@ public void open(){ int dimension = 45; Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3Mines -> MineInfo")); - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - - if (guiBuilder(inv, GuiConfig)) return; + if (guiBuilder(inv)) return; // Opens the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Inventory inv, Configuration guiConfig) { + private boolean guiBuilder(Inventory inv) { try { - buttonsSetup(inv, guiConfig); + buttonsSetup(inv); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -55,58 +53,54 @@ private boolean guiBuilder(Inventory inv, Configuration guiConfig) { return false; } - private void buttonsSetup(Inventory inv, Configuration guiConfig) { + private void buttonsSetup(Inventory inv) { + + // The Reset Mine button and lore - List resetminelore = createLore( - guiConfig.getString("Gui.Lore.LeftClickToReset"), + List resetMineLore = createLore( + messages.getString("Lore.LeftClickToReset"), "", - guiConfig.getString("Gui.Lore.RightClickToToggle"), - guiConfig.getString("Gui.Lore.SkipReset1"), - guiConfig.getString("Gui.Lore.SkipReset2"), - guiConfig.getString("Gui.Lore.SkipReset3"), + messages.getString("Lore.RightClickToToggle"), + messages.getString("Lore.SkipReset1"), + messages.getString("Lore.SkipReset2"), + messages.getString("Lore.SkipReset3"), "", - guiConfig.getString("Gui.Lore.ShiftAndRightClickToToggle"), - guiConfig.getString("Gui.Message.ZeroBlocksReset1"), - guiConfig.getString("Gui.Message.ZeroBlocksReset2"), - guiConfig.getString("Gui.Message.ZeroBlocksReset3") + messages.getString("Lore.ShiftAndRightClickToToggle"), + messages.getString("Message.ZeroBlocksReset1"), + messages.getString("Message.ZeroBlocksReset2"), + messages.getString("Message.ZeroBlocksReset3") ); - - // Set the Mine spawn at your location - List MineSpawnlore = createLore( - guiConfig.getString("Gui.Lore.ClickToUse"), - guiConfig.getString("Gui.Lore.SpawnPoint2") + List MineSpawnLore = createLore( + messages.getString("Lore.ClickToUse"), + messages.getString("Lore.SpawnPoint2") ); - - // Lore and button List MinesNotificationsLore = createLore( - guiConfig.getString("Gui.Lore.ClickToOpen"), - guiConfig.getString("Gui.Lore.Notifications") + messages.getString("Lore.ClickToOpen"), + messages.getString("Lore.Notifications") ); - - // Lore and button List MinesTpLore = createLore( - guiConfig.getString("Gui.Lore.ClickToTeleport"), - guiConfig.getString("Gui.Lore.Tp") + messages.getString("Lore.ClickToTeleport"), + messages.getString("Lore.Tp") ); - - // Blocks of the mine button and lore - List blocksoftheminelore = createLore( - guiConfig.getString("Gui.Lore.ClickToOpen"), - guiConfig.getString("Gui.Lore.Blocks2")); - - // Blocks of the mine button and lore + List blocksOfTheMineLore = createLore( + messages.getString("Lore.ClickToOpen"), + messages.getString("Lore.Blocks2")); List mineResetTimeLore = createLore( - guiConfig.getString("Gui.Lore.ClickToOpen"), - guiConfig.getString("Gui.Lore.ManageResetTime"), - guiConfig.getString("Gui.Lore.ResetTime") + mine.getResetTime()); - - // Create the button, set up the material, amount, lore and name - ItemStack resetmine = createButton(Material.EMERALD_BLOCK, 1, resetminelore, SpigotPrison.format("&3" + "Reset_Mine: " + mineName)); - - // Create the button - ItemStack MineSpawn = createButton(Material.COMPASS, 1, MineSpawnlore, SpigotPrison.format("&3" + "Mine_Spawn: " + mineName)); + messages.getString("Lore.ClickToOpen"), + messages.getString("Lore.ManageResetTime"), + messages.getString("Lore.ResetTime") + mine.getResetTime()); + List mineRenameLore = createLore( + messages.getString("Lore.ClickToRename"), + messages.getString("Lore.MineName") + mineName + ); + List closeGUILore = createLore( + messages.getString("Lore.ClickToClose") + ); - // Create the button + // Create the button, set the material, amount, lore and name + ItemStack closeGUI = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), closeGUILore, SpigotPrison.format("&c" + "Close")); + ItemStack resetMine = createButton(Material.EMERALD_BLOCK, 1, resetMineLore, SpigotPrison.format("&3" + "Reset_Mine: " + mineName)); + ItemStack MineSpawn = createButton(Material.COMPASS, 1, MineSpawnLore, SpigotPrison.format("&3" + "Mine_Spawn: " + mineName)); ItemStack MinesNotifications = createButton(Material.SIGN, 1, MinesNotificationsLore, SpigotPrison.format("&3" + "Mine_notifications: " + mineName)); // Create the button @@ -117,7 +111,7 @@ private void buttonsSetup(Inventory inv, Configuration guiConfig) { ItemStack MinesTP = createButton(bed, 1, MinesTpLore, SpigotPrison.format("&3" + "TP_to_the_Mine: " + mineName)); // Create the button, set up the material, amount, lore and name - ItemStack blocksofthemine = createButton(Material.COAL_ORE, 1, blocksoftheminelore, SpigotPrison.format("&3" + "Blocks_of_the_Mine: " + mineName)); + ItemStack blocksOfTheMine = createButton(Material.COAL_ORE, 1, blocksOfTheMineLore, SpigotPrison.format("&3" + "Blocks_of_the_Mine: " + mineName)); // Create the button, set up the material, amount, lore and name Material watch = Material.matchMaterial( "watch" ); @@ -128,23 +122,17 @@ private void buttonsSetup(Inventory inv, Configuration guiConfig) { } ItemStack mineResetTime = createButton(watch, 1, mineResetTimeLore, SpigotPrison.format("&3" + "Reset_Time: " + mineName)); - // Position of the button - inv.setItem(10, resetmine); - - // Position of the button - inv.setItem(13, MineSpawn); - - // Position of the button - inv.setItem(16, MinesNotifications); - - // Position of the button - inv.setItem(28, MinesTP); - - // Position of the button - inv.setItem(31, blocksofthemine); + ItemStack mineRename = createButton(Material.FEATHER, 1, mineRenameLore, SpigotPrison.format("&3" + "Mine_Name: " + mineName)); // Position of the button - inv.setItem(34, mineResetTime); + inv.setItem(10, resetMine); + inv.setItem(12, MineSpawn); + inv.setItem(14, MinesNotifications); + inv.setItem(16, MinesTP); + inv.setItem(29, blocksOfTheMine); + inv.setItem(31, mineResetTime); + inv.setItem(33, mineRename); + inv.setItem(44, closeGUI); } } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineNotificationRadiusGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineNotificationRadiusGUI.java index fa0b375b9..159cb09d1 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineNotificationRadiusGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineNotificationRadiusGUI.java @@ -21,6 +21,7 @@ public class SpigotMineNotificationRadiusGUI extends SpigotGUIComponents { private final String mineName; private final long val; private final String typeNotification; + private final Configuration messages = messages(); public SpigotMineNotificationRadiusGUI(Player p, Long val, String typeNotification, String mineName){ this.p = p; @@ -35,19 +36,15 @@ public void open() { int dimension = 45; Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3MineNotifications -> Radius")); - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - - if (guiBuilder(inv, GuiConfig)) return; + if (guiBuilder(inv)) return; // Open the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Inventory inv, Configuration guiConfig) { + private boolean guiBuilder(Inventory inv) { try { - buttonsSetup(inv, guiConfig); + buttonsSetup(inv); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -56,41 +53,31 @@ private boolean guiBuilder(Inventory inv, Configuration guiConfig) { return false; } - private void buttonsSetup(Inventory inv, Configuration guiConfig) { + private void buttonsSetup(Inventory inv) { + + // Create new lore List changeDecreaseValueLore = createLore( - guiConfig.getString("Gui.Lore.ClickToDecrease") + messages.getString("Lore.ClickToDecrease") ); - - // Create a new lore List confirmButtonLore = createLore( - guiConfig.getString("Gui.Lore.LeftClickToConfirm"), - guiConfig.getString("Gui.Lore.Radius") + val, - guiConfig.getString("Gui.Lore.RightClickToCancel") + messages.getString("Lore.LeftClickToConfirm"), + messages.getString("Lore.Radius") + val, + messages.getString("Lore.RightClickToCancel") ); - - // Create a new lore List changeIncreaseValueLore = createLore( - guiConfig.getString("Gui.Lore.ClickToIncrease") + messages.getString("Lore.ClickToIncrease") ); // Decrease buttons ItemStack decreaseOf1 = createButton(Material.REDSTONE_BLOCK, 1, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " - 1 " + typeNotification )); inv.setItem(1, decreaseOf1); - - // Decrease buttons ItemStack decreaseOf5 = createButton(Material.REDSTONE_BLOCK, 5, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " - 5 " + typeNotification)); inv.setItem(10, decreaseOf5); - - // Decrease buttons ItemStack decreaseOf10 = createButton(Material.REDSTONE_BLOCK, 10, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " - 10 " + typeNotification)); inv.setItem(19, decreaseOf10); - - // Decrease buttons ItemStack decreaseOf50 = createButton(Material.REDSTONE_BLOCK, 50, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " - 50 " + typeNotification)); inv.setItem(28, decreaseOf50); - - // Decrease buttons ItemStack decreaseOf100 = createButton(Material.REDSTONE_BLOCK, 1, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " - 100 " + typeNotification)); inv.setItem(37, decreaseOf100); @@ -109,20 +96,12 @@ private void buttonsSetup(Inventory inv, Configuration guiConfig) { // Increase buttons ItemStack increseOf1 = createButton(Material.EMERALD_BLOCK, 1, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " + 1 " + typeNotification)); inv.setItem(7, increseOf1); - - // Increase buttons ItemStack increaseOf5 = createButton(Material.EMERALD_BLOCK, 5, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " + 5 " + typeNotification)); inv.setItem(16, increaseOf5); - - // Increase buttons ItemStack increaseOf10 = createButton(Material.EMERALD_BLOCK, 10, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " + 10 " + typeNotification)); inv.setItem(25, increaseOf10); - - // Increase buttons ItemStack increaseOf50 = createButton(Material.EMERALD_BLOCK, 50, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " + 50 " + typeNotification)); inv.setItem(34, increaseOf50); - - // Increase buttons ItemStack increaseOf100 = createButton(Material.EMERALD_BLOCK, 1, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " + 100 " + typeNotification)); inv.setItem(43, increaseOf100); } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineNotificationsGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineNotificationsGUI.java index c915e09d7..12027bae0 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineNotificationsGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineNotificationsGUI.java @@ -1,5 +1,6 @@ package tech.mcprison.prison.spigot.gui.mine; +import com.cryptomorin.xseries.XMaterial; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.configuration.Configuration; @@ -22,6 +23,7 @@ public class SpigotMineNotificationsGUI extends SpigotGUIComponents { private final Player p; private final String mineName; + private final Configuration messages = messages(); public SpigotMineNotificationsGUI(Player p, String mineName){ this.p = p; @@ -34,24 +36,20 @@ public void open() { int dimension = 27; Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3MineInfo -> MineNotifications")); - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - // Init variables PrisonMines pMines = PrisonMines.getInstance(); Mine m = pMines.getMine(mineName); String enabledOrDisabled = m.getNotificationMode().name(); - if (guiBuilder(inv, GuiConfig, enabledOrDisabled)) return; + if (guiBuilder(inv, enabledOrDisabled)) return; // Opens the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Inventory inv, Configuration guiConfig, String enabledOrDisabled) { + private boolean guiBuilder(Inventory inv, String enabledOrDisabled) { try { - buttonsSetup(inv, guiConfig, enabledOrDisabled); + buttonsSetup(inv, enabledOrDisabled); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -60,37 +58,41 @@ private boolean guiBuilder(Inventory inv, Configuration guiConfig, String enable return false; } - private void buttonsSetup(Inventory inv, Configuration guiConfig, String enabledOrDisabled) { - // Create a new lore - List modeWithinLore = createLore( - guiConfig.getString("Gui.Lore.ClickToChoose"), - guiConfig.getString("Gui.Lore.ActivateWithinMode")); + private void buttonsSetup(Inventory inv, String enabledOrDisabled) { - // Create a new lore - List modeRadiusLore = createLore( - guiConfig.getString("Gui.Lore.ClickToChoose"), - guiConfig.getString("Gui.Lore.ActivateRadiusMode")); // Create a new lore + List modeWithinLore = createLore( + messages.getString("Lore.ClickToChoose"), + messages.getString("Lore.ActivateWithinMode")); + List modeRadiusLore = createLore( + messages.getString("Lore.ClickToChoose"), + messages.getString("Lore.ActivateRadiusMode")); List disabledModeLore = createLore( - guiConfig.getString("Gui.Lore.ClickToChoose"), - guiConfig.getString("Gui.Lore.DisableNotifications")); + messages.getString("Lore.ClickToChoose"), + messages.getString("Lore.DisableNotifications")); + List closeGUILore = createLore( + messages.getString("Lore.ClickToClose") + ); + + ItemStack closeGUI = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), closeGUILore, SpigotPrison.format("&c" + "Close")); + inv.setItem(26, closeGUI); // Add the selected lore to the mode used if (enabledOrDisabled.equalsIgnoreCase("disabled")){ // Add the selected lore - disabledModeLore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.Selected"))); + disabledModeLore.add(SpigotPrison.format(messages.getString("Lore.Selected"))); } else if (enabledOrDisabled.equalsIgnoreCase("within")){ // Add the selected lore - modeWithinLore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.Selected"))); + modeWithinLore.add(SpigotPrison.format(messages.getString("Lore.Selected"))); } else if (enabledOrDisabled.equalsIgnoreCase("radius")){ // Add the selected lore - modeRadiusLore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.Selected"))); + modeRadiusLore.add(SpigotPrison.format(messages.getString("Lore.Selected"))); } @@ -112,11 +114,8 @@ private void buttonsSetup(Inventory inv, Configuration guiConfig, String enabled // Add a button to the inventory inv.setItem( 11, modeWithin); - - // Add a button to the inventory inv.setItem(13, radiusMode); - - // Add a button to the inventory + // Add an enchantment effect to the button disabledMode.addUnsafeEnchantment(Enchantment.LUCK, 1); inv.setItem(15, disabledMode); @@ -126,11 +125,7 @@ private void buttonsSetup(Inventory inv, Configuration guiConfig, String enabled // Add a button to the inventory modeWithin.addUnsafeEnchantment(Enchantment.LUCK, 1); inv.setItem(11, modeWithin); - - // Add a button to the inventory inv.setItem(13, radiusMode); - - // Add a button to the inventory inv.setItem(15, disabledMode); // Check which buttons should be added, based on the mode already in use of the Mine Notifications @@ -138,12 +133,8 @@ private void buttonsSetup(Inventory inv, Configuration guiConfig, String enabled // Add a button to the inventory inv.setItem( 11, modeWithin); - - // Add a button to the inventory radiusMode.addUnsafeEnchantment(Enchantment.LUCK, 1); inv.setItem( 13, radiusMode); - - // Add a button to the inventory inv.setItem(15, disabledMode); } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineResetTimeGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineResetTimeGUI.java index 007cbc818..2f1fc94d1 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineResetTimeGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMineResetTimeGUI.java @@ -20,6 +20,7 @@ public class SpigotMineResetTimeGUI extends SpigotGUIComponents { private final Player p; private final String mineName; private final Integer val; + private final Configuration messages = messages(); public SpigotMineResetTimeGUI(Player p, Integer val, String mineName){ this.p = p; @@ -33,19 +34,15 @@ public void open() { int dimension = 45; Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3MineInfo -> ResetTime")); - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - - if (guiBuilder(inv, GuiConfig)) return; + if (guiBuilder(inv)) return; // Open the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Inventory inv, Configuration guiConfig) { + private boolean guiBuilder(Inventory inv) { try { - buttonsSetup(inv, guiConfig); + buttonsSetup(inv); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -54,46 +51,34 @@ private boolean guiBuilder(Inventory inv, Configuration guiConfig) { return false; } - private void buttonsSetup(Inventory inv, Configuration guiConfig) { + private void buttonsSetup(Inventory inv) { + + // Create a new lore List changeDecreaseValueLore = createLore( - guiConfig.getString("Gui.Lore.ClickToDecrease") + messages.getString("Lore.ClickToDecrease") ); - - // Create a new lore List confirmButtonLore = createLore( - guiConfig.getString("Gui.Lore.LeftClickToConfirm"), - guiConfig.getString("Gui.Lore.Time") + val, - guiConfig.getString("Gui.Lore.RightClickToCancel") + messages.getString("Lore.LeftClickToConfirm"), + messages.getString("Lore.Time") + val, + messages.getString("Lore.RightClickToCancel") ); - - // Create a new lore List changeIncreaseValueLore = createLore( - guiConfig.getString("Gui.Lore.ClickToIncrease") + messages.getString("Lore.ClickToIncrease") ); - // Decrease button ItemStack decreaseOf1 = createButton(Material.REDSTONE_BLOCK, 1, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " - 1" )); inv.setItem(1, decreaseOf1); - - // Decrease button ItemStack decreaseOf5 = createButton(Material.REDSTONE_BLOCK, 5, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " - 5")); inv.setItem(10, decreaseOf5); - - // Decrease button ItemStack decreaseOf10 = createButton(Material.REDSTONE_BLOCK, 10, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " - 10")); inv.setItem(19, decreaseOf10); - - // Decrease button ItemStack decreaseOf50 = createButton(Material.REDSTONE_BLOCK, 50, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " - 50")); inv.setItem(28, decreaseOf50); - - // Decrease button ItemStack decreaseOf100 = createButton(Material.REDSTONE_BLOCK, 1, changeDecreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " - 100")); inv.setItem(37, decreaseOf100); - // Create a button and set the position Material watch = Material.matchMaterial( "watch" ); if ( watch == null ) { @@ -104,26 +89,16 @@ private void buttonsSetup(Inventory inv, Configuration guiConfig) { ItemStack confirmButton = createButton(watch, 1, confirmButtonLore, SpigotPrison.format("&3" + "Confirm: " + mineName + " " + val)); inv.setItem(22, confirmButton); - // Increase button ItemStack increseOf1 = createButton(Material.EMERALD_BLOCK, 1, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " + 1" )); inv.setItem(7, increseOf1); - - // Increase button ItemStack increaseOf5 = createButton(Material.EMERALD_BLOCK, 5, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " + 5")); inv.setItem(16, increaseOf5); - - // Increase button ItemStack increaseOf10 = createButton(Material.EMERALD_BLOCK, 10, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " + 10")); inv.setItem(25, increaseOf10); - - // Increase button ItemStack increaseOf50 = createButton(Material.EMERALD_BLOCK, 50, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " + 50")); inv.setItem(34, increaseOf50); - - // Increase button ItemStack increaseOf100 = createButton(Material.EMERALD_BLOCK, 1, changeIncreaseValueLore, SpigotPrison.format("&3" + mineName + " " + val + " + 100")); inv.setItem(43, increaseOf100); } - } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesBlocksGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesBlocksGUI.java index 552f6e680..b3130f525 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesBlocksGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesBlocksGUI.java @@ -2,6 +2,7 @@ import java.util.List; +import com.cryptomorin.xseries.XMaterial; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.configuration.Configuration; @@ -25,6 +26,7 @@ public class SpigotMinesBlocksGUI extends SpigotGUIComponents { private final Player p; private final String mineName; + private final Configuration messages = messages(); public SpigotMinesBlocksGUI(Player p, String mineName){ this.p = p; @@ -38,47 +40,28 @@ public void open(){ Mine m = pMines.getMine(mineName); // Get the dimensions and if needed increases them - int dimension; + int dimension = 54; boolean useNewBlockModel = Prison.get().getPlatform().getConfigBooleanFalse( "use-new-prison-block-model" ); - if ( useNewBlockModel ) { - dimension = (int) Math.ceil(m.getPrisonBlocks().size() / 9D) * 9; - } - else { - dimension = (int) Math.ceil(m.getBlocks().size() / 9D) * 9; - } - - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - - // If the inventory is empty - if (dimension == 0){ - p.sendMessage(SpigotPrison.format(GuiConfig.getString("Gui.Message.NoBlocksMine"))); - p.closeInventory(); - return; - } - - // If the dimension's too big, don't open the GUI - if (dimension > 54){ - p.sendMessage(SpigotPrison.format(GuiConfig.getString("Gui.Message.TooManyBlocks"))); - p.closeInventory(); - return; - } - // Create the inventory Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3MineInfo -> Blocks")); - if ( useNewBlockModel ) { - + List addBlockLore = createLore( + messages.getString("Lore.ClickToAddBlock") + ); + + // Add the button to the inventory + ItemStack addBlockButton = createButton(XMaterial.LIME_STAINED_GLASS_PANE.parseItem(), addBlockLore, SpigotPrison.format("&a" + "Add" + " " + mineName)); + inv.setItem(dimension - 1, addBlockButton); + + if (useNewBlockModel) { // For every block makes a button for (PrisonBlock block : m.getPrisonBlocks()) { - // Get the block material as a string + // Get the block material as a string and displayname String blockmaterial = block.getBlockName(); - - // Display title of the item String blockmaterialdisplay = blockmaterial; // Check if a block's air and changed the item of it to BARRIER @@ -87,8 +70,7 @@ public void open(){ blockmaterialdisplay = blockmaterial; } - if (guiBuilder(GuiConfig, inv, block, blockmaterial, blockmaterialdisplay)) return; - + if (guiBuilder(inv, block, blockmaterial, blockmaterialdisplay)) return; } } else { @@ -96,10 +78,8 @@ public void open(){ // For every block makes a button for (Block block : m.getBlocks()) { - // Get the block material as a string + // Get the block material as a string and displayname String blockmaterial = block.getType().name(); - - // Display title of the item String blockmaterialdisplay = blockmaterial; // Check if a block's air and changed the item of it to BARRIER @@ -108,20 +88,17 @@ public void open(){ blockmaterialdisplay = blockmaterial; } - if (guiBuilder(GuiConfig, inv, block, blockmaterial, blockmaterialdisplay)) return; - + if (guiBuilder(inv, block, blockmaterial, blockmaterialdisplay)) return; } } - // Open the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Configuration guiConfig, Inventory inv, PrisonBlock block, String blockmaterial, String blockmaterialdisplay) { + private boolean guiBuilder(Inventory inv, PrisonBlock block, String blockmaterial, String blockmaterialdisplay) { try { - buttonsSetup(guiConfig, inv, block, blockmaterial, blockmaterialdisplay); + buttonsSetup(inv, block, blockmaterial, blockmaterialdisplay); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -130,9 +107,9 @@ private boolean guiBuilder(Configuration guiConfig, Inventory inv, PrisonBlock b return false; } - private boolean guiBuilder(Configuration guiConfig, Inventory inv, Block block, String blockmaterial, String blockmaterialdisplay) { + private boolean guiBuilder(Inventory inv, Block block, String blockmaterial, String blockmaterialdisplay) { try { - buttonsSetup(guiConfig, inv, block, blockmaterial, blockmaterialdisplay); + buttonsSetup(inv, block, blockmaterial, blockmaterialdisplay); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -141,13 +118,17 @@ private boolean guiBuilder(Configuration guiConfig, Inventory inv, Block block, return false; } - private void buttonsSetup(Configuration guiConfig, Inventory inv, PrisonBlock block, String blockmaterial, String blockmaterialdisplay) { + private void buttonsSetup(Inventory inv, PrisonBlock block, String blockmaterial, String blockmaterialdisplay) { + + // Don't load this every time a button is created.... making it a class variable: + //Configuration messages = SpigotPrison.getGuiMessagesConfig(); + // Create the lore List blockslore = createLore( - guiConfig.getString("Gui.Lore.ShiftAndRightClickToDelete"), - guiConfig.getString("Gui.Lore.ClickToEditBlock"), + messages.getString("Lore.ShiftAndRightClickToDelete"), + messages.getString("Lore.ClickToEditBlock"), "", - guiConfig.getString("Gui.Lore.Info")); + messages.getString("Lore.Info")); boolean isEnum = true; @@ -162,26 +143,24 @@ private void buttonsSetup(Configuration guiConfig, Inventory inv, PrisonBlock bl } // Add a lore - blockslore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.Chance") + block.getChance() + "%")); - - // Add a lore - blockslore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.BlockType") + blockmaterial)); + blockslore.add(SpigotPrison.format(messages.getString("Lore.Chance") + block.getChance() + "%")); + blockslore.add(SpigotPrison.format(messages.getString("Lore.BlockType") + blockmaterial)); // Make the item ItemStack block1 = createButton(Material.valueOf(blockmaterial), 1, blockslore, SpigotPrison.format("&3" + blockmaterialdisplay + " " + mineName + " " + block.getChance())); - - // Add the item to the inventory inv.addItem(block1); } - private void buttonsSetup(Configuration guiConfig, Inventory inv, Block block, String blockmaterial, String blockmaterialdisplay) { - // Create the lore + private void buttonsSetup(Inventory inv, Block block, String blockmaterial, String blockmaterialdisplay) { + + //Configuration messages = SpigotPrison.getGuiMessagesConfig(); + + // Create the lore List blockslore = createLore( - guiConfig.getString("Gui.Lore.ShiftAndRightClickToDelete"), - guiConfig.getString("Gui.Lore.ClickToEditBlock"), + messages.getString("Lore.ShiftAndRightClickToDelete"), + messages.getString("Lore.ClickToEditBlock"), "", - guiConfig.getString("Gui.Lore.Info")); - + messages.getString("Lore.Info")); boolean isEnum = true; try { @@ -195,10 +174,8 @@ private void buttonsSetup(Configuration guiConfig, Inventory inv, Block block, S } // Add a lore - blockslore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.Chance") + block.getChance() + "%")); - - // Add a lore - blockslore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.BlockType") + blockmaterial)); + blockslore.add(SpigotPrison.format(messages.getString("Lore.Chance") + block.getChance() + "%")); + blockslore.add(SpigotPrison.format(messages.getString("Lore.BlockType") + blockmaterial)); // Make the item ItemStack block1 = createButton(Material.valueOf(blockmaterial), 1, blockslore, SpigotPrison.format("&3" + blockmaterialdisplay + " " + mineName + " " + block.getChance())); diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesConfirmGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesConfirmGUI.java index 2b3d0a9f1..8eddad3a9 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesConfirmGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesConfirmGUI.java @@ -19,6 +19,7 @@ public class SpigotMinesConfirmGUI extends SpigotGUIComponents { private final Player p; private final String mineName; + private final Configuration messages = messages(); public SpigotMinesConfirmGUI(Player p, String mineName) { this.p = p; @@ -31,19 +32,15 @@ public void open(){ int dimension = 9; Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3Mines -> Delete")); - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - - if (guiBuilder(inv, GuiConfig)) return; + if (guiBuilder(inv)) return; // Open the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Inventory inv, Configuration guiConfig) { + private boolean guiBuilder(Inventory inv) { try { - buttonsSetup(inv, guiConfig); + buttonsSetup(inv); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -52,26 +49,21 @@ private boolean guiBuilder(Inventory inv, Configuration guiConfig) { return false; } - private void buttonsSetup(Inventory inv, Configuration guiConfig) { - // Blocks of the mine - List confirmlore = createLore( - guiConfig.getString("Gui.Lore.ClickToConfirm")); + private void buttonsSetup(Inventory inv) { + // Blocks of the mine + List confirmlore = createLore( + messages.getString("Lore.ClickToConfirm")); List cancelore = createLore( - guiConfig.getString("Gui.Lore.ClickToCancel")); + messages.getString("Lore.ClickToCancel")); // Create the button, set up the material, amount, lore and name ItemStack confirm = createButton(Material.EMERALD_BLOCK, 1, confirmlore, SpigotPrison.format("&3" + "Confirm: " + mineName)); - - // Create the button, set up the material, amount, lore and name ItemStack cancel = createButton(Material.REDSTONE_BLOCK, 1, cancelore, SpigotPrison.format("&3" + "Cancel: " + mineName)); // Position of the button inv.setItem(2, confirm); - - // Position of the button inv.setItem(6, cancel); } - } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesGUI.java index 722ab7f89..65fad02e7 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/mine/SpigotMinesGUI.java @@ -2,7 +2,6 @@ import java.text.DecimalFormat; import java.util.List; -import java.util.Set; import org.apache.commons.lang3.StringUtils; import org.bukkit.Bukkit; @@ -14,11 +13,14 @@ import tech.mcprison.prison.Prison; import tech.mcprison.prison.internal.block.PrisonBlock; +import tech.mcprison.prison.mines.PrisonMines; import tech.mcprison.prison.mines.data.Block; import tech.mcprison.prison.mines.data.Mine; -import tech.mcprison.prison.mines.data.PrisonSortableMines; +import tech.mcprison.prison.mines.data.PrisonSortableResults; +import tech.mcprison.prison.mines.managers.MineManager.MineSortOrder; import tech.mcprison.prison.spigot.SpigotPrison; import tech.mcprison.prison.spigot.gui.ListenersPrisonManager; +import tech.mcprison.prison.spigot.gui.PrisonSetupGUI; import tech.mcprison.prison.spigot.gui.SpigotGUIComponents; /** @@ -27,6 +29,8 @@ public class SpigotMinesGUI extends SpigotGUIComponents { private final Player p; + + private final Configuration messages = messages(); public SpigotMinesGUI(Player p) { this.p = p; @@ -37,26 +41,25 @@ public void open(){ // Init the ItemStack // ItemStack itemMines; - // Get the mines - Set mines = new PrisonSortableMines().getSortedSet(); + // Get the mines - In sort order, minus any marked as suppressed + PrisonSortableResults mines = PrisonMines.getInstance().getMines( MineSortOrder.sortOrder ); +// Set mines = new PrisonSortableMines().getSortedSet(); // PrisonMines pMines = PrisonMines.getInstance(); // Get the dimensions and if needed increases them - int dimension = (int) Math.ceil(mines.size() / 9D) * 9; - - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); + int dimension = (int) Math.ceil(mines.getSortedList().size() / 9D) * 9; // If the inventory is empty if (dimension == 0){ - p.sendMessage(SpigotPrison.format(GuiConfig.getString("Gui.Message.NoMines"))); p.closeInventory(); + PrisonSetupGUI gui = new PrisonSetupGUI(p); + gui.open(); return; } // If the dimension's too big, don't open the GUI if (dimension > 54){ - p.sendMessage(SpigotPrison.format(GuiConfig.getString("Gui.Message.TooManyMines"))); + p.sendMessage(SpigotPrison.format(messages.getString("Message.TooManyMines"))); p.closeInventory(); return; } @@ -65,20 +68,17 @@ public void open(){ Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3MinesManager -> Mines")); // Make the buttons for every Mine with info - for (Mine m : mines ) { - - if (guiBuilder(GuiConfig, inv, m)) return; - + for (Mine m : mines.getSortedList() ) { + if (guiBuilder(inv, m)) return; } // Open the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Configuration guiConfig, Inventory inv, Mine m) { + private boolean guiBuilder(Inventory inv, Mine m) { try { - buttonsSetup(guiConfig, inv, m); + buttonsSetup(inv, m); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -87,33 +87,33 @@ private boolean guiBuilder(Configuration guiConfig, Inventory inv, Mine m) { return false; } - private void buttonsSetup(Configuration guiConfig, Inventory inv, Mine m) { + private void buttonsSetup(Inventory inv, Mine m) { + + // Don't load this every time a button is created.... making it a class variable: + // Configuration messages = SpigotPrison.getGuiMessagesConfig(); + ItemStack itemMines; // Init the lore array with default values for ladders List minesLore = createLore( - guiConfig.getString("Gui.Lore.LeftClickToOpen"), - guiConfig.getString("Gui.Lore.ShiftAndRightClickToDelete"), + messages.getString("Lore.LeftClickToOpen"), + messages.getString("Lore.ShiftAndRightClickToDelete"), "", - guiConfig.getString("Gui.Lore.Info")); + messages.getString("Lore.Info")); // Add a lore - minesLore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.World") + m.getWorldName())); - - // Init a variable and add it to the lore + minesLore.add(SpigotPrison.format(messages.getString("Lore.World") + m.getWorldName())); String spawnPoint = m.getSpawn() != null ? m.getSpawn().toBlockCoordinates() : "&cnot set"; - minesLore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.SpawnPoint") + spawnPoint)); - - // Add a lore - minesLore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.ResetTime") + m.getResetTime())); + minesLore.add(SpigotPrison.format(messages.getString("Lore.SpawnPoint") + spawnPoint)); + minesLore.add(SpigotPrison.format(messages.getString("Lore.ResetTime") + m.getResetTime())); - // Add a lore - minesLore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.SizeOfMine") + m.getBounds().getDimensions())); - - // Add a lore - minesLore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.Volume") + m.getBounds().getTotalBlockCount())); + if (!m.isVirtual()) { + // Add a lore + minesLore.add(SpigotPrison.format(messages.getString("Lore.SizeOfMine") + m.getBounds().getDimensions())); + minesLore.add(SpigotPrison.format(messages.getString("Lore.Volume") + m.getBounds().getTotalBlockCount())); + } // Add a lore - minesLore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.Blocks"))); + minesLore.add(SpigotPrison.format(messages.getString("Lore.Blocks"))); // Init some variables and do the actions DecimalFormat dFmt = new DecimalFormat("##0.00"); @@ -121,7 +121,7 @@ private void buttonsSetup(Configuration guiConfig, Inventory inv, Mine m) { boolean useNewBlockModel = Prison.get().getPlatform().getConfigBooleanFalse( "use-new-prison-block-model" ); - if ( useNewBlockModel ) { + if (useNewBlockModel) { for (PrisonBlock block : m.getPrisonBlocks()) { double chance = Math.round(block.getChance() * 100.0d) / 100.0d; @@ -133,17 +133,15 @@ private void buttonsSetup(Configuration guiConfig, Inventory inv, Mine m) { } } else { - + for (Block block : m.getBlocks()) { double chance = Math.round(block.getChance() * 100.0d) / 100.0d; totalChance += chance; - String blockName = StringUtils.capitalize(block.getType().name().replaceAll("_", " ").toLowerCase()); minesLore.add(SpigotPrison.format("&7" + chance + "% - " + block.getType().name() + " (" + blockName + ")")); } } - if (totalChance < 100.0d) { minesLore.add(SpigotPrison.format("&e " + dFmt.format(100.0d - totalChance) + "% - Air")); @@ -151,8 +149,6 @@ private void buttonsSetup(Configuration guiConfig, Inventory inv, Mine m) { // Create the button itemMines = createButton(Material.COAL_ORE, 1, minesLore, SpigotPrison.format("&3" + m.getName())); - - // Add the button to the inventory inv.addItem(itemMines); } 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 fe1fd0312..f40840347 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 @@ -1,7 +1,6 @@ package tech.mcprison.prison.spigot.gui.mine; import java.util.List; -import java.util.Set; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -10,15 +9,22 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; +import com.cryptomorin.xseries.XMaterial; + +import tech.mcprison.prison.mines.PrisonMines; import tech.mcprison.prison.mines.data.Mine; -import tech.mcprison.prison.mines.data.PrisonSortableMines; +import tech.mcprison.prison.mines.data.PrisonSortableResults; +import tech.mcprison.prison.mines.managers.MineManager.MineSortOrder; +import tech.mcprison.prison.output.Output; import tech.mcprison.prison.spigot.SpigotPrison; -import tech.mcprison.prison.spigot.gui.ListenersPrisonManager; +import tech.mcprison.prison.spigot.SpigotUtil; import tech.mcprison.prison.spigot.gui.SpigotGUIComponents; public class SpigotPlayerMinesGUI extends SpigotGUIComponents { private final Player p; + private final Configuration messages = messages(); + private final Configuration GuiConfig = guiConfig(); public SpigotPlayerMinesGUI(Player p) { this.p = p; @@ -29,26 +35,26 @@ public void open(){ // Init the ItemStack // ItemStack itemMines; - // Get the mines - Set mines = new PrisonSortableMines().getSortedSet(); + // Get the mines - In sort order, minus any marked as suppressed + PrisonSortableResults mines = PrisonMines.getInstance().getMines( MineSortOrder.sortOrder ); +// Set mines = new PrisonSortableMines().getSortedSet(); //PrisonMines pMines = PrisonMines.getInstance(); // Get the dimensions and if needed increases them - int dimension = (int) Math.ceil(mines.size() / 9D) * 9; + int dimension = (int) Math.ceil(mines.getSortedList().size() / 9D) * 9; // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); // If the inventory is empty if (dimension == 0){ - p.sendMessage(SpigotPrison.format(GuiConfig.getString("Gui.Message.NoMines"))); + p.sendMessage(SpigotPrison.format(messages.getString("Message.NoMines"))); p.closeInventory(); return; } // If the dimension's too big, don't open the GUI if (dimension > 54){ - p.sendMessage(SpigotPrison.format(GuiConfig.getString("Gui.Message.TooManyMines"))); + p.sendMessage(SpigotPrison.format(messages.getString("Message.TooManyMines"))); p.closeInventory(); return; } @@ -57,24 +63,22 @@ public void open(){ Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3Mines -> PlayerMines")); // Make the buttons for every Mine with info - for (Mine m : mines) { + for (Mine m : mines.getSortedList()) { // Init the lore array with default values for ladders List minesLore = createLore( ); - if (guiBuilder(GuiConfig, inv, m, minesLore)) return; - + if (guiBuilder(inv, m, minesLore)) return; } // Open the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Configuration guiConfig, Inventory inv, Mine m, List mineslore) { + private boolean guiBuilder(Inventory inv, Mine m, List minesLore) { try { - buttonsSetup(guiConfig, inv, m, mineslore); + buttonsSetup(inv, m, minesLore); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -83,25 +87,51 @@ private boolean guiBuilder(Configuration guiConfig, Inventory inv, Mine m, List< return false; } - private void buttonsSetup(Configuration guiConfig, Inventory inv, Mine m, List mineslore) { + private void buttonsSetup(Inventory inv, Mine m, List minesLore) { + + // Don't load this every time a button is created.... making it a class variable: + // Configuration messages = SpigotPrison.getGuiMessagesConfig(); + ItemStack itemMines; Material material; - String permission = SpigotPrison.format(guiConfig.getString("Options.Mines.PermissionWarpPlugin")); + String permission = SpigotPrison.format(GuiConfig.getString("Options.Mines.PermissionWarpPlugin")); + + /** + * The valid names to use for Options.Mines.MaterialType. must be + * based upon the XMaterial enumeration name, or supported past names. + */ + Material mineMaterial = null; + String materialTypeStr = GuiConfig.getString("Options.Mines.MaterialType." + m.getName()); + if ( materialTypeStr != null && materialTypeStr.trim().length() > 0 ) { + XMaterial mineXMaterial = SpigotUtil.getXMaterial( materialTypeStr ); + if ( mineXMaterial != null ) { + mineMaterial = mineXMaterial.parseMaterial(); + } + else { + Output.get().logInfo( "Warning: A block was specified for mine %s but it was " + + "unable to be mapped to an XMaterial type. Key = " + + "[Options.Mines.MaterialType.%s] value = " + + "[%s] Please use valid material names as found in the XMaterial " + + "source on git hub: " + + "https://github.com/CryptoMorin/XSeries/blob/master/src/main/java/" + + "com/cryptomorin/xseries/XMaterial.java ", + m.getName(), m.getName(), mineXMaterial ); + } + } if (p.hasPermission(permission + m.getName()) || p.hasPermission(permission.substring(0, permission.length() - 1))){ - material = Material.COAL_ORE; - mineslore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.StatusUnlockedMine"))); - mineslore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.ClickToTeleport"))); + material = ( mineMaterial == null ? Material.COAL_ORE : mineMaterial); + minesLore.add(SpigotPrison.format(messages.getString("Lore.StatusUnlockedMine"))); + minesLore.add(SpigotPrison.format(messages.getString("Lore.ClickToTeleport"))); } else { material = Material.REDSTONE_BLOCK; - mineslore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.StatusLockedMine"))); + minesLore.add(SpigotPrison.format(messages.getString("Lore.StatusLockedMine"))); } // Create the button - itemMines = createButton(material, 1, mineslore, SpigotPrison.format("&3" + m.getName())); + itemMines = createButton(material, 1, minesLore, SpigotPrison.format("&3" + m.getName())); // Add the button to the inventory inv.addItem(itemMines); } - } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotConfirmPrestigeGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotConfirmPrestigeGUI.java index bf1d9576b..a69d017b9 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotConfirmPrestigeGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotConfirmPrestigeGUI.java @@ -15,6 +15,7 @@ public class SpigotConfirmPrestigeGUI extends SpigotGUIComponents { private final Player p; + private final Configuration messages = messages(); public SpigotConfirmPrestigeGUI(Player p) { this.p = p; @@ -26,19 +27,15 @@ public void open(){ int dimension = 9; Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3Prestige -> Confirmation")); - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - - if (guiBuilder(inv, GuiConfig)) return; + if (guiBuilder(inv)) return; // Open the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Inventory inv, Configuration guiConfig) { + private boolean guiBuilder(Inventory inv) { try { - buttonsSetup(inv, guiConfig); + buttonsSetup(inv); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -47,29 +44,26 @@ private boolean guiBuilder(Inventory inv, Configuration guiConfig) { return false; } - private void buttonsSetup(Inventory inv, Configuration guiConfig) { + private void buttonsSetup(Inventory inv) { + // Blocks of the mine List confirmLore = createLore( - guiConfig.getString("Gui.Lore.ClickToConfirm"), - guiConfig.getString("Gui.Lore.PrestigeWarning"), - guiConfig.getString("Gui.Lore.PrestigeWarning2"), - guiConfig.getString("Gui.Lore.PrestigeWarning3") + messages.getString("Lore.ClickToConfirm"), + messages.getString("Lore.PrestigeWarning"), + messages.getString("Lore.PrestigeWarning2"), + messages.getString("Lore.PrestigeWarning3") ); // Blocks of the mine List cancelLore = createLore( - guiConfig.getString("Gui.Lore.ClickToCancel")); + messages.getString("Lore.ClickToCancel")); // Create the button, set up the material, amount, lore and name ItemStack confirm = createButton(Material.EMERALD_BLOCK, 1, confirmLore, SpigotPrison.format("&3" + "Confirm: Prestige")); - - // Create the button, set up the material, amount, lore and name ItemStack cancel = createButton(Material.REDSTONE_BLOCK, 1, cancelLore, SpigotPrison.format("&3" + "Cancel: Don't Prestige")); // Position of the button inv.setItem(2, confirm); - - // Position of the button inv.setItem(6, cancel); } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotLaddersGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotLaddersGUI.java index 8c55a4fd0..aadd703a1 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotLaddersGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotLaddersGUI.java @@ -22,6 +22,7 @@ public class SpigotLaddersGUI extends SpigotGUIComponents { private final Player p; + private final Configuration messages = messages(); public SpigotLaddersGUI(Player p){ this.p = p; @@ -43,19 +44,16 @@ public void open(){ // Get the dimensions and if needed increases them int dimension = (int) Math.ceil(lm.getLadders().size() / 9D) * 9; - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - // If the inventory is empty if (dimension == 0){ - p.sendMessage(SpigotPrison.format(GuiConfig.getString("Gui.Message.NoLadders"))); + p.sendMessage(SpigotPrison.format(messages.getString("Message.NoLadders"))); p.closeInventory(); return; } // If the dimension's too big, don't open the GUI if (dimension > 54){ - p.sendMessage(SpigotPrison.format(GuiConfig.getString("Gui.Message.TooManyLadders"))); + p.sendMessage(SpigotPrison.format(messages.getString("Message.TooManyLadders"))); p.closeInventory(); return; } @@ -66,18 +64,17 @@ public void open(){ // Make for every ladder a button for (RankLadder ladder : lm.getLadders()){ - if (guiBuilder(GuiConfig, inv, ladder)) return; + if (guiBuilder(inv, ladder)) return; } // Open the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Configuration guiConfig, Inventory inv, RankLadder ladder) { + private boolean guiBuilder(Inventory inv, RankLadder ladder) { try { - buttonsSetup(guiConfig, inv, ladder); + buttonsSetup(inv, ladder); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -86,12 +83,15 @@ private boolean guiBuilder(Configuration guiConfig, Inventory inv, RankLadder la return false; } - private void buttonsSetup(Configuration guiConfig, Inventory inv, RankLadder ladder) { + private void buttonsSetup(Inventory inv, RankLadder ladder) { + + //Configuration messages = SpigotPrison.getGuiMessagesConfig(); + ItemStack itemLadder; // Init the lore array with default values for ladders List laddersLore = createLore( - guiConfig.getString("Gui.Lore.ClickToOpen"), - guiConfig.getString("Gui.Lore.ShiftAndRightClickToDelete")); + messages.getString("Lore.ClickToOpen"), + messages.getString("Lore.ShiftAndRightClickToDelete")); // Create the button itemLadder = createButton(Material.LADDER, 1, laddersLore, SpigotPrison.format("&3" + ladder.name)); 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 baa4cc22e..06cbd9ba5 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 @@ -32,9 +32,10 @@ public class SpigotPlayerPrestigesGUI extends SpigotGUIComponents { private final Player player; - private PrisonRanks rankPlugin; private RankPlayer rankPlayer; + private final Configuration guiConfig = guiConfig(); + private final Configuration messages = messages(); public SpigotPlayerPrestigesGUI(Player player) { this.player = player; @@ -113,7 +114,6 @@ public void open() { } // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); LadderManager lm = getRankPlugin().getLadderManager(); Optional ladder = lm.getLadder("prestiges"); @@ -131,16 +131,15 @@ public void open() { Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3" + "Prestiges -> PlayerPrestiges")); // guiBuilder and validation - if (guiBuilder(GuiConfig, ladder, dimension, inv)) return; + if (guiBuilder(ladder, dimension, inv)) return; // Open the inventory - getPlayer().openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(getPlayer()); + openGUI(getPlayer(), inv); } - private boolean guiBuilder(Configuration guiConfig, Optional ladder, int dimension, Inventory inv) { + private boolean guiBuilder(Optional ladder, int dimension, Inventory inv) { try { - buttonsSetup(guiConfig, ladder, dimension, inv); + buttonsSetup(ladder, dimension, inv); } catch (NullPointerException ex){ getPlayer().sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -149,17 +148,18 @@ private boolean guiBuilder(Configuration guiConfig, Optional ladder, return false; } - private void buttonsSetup(Configuration guiConfig, Optional ladder, int dimension, Inventory inv) { + private void buttonsSetup(Optional ladder, int dimension, Inventory inv) { + if (!ladder.isPresent()){ - player.sendMessage(SpigotPrison.format(guiConfig.getString("Gui.Message.LadderPrestigesNotFound"))); + player.sendMessage(SpigotPrison.format(messages.getString("Message.LadderPrestigesNotFound"))); return; } RankLadder ladderData = ladder.get(); if (!ladderData.getLowestRank().isPresent()){ - player.sendMessage(SpigotPrison.format(guiConfig.getString("Gui.Message.NoRanksPrestigesLadder"))); + player.sendMessage(SpigotPrison.format(messages.getString("Message.NoRanksPrestigesLadder"))); return; } @@ -178,8 +178,8 @@ private void buttonsSetup(Configuration guiConfig, Optional ladder, while ( rank != null ) { List ranksLore = createLore( - guiConfig.getString("Gui.Lore.Info"), - guiConfig.getString("Gui.Lore.Price3") + rank.cost + messages.getString("Lore.Info"), + messages.getString("Lore.Price3") + rank.cost ); ItemStack itemrank = createButton( (playerHasThisRank ? materialHas : materialHasNot), @@ -201,8 +201,8 @@ private void buttonsSetup(Configuration guiConfig, Optional ladder, } List rankupLore = createLore( - guiConfig.getString("Gui.Lore.IfYouHaveEnoughMoney"), - guiConfig.getString("Gui.Lore.ClickToRankup") + messages.getString("Lore.IfYouHaveEnoughMoney"), + messages.getString("Lore.ClickToRankup") ); ItemStack rankupButton = createButton(Material.EMERALD_BLOCK, 1, rankupLore, SpigotPrison.format("&aPrestige")); diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerRanksGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotPlayerRanksGUI.java index 18dbafc67..06c947a7a 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 @@ -1,7 +1,6 @@ package tech.mcprison.prison.spigot.gui.rank; import java.util.List; -import java.util.Objects; import java.util.Optional; import org.bukkit.Bukkit; @@ -36,6 +35,9 @@ public class SpigotPlayerRanksGUI extends SpigotGUIComponents { private PrisonRanks rankPlugin; private RankPlayer rankPlayer; + // Load config + private final Configuration guiConfig = guiConfig(); + private final Configuration messages = messages(); public SpigotPlayerRanksGUI(Player player) { this.player = player; @@ -44,20 +46,17 @@ public SpigotPlayerRanksGUI(Player player) { // SpigotPlayer sPlayer = new SpigotPlayer(p); Server server = SpigotPrison.getInstance().getServer(); - PrisonRanks rankPlugin; RankPlayer rPlayer; - ModuleManager modMan = Prison.get().getModuleManager(); Module module = modMan == null ? null : modMan.getModule( PrisonRanks.MODULE_NAME ).orElse( null ); + rankPlugin = (PrisonRanks) module; // Check if (!(checkRanks(player))){ return; } - rankPlugin = (PrisonRanks) module; - if (rankPlugin == null){ player.sendMessage(SpigotPrison.format("&cError: rankPlugin == null")); return; @@ -69,10 +68,9 @@ public SpigotPlayerRanksGUI(Player player) { } PlayerManager playerManager = rankPlugin.getPlayerManager(); - rPlayer = playerManager.getPlayer( player.getUniqueId(), player.getName() ).orElse( null ); - Plugin plugin = server.getPluginManager().getPlugin( PrisonRanks.MODULE_NAME ); + if (plugin instanceof PrisonRanks) { rankPlugin = (PrisonRanks) plugin; Optional oPlayer = rankPlugin.getPlayerManager(). @@ -107,48 +105,43 @@ public void open() { return; } - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - LadderManager lm = getRankPlugin().getLadderManager(); - Optional ladder = lm.getLadder(GuiConfig.getString("Options.Ranks.Ladder")); + Optional ladder = lm.getLadder(guiConfig.getString("Options.Ranks.Ladder")); // Ensure ladder is present and that it has a rank: - if ( !ladder.isPresent() || !ladder.get().getLowestRank().isPresent() ){ - getPlayer().sendMessage(SpigotPrison.format(GuiConfig.getString("Gui.Message.NoRanksFoundHelp1") + GuiConfig.getString("Options.Ranks.Ladder") + GuiConfig.getString("Gui.Message.NoRanksFoundHelp2"))); + if (!ladder.isPresent() || !ladder.get().getLowestRank().isPresent()){ + getPlayer().sendMessage(SpigotPrison.format(messages.getString("Message.NoRanksFoundHelp1") + guiConfig.getString("Options.Ranks.Ladder") + messages.getString("Message.NoRanksFoundHelp2"))); getPlayer().closeInventory(); return; } // Get the dimensions and if needed increases them if (ladder.get().ranks.size() == 0) { - getPlayer().sendMessage(SpigotPrison.format(GuiConfig.getString("Gui.Message.NoRanksFound"))); + getPlayer().sendMessage(SpigotPrison.format(messages.getString("Message.NoRanksFound"))); return; } // Create the inventory and set up the owner, dimensions or number of slots, and title int dimension = (int) (Math.ceil(ladder.get().ranks.size() / 9D) * 9) + 9; - Configuration guiConfig = SpigotPrison.getGuiConfig(); - + // Create the inventory Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3" + "Ranks -> PlayerRanks")); + // Get many parameters RankLadder ladderData = ladder.get(); - Rank rank = ladderData.getLowestRank().get(); - Rank playerRank = getRankPlayer().getRank( ladderData ).orElse( null ); - if (guiBuilder(GuiConfig, dimension, guiConfig, inv, rank, playerRank)) return; + // Call the whole GUI and build it + if (guiBuilder(dimension, inv, rank, playerRank)) return; // Open the inventory - getPlayer().openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(getPlayer()); + openGUI(getPlayer(), inv); } - private boolean guiBuilder(Configuration guiConfig, int dimension, Configuration guiConfig2, Inventory inv, Rank rank, Rank playerRank) { + private boolean guiBuilder( int dimension, Inventory inv, Rank rank, Rank playerRank) { try { - buttonsSetup(guiConfig, dimension, guiConfig2, inv, rank, playerRank); + buttonsSetup(dimension, inv, rank, playerRank); } catch (NullPointerException ex){ getPlayer().sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -157,48 +150,51 @@ private boolean guiBuilder(Configuration guiConfig, int dimension, Configuration return false; } - private void buttonsSetup(Configuration guiConfig, int dimension, Configuration guiConfig2, Inventory inv, Rank rank, Rank playerRank) { + private void buttonsSetup(int dimension, Inventory inv, Rank rank, Rank playerRank) { + // Not sure how you want to represent this: - Material materialHas; - materialHas = Material.getMaterial(Objects.requireNonNull(guiConfig.getString("Options.Ranks.Item_gotten_rank"))); - Material materialHasNot = Material.getMaterial(Objects.requireNonNull(guiConfig.getString("Options.Ranks.Item_not_gotten_rank"))); + Material materialHas = Material.getMaterial(guiConfig.getString("Options.Ranks.Item_gotten_rank")); + Material materialHasNot = Material.getMaterial(guiConfig.getString("Options.Ranks.Item_not_gotten_rank")); + // Variables boolean playerHasThisRank = true; int hackyCounterEnchant = 0; - int amount = 1; + while ( rank != null ) { List ranksLore = createLore( - guiConfig2.getString("Gui.Lore.Info"), - guiConfig2.getString("Gui.Lore.Price3") + rank.cost + messages.getString("Lore.Info"), + messages.getString("Lore.Price3") + rank.cost ); + ItemStack itemRank = createButton( (playerHasThisRank ? materialHas : materialHasNot), amount++, ranksLore, SpigotPrison.format(rank.tag)); + if (playerRank != null && playerRank.equals(rank)){ playerHasThisRank = false; } + if (!(playerHasThisRank)){ if (hackyCounterEnchant <= 0) { hackyCounterEnchant++; - if (Objects.requireNonNull(guiConfig2.getString("Options.Ranks.Enchantment_effect_current_rank")).equalsIgnoreCase("true")) { + if (guiConfig.getString("Options.Ranks.Enchantment_effect_current_rank").equalsIgnoreCase("true")) { itemRank.addUnsafeEnchantment(Enchantment.LUCK, 1); } } } - inv.addItem(itemRank); + inv.addItem(itemRank); rank = rank.rankNext; } List rankupLore = createLore( - guiConfig.getString("Gui.Lore.IfYouHaveEnoughMoney"), - guiConfig.getString("Gui.Lore.ClickToRankup") + messages.getString("Lore.IfYouHaveEnoughMoney"), + messages.getString("Lore.ClickToRankup") ); - ItemStack rankupButton = createButton(Material.EMERALD_BLOCK, 1, rankupLore, SpigotPrison.format(guiConfig.getString("Gui.Lore.Rankup"))); + ItemStack rankupButton = createButton(Material.EMERALD_BLOCK, 1, rankupLore, SpigotPrison.format(messages.getString("Lore.Rankup"))); inv.setItem(dimension - 5, rankupButton); } - } \ No newline at end of file diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankManagerGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankManagerGUI.java index 27e1525c6..0fc26cefa 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankManagerGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankManagerGUI.java @@ -1,5 +1,6 @@ package tech.mcprison.prison.spigot.gui.rank; +import com.cryptomorin.xseries.XMaterial; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.configuration.Configuration; @@ -20,6 +21,7 @@ public class SpigotRankManagerGUI extends SpigotGUIComponents { private final Player p; private final Rank rank; + private final Configuration messages = messages(); public SpigotRankManagerGUI(Player p, Rank rank) { this.p = p; @@ -37,19 +39,15 @@ public void open() { int dimension = 27; Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3" + "Ranks -> RankManager")); - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - - if (guiBuilder(inv, GuiConfig)) return; + if (guiBuilder(inv)) return; // Open the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Inventory inv, Configuration guiConfig) { + private boolean guiBuilder(Inventory inv) { try { - buttonsSetup(inv, guiConfig); + buttonsSetup(inv); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -58,30 +56,30 @@ private boolean guiBuilder(Inventory inv, Configuration guiConfig) { return false; } - private void buttonsSetup(Inventory inv, Configuration guiConfig) { + private void buttonsSetup(Inventory inv) { + + // Create the lore List rankupCommandsLore = createLore( - guiConfig.getString("Gui.Lore.ClickToOpen"), + messages.getString("Lore.ClickToOpen"), "", - guiConfig.getString("Gui.Lore.Info") + messages.getString("Lore.Info") ); - SpigotRanksGUI.getCommands(rankupCommandsLore, rank); + // SpigotRanksGUI.getCommands(rankupCommandsLore, rank); // Create the lore List editPriceLore = createLore( - guiConfig.getString("Gui.Lore.ClickToOpen"), + messages.getString("Lore.ClickToOpen"), "", - guiConfig.getString("Gui.Lore.Info"), - guiConfig.getString("Gui.Lore.Price") + rank.cost + messages.getString("Lore.Info"), + messages.getString("Lore.Price") + rank.cost ); - - // Create the lore List editTagLore = createLore( - guiConfig.getString("Gui.Lore.ClickToOpen"), + messages.getString("Lore.ClickToOpen"), "", - guiConfig.getString("Gui.Lore.Info"), - guiConfig.getString("Gui.Lore.Tag") + rank.tag + messages.getString("Lore.Info"), + messages.getString("Lore.Tag") + rank.tag ); // Create the button @@ -90,22 +88,22 @@ private void buttonsSetup(Inventory inv, Configuration guiConfig) { commandMinecart = Material.matchMaterial( "command_block_minecart" ); } - ItemStack rankupCommands = createButton(commandMinecart, 1, rankupCommandsLore, SpigotPrison.format("&3" + "RankupCommands" + " " + rank.name)); + List closeGUILore = createLore( + messages.getString("Lore.ClickToClose") + ); - // Create the button - ItemStack rankPrice = createButton(Material.GOLD_NUGGET, 1, editPriceLore, SpigotPrison.format("&3" + "RankPrice" + " " + rank.name)); // Create the button + ItemStack closeGUI = createButton(XMaterial.RED_STAINED_GLASS_PANE.parseItem(), closeGUILore, SpigotPrison.format("&c" + "Close")); + ItemStack rankupCommands = createButton(commandMinecart, 1, rankupCommandsLore, SpigotPrison.format("&3" + "RankupCommands" + " " + rank.name)); + ItemStack rankPrice = createButton(Material.GOLD_NUGGET, 1, editPriceLore, SpigotPrison.format("&3" + "RankPrice" + " " + rank.name)); ItemStack rankTag = createButton(Material.NAME_TAG, 1, editTagLore, SpigotPrison.format("&3" + "RankTag" + " " + rank.name)); // Set the position and add it to the inventory inv.setItem(10, rankupCommands); - - // Set the position and add it to the inventory inv.setItem(13, rankPrice); - - // Set the position and add it to the inventory inv.setItem(16, rankTag); + inv.setItem(26, closeGUI); } } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankPriceGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankPriceGUI.java index 7df41130a..d30e6b08a 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankPriceGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankPriceGUI.java @@ -20,6 +20,7 @@ public class SpigotRankPriceGUI extends SpigotGUIComponents { private final Player p; private final String rankName; private final Integer val; + private final Configuration messages = messages(); public SpigotRankPriceGUI(Player p, Integer val, String rankname){ this.p = p; @@ -27,8 +28,6 @@ public SpigotRankPriceGUI(Player p, Integer val, String rankname){ this.rankName = rankname; } - - public void open() { // Check if Ranks are enabled @@ -40,19 +39,15 @@ public void open() { int dimension = 45; Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3RankManager -> RankPrice")); - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - - if (guiBuilder(inv, GuiConfig)) return; + if (guiBuilder(inv)) return; // Open the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Inventory inv, Configuration guiConfig) { + private boolean guiBuilder(Inventory inv) { try { - buttonsSetup(inv, guiConfig); + buttonsSetup(inv); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -61,42 +56,32 @@ private boolean guiBuilder(Inventory inv, Configuration guiConfig) { return false; } - private void buttonsSetup(Inventory inv, Configuration guiConfig) { + private void buttonsSetup(Inventory inv) { + + // Create a new lore List changeDecreaseValueLore = createLore( - guiConfig.getString("Gui.Lore.ClickToDecrease") + messages.getString("Lore.ClickToDecrease") ); - - // Create a new lore List confirmButtonLore; confirmButtonLore = createLore( - guiConfig.getString("Gui.Lore.LeftClickToConfirm"), - guiConfig.getString("Gui.Lore.Price2") + val, - guiConfig.getString("Gui.Lore.RightClickToCancel") + messages.getString("Lore.LeftClickToConfirm"), + messages.getString("Lore.Price2") + val, + messages.getString("Lore.RightClickToCancel") ); - - // Create a new lore List changeIncreaseValueLore = createLore( - guiConfig.getString("Gui.Lore.ClickToIncrease") + messages.getString("Lore.ClickToIncrease") ); // Decrease button ItemStack decreaseOf1 = createButton(Material.REDSTONE_BLOCK, 1, changeDecreaseValueLore, SpigotPrison.format("&3" + rankName + " " + val + " - 1" )); inv.setItem(1, decreaseOf1); - - // Decrease button ItemStack decreaseOf5 = createButton(Material.REDSTONE_BLOCK, 10, changeDecreaseValueLore, SpigotPrison.format("&3" + rankName + " " + val + " - 10")); inv.setItem(10, decreaseOf5); - - // Decrease button ItemStack decreaseOf10 = createButton(Material.REDSTONE_BLOCK, 1, changeDecreaseValueLore, SpigotPrison.format("&3" + rankName + " " + val + " - 100")); inv.setItem(19, decreaseOf10); - - // Decrease button ItemStack decreaseOf50 = createButton(Material.REDSTONE_BLOCK, 1, changeDecreaseValueLore, SpigotPrison.format("&3" + rankName + " " + val + " - 1000")); inv.setItem(28, decreaseOf50); - - // Decrease button ItemStack decreaseOf100 = createButton(Material.REDSTONE_BLOCK, 1, changeDecreaseValueLore, SpigotPrison.format("&3" + rankName + " " + val + " - 10000")); inv.setItem(37, decreaseOf100); @@ -109,20 +94,12 @@ private void buttonsSetup(Inventory inv, Configuration guiConfig) { // Increase button ItemStack increaseOf1 = createButton(Material.EMERALD_BLOCK, 1, changeIncreaseValueLore, SpigotPrison.format("&3" + rankName + " " + val + " + 1" )); inv.setItem(7, increaseOf1); - - // Increase button ItemStack increaseOf5 = createButton(Material.EMERALD_BLOCK, 10, changeIncreaseValueLore, SpigotPrison.format("&3" + rankName + " " + val + " + 10")); inv.setItem(16, increaseOf5); - - // Increase button ItemStack increaseOf10 = createButton(Material.EMERALD_BLOCK, 1, changeIncreaseValueLore, SpigotPrison.format("&3" + rankName + " " + val + " + 100")); inv.setItem(25, increaseOf10); - - // Increase button ItemStack increaseOf50 = createButton(Material.EMERALD_BLOCK, 1, changeIncreaseValueLore, SpigotPrison.format("&3" + rankName + " " + val + " + 1000")); inv.setItem(34, increaseOf50); - - // Increase button ItemStack increaseOf100 = createButton(Material.EMERALD_BLOCK, 1, changeIncreaseValueLore, SpigotPrison.format("&3" + rankName + " " + val + " + 10000")); inv.setItem(43, increaseOf100); } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankUPCommandsGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankUPCommandsGUI.java index 2127c1817..baa32c80c 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankUPCommandsGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRankUPCommandsGUI.java @@ -21,6 +21,7 @@ public class SpigotRankUPCommandsGUI extends SpigotGUIComponents { private final Player p; private final Rank rank; + private final Configuration messages = messages(); public SpigotRankUPCommandsGUI(Player p, Rank rank) { this.p = p; @@ -37,11 +38,8 @@ public void open() { return; } - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - if (rank.rankUpCommands.size() == 0){ - p.sendMessage(SpigotPrison.format(GuiConfig.getString("Gui.Message.NoRankupCommands"))); + p.sendMessage(SpigotPrison.format(messages.getString("Message.NoRankupCommands"))); return; } @@ -52,14 +50,14 @@ public void open() { // If the inventory is empty if (dimension == 0){ - p.sendMessage(SpigotPrison.format(GuiConfig.getString("Gui.Message.EmptyGui"))); + p.sendMessage(SpigotPrison.format(messages.getString("Message.EmptyGui"))); p.closeInventory(); return; } // If the dimension's too big, don't open the GUI if (dimension > 54){ - p.sendMessage(SpigotPrison.format(GuiConfig.getString("Gui.Message.TooManyRankupCommands"))); + p.sendMessage(SpigotPrison.format(messages.getString("Message.TooManyRankupCommands"))); p.closeInventory(); return; } @@ -70,18 +68,17 @@ public void open() { // For every command make a button for (String command : rank.rankUpCommands) { - if (guiBuilder(GuiConfig, inv, command)) return; + if (guiBuilder(inv, command)) return; } // Open the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Configuration guiConfig, Inventory inv, String command) { + private boolean guiBuilder(Inventory inv, String command) { try { - buttonsSetup(guiConfig, inv, command); + buttonsSetup(inv, command); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -90,16 +87,17 @@ private boolean guiBuilder(Configuration guiConfig, Inventory inv, String comman return false; } - private void buttonsSetup(Configuration guiConfig, Inventory inv, String command) { + private void buttonsSetup(Inventory inv, String command) { + + //Configuration messages = SpigotPrison.getGuiMessagesConfig(); + ItemStack itemCommand; // Init the lore array with default values for ladders List commandsLore = createLore( - guiConfig.getString("Gui.Lore.ShiftAndRightClickToDelete"), + messages.getString("Lore.ShiftAndRightClickToDelete"), "", - guiConfig.getString("Gui.Lore.Info")); - - // Adding a lore - commandsLore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.Command") + command)); + messages.getString("Lore.Info")); + commandsLore.add(SpigotPrison.format(messages.getString("Lore.Command") + command)); // Make the button with materials, amount, lore and name itemCommand = createButton(Material.TRIPWIRE_HOOK, 1, commandsLore, SpigotPrison.format("&3" + rank.name + " " + command)); diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRanksGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRanksGUI.java index a1fd17606..d13096799 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRanksGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/rank/SpigotRanksGUI.java @@ -18,6 +18,7 @@ import tech.mcprison.prison.ranks.data.RankPlayer; import tech.mcprison.prison.spigot.SpigotPrison; import tech.mcprison.prison.spigot.gui.ListenersPrisonManager; +import tech.mcprison.prison.spigot.gui.PrisonSetupGUI; import tech.mcprison.prison.spigot.gui.SpigotGUIComponents; /** @@ -27,6 +28,7 @@ public class SpigotRanksGUI extends SpigotGUIComponents { private final Player p; private final Optional ladder; + private static final Configuration messages = messages(); public SpigotRanksGUI(Player p, Optional ladder) { this.p = p; @@ -45,27 +47,25 @@ public void open() { return; } - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - // Get the dimensions and if needed increases them if (ladder.isPresent() && !(ladder.get().ranks.size() == 0)) { dimension = (int) Math.ceil(ladder.get().ranks.size() / 9D) * 9; } else { - p.sendMessage(SpigotPrison.format(GuiConfig.getString("Gui.Message.NoRanksFoundAdmin"))); + p.sendMessage(SpigotPrison.format(messages.getString("Message.NoRanksFoundAdmin"))); return; } // If the inventory is empty if (dimension == 0){ - p.sendMessage(SpigotPrison.format(GuiConfig.getString("Gui.Message.EmptyGui"))); p.closeInventory(); + PrisonSetupGUI gui = new PrisonSetupGUI(p); + gui.open(); return; } // If the dimension's too big, don't open the GUI if (dimension > 54){ - p.sendMessage(SpigotPrison.format(GuiConfig.getString("Gui.Message.TooManyRanks"))); + p.sendMessage(SpigotPrison.format(messages.getString("Message.TooManyRanks"))); p.closeInventory(); return; } @@ -82,18 +82,17 @@ public void open() { continue; // Skip it } - if (guiBuilder(GuiConfig, inv, rankOptional)) return; + if (guiBuilder(inv, rankOptional)) return; } // Open the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Configuration guiConfig, Inventory inv, Optional rankOptional) { + private boolean guiBuilder(Inventory inv, Optional rankOptional) { try { - buttonsSetup(guiConfig, inv, rankOptional); + buttonsSetup(inv, rankOptional); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -102,17 +101,20 @@ private boolean guiBuilder(Configuration guiConfig, Inventory inv, Optional rankOptional) { + private void buttonsSetup(Inventory inv, Optional rankOptional) { + +// Configuration messages = SpigotPrison.getGuiMessagesConfig(); + ItemStack itemRank; // Init the lore array with default values for ladders List ranksLore = createLore( - guiConfig.getString("Gui.Lore.ShiftAndRightClickToDelete"), - guiConfig.getString("Gui.Lore.ClickToManageRank"), + messages.getString("Lore.ShiftAndRightClickToDelete"), + messages.getString("Lore.ClickToManageRank"), "", - guiConfig.getString("Gui.Lore.Info")); + messages.getString("Lore.Info")); if (!rankOptional.isPresent()){ - p.sendMessage(SpigotPrison.format(guiConfig.getString("Gui.Message.CantGetRanksAdmin"))); + p.sendMessage(SpigotPrison.format(messages.getString("Message.CantGetRanksAdmin"))); return; } @@ -120,16 +122,10 @@ private void buttonsSetup(Configuration guiConfig, Inventory inv, Optional Rank rank = rankOptional.get(); // Add the RankID Lore - ranksLore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.Id") + rank.id)); - - // Add the RankName lore - ranksLore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.Name") + rank.name)); - - // Add the Rank Tag lore - ranksLore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.Tag2") + ChatColor.translateAlternateColorCodes('&', rank.tag))); - - // Add the Price lore - ranksLore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.Price3") + rank.cost)); + ranksLore.add(SpigotPrison.format(messages.getString("Lore.Id") + rank.id)); + ranksLore.add(SpigotPrison.format(messages.getString("Lore.Name") + rank.name)); + ranksLore.add(SpigotPrison.format(messages.getString("Lore.Tag2") + ChatColor.translateAlternateColorCodes('&', rank.tag))); + ranksLore.add(SpigotPrison.format(messages.getString("Lore.Price3") + rank.cost)); // Init a variable List players = @@ -138,11 +134,9 @@ private void buttonsSetup(Configuration guiConfig, Inventory inv, Optional .collect(Collectors.toList()); // Add the number of players with this rank - ranksLore.add(SpigotPrison.format(guiConfig.getString("Gui.Lore.PlayersWithTheRank") + players.size())); - - // RankUpCommands info lore + ranksLore.add(SpigotPrison.format(messages.getString("Lore.PlayersWithTheRank") + players.size())); ranksLore.add(""); - getCommands(ranksLore, rank); + //getCommands(ranksLore, rank); // Make the button with materials, amount, lore and name itemRank = createButton(Material.TRIPWIRE_HOOK, 1, ranksLore, SpigotPrison.format("&3" + rank.name)); @@ -151,18 +145,16 @@ private void buttonsSetup(Configuration guiConfig, Inventory inv, Optional inv.addItem(itemRank); } - static void getCommands(List ranksLore, Rank rank) { - - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - - if (rank.rankUpCommands == null || rank.rankUpCommands.size() == 0) { - ranksLore.add(SpigotPrison.format(GuiConfig.getString("Gui.Lore.ContainsTheRank") + rank.name + GuiConfig.getString("Gui.Lore.ContainsNoCommands"))); - } else { - ranksLore.add(SpigotPrison.format(GuiConfig.getString("Gui.Lore.LadderThereAre") + rank.rankUpCommands.size() + GuiConfig.getString("Gui.Lore.LadderCommands"))); - for (String command : rank.rankUpCommands) { - ranksLore.add(SpigotPrison.format(GuiConfig.getString("Gui.Lore.RankupCommands") + command)); - } - ranksLore.add(SpigotPrison.format(GuiConfig.getString("Gui.Lore.ClickToManageCommands"))); - } - } + //static void getCommands(List ranksLore, Rank rank) { + + // if (rank.rankUpCommands == null || rank.rankUpCommands.size() == 0) { + // ranksLore.add(SpigotPrison.format(messages.getString("Lore.ContainsTheRank") + rank.name + messages.getString("Lore.ContainsNoCommands"))); + // } else { + // ranksLore.add(SpigotPrison.format(messages.getString("Lore.LadderThereAre") + rank.rankUpCommands.size() + messages.getString("Lore.LadderCommands"))); + // for (String command : rank.rankUpCommands) { + // ranksLore.add(SpigotPrison.format(messages.getString("Lore.RankupCommands") + command)); + // } + // ranksLore.add(SpigotPrison.format(messages.getString("Lore.ClickToManageCommands"))); + // } + //} } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllAdminGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllAdminGUI.java index 48bd83234..a6827a8b1 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllAdminGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllAdminGUI.java @@ -21,6 +21,8 @@ public class SellAllAdminGUI extends SpigotGUIComponents { private final Player p; + private final Configuration conf = sellAll(); + private final Configuration messages = messages(); public SellAllAdminGUI(Player p){ this.p = p; @@ -28,26 +30,23 @@ public SellAllAdminGUI(Player p){ public void open() { - // Load configs - Configuration conf = SpigotPrison.getSellAllConfig(); - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - Inventory inv; - if (guiBuilder(conf, GuiConfig)) return; + if (guiBuilder()) return; - inv = buttonsSetup(conf, GuiConfig); + inv = buttonsSetup(); if (inv == null) return; - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private Inventory buttonsSetup(Configuration conf, Configuration guiConfig) { + private Inventory buttonsSetup() { + boolean emptyInv = false; try { + assert conf != null; if (conf.getConfigurationSection("Items") == null) { emptyInv = true; } @@ -56,7 +55,6 @@ private Inventory buttonsSetup(Configuration conf, Configuration guiConfig) { } if (emptyInv){ - p.sendMessage(SpigotPrison.format(guiConfig.getString("Gui.Message.NoSellAllItems"))); p.closeInventory(); return null; } @@ -68,7 +66,7 @@ private Inventory buttonsSetup(Configuration conf, Configuration guiConfig) { int dimension = (int) Math.ceil(items.size() / 9D) * 9; if (dimension > 54){ - p.sendMessage(SpigotPrison.format(guiConfig.getString("Gui.Message.TooManySellAllItems"))); + p.sendMessage(SpigotPrison.format(messages.getString("Message.TooManySellAllItems"))); return null; } @@ -86,9 +84,9 @@ private Inventory buttonsSetup(Configuration conf, Configuration guiConfig) { return inv; } - private boolean guiBuilder(Configuration conf, Configuration guiConfig) { + private boolean guiBuilder() { try { - buttonsSetup(conf, guiConfig); + buttonsSetup(); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPlayerGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPlayerGUI.java index 7b3332c2c..9b38d65b5 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPlayerGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPlayerGUI.java @@ -20,6 +20,8 @@ public class SellAllPlayerGUI extends SpigotGUIComponents { private final Player p; + private final Configuration messages = messages(); + private final Configuration conf = sellAll(); public SellAllPlayerGUI(Player p){ this.p = p; @@ -27,25 +29,19 @@ public SellAllPlayerGUI(Player p){ public void open() { - // Load configs - Configuration conf = SpigotPrison.getSellAllConfig(); - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - Inventory inv; - if (guiBuilder(conf, GuiConfig)) return; + if (guiBuilder()) return; - inv = buttonsSetup(conf, GuiConfig); + inv = buttonsSetup(); if (inv == null) return; - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private Inventory buttonsSetup(Configuration conf, Configuration guiConfig) { + private Inventory buttonsSetup() { Inventory inv; - boolean emptyInv = false; try { @@ -57,7 +53,7 @@ private Inventory buttonsSetup(Configuration conf, Configuration guiConfig) { } if (emptyInv){ - p.sendMessage(SpigotPrison.format(guiConfig.getString("Gui.Message.NoSellAllItems"))); + p.sendMessage(SpigotPrison.format(messages.getString("Message.NoSellAllItems"))); p.closeInventory(); return null; } @@ -69,7 +65,7 @@ private Inventory buttonsSetup(Configuration conf, Configuration guiConfig) { int dimension = (int) Math.ceil(items.size() / 9D) * 9; if (dimension > 54){ - p.sendMessage(SpigotPrison.format(guiConfig.getString("Gui.Message.TooManySellAllItems"))); + p.sendMessage(SpigotPrison.format(messages.getString("Message.TooManySellAllItems"))); return null; } @@ -77,7 +73,7 @@ private Inventory buttonsSetup(Configuration conf, Configuration guiConfig) { for (String key : items) { List itemsLore = createLore( - guiConfig.getString("Gui.Lore.Value") + conf.getString("Items." + key + ".ITEM_VALUE") + messages.getString("Lore.Value") + conf.getString("Items." + key + ".ITEM_VALUE") ); ItemStack item = createButton(Material.valueOf(conf.getString("Items." + key + ".ITEM_ID")), 1, itemsLore, SpigotPrison.format("&3" + conf.getString("Items." + key + ".ITEM_ID"))); inv.addItem(item); @@ -85,9 +81,9 @@ private Inventory buttonsSetup(Configuration conf, Configuration guiConfig) { return inv; } - private boolean guiBuilder(Configuration conf, Configuration guiConfig) { + private boolean guiBuilder() { try { - buttonsSetup(conf, guiConfig); + buttonsSetup(); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPriceGUI.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPriceGUI.java index a9f6fa236..3b11735ef 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPriceGUI.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/gui/sellall/SellAllPriceGUI.java @@ -20,6 +20,7 @@ public class SellAllPriceGUI extends SpigotGUIComponents { private final Player p; private final String itemID; private final Double val; + private final Configuration messages = messages(); public SellAllPriceGUI(Player p, Double val, String itemID){ this.p = p; @@ -33,19 +34,15 @@ public void open() { int dimension = 45; Inventory inv = Bukkit.createInventory(null, dimension, SpigotPrison.format("&3SellAll -> ItemValue")); - // Load config - Configuration GuiConfig = SpigotPrison.getGuiConfig(); - - if (guiBuilder(inv, GuiConfig)) return; + if (guiBuilder(inv)) return; // Open the inventory - this.p.openInventory(inv); - ListenersPrisonManager.get().addToGUIBlocker(p); + openGUI(p, inv); } - private boolean guiBuilder(Inventory inv, Configuration guiConfig) { + private boolean guiBuilder(Inventory inv) { try { - buttonsSetup(inv, guiConfig); + buttonsSetup(inv); } catch (NullPointerException ex){ p.sendMessage(SpigotPrison.format("&cThere's a null value in the GuiConfig.yml [broken]")); ex.printStackTrace(); @@ -54,43 +51,32 @@ private boolean guiBuilder(Inventory inv, Configuration guiConfig) { return false; } - private void buttonsSetup(Inventory inv, Configuration guiConfig) { + private void buttonsSetup(Inventory inv) { + // Create a new lore List changeDecreaseValueLore; changeDecreaseValueLore = createLore( - guiConfig.getString("Gui.Lore.ClickToDecrease") + messages.getString("Lore.ClickToDecrease") ); - - // Create a new lore List confirmButtonLore = createLore( - guiConfig.getString("Gui.Lore.LeftClickToConfirm"), - guiConfig.getString("Gui.Lore.Price2") + val, - guiConfig.getString("Gui.Lore.RightClickToCancel") + messages.getString("Lore.LeftClickToConfirm"), + messages.getString("Lore.Price2") + val, + messages.getString("Lore.RightClickToCancel") ); - - // Create a new lore List changeIncreaseValueLore = createLore( - guiConfig.getString("Gui.Lore.ClickToIncrease") + messages.getString("Lore.ClickToIncrease") ); // Decrease button ItemStack decreaseOf1 = createButton(Material.REDSTONE_BLOCK, 1, changeDecreaseValueLore, SpigotPrison.format("&3" + itemID + " " + val + " - 1" )); inv.setItem(1, decreaseOf1); - - // Decrease button ItemStack decreaseOf5 = createButton(Material.REDSTONE_BLOCK, 10, changeDecreaseValueLore, SpigotPrison.format("&3" + itemID + " " + val + " - 10")); inv.setItem(10, decreaseOf5); - - // Decrease button ItemStack decreaseOf10 = createButton(Material.REDSTONE_BLOCK, 1, changeDecreaseValueLore, SpigotPrison.format("&3" + itemID + " " + val + " - 100")); inv.setItem(19, decreaseOf10); - - // Decrease button ItemStack decreaseOf50 = createButton(Material.REDSTONE_BLOCK, 1, changeDecreaseValueLore, SpigotPrison.format("&3" + itemID + " " + val + " - 1000")); inv.setItem(28, decreaseOf50); - - // Decrease button ItemStack decreaseOf100 = createButton(Material.REDSTONE_BLOCK, 1, changeDecreaseValueLore, SpigotPrison.format("&3" + itemID + " " + val + " - 10000")); inv.setItem(37, decreaseOf100); @@ -103,20 +89,12 @@ private void buttonsSetup(Inventory inv, Configuration guiConfig) { // Increase button ItemStack increseOf1 = createButton(Material.EMERALD_BLOCK, 1, changeIncreaseValueLore, SpigotPrison.format("&3" + itemID + " " + val + " + 1" )); inv.setItem(7, increseOf1); - - // Increase button ItemStack increaseOf5 = createButton(Material.EMERALD_BLOCK, 10, changeIncreaseValueLore, SpigotPrison.format("&3" + itemID + " " + val + " + 10")); inv.setItem(16, increaseOf5); - - // Increase button ItemStack increaseOf10 = createButton(Material.EMERALD_BLOCK, 1, changeIncreaseValueLore, SpigotPrison.format("&3" + itemID + " " + val + " + 100")); inv.setItem(25, increaseOf10); - - // Increase button ItemStack increaseOf50 = createButton(Material.EMERALD_BLOCK, 1, changeIncreaseValueLore, SpigotPrison.format("&3" + itemID + " " + val + " + 1000")); inv.setItem(34, increaseOf50); - - // Increase button ItemStack increaseOf100 = createButton(Material.EMERALD_BLOCK, 1, changeIncreaseValueLore, SpigotPrison.format("&3" + itemID + " " + val + " + 10000")); inv.setItem(43, increaseOf100); } diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/sellall/SellAllCommands.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/sellall/SellAllCommands.java index b6f4a82dc..4ee49f444 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/sellall/SellAllCommands.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/sellall/SellAllCommands.java @@ -1,5 +1,10 @@ package tech.mcprison.prison.spigot.sellall; +import java.io.File; +import java.io.IOException; +import java.util.Objects; +import java.util.Set; + import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.command.Command; @@ -9,10 +14,10 @@ import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; + import tech.mcprison.prison.Prison; import tech.mcprison.prison.PrisonAPI; import tech.mcprison.prison.integration.EconomyIntegration; -import tech.mcprison.prison.integration.IntegrationType; import tech.mcprison.prison.modules.Module; import tech.mcprison.prison.modules.ModuleManager; import tech.mcprison.prison.ranks.PrisonRanks; @@ -21,11 +26,6 @@ import tech.mcprison.prison.spigot.gui.sellall.SellAllAdminGUI; import tech.mcprison.prison.spigot.gui.sellall.SellAllPlayerGUI; -import java.io.File; -import java.io.IOException; -import java.util.Objects; -import java.util.Set; - /** * @author GABRYCA */ @@ -173,14 +173,14 @@ private boolean sellAllMultipliers(CommandSender sender, String[] args, File fil return true; } - boolean isARank = rankPlugin.getRankManager().getRank(args[1]).isPresent(); + boolean isARank = rankPlugin.getRankManager().getRank(args[1]) != null; if (!isARank) { sender.sendMessage(SpigotPrison.format("&3[PRISON WARN] &cCan't find the Prestige/Rank: " + args[2])); return true; } - boolean isInPrestigeLadder = rankPlugin.getLadderManager().getLadder("prestiges").get().containsRank(rankPlugin.getRankManager().getRank(args[1]).get().id); + boolean isInPrestigeLadder = rankPlugin.getLadderManager().getLadder("prestiges").get().containsRank(rankPlugin.getRankManager().getRank(args[1]).id); if (!isInPrestigeLadder) { sender.sendMessage(SpigotPrison.format("&3[PRISON WARN] &cThe -prestiges- ladder doesn't contains the Rank: " + args[2])); @@ -391,7 +391,8 @@ private boolean sellallCommandSell(CommandSender sender, FileConfiguration conf) } // Get economy - EconomyIntegration economy = (EconomyIntegration) PrisonAPI.getIntegrationManager().getForType(IntegrationType.ECONOMY).orElseThrow(IllegalStateException::new); + EconomyIntegration economy = PrisonAPI.getIntegrationManager().getEconomy(); + // Add balance economy.addBalance(sPlayer, moneyToGive); if (moneyToGive<0.001){ diff --git a/prison-spigot/src/main/resources/config.yml b/prison-spigot/src/main/resources/config.yml index d4218e193..b5c504266 100644 --- a/prison-spigot/src/main/resources/config.yml +++ b/prison-spigot/src/main/resources/config.yml @@ -50,20 +50,20 @@ prison-gui-enabled: true # NEW: Enable or disable /mines to open the GUI to players (This won't works # with OPs or admins who have the permission mines.admin or prison.admin) -# This command's only a shortcut of /prisonmanager mines +# This command's only a shortcut of /gui mines mines-gui-enabled: true # NEW: Enable or disable /ranks to open the GUI to players (This won't # works with OPs or admins who have the permission ranks.admin or prison.admin) -# This command's only a shortcut of /prisonmanager ranks +# This command's only a shortcut of /gui ranks ranks-gui-enabled: true -# NEW: /ranks prestiges's a shortcut of /prisonmanager prestiges and the same +# NEW: /ranks prestiges's a shortcut of /gui prestiges and the same # as the /prestiges shortcut ranks-gui-prestiges-enabled: true # NEW: /prestiges command which opens the Prestiges GUI, this's basically a -# shortcut of the /prisonmanager prestiges +# shortcut of the /gui prestiges prestiges-gui-enabled: true # NEW: /prestige will open a confirmation GUI if this's on true, if on false diff --git a/prison-spigot/src/main/resources/plugin.yml b/prison-spigot/src/main/resources/plugin.yml index 99196e81f..b510ff218 100644 --- a/prison-spigot/src/main/resources/plugin.yml +++ b/prison-spigot/src/main/resources/plugin.yml @@ -2,8 +2,8 @@ name: Prison main: tech.mcprison.prison.spigot.SpigotPrison version: "${version}" description: Prison is an all-in-one plugin for the Minecraft prison game mode. -website: https://mc-prison.tech -softdepend: [Essentials, Vault, LuckPerms, Multiverse-Core, Multiworld, MVdWPlaceholderAPI, PlaceholderAPI, GemsEconomy] +website: https://prison.jar-mc.com +softdepend: [Essentials, Vault, LuckPerms, Multiverse-Core, Multiworld, MVdWPlaceholderAPI, PlaceholderAPI, GemsEconomy, TokenEnchant] # 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 @@ -12,9 +12,9 @@ api-version: 1.13 # New commands compatible only with spigot # ====================================================== commands: - prisonmanager: - description: Call a fancy GUI where manage the ranks and mines - usage: / gui + #prisonmanager: + #description: Call a fancy GUI where manage the ranks and mines + #usage: / gui sellall: description: SellAll Command and SubCommands usage: / @@ -71,6 +71,9 @@ permissions: mines.create: description: Access to the /mines create command. + mines.rename: + description: Access to the /mines rename command. + mines.set: description: Access to the /mines set command. @@ -122,6 +125,7 @@ permissions: children: mines.block: true mines.create: true + mines.rename: true mines.delete: true mines.set: true mines.info: true diff --git a/prison-spigot/src/test/java/tech/mcprison/prison/spigot/SpigotPlatformTest.java b/prison-spigot/src/test/java/tech/mcprison/prison/spigot/SpigotPlatformTest.java new file mode 100644 index 000000000..a24685d75 --- /dev/null +++ b/prison-spigot/src/test/java/tech/mcprison/prison/spigot/SpigotPlatformTest.java @@ -0,0 +1,63 @@ +package tech.mcprison.prison.spigot; + +import static org.junit.Assert.assertEquals; + +import java.util.List; + +import org.junit.Test; + +public class SpigotPlatformTest + extends SpigotPlatform +{ + + @Test + public void testMineBlockList() + { + List blockList = buildBlockListBlockType(); + + int i = -1; + + assertEquals( 0, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 1, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 2, mineBlockList( blockList, i++, 5 ).size() ); // Mine name: A + assertEquals( 3, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 4, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); // Mine name: E + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); // Mine name: J + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); // Mine name: O + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); // Mine name: S + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); // Mine name: T + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 5, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 4, mineBlockList( blockList, i++, 5 ).size() ); // Mine name: W + assertEquals( 3, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 2, mineBlockList( blockList, i++, 5 ).size() ); // Mine name: Y + assertEquals( 1, mineBlockList( blockList, i++, 5 ).size() ); // Mine name: Z + assertEquals( 0, mineBlockList( blockList, i++, 5 ).size() ); + assertEquals( 0, mineBlockList( blockList, i++, 5 ).size() ); + + + } + + @Override + protected List mineBlockList( List blockList, int startPos, int length ) { + List results = super.mineBlockList( blockList, startPos, length); + + System.out.println( results ); + + return results; + } + +}