diff --git a/LICENSE.md b/LICENSE.md
index a7f82fe4c..95f77abeb 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,3 +1,4 @@
+[Prison Documents - Table of Contents](docs/prison_docs_000_toc.md)
# GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
diff --git a/README.md b/README.md
index d2782bf11..bba1119d7 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,3 @@
-[](https://confluence.onultz.com/display/PRIS)
-
-
[](LICENSE.md)
[](https://travis-ci.org/MC-Prison/Prison)
[](https://discord.gg/396ed5F)
@@ -9,21 +6,31 @@
2. [Why should I use Prison?](#why-should-i-use-prison)
3. [Get Prison](#get-prison)
+## Prison Documentation
+
+[Prison Documents - Table of Contents](docs/prison_docs_000_toc.md)
+
+The Prison documentation covers the important details on how to setup a usable Prison server.
+These documents are in a state of development, so more will be added.
+
## What is Prison?
-Prison is a Minecraft plugin that adds all the features necessary for [prison servers](https://woodycraft.net/threads/what-is-a-prison-server-a-general-explanation.21161/). It runs on multiple platforms, including the popular [Spigot](http://spigotmc.org) and the rapidly growing [Sponge](http://spongepowered.org). Plugins for prison servers exist already, but many of them are poorly maintained, and the solid ones are paid resources. Prison eliminates the paywall and the updating hassle, and puts a one-stop solution in their place.
+Prison is a Minecraft plugin that adds all the features necessary for prison servers. It runs on the popular [Spigot](http://spigotmc.org). Plugins for prison servers exist already, but many of them are poorly maintained, and the solid ones are paid resources. Prison eliminates the paywall and the updating hassle, and puts a one-stop solution in their place.
### History of Prison
Prison began as a plugin with the goal of combining two main prison server features: resetting mines and purchasable ranks. In June 2014, Prison v2.0 was released with the goal of providing a single solution for prison servers. Prison v2.0 has had numerous problems and is not the solution that we had envisioned for an all-in-one package to be. The solution is the current version - Prison v3.0.
+Starting with prison v3.2.0 new development efforts were began with a focus on adding new features
+and improving the performance and stability.
+
## Why should I use Prison?
If hassle-free updates and zero payments is not enough for you to consider switching to Prison, it doesn't stop there.
* **Prison is modular.** If you don't want to use a certain feature on your server, you can disable it in just a few keystrokes.
* **Prison is completely, 100% open source.** This means that your developers can make changes to the plugin to customize your server's experience, if you so desire.
-* **Prison is and always will be free.** While we do ask for donations, all of our code, resources, and binaries are provided free of charge to the Minecraft community.
+* **Prison is and always will be free.** All of our code, resources, and binaries are provided free of charge to the Minecraft community. We do not accept donations.
* **New releases are heavily bug-tested.** We test every single aspect of every new release of Prison before releasing it to the community. If a release doesn't pass our rigorous update checklist, it is iterated upon until it does. What does this mean for you? Solid updates with minimal bugs for your server.
* **Prison is always expanding.** We are always looking for ways to expand Prison with features that make your server run more smoothly. Additionally, we are always looking for contributions from the community, be it code contributions, feature requests, bug reports, translations, or documentation.
@@ -31,7 +38,5 @@ If hassle-free updates and zero payments is not enough for you to consider switc
| Stable | Experimental (Nightly) |
| ------ | ---------------------- |
-| [](https://github.com/MC-Prison/Prison/releases/latest) | [](https://ci.appveyor.com/project/faizaand/prison/build/artifacts) |
-
+| [](https://www.spigotmc.org/resources/prison.1223/) | [](https://ci.appveyor.com/project/faizaand/prison/build/artifacts) |
-
diff --git a/build.gradle b/build.gradle
index 4b1f79275..1bcd27706 100644
--- a/build.gradle
+++ b/build.gradle
@@ -15,23 +15,30 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see gradlew wrapper --gradle-version 5.0
:: Sets the new wrapper version
+ * gradlew --version
:: Will actually install the new version
+ * gradlew build
:: Will build project with the new version to ensure all is good. If build is good, then you can try to upgrade to the next version.
+ * Update to v5.0 was successful. Had to remove enableFeaturePreview('STABLE_PUBLISHING')
+ since it has been deprecated. It does nothing in v5.x, but will be removed in v6.0.
+ * Update to v5.1.1, v5.2.1, v5.3.1, v5.4.1, v5.5.1, v5.6.4 was successful.
+
+
+* **Minor clean up to Gradle scripts**
+The "compile" directive is actually very old and was deprecated back around version
+v2.x. The replacements for that is "implementation" or "api" instead. The use of
+api does not make sense since its use is to tag when internal functions are exposed
+to the outside world as if it will be used as an externally facing API. That
+really does not fit our use case, but what api also does is to force compiling all
+source that is associated with something marked as api, including everyone's children. So performance will suffer due to that usage, since it shuts down incremental
+building of resources.
+
+I also found that use of compileOnly may not be used correctly, but at this point
+I'm just leaving this as a mention and then revisit in the future if time
+permits, or issues appear to be related. Its a very old addition that provided
+gradle with "some" maven like behaviors. It was only intended to be strictly used
+for compile time dependencies, such as for annotations that are only needed for
+compile-time checks, of which the plugins and resources we have marked as
+compileOnly do not fit that use case.
+[discuss.gradle.org: compileOnly](https://discuss.gradle.org/t/is-it-recommended-to-use-compileonly-over-implementation-if-another-module-use-implementation-already/26699/2)
+
+
+* **Redesigned mine block generation works - Async and paged enabled**
+Redesigned how prison blocks are generated to improve performance and to allow the
+asynch generation of blocks, but more importantly, allows for paging of actual
+block updates. The paging is a major feature change that will allow for minimal
+impact on server lag, even with stupid-large mines. The idea is to chop up the
+large number of blocks that need to be regenerated in to smaller chunks that can
+be performed within one or two ticks, then defer the other updates to the future.
+Thus freeing up the main bukkit/spigot execution thread to allow other tasks
+to run to help prevent the server from lagging.
+
+* **Support for LuckPerms v5.0.x**
+In addition to supporting older versions of LuckPerms, Prison now is able to
+integrate LuckPerms v5.0.x or LuckPerms v.4.x or earlier. Take your pick.
+
+* **Minor changes to reduce the number of compiler warnings**
+Minor changes, but better code overall.
+
+
+* **Improved mine regeneration performance by 33.3%**
+Figured out how to improve performance on mine regeneration by roughly about 33.3% overall. This
+could help drastically improve performance and reduce lag since block updates must run
+synchronously to prevent server corruption (limitation is due to the bukkit and spigot api).
+
+* **Mine stats and whereami**
+Added a new command, **/mines stats**, to toggle the stats on the mine resets. Viewable with **/mines list** and **/mines info**. Stats are now within the MineManager so it can be accessed from within
+the individual mines.
+Added a new command, **/mines whereami**, to tell you what mine you are in, or up to three mines you are nearest to and the distance from their centers.
+
+
+* **Major restructuring of how Mines work - Self-managing their own workflow**
+They now are able to self-manage their own workflow for sending out notifications and for resetting automatically.
+Mines is now layered, where each layer (abstract class of its ancestors) contributes a type of behavior and business logic that allows Mines to be more autonomous.
+As a result, PrisonMines and MineManager are greatly simplified since they have less to manage.
+Because Mines are now self-managing their own workflow, and they have taken on a more expanded role, some of the mine configurations are obsolete and removed.
+Mines only notify players that are within a limited range of their center; they no longer blindly broadcast to all players within a given world or the whole server.
+Mines extend from MineScheduler, which extend from MineReset, which extend from MineData. Each layer focuses on it's own business rules and reduces the clutter in the others, which results in tighter
+code and less moving parts and less possible errors and bugs.
+
+
+* **Concept of distance added to Bound objects**
+Added the concept of distance between two Bound objects so as to support new
+functionalities between mines and players.
+
+
+* **Gradle now ready to upgrade to v5**
+Resolved the last few issues that would have caused issues when upgrading to gradle
+v5. Explored how gradle can use java fragments and variables.
+
## tag v3.2.0 - 2019-12-03
@@ -63,7 +1041,7 @@ Test server versions used in testing:
* **Minecraft 1.11**
* **Minecraft 1.12.2**
* **Minecraft 1.13.2**
- * **Minecraft 1.14.2**
+ * **Minecraft 1.14.4**
* **Major refactoring of the prison-mines package**
diff --git a/docs/docs-commands/prison_docs_command_10_sellall.md b/docs/docs-commands/prison_docs_command_10_sellall.md
new file mode 100644
index 000000000..91a56da7a
--- /dev/null
+++ b/docs/docs-commands/prison_docs_command_10_sellall.md
@@ -0,0 +1,26 @@
+### Prison Documentation - **WORK-IN-PROGRESS**
+[Prison Documents - Table of Contents](../prison_docs_000_toc.md)
+
+## Description:
+
+Show a list of subcommands for the sellall feature.
+
+## SubCommands:
+
+- `/sellall sell`
+- `/sellall gui`
+- `/sellall add`
+- `/sellall delete`
+- `/sellall multiplier`
+- `/sellall setdefault`
+
+## How to use the command
+
+Execute the command with the argument you want following the instruction, on the [main doc](../prison_docs_000_toc.md) page there's a whole guidebook for [this](../prison_docs_113_setting_up_sellall.md)!
+Example: `/sellall`
+
+### Command Format
+
+`/sellall
+
+
+## Project Related
+
+* **[Prison README.md](../README.md)**
+* **[Prison LICENSE.md](../LICENSE.md)**
+* **[Prison Change logs](../changelog_v3.2.x.md)** Detailed changes to prison.
+* **[Prison Known Issues](../knownissues_v3.2.x.md)** Known Issues and To Do's.
+* **[Prison Discord Server](https://discord.gg/DCJ3j6r)** Get help here.
+
+
+* **[Most Recent Version of Prison Documentation](https://github.com/PrisonTeam/Prison/blob/bleeding/docs/prison_docs_000_toc.md)** Docs change frequently, but GITHUG's master versions do not. These are the latest docs!
+
+
+
+
+
+
+# Table of Contents for this Document
+
+* [Commands Shortcut Help](#commands-shortcut-help)
+
+* [Guides - Setting up the Server Basics](#guides-setting-up-the-server-basics)
+* [Guides - Configuring Prison](#guides-configuring-prison)
+
+* [Guides - Working with other Plugins](#guides-working-with-other-plugins)
+* [Guides - Configuring Other Plugins for Prison](#guides-configuring-other-plugins-for-prison)
+* [Guides - FAQs](#guides-faqs)
+
+
+
+
+
+### Commands Shortcut help
+
+*Adding the `help` argument as the first parameter of any command will show additional help.*
+
+
+**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)
+
+**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)
+
+**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)
+
+
+
+
+
+
+
+
+
+
+# Guides: Setting Up the Server Basics
+
+
+* [Setting up a Spigot Server](prison_docs_010_setting_up_a_spigot_server.md)
+ Setting up Java. Setting up and running BuildTool. Creating a runnable Spigot Server.
+
+
+* [Setting up Prison - Basics](prison_docs_012_setting_up_prison_basics.md) **Required**
+ Adding the plugin to your server.
+
+
+* [Prison - Getting Help](prison_docs_013_Prison_Help.md) **Important**
+ Commands. Getting help for issues. Upgrading Prison.
+
+
+* [Prison - Prison Configuration Files](prison_docs_014_Prison_Configs.md) **Important**
+ Customizing how Prison works by changing the Config files.
+
+
+
+
+* **Setting up Vault** - (coming soon)
+ Including Vault is Strongly Suggested.
+ Hint: Download from spigotmc.org and copy jar to plugin folder. Zero setup.
+
+
+* [Setting up EssentialsX](prison_docs_0xx_setting_up_EssentialsX.md) -
+ Including EssentialsX is Strongly Suggested - Configuring EssentialsX Chat placeholders - Recommend which modules to include.
+
+
+* [Setting up LuckPerms](prison_docs_020_setting_up_luckperms.md)
+ Setting up LuckPerms. Warning about LuckPerms Versions.
+
+
+* [Setting up PermissionsEX](prison_docs_022_setting_up_PermissionsEX.md)
+ Setting up PermissionsEX. Warning about being obsolete.
+
+
+* [Setting up Ultra Permissions](prison_docs_024_setting_up_Ultra_Permissions.md)
+ Setting up Ultra Permissions. Compatible with Prison 3.2+
+
+
+* [Setting up WorldGuard & WorldEdit](prison_docs_026_setting_up_worldguard_worldedit.md)
+ Installing the plugins
+
+
+* [Setting up PlaceholderAPI](prison_docs_0xx_setting_up_PlaceholderAPI.md) - Strongly Suggested if using placeholders. Troubleshooting.
+
+
+
+
+
+# Guides: Configuring Prison
+
+These guides cover the core fundamentals of Prison. They may reference other plugins, but these guides will not go in to depth on how to install or use the other plugins; those details will be a focused guide of their own.
+
+
+
+* [Setting up Mines](prison_docs_101_setting_up_mines.md)
+ Basics of creating. Searching for Blocks. Customizing. One-block mine example with HolographicDisplays.
+
+
+
+* [Setting up Ranks & Ladders](prison_docs_102_setting_up_ranks.md)
+ **-+= New! Work In Progress! =+-** Configuring and using Ranks and Ladders.
+
+
+
+* [Setting up Prestiges](prison_docs_107_setting_up_pestiges.md)
+ Configuring and using Prestiges.
+
+
+
+* [Mine Commands](prison_docs_111_mine_commands.md)
+ What they are. Setting up. Working with Mine Commands.
+
+
+
+* [Setting up SellAll](prison_docs_113_setting_up_sellall.md)
+ What's SellAll, how to use it and set up (Including sellall **multipliers**).
+
+
+
+
+
+
+
+
+
+
+# Guides: Working with other Plugins
+
+
+* [Guide: Prison Placeholders](prison_docs_310_guide_placeholders.md) How to use. Includes HolographicDisplays.
+
+
+**Work In Progress**
+
+
+
+
+
+
+
+
+# Guides: Configuring Other Plugins for Prison
+
+This section of guides will focus more on other plugins and how they can integrate with Prison. They may use a few aspects of the prison API or command interface, but these guides will spend the majority of their time covering the other technologies that can help give Prison your own character.
+
+
+* [Configuring and Using WorldGuard with LuckPerms to Protect Mines](prison_docs_626_configuring_worldguard_regions.md)
+ This guide uses LuckPerms in the examples, but any other permission plugin will work just as well.
+
+
+* [Setting up EssentialsX Warps for Players](prison_docs_630_configuring_warps.md)
+
+
+* [Ideas on Setting up Donor Mines and Private Mines](prison_docs_628_configuring_private_mines.md)
+
+
+
+* **Work In Progress**
+
+
+
+
+
+
+
+
+
+
+# Guides: FAQs
+
+This section of guides will focus on FAQs; short helps for common problems.
+
+
+* [FAQ - Other Plugins](prison_docs_810_faq_other_plugins.md)
+ CMI Plugin. Prison fails to load. No modules.
+
+
+* [FAQ - Miscellaneous Questions](prison_docs_880_faq_misc_01.md)
+ Is Paper Supported? Setting the Currency symbol.
+
+
diff --git a/docs/prison_docs_010_setting_up_a_spigot_server.md b/docs/prison_docs_010_setting_up_a_spigot_server.md
new file mode 100644
index 000000000..12d6f9419
--- /dev/null
+++ b/docs/prison_docs_010_setting_up_a_spigot_server.md
@@ -0,0 +1,128 @@
+
+### Prison Documentation
+[Prison Documents - Table of Contents](prison_docs_000_toc.md)
+
+## Setting up a Spigot Server
+
+The Prison documentation covers how to setup a Spigot server for use as either
+a test environment, a production server. These instructions covers how to
+use the spigotmc's buildtools to simplify not only the initial setup,
+but also provides easy updates.
+
+Buildtools also allows easy setup of many test environments since all you
+would need to do is to just change the version.
+
+
+
+
+
+
+# Setting up Java
+This is intended strictly as a high-level overview on how to setup Java.
+If you need more assistance, please search for online documentation since
+there are many good resources out there.
+
+* First install a copy of Java that is accessible from the command line.
+ - It’s strongly suggested to use only the latest version 1.8.0_x since that is the version spigot and most other plugins are developed under.
+
+
+* You can download it from [Sun SE Development Kit 8]https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html) for product that you need.
+
+
+* You can also use Open JDK if Sun's license does not fit your needs. [OpenJDK Install](https://openjdk.java.net/install/)
+
+
+* Test the java install with `java -version` from a command line
+
+
+
+
+
+# Setting Up and Running BuildTools
+
+* Download the spigot `BuildTools.jar` file. Follow the directions from here:
+ [https://www.spigotmc.org/wiki/buildtools/](https://www.spigotmc.org/wiki/buildtools/)
+
+
+* Once you have downloaded BuildTools.jar, you will run *one* of the following commands (only one) from the command line. Multiple versions are shown as an example of how by simply specifying different versions, the same BuildTool will generate the different environments. The Windows and linux command line usage are the same. See the provided URL in the first step above for the list of valid versions that are supported by the BuildTools.jar file.
+
+ java -jar BuildTools.jar --rev 1.8.8
+ java -jar BuildTools.jar --rev 1.12.2
+ java -jar BuildTools.jar --rev 1.13.2
+ java -jar BuildTools.jar --rev 1.14.4
+ java -jar BuildTools.jar --rev 1.15.1
+
+
+* For example, with BuildTools.jar being in a root directory, create a subdirectory and then start a build within that directory. The benefit is that you can use the same BuildTools.jar to build multiple different versions of spigot. This example starts off with building a v1.14.4 instance and then builds a 1.8.8 instance.
+
+ mkdir spigot-1.14.4
+ cd spigot-1.14.4
+ java -jar ../BuildTools.jar –rev 1.14.4
+ cd ..
+ mkdir spigot-1.8.8
+ cd spigot-1.8.8
+ java -jar ../BuildTools.jar –rev 1.8.8
+
+
+* **Updating BuildTools:** Once in a while you will be prompted to update the BuildTools.jar file. To do update it, all you need to do is to just download it, and replace the older one you were using.
+
+
+* **Updating the built servers:** Every once in a while, when you are starting a server, there may be a notification that the server software needs to be update. Just rerun the BuildTools for the same version within the original build directory. The build tools will update all of the changed resources and then generate the new server jars that you copy to the actual server (see the next step).
+
+
+
+
+
+
+# Creating a Runnable Spigot Server
+
+* Create a runnable server directory by creating a new directory outside of the build directory. Then copy the newly generated jar file, such as spigot-1.14.4.jar, to the new server run time directory.
+
+
+* Windows example, if you’re still in the build directory:
+
+ cd ../..
+ mkdir spigot-1.14.4_server
+ copy /B builds\spigot-1.14.4\spigot-1.14.4.jar spigot-1.14.4_server
+
+
+* Linux example, if you’re still in the build directory:
+
+ cd ../..
+ mkdir spigot-1.14.4_server
+ cp builds/spigot-1.14.4/spigot-1.14.4.jar spigot-1.14.4_server
+
+
+
+* Run the server for the first time (see the next step). It will start to auto-generate the server environment and then will stop. You will need to manually modify eula.txt and set eula=true. Save. Close. Restart the server. It will startup successfully now.
+
+
+* This is a simple example of what is needed for a windows cmd file. It sets the minimum memory to 2 GB and the max to 8 GB. A linux script would be similar, but without the pause.
+
+ java -Xms2g -Xmx8g -jar spigot-1.14.4.jar
+ pause
+
+* Let the server fully start for the first time, then stop it by entering “stop” in the open server console. The server is now ready to be customized.
+
+
+This should give you a functional server for which to run the Prison plugin.
+
+
+
+
+
+
+# Customizing your Server
+
+You can now customize the server, such as by adding plugins, etc...
+
+
+
+
+
+
+# Other Server Platforms
+
+The same general instructions apply to paper server, but the big difference is that you download the runnable paper jar file from https://papermc.io/downloads and then place them in to your server runtime directory, and then follow the steps under **Creating a Runnable Spigot Server** but use the resources for the other platform. Then run the same general startup scripts.
+
+
diff --git a/docs/prison_docs_012_setting_up_prison_basics.md b/docs/prison_docs_012_setting_up_prison_basics.md
new file mode 100644
index 000000000..b4d835409
--- /dev/null
+++ b/docs/prison_docs_012_setting_up_prison_basics.md
@@ -0,0 +1,162 @@
+
+### Prison Documentation
+[Prison Documents - Table of Contents](prison_docs_000_toc.md)
+
+## Setting up Prison - The Basics
+
+This document provides a quick overview on how to install Prison and get it running.
+
+
+
+
+
+# Dependencies
+
+* **None - No hard dependencies** - There are no hard dependencies for Prison.
+
+There may be no hard dependencies that will prevent Prison from running, but there are some core plugins that will make it easier to use. This short list is just a suggestion, but alternatives do exist and may be outside of our ability to comment or assist in their usage.
+
+
+* **Vault** - Optional, but STRONGLY Suggested - This is perhaps the most important plugin. This plugin provides a common way to access other plugins running on your server, but without having to write any code within Prison to support them. Vault provides the mapping of a plugin's unique APIs to a common Vault API. Vault helps support Economy, Permissions, and Placeholders. Because of Vault, Prison can work flawlessly with dozens of other plugins. Please refer to Vault's documentation for what it supports.
+
+
+* **EssentialsX** - Optional, but STRONGLY Suggested - Provides many of the basic commands and behaviors that you would expect from a Spigot server such as chat, warps, and even some moderation commands. EssentialsX is not Essentials, since Essentials is an older abandoned project, and EssentialsX is a forked project that is still maintained. Unfortunately, internally it is identified as simply Essentials, but you can tell it's EssentialsX if the version is greater than 2.15.x.
+
+
+* **EssentialsX Chat** - Optional - Enhanced Chat experience.
+
+
+* **EssentialsX Spawn** - Optional - Enhanced support for Spawns.
+
+
+* **A permissions plugin of your choice** - Required - Prison works with many different permission plugins through Vault. I strongly suggest LuckPerms since it is free and is under active development so bugs and performance issues will be addressed.
+ * Warning: LuckPerms v5.0.x crashes older versions of prison, such as V3.2.0 and earlier.
+ * Notice: Prison v3.2.1 (including the pre-release versions) supports all versions of LuckPerms.
+ * Strongly suggest using LuckPerms v5.0.x with latest pre-release version of Prison.
+
+
+* **PlaceholderAPI** - Used through Vault, it is free and provides the core interfaces in to the usage of placeholders. Prison also has a special integration setup for PlaceholderAPI to register all of the Prison placeholders dynamically upon startup. You do not need to download anything from the cloud for prison to work with this plugin.
+
+
+
+
+
+# Download Prison
+
+Download Prison from [spigotmc.org's Prison History Page](https://www.spigotmc.org/resources/prison.1223/history).
+
+
+Setting up Prison is simple:
+
+* Download Prison - Current Releases
+ - Go to the SpigotMC.org LuckPerm's resource page:
+ - [Prison Downloads](https://www.spigotmc.org/resources/prison.1223/history "Prison download can be found under the Version History tab")
+ - Click on the Version History tab
+ - Choose the version to download
+
+* **Download Prison's Pre-Release Version**
+ - Useful to access newer features and fixes
+ - You can usually find a build on the Discord Server:
+ - [Prison Discord Server](https://discord.gg/DCJ3j6r)
+
+* Copy to your server's plugin directory
+
+* Restart the server
+
+* Follow Prison's documentation on customization, but at this point it's ready for use.
+
+
+
+
+
+
+# Important Prison Information
+
+Upon starting up, Prison will display a lot of information in the server's console.
+This information is intended to help you configure and confirm that prison started
+correctly with all of the related resources that it is using. It also provides you
+with valuable information that is needed to help troubleshoot issues, if you should
+happen to encounter any.
+
+Some of the important details that are listed:
+* Versions of Prison, Spigot, and other plugins
+* Which modules were successfully loaded
+* The root commands that are available
+* The integration status of all related plugins that are supported
+* The list of active placeholders
+* Startup error messages, if any. Examples would be if a rank is configured to use a
+custom currency and that currency cannot be found in any economy.
+
+
+
+
+
+
+# Getting Help
+
+If you should run in to any questions or issues, please first review all online documentation first.
+
+
+If you cannot find what you need within the documentation, please visit our Discord server to get the quickest responses there.
+[Prison Discord Server](https://discord.gg/DCJ3j6r)
+
+
+In order to provide the best support, the prison startup screen provides most of the information that is needed to help trouble shoot your issues. Please take a screen print and provide on discord with a detailed explanation of the issue.
+
+
+
+If you do encounter an issue, and the startup information is requested, please include
+everything from the first line to the last. Please take a screen print and provide on
+discord with a detailed explanation of the issue. Include everything from:
+
+```
+ [16:21:30 INFO]: [Prison] Enabling Prison v3.2.1-alpha.13
+```
+
+through:
+
+```
+ [16:21:31 INFO]: | Prison | Prison - Finished loading.
+```
+
+
+
+# Prison Commands
+
+On the startup screen, prison shows all of the base commands that are active. From these commands, they will provide you with sub-listings of all the other commands.
+
+* **/prison**
+* **/mines**
+* **/ranks**
+* **/rankup**
+
+
+These commands are intended to run in game, but most can be ran from the system console. Sometimes the system console is easier to displays longer listings, such as **/mines list**. Also the console is better with wider text, and with easier to read text since it's not trying to display over a mc world.
+
+
+
+
+
+# Getting Started
+
+There is a lot to do get your server up and running. But here are some ideas on what to get started on first. It may even be a good idea to create a couple of small mines in an area that you have not spent much time with your final builds. Plan on creating a couple of test mines and ranks, then deleting them. You can quickly get a good understanding of how prison can be setup by playing around with a lot of the setting within a few minutes.
+
+
+Remember that the command **/prison version** will show all the available root level commands by the modules. Entering those commands will show all of the related sub commands.
+
+
+* Create a couple of small mines. About 10x10x5 blocks in size would work well. Above ground is easy too.
+* Play around with adding blocks, removing them, searching for blocks to add.
+* Try to resize the mines, and even deleting them.
+
+* Go ahead and create a couple of ranks.
+* Setup the permissions (see the WorldGuard and LuckPerms document for examples)
+* Add some simple permissions to the rank commands
+* Test the ranks and the /rankup commands.
+
+* To clean up, you can remove the test ranks (or keep them)
+* Remove the mines.
+
+
+
+
diff --git a/docs/prison_docs_013_Prison_Help.md b/docs/prison_docs_013_Prison_Help.md
new file mode 100644
index 000000000..caef5c56a
--- /dev/null
+++ b/docs/prison_docs_013_Prison_Help.md
@@ -0,0 +1,187 @@
+
+### Prison Documentation
+[Prison Documents - Table of Contents](prison_docs_000_toc.md)
+
+## Prison - Getting Help
+
+This document provides some important information on how to find help in setting up your prison server, and ultimately, how and where to ask for help.
+
+
+
+# Overview
+
+If you are having problem, please take a quick look at the following documents as found in the Table of Contents:
+
+* Setting up prison and various plugins - If special conditions for their configurations become apparent in order for prison to work, notes will be added there.
+* Review topics that may address your issue
+* At the end of the table of contents are some FAQs. Special situations may be added to them.
+* Known Issues & A TO DO List - This is also a TO DO list, but at the bottom are some known issues with prison.
+
+
+
+
+# General Information on Prison Commands
+
+All of the commands for Prison can be ran in-game, and most can be ran from the console. When running commands from the console, you do not have to prefix the commands with a **/**. But within these documents, all commands will be referenced with a prefixed **/** so it is clear that it's a command. Just don't include it when running within the console.
+
+Personal preference is to run the commands from the console since there are less restrictions on width or number of lines shown, and they are easier to see without the busy background of the game.
+
+Within most of these documents, the console will be used to screen print from for those reasons.
+
+The only commands that cannot be ran from the console are the commands that expect you to be an in-game player. Examples are **/mines whereami** and **/mines tp
+
+
+# Prison Commands and Using "help"
+
+It may be helpful to know what commands are available, and what options exist for those commands.
+
+Upon startup, prison lists many details about the environment, and one set of those details, are the base commands that are available within Prison. See the area pertaining to the modules, since the commands generally are tied to modules.
+
+
+
+
+
+Many commands within prison are compound commands, such that they start with a base command, followed by one or more other commands. When Prison lists the available commands, if there are sub commands, that information is included in the command listing, including the sub command count. For example:
+
+* **/mines**
+* **/mines set**
+* **/mines set spawn**
+
+If for a given set of commands, such as **/mines set**, has sub commands, then Prison will present a listing of all sub commands and their parameters.
+
+
+
+In this screen print, you can see the hierarchy of **/mines** and **/mines set**. The parameter listing is helpful, but it does not provide all the information that is available.
+
+Let's take a closer look at **/mines set notification** and how the **help** keyword can provide a lot more meaningful details. If you just enter that command, without any parameters, Prison reports an error message, depending upon which parameter failed. See the next screen print and the related *Error* message. It's not helpful in the least, especially if you are not certain what each parameter is supposed to be.
+
+
+
+
+But notice within the above screen print, the same command has been entered, but this time with the keyword **help** added as if it were the first parameter. For example, **/mines set notification help**. Prison recognizes that you are requesting help for that command, and then it displays all of the information it has for each parameter. Finally, that is truly help.
+
+
+Prison automatically inserts the **help** keyword if you enter the base commands. So **/mines** is really injecting the **help** keyword for you so it will generate the list. It's like you've entered **/mines help**.
+
+
+
+
+
+
+
+# Where to ask for help: The Prison Discord Server
+
+The best place to ask for help, and to get answers quickly (within a few hours) would be without a doubt the Prison Discord Server.
+
+[Prison Discord Server](https://discord.gg/DCJ3j6r)
+
+
+You can also submit a help ticket on the Prison github Issues tab, but the response may be slower and less detailed
+
+
+
+
+
+
+# Asking for Help
+
+Before you actually ask for help, take a look at some of the documents presented here. You may find your answer, or at least become a little more familiar with Prison. There is a good chance that if your question is a common one, then you will just be referred to this documentation anyway.
+
+When you do ask for help, please realize if you can provide a clear description of the problems you are experiencing, plus the versions of Prison, Spigot, etc, then we can help you faster and more accurately. To help provide you with answers to these questions, see the next section of this document for information on what you can copy and paste to provide all those much needed details.
+
+
+
+
+
+
+# Prison v3.2.1 and it's Pre-Release Versions
+
+
+The Prison startup screen contains a lot of information that can be used help identify issues that are detected by Prison on start up, and can provide useful information about the general environment. See the screen prints below.
+
+If you are having problems and need to ask for help, please provide all of this information when requested. Screen prints are preferred. When asked what versions of prison and platform that you are running, copying the following three lines is what is needed to answer that question:
+
+```
+[18:40:20 INFO]: | Prison | Loading Prison version: 3.2.1-alpha.12
+[18:40:20 INFO]: | Prison | Running on platform: SpigotPlatform
+[18:40:20 INFO]: | Prison | Minecraft version: git-Spigot-21fe707-e1ebe52 (MC: 1.8.8)
+```
+
+
+
+
+
+These screen prints may not contain the most recent enhancements to prison, since they are based upon an alpha release. Please see your server's console for details pertaining to your environment.
+
+
+
+
+
+
+# Prison v3.1.0 and Earlier - General Information
+
+There is zero support available for these earlier versions of Prison. It is therefore highly recommended that you upgrade to the latest release of Prison. Once a version of prison is released, we cannot go back and apply any fixes; fixes will be applied to the next release.
+
+
+My suggestions are based upon what I have seen within the code for Prison, and best guesses on how the older versions **may** have worked. These are guesses. Proceed carefully and make backups at each upgrade to ensure you can retry a step if something should go wrong. - Blue
+
+
+To upgrade prison, the process should be rather simple. But there are general steps that you must follow to help ensure a smoother transition to the latest release.
+
+
+It is highly suggested that you should first backup your whole server, especially the data within your plugins folder. Please be aware that upgrading Prison may require you to upgrade other pugins that you have, and those plugins may require other plugins to be upgraded.
+
+
+DO NOT just install the latest plugin(s) you find on the internet! Most plugins have specific versions of Spigot/Bukkit/Minecraft that they will work with! Get them only from trusted servers such as spigotmc.org, bukkit.org, or etc... Those sites should have multiple versions and should identify what server engines they are compatible with.
+
+
+If you want to also upgrade to a newer version of the server software that you are running, such as spigot, bukkit, paper, etc..., first upgrade the plugins for your current version of the server. So if you are running Spigot 1.8.8 and a plugin has a newer version available that works with 1.8.8, install that first and then start the server and make sure everything is working well. Usually if there is a major change in a plugin from one version to the next, the "last" version may have code to "convert" your data to prepare for the next higher version. If there is an important intermediate step that will convert your data, or require you to make major changes, there should be some notes in documents somewhere. Spending a few minutes reading the release notes on these websites could save you hours of work trying to recover from a messed up upgrade. Remember to make backups!
+
+
+Upgrading from Prison v3.2.0 to Prison v3.2.1
+
+If you are running Prison v3.2.0, then upgrading to v3.2.1, or it's pre-release editions, you don't have to take any special precautions other than backing up your server and the plugin's data folders.
+
+The internal files remain the same between these two versions. Version 3.2.1 has a lot of new additions to the internal file formats, but nothing will break if using v3.2.0 data with v3.2.1. Matter of fact, if for some reason, you want to down grade from v3.2.1 to v3.2.0 you can. Any new data elements from v3.2.1 will be lost if any of the data items are rewriting to the file system. If a mine is not modified, as an example, then it will not write the mine data back to the file system.
+
+
+Upgrading from Prison v3.1.1 to Prison v3.2.1 or Prison v3.2.0
+
+Upgrading from Prison v3.1.1 to either Prison v3.2.0 or Prison v3.2.1 requires no special procedures or processes. The internal file formats are pretty close to being the same that it should work with no problems. Just make sure you perform a backup of the server and the plugins data folders to provide that extra level of insurance and protection.
+
+
+It is inadvisable to try to down grade to Prison v3.1.1 if running Prison v3.2.0 or later. It may work, but there could possibly be potential internal failures due to the addition of the new fields. If you try to do this, you assume all risks and no help will be provided.
+
+
+Upgrading from v3.0.0 to Newer Versions of Prison
+
+Honestly I cannot advise you on actual steps to take, since I do not know what file formats were used with v3.0.0. I suspect they are compatible 100% with v3.1.1. If this is true, you can just jump to Prison v3.2.1 with no problems.
+
+If there is an incompatibility, then its strongly suggested that you upgrade to v3.1.1 first and let it perform its own conversions, then shut down the server carefully. If it is not shutdown cleanly, then the data files will not be saved to the file system. Once you update to v3.1.1 then you can update to v3.2.1 without any issues.
+
+
+
+
+Upgrading from Earlier Versions Prior to v3.0.0
An instance of Prison can be retrieved using the static * {@link Prison#get()} method, however in order to use the core libraries, you must call @@ -48,19 +49,34 @@ * @author Faizaan A. Datoo * @since API 1.0 */ -public class Prison implements PluginEntity { - +public class Prison + implements PluginEntity { + + /** + *
This is not exactly a Prison module, but it's name is used within + * the LocaleManager to correct the generation of an incorrect directory + * path for the locale language files for this "core" module. Basically + * this provides consistency in the location of all language files that + * the admins can easily edit and know where to find them. + *
+ * + */ + public static final String PSEDUO_MODLE_NAME = "core"; + public static final int SPIGOTMC_ORG_PROJECT_ID = 1223; //72740; // Singleton public static final int API_LEVEL = 3; private static Prison instance = null; + + private String minecraftVersion; // Fields private Platform platform; private File dataFolder; private ModuleManager moduleManager; + private PrisonCommand prisonCommands; private CommandHandler commandHandler; private SelectionManager selectionManager; private EventBus eventBus; @@ -92,50 +108,69 @@ public static Prison get() { *
* Note that modules should not call this method. This is solely for the implementations.
*/
- public boolean init(Platform platform) {
+ public boolean init(Platform platform, String minecraftVersion) {
long startTime = System.currentTimeMillis();
this.platform = platform;
+ this.minecraftVersion = minecraftVersion;
+
sendBanner();
- Output.get().logInfo("Enable start...");
+ Output.get().logInfo("Enabling and starting...");
// Initialize various parts of the API. The magic happens here :)
if (!initDataFolder()) {
+ Output.get().logInfo("&cFailure: &eInitializing the Prison Data Folders!" );
+ Output.get().logInfo("&e&k!=&d Prison Plugin Terminated! &e&k=!&7" );
return false;
}
initManagers();
if (!initMetaDatabase()) {
+ Output.get().logInfo("&cFailure: &eInitializing the Prison Database!" );
+ Output.get().logInfo("&e&k!=&d Prison Plugin Terminated! &e&k=!&7" );
return false;
}
Alerts.getInstance(); // init alerts
- this.commandHandler.registerCommands(new PrisonCommand());
+ this.prisonCommands = new PrisonCommand();
+ this.commandHandler.registerCommands(prisonCommands);
+ long stopTime = System.currentTimeMillis();
+
Output.get()
.logInfo("Enabled &3Prison v%s in %d milliseconds.", getPlatform().getPluginVersion(),
- (System.currentTimeMillis() - startTime));
+ (stopTime - startTime));
registerInbuiltTroubleshooters();
if (getPlatform().shouldShowAlerts())
scheduleAlertNagger();
-
+
+
+ // Disabled for now. The integrations cannot properly support this yet.
+// List This class contains the data that is used to log the plugins, commands, and their aliases,
+ * that may be setup on the server. This is setting the ground work to store the command
+ * data that can be used to trouble shoot complex problems, such as conflicts, that are
+ * occuring with the prison plugin.
+ * This is just the data, and does not interact, or modify, any of the other commands.
+ * 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.
+ * This command does not do anything, except to provide a command placeholder to
+ * make owners aware that there is auto features enabled within prison.
+ * Running this command will show the permissions needed to use these auto features.
+ * Cannot use the @Command altPermissions parameter since the permissions can be
+ * dynamically altered to fit the needs of the owner's server. Using the command
+ * altPermissions will also require a server restart to reflect any online changes,
+ * not to mention a recompile since the end users cannot make these changes.
+ * Get a String message from the FileConfiguration, and if the key
+ * does not exist, return the default value associated with the enum
+ * entry, if it does not exist, then it returns a blank string value.
+ *
+ *
+ * @param conf
+ * @return
+ */
+ public String getMessage( Map Get's the boolean value from the FileConfiguration, and if the key
+ * does not exist, then it returns the default value associated with the
+ * enum entry, if it does not exist, then it returns false.
+ * @param conf
+ * @return
+ */
+ public boolean getBoolean( Map Get the children nodes to the given item.
+ * Get the children for the specified node.
+ * This updates AutoFeatures with a String value.
+ * This updates AutoFeatures with a boolean value.
+ * This function attempts to save the AutoFeatures configurations to the
+ * file system. This function uses a temporary file to initially perform the save,
+ * then when it is successfully finished, it then deletes the original file, and
+ * renames the temp file to the correct file name. This swapping of files
+ * will prevent the loss of configuration data if something should go wrong in the
+ * initial saving of the data since the original file will not be deleted first.
+ * This function loads a yaml file based upon the AutoFeatures enumeration.
+ * It loads the proper ValueNode based upon the defined value within the
+ * enum. If there is a property that does not exist within the yaml file,
+ * it will add it to the config object with the default value, plus it will
+ * return a list of all features that do not exist (dne). If any new settings
+ * are added to the configuration uploading (ie. new features), then it will
+ * trigger a save to update the file so the new features will exist in there.
+ * This way, if the dne List is not empty, then it needs to be saved to
+ * update what is saved on the file system. Only the new items, with the
+ * default values, will be added; the original values will not be altered.
+ * This is a way for an integration to provide additional information when the
+ * integration is displayed through the /prison version command. This may vary
+ * from integration to integration, or by type. It is perfectly valid for it
+ * to return a null value, which indicates there is nothing available, so ignore
+ * this.
+ * To help admins setup integrations, this is the URL that is generally associated
+ * with the integration. It should usually refer to the spigotmc.org website for
+ * that resource.
+ * This class provides for most of the default implementations for the
+ * Integration interface, and sets up some of the expected core behaviors.
+ * The given place holders should have both the prison prefix and without,
+ * with the without having the suppress value set. The suppressable items
+ * will not always be displayed since it would be implied that the prefix
+ * would have been provided.
+ * Update: The placeholders without the prison prefix have been eliminated
+ * since the prefix is now prepended when it is missing prior to matching to a
+ * valid placeholder enum. This cuts the number of generated placeholders in half.
+ * This is significant since with the addition of the aliases there would be about
+ * 744 placeholders generated if the prison had 30 mines setup! Now a 30 mine prison
+ * would have about 372.
+ * Note: In order to use these placeholders with something like holographic display
+ * you need to also include the placeholderAPI,
+ * plugin holographic extension and protocolib.
+ * In order to get the holographics extension to work it is critical you read
+ * their spigot page since you have to specify a refresh speed.
+ * This function uses the settings within the config.yml to construct a progress
+ * bar. It takes two numeric values and constructs it upon those parameters.
+ * The parameter The lowest range is always zero and If the progress bar is moving in the wrong direction, then set the parameter
+ * Bukkit.getPluginManager().isPluginEnabled()
. If the
+ * the given integration has not been registered, then it could be dangerous tying to
+ * access the class files associated with that plugin since it could result in
+ * class not found exceptions, or similar. Some plugins may have the same identifier,
+ * but yet different internal classes depending upon their versions, such as LuckPerms,
+ * so additional code must be used to verify what is actually loaded. Of course there
+ * are always exceptions to the rules too.
+ *
+ * @return true if the requested plugin has been registered with the server engine
+ */
+ public boolean isRegistered();
+
+ /**
+ * Used to identify if the integration (plugin) has been registered with the server
+ * engine.
+ *
+ * @param registered
+ */
+ public void setRegistered( boolean registered );
+
+ /**
* Returns the type of integration that this class provides.
*
* @return The {@link IntegrationType}.
*/
- IntegrationType getType();
+ public IntegrationType getType();
/**
- * Returns the name of the third-party plugin that this class is integrating with.
+ * Returns true if this class has integrated with the provider successfully, or false
+ * otherwise. This should also return false if the third-party plugin which this
+ * integration is built for is not present. This is not the same as isRegistered,
+ * since a few integrations may have different class files backing it (such as LuckPerms).
*
- * @return The name of the provider.
+ * @return true if this class has integrated successfully, false otherwise.
+ */
+ public boolean hasIntegrated();
+
+
+ /**
+ * The function that is called to perform the integration. Generally the check is done
+ * prior to calling this function, but may vary. The attempt at integration used to be
+ * performed in the constructor, but but that prevents storing the failed integrations
+ * which can then be used to inform the admins what's available. If the integration
+ * was successful, then hasIntegrated() will return a value of true.
+ */
+ public void integrate();
+
+ /**
+ * Returns the name of the internal representation that should be used for this integrator.
+ * It may not always be the same as providerName, but in most circumstances it will be.
+ * It's important that this keyName should be unique from any other integration keyName.
+ * For example, since there are two major kinds of LuckPerms that are supported,
+ * these should reflect which one is which. This field is used internally within
+ * collections and for display purposes when listing integrations so it should be
+ * more descriptive than the providerName.
*/
- String getProviderName();
+ public String getKeyName();
/**
- * Returns true if this class has integrated with the provider successfully, or false otherwise.
- * This should also return false if the third-party plugin which this integration is built for is not present.
+ * Returns the name of the third-party plugin that this class is integrating with. This
+ * must be exactly what is provided in the plugin's plugin.yml
file that
+ * is within the given jar files for the field called name:
.
*
- * @return true if this class has integrated successfully, false otherwise.
+ * @return The name of the provider.
*/
- boolean hasIntegrated();
-
+ public String getProviderName();
+
+ /**
+ * The displayName is the value that is actually used when listing all the integrations.
+ * In general it is the combination of both the providerName and the keyName, but
+ * different integrations could customize it to better suite their unique requirements,
+ * such as with Vault.
+ *
+ * @return
+ */
+ public String getDisplayName();
+
+ /**
+ *
+ * /hd addline temp2 Mine Size: {slowest}{prison_mines_blocks_size_temp2}
+ * or
+ * /hd addline temp2 Mine Size: {slowest}{prison_mines_blocks_size_temp2}
+ * /hd addline temp2 Mine Size: {slowest}%prison_mines_blocks_size_temp2%
+ *
+ *
+ * https://dev.bukkit.org/projects/holographic-displays
+ * https://www.spigotmc.org/resources/placeholderapi.6245/
+ * https://www.spigotmc.org/resources/protocollib.1997/
+ * https://www.spigotmc.org/resources/holographicextension.18461/
+ */
+ public enum PrisonPlaceHolders {
+
+ no_match__(PlaceHolderFlags.SUPRESS),
+
+ // Rank aliases:
+ prison_r(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS),
+ prison_rt(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS),
+ prison_rc(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS),
+ prison_rcp(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS),
+ prison_rcb(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS),
+ prison_rcr(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS),
+ prison_rr(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS),
+ prison_rrt(PlaceHolderFlags.PLAYER, PlaceHolderFlags.ALIAS),
+
+
+ prison_rank(prison_r, PlaceHolderFlags.PLAYER),
+ prison_rank_tag(prison_rt, PlaceHolderFlags.PLAYER),
+ prison_rankup_cost(prison_rc, 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_rank(prison_rr, PlaceHolderFlags.PLAYER),
+ prison_rankup_rank_tag(prison_rrt, PlaceHolderFlags.PLAYER),
+
+
+ // Ladder aliases:
+ prison_r_laddername(PlaceHolderFlags.LADDERS, PlaceHolderFlags.ALIAS),
+ prison_rt_laddername(PlaceHolderFlags.LADDERS, PlaceHolderFlags.ALIAS),
+ prison_rc_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_rr_laddername(PlaceHolderFlags.LADDERS, PlaceHolderFlags.ALIAS),
+ prison_rrt_laddername(PlaceHolderFlags.LADDERS, PlaceHolderFlags.ALIAS),
+
+
+ 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_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_rank_laddername(prison_rr_laddername, PlaceHolderFlags.LADDERS),
+ prison_rankup_rank_tag_laddername(prison_rrt_laddername, PlaceHolderFlags.LADDERS),
+
+
+ // Mine aliases:
+ prison_mi_minename(PlaceHolderFlags.MINES, PlaceHolderFlags.ALIAS),
+ prison_mif_minename(PlaceHolderFlags.MINES, PlaceHolderFlags.ALIAS),
+ prison_mtl_minename(PlaceHolderFlags.MINES, PlaceHolderFlags.ALIAS),
+ prison_mtlb_minename(PlaceHolderFlags.MINES, PlaceHolderFlags.ALIAS),
+ prison_mtlf_minename(PlaceHolderFlags.MINES, PlaceHolderFlags.ALIAS),
+ prison_ms_minename(PlaceHolderFlags.MINES, PlaceHolderFlags.ALIAS),
+ prison_mr_minename(PlaceHolderFlags.MINES, PlaceHolderFlags.ALIAS),
+ prison_mrb_minename(PlaceHolderFlags.MINES, PlaceHolderFlags.ALIAS),
+ prison_mp_minename(PlaceHolderFlags.MINES, PlaceHolderFlags.ALIAS),
+ prison_mpc_minename(PlaceHolderFlags.MINES, PlaceHolderFlags.ALIAS),
+ prison_mbm_minename(PlaceHolderFlags.MINES, PlaceHolderFlags.ALIAS),
+ prison_mrc_minename(PlaceHolderFlags.MINES, PlaceHolderFlags.ALIAS),
+
+
+ // reset_interval, reset_timeleft, blocks_size, blocks_remaining, blocks_percent
+ // player_count
+ // NOTE: Remove PrisonPlaceHolderFlags.SUPRESS when ready to be used:
+ 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),
+ prison_mines_timeleft_bar_minename(prison_mtlb_minename, PlaceHolderFlags.MINES),
+ prison_mines_timeleft_formatted_minename(prison_mtlf_minename, PlaceHolderFlags.MINES),
+ prison_mines_size_minename(prison_ms_minename, PlaceHolderFlags.MINES),
+ prison_mines_remaining_minename(prison_mr_minename, PlaceHolderFlags.MINES),
+ prison_mines_remaining_bar_minename(prison_mrb_minename, PlaceHolderFlags.MINES),
+ prison_mines_percent_minename(prison_mp_minename, PlaceHolderFlags.MINES),
+ prison_mines_player_count_minename(prison_mpc_minename, PlaceHolderFlags.MINES),
+ prison_mines_blocks_mined_minename(prison_mbm_minename, PlaceHolderFlags.MINES),
+ prison_mines_reset_count_minename(prison_mrc_minename, PlaceHolderFlags.MINES),
+
+
+
+ // PlayerMine aliases:
+ prison_mi_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS),
+ prison_mif_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS),
+ prison_mtl_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS),
+ prison_mtlb_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS),
+ prison_mtlf_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS),
+ prison_ms_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS),
+ prison_mr_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS),
+ prison_mrb_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS),
+ prison_mp_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS),
+ prison_mpc_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS),
+ prison_mbm_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS),
+ prison_mrc_pm(PlaceHolderFlags.PLAYERMINES, PlaceHolderFlags.ALIAS),
+
+
+ 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),
+ prison_mines_timeleft_bar_playermines(prison_mtlb_pm, PlaceHolderFlags.PLAYERMINES),
+ prison_mines_timeleft_formatted_playermines(prison_mtlf_pm, PlaceHolderFlags.PLAYERMINES),
+ prison_mines_size_playermines(prison_ms_pm, PlaceHolderFlags.PLAYERMINES),
+ prison_mines_remaining_playermines(prison_mr_pm, PlaceHolderFlags.PLAYERMINES),
+ prison_mines_remaining_bar_playermines(prison_mrb_pm, PlaceHolderFlags.PLAYERMINES),
+ prison_mines_percent_playermines(prison_mp_pm, PlaceHolderFlags.PLAYERMINES),
+ prison_mines_player_count_playermines(prison_mpc_pm, PlaceHolderFlags.PLAYERMINES),
+ prison_mines_blocks_mined_playermines(prison_mbm_pm, PlaceHolderFlags.PLAYERMINES),
+ prison_mines_reset_count_playermines(prison_mrc_pm, PlaceHolderFlags.PLAYERMINES),
+
+
+
+ ;
+
+
+ private final PrisonPlaceHolders alias;
+ private final Listvalue
is the value that changes, and is the value that
+ * sets where the bar changes. The parameter valueTotal
is the max value
+ * of where the value
is increasing to.
+ * value
will be set to zero if
+ * it is negative. If value
is greater than valueTotal
+ * then it will be set to that value. The valid range for this function is only 0 percent
+ * to 100 percent.
+ * reverse
to true and then the value
will be inverted by subtracting
+ * its value from valueTotal
.
+ *
This function formats all the Integrations, both active and inactive, to be displayed + * to a user, or sent to the server logs. This function returns a List to provide a + * degree of flexibility in where it is being used, without this container + * (The integration manager) having to know where the data will be used. This function + * keeps the business logic of relationship of integrations to Integration Types + * internal so as to no leak that knowledge out of this function. + *
+ * + * @return + */ + public ListWorldGuard Integration is needed because there are two major versions of + * WorldGuard and WorldEdit that needs to be supported. This is required due + * to the wide range of spigot versions that are supported. + *
+ * + *The two different versions WorldGuard, and WorldEdit, may have different + * command sets and parameters, not to mention different class names and + * possibly different package names too. So these integrations are to + * provide a common interface in to any platform, and any version. Hopefully! lol + *
+ * + *Version 6.x is for minecraft versions 1.12.2 and below.
+ * + *Version 7.x is for minecraft versions 1.13.0 and up. + *
+ * + *It is stated that minecraft implementations for spigot have significant + * changes from one version to the next, so one version of WorldEdit and + * WorldGuard may not support any of the older versions. Due to these restrictions + * and warnings, carefully make sure you download the version of WorldGuard and + * WorldEdit that matches the server you are running. All v6.x are not the same, nor + * are all v7.x the same. The best we can do is to make sure you are using the + * correct major version for the version of minecraft that you are running on + * your server; the correct minor version is on you to get correct. + *
+ * + */ +public class WorldGuardIntegration + extends IntegrationCore { + + private boolean integrated = false; + + public WorldGuardIntegration( String keyName, String providerName ) { + super( keyName, providerName, IntegrationType.WORLDGUARD ); + } + + public boolean isIntegrated() { + return integrated; + } + public void setIntegrated( boolean integrated ) { + this.integrated = integrated; + } + + +} diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/CommandSender.java b/prison-core/src/main/java/tech/mcprison/prison/internal/CommandSender.java index 8e88a7142..4f4b3af36 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/CommandSender.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/CommandSender.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 @@ -73,5 +73,8 @@ public interface CommandSender { * @param json The JSON message. Must be in proper format. */ void sendRaw(String json); + + + public boolean isOp(); } diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/ItemStack.java b/prison-core/src/main/java/tech/mcprison/prison/internal/ItemStack.java index 22e33680c..a4c5d9ee5 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/ItemStack.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/ItemStack.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/OfflineMcPlayer.java b/prison-core/src/main/java/tech/mcprison/prison/internal/OfflineMcPlayer.java new file mode 100644 index 000000000..6f99e3da0 --- /dev/null +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/OfflineMcPlayer.java @@ -0,0 +1,29 @@ +package tech.mcprison.prison.internal; + +import java.util.UUID; + +public interface OfflineMcPlayer + extends Player { + /** + * Returns the unique identifier for this player. + */ + UUID getUUID(); + + /** + * Returns the player's display name (nickname), which may include colors. + */ + String getDisplayName(); + + /** + * Sets the player's display name (nickname). + * + * @param newDisplayName The new display name. May include colors, amp-prefixed. + */ + void setDisplayName(String newDisplayName); + + /** + * @return Returns true if the player is online, false otherwise. + */ + boolean isOnline(); + +} 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 c359145be..75a3afcf6 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 @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/Scheduler.java b/prison-core/src/main/java/tech/mcprison/prison/internal/Scheduler.java index 5bffb46fe..7eea4e1c3 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/Scheduler.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/Scheduler.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/World.java b/prison-core/src/main/java/tech/mcprison/prison/internal/World.java index 74ab75a12..9921126e7 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/World.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/World.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 @@ -18,11 +18,11 @@ package tech.mcprison.prison.internal; +import java.util.List; + import tech.mcprison.prison.internal.block.Block; import tech.mcprison.prison.util.Location; -import java.util.List; - /** * Represents a world on the Minecraft server. * @@ -36,7 +36,7 @@ public interface World { */ String getName(); - /** + /**O * Returns a list of all the players in this world. */ ListThis class embodies the nature of the block and different behaviors, if + * they exist. + *
+ * + */ +public class PrisonBlock { + private String blockName; + + private double chance; + + private boolean valid = true; + private boolean mineable = true; + + private boolean legacyBlock = false; + + public PrisonBlock( String blockName ) { + this( blockName, 0); + } + + public PrisonBlock( String blockName, double chance ) { + super(); + + this.blockName = blockName; + this.chance = chance; + } + + public String getBlockName() { + return blockName; + } + public void setBlockName( String blockName ) { + this.blockName = blockName; + } + + public double getChance() { + return chance; + } + public void setChance( double chance ) { + this.chance = chance; + } + + public boolean isValid() { + return valid; + } + public void setValid( boolean valid ) { + this.valid = valid; + } + + public boolean isMineable() { + return mineable; + } + public void setMineable( boolean mineable ){ + this.mineable = mineable; + } + + /** + *This value isLegacyBlock indicates that there was not a direct match + * with the stored (saved) name of the block, and list of valid block types + * for the server. In order to find a successful match, had to use the + * obsolete BlockType to make a connection to the valid block types. + *
+ * + *If this value is set to true, it only has a purpose during the loading + * of the mine when the server is starting up. If it is set to true, then it + * indicates that the block name that was saved to disk is not directly translatable + * to a valid block type, and therefore once the mine is loaded, if any of the + * blocks have this set, then the mine must be saved to store the + * correct block name. The next time it is loaded, it will not have to + * fall back to the legacy BlockType for a conversion. + *
+ * + * @return + */ + public boolean isLegacyBlock() { + return legacyBlock; + } + public void setLegacyBlock( boolean legacyBlock ) { + this.legacyBlock = legacyBlock; + } + +} 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 new file mode 100644 index 000000000..3bcf90bbf --- /dev/null +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/block/PrisonBlockTypes.java @@ -0,0 +1,56 @@ +package tech.mcprison.prison.internal.block; + +import java.util.ArrayList; +import java.util.List; + +import tech.mcprison.prison.Prison; + +/** + *This class is a new way of dealing with blocks within prison. + * All blocks will be stored and used as string values. + *
+ * + */ +public class PrisonBlockTypes { + + private ListThis event monitors the loading of worlds. During the loading of mines, not + * all worlds may be loaded yet, so we need to monitor when they come online + * so we can hook them up to the mines. + *
+ * + *At this point in time, all we need to know is the world name when it loads. + * All other uses of the world can go through the standard procedures since + * it will then be fully loaded. The key is knowing when the world is avialble + * for use. + *
+ * + */ +public class PrisonWorldLoadEvent { + + private String worldName; + + public PrisonWorldLoadEvent(String worldName) { + super(); + + this.worldName = worldName; + } + + public String getWorldName() { + return worldName; + } + public void setWorldName( String worldName ) { + this.worldName = worldName; + } + +} diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/AnvilInventory.java b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/AnvilInventory.java index 297491411..8610602c5 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/AnvilInventory.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/AnvilInventory.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/BeaconInventory.java b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/BeaconInventory.java index 07e86ed21..5367e2be2 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/BeaconInventory.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/BeaconInventory.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/BrewerInventory.java b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/BrewerInventory.java index 1ad58b063..9d601a0d4 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/BrewerInventory.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/BrewerInventory.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/CraftingInventory.java b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/CraftingInventory.java index 9012f4ebb..3cb8b8cc2 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/CraftingInventory.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/CraftingInventory.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/DoubleChestInventory.java b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/DoubleChestInventory.java index 51ebfaa8b..33478166d 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/DoubleChestInventory.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/DoubleChestInventory.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/EnchantingInventory.java b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/EnchantingInventory.java index 0d69cd9ec..8cc72e4eb 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/EnchantingInventory.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/EnchantingInventory.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/FurnaceRecipe.java b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/FurnaceRecipe.java index 5402875d5..d38fd8adb 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/FurnaceRecipe.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/FurnaceRecipe.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/Inventory.java b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/Inventory.java index 9d9003806..1aa117814 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/Inventory.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/Inventory.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/InventoryHolder.java b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/InventoryHolder.java index 41b3f572b..16e40a61a 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/InventoryHolder.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/InventoryHolder.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/InventoryType.java b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/InventoryType.java index 48dcbb6c1..d1bc54828 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/InventoryType.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/InventoryType.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/PlayerInventory.java b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/PlayerInventory.java index ec97c31a1..723b4b11d 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/PlayerInventory.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/PlayerInventory.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/Recipe.java b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/Recipe.java index e894aeab5..734c550ce 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/Recipe.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/Recipe.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/ShapedRecipe.java b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/ShapedRecipe.java index 045471a71..73cee8c90 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/ShapedRecipe.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/ShapedRecipe.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/ShapelessRecipe.java b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/ShapelessRecipe.java index 147daf2af..883aed4f2 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/ShapelessRecipe.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/ShapelessRecipe.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/Viewable.java b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/Viewable.java index 958df5498..759268132 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/Viewable.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/inventory/Viewable.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/package-info.java b/prison-core/src/main/java/tech/mcprison/prison/internal/package-info.java index bcddaa1a7..479705078 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/package-info.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/package-info.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/platform/Capability.java b/prison-core/src/main/java/tech/mcprison/prison/internal/platform/Capability.java index bd8c6013e..bbf871610 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/platform/Capability.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/platform/Capability.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/internal/platform/IncapableException.java b/prison-core/src/main/java/tech/mcprison/prison/internal/platform/IncapableException.java index e7d04b9df..c29b09285 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/internal/platform/IncapableException.java +++ b/prison-core/src/main/java/tech/mcprison/prison/internal/platform/IncapableException.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 @@ -25,8 +25,9 @@ * @since API 1.0 */ public class IncapableException extends RuntimeException { - - private Capability capability; + private static final long serialVersionUID = 1L; + + private Capability capability; public IncapableException(Capability capability) { this.capability = capability; 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 f4a60b486..4a4b8f4b7 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 @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 @@ -18,21 +18,26 @@ package tech.mcprison.prison.internal.platform; +import java.io.File; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; + 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; import tech.mcprison.prison.internal.Scheduler; import tech.mcprison.prison.internal.World; +import tech.mcprison.prison.internal.block.PrisonBlock; import tech.mcprison.prison.internal.scoreboard.ScoreboardManager; +import tech.mcprison.prison.output.ChatDisplay; import tech.mcprison.prison.store.Storage; import tech.mcprison.prison.util.Location; -import java.io.File; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.UUID; - /** * Represents an internal platform that Prison has been implemented for. * The internal platform is responsible for connecting Prison's APIs to the underlying server API. @@ -48,6 +53,18 @@ public interface Platform { */ OptionalThis function allows the PrisonCommand to get a list of any possible world + * load failures. + *
+ * + * @param display + * @return + */ + public void getWorldLoadErrors( ChatDisplay display ); + + /** * Returns the player with the specified name. */ @@ -63,6 +80,12 @@ public interface Platform { */ ListThis class uses Jackson's YAML databind tools to + * read and write to yaml configuration files. + *
+ * + *What makes this different, is that the yaml is built + * upon a hierarchy, but when loaded, it must be flattened + * using dot notation to represent the levels within the + * key. + *
+ * + *Since values of the various properties can have + * different types, internally the Jackson's ValueNode object + * is used since it is extended to contain various kinds of + * values. See list: + *
+ * + *Possible ValueNodes values: + *
+ *Collections based nodes that extend from ValueNode: + *
+ *This function will read a yaml file, which loads as a hierarchical +// * map. Then it will flatten the hierarchical map and return it. +// *
+// * +// * +// * @param file +// */ +// public MapThis function will write a flat map to a yaml file after it +// * expands it to an hierarchical map, expanding the key values on +// * their periods. +// *
+// * +// * @param file Target file to save to +// * @param map A flat map of all the configs +// */ +// public void writeYamlConfigFile( File file, MapThis takes a flat map and expands the keys, breaking on the periods, +// * and builds a multi-level hierarchy. +// *
+// * +// * @param map Flat map +// * @return Hierarchical map +// */ +// private MapThe Prison core is not truly a Prison module, so the targetPath that is passed to this function + * is not correctly setup to place the core/lang directory in the correct place. It will try + * to put it in /plugins/Prison/lang which is wrong. This function detects this error and + * will regenerate the targetPath to be /plugins/Prison/module_conf/core/lang. + *
+ * + *Note: There is a unit test that is ran by the gradle build process that hits this + * function. At the time, the value of PrisonAPI.getModuleManager() is null due to the unit test, + * therefore the following function is using static functions to ensure there is not a + * null pointer exception thrown. The unit test does not do anything with the content of + * these directories, but it still hits these functions, so allowing it to proceed, even if the + * paths are incorrect, will have no impact on anything. + *
+ * + * @param targetPath + * @return The corrected targetPath for the core plugin + */ + private File fixPrisonCoreLanguagePath( File targetPath ) { + if ( !targetPath.getAbsolutePath().startsWith( + ModuleManager.getModuleRootDefault().getAbsolutePath() ) ) { + targetPath = Module.setupDataFolder( Prison.PSEDUO_MODLE_NAME ); + } + return targetPath; + } + + private void extractShippedLocales( File targetPath ) { + + targetPath = fixPrisonCoreLanguagePath( targetPath ); + + CodeSource cs = getOwningPlugin().getClass().getProtectionDomain().getCodeSource(); + if (cs != null) { + try { + URL jar = cs.getLocation(); + ZipInputStream zip = new ZipInputStream(jar.openStream()); + ZipEntry entry; + while ((entry = zip.getNextEntry()) != null) { + String entryName = entry.getName(); + + if (entryName.startsWith(internalPath) && entryName.endsWith(".properties")) { + + String[] arr = entryName.split("/"); + String localeName = arr[arr.length - 1]; + + File newLocal = new File( targetPath, localeName ); + + BufferedInputStream inStream = new BufferedInputStream( zip ); + try ( + OutputStream outStream = Files.newOutputStream( newLocal.toPath(), + StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE ); + ) { + copyStreams( inStream, outStream) ; + } + } + + } + } catch (IOException ex) { + throw new RuntimeException( + "Failed to initialize LocaleManager for plugin " + getOwningPlugin() + + " - Prison cannot continue to load.", ex); + } + } else { + throw new RuntimeException("LocalManager.extractShippedLocales(): " + + "Failed to load code source for plugin " + getOwningPlugin() + + " - Prison cannot continue to load."); + } + + } + + private void copyStreams(InputStream inStream, OutputStream outStream) + throws IOException { + byte[] buf = new byte[8192]; + int length; + while ((length = inStream.read(buf)) > 0) { + outStream.write(buf, 0, length); + } + } + + private void loadShippedLocales() { CodeSource cs = getOwningPlugin().getClass().getProtectionDomain().getCodeSource(); if (cs != null) { @@ -181,6 +284,7 @@ private void loadShippedLocales() { } private void loadLocale(String name, InputStream is, boolean printStackTrace) { + try { Properties temp = new Properties(); temp.load(is); diff --git a/prison-core/src/main/java/tech/mcprison/prison/localization/package-info.java b/prison-core/src/main/java/tech/mcprison/prison/localization/package-info.java index f23816076..0eb959ae4 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/localization/package-info.java +++ b/prison-core/src/main/java/tech/mcprison/prison/localization/package-info.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/modules/Module.java b/prison-core/src/main/java/tech/mcprison/prison/modules/Module.java index 6b9b08d3b..131683eeb 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/modules/Module.java +++ b/prison-core/src/main/java/tech/mcprison/prison/modules/Module.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 @@ -18,12 +18,11 @@ package tech.mcprison.prison.modules; +import java.io.File; + import tech.mcprison.prison.Prison; -import tech.mcprison.prison.PrisonAPI; import tech.mcprison.prison.error.ErrorManager; -import java.io.File; - /** * Represents a module, which is a part of Prison that can be enabled and * disabled independently from the rest of the modules. @@ -57,16 +56,42 @@ public abstract class Module implements PluginEntity { public Module(String name, String version, int target) { this.name = name; this.version = version; - this.dataFolder = new File(PrisonAPI.getModuleManager().getModuleRoot(), - name.toLowerCase().replace(" ", "_")); this.apiTarget = target; + + this.dataFolder = setupDataFolder( name ); + this.status = new ModuleStatus(); - if (!this.dataFolder.exists()) { - this.dataFolder.mkdir(); - } this.errorManager = new ErrorManager(this); } + + public static File setupDataFolder( String name ) { + File dataFolder = new File(ModuleManager.getModuleRootDefault(), + name.toLowerCase().replace(" ", "_")); + if (!dataFolder.exists()) { + dataFolder.mkdir(); + } + return dataFolder; + } + + /** + *The getBaseCommands() should return all of the base commands that + * would apply to the module. It should include the / as in /mines or + * the /ranks command. It should be viewed as being ran from in game + * to be consistent. + *
+ * + *An example of what this would return would be: + *
+ * + *Displays the associated test based upon the three combinations + * of status codes. + *
+ * + * @return + */ + public String getStatusText() { + return (getStatus() == ModuleStatus.Status.ENABLED ? + "&2Enabled" : + (getStatus() == ModuleStatus.Status.FAILED ? + "&cFailed" : "&9&m-Disabled-" )); + } + + /* * Getters & Setters */ @@ -89,6 +104,14 @@ public String getMessage() { public void setMessage(String message) { this.message = message; } + + public void addMessage(String message) { + if ( this.message == null ) { + setMessage(message); + } else { + setMessage( getMessage() + ". " + message); + } + } public enum Status { ENABLED, DISABLED, FAILED diff --git a/prison-core/src/main/java/tech/mcprison/prison/modules/PluginEntity.java b/prison-core/src/main/java/tech/mcprison/prison/modules/PluginEntity.java index c27cc7602..03b3da3f6 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/modules/PluginEntity.java +++ b/prison-core/src/main/java/tech/mcprison/prison/modules/PluginEntity.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/modules/package-info.java b/prison-core/src/main/java/tech/mcprison/prison/modules/package-info.java index 86de0ce4a..7f8fdba95 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/modules/package-info.java +++ b/prison-core/src/main/java/tech/mcprison/prison/modules/package-info.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/output/BulletedListComponent.java b/prison-core/src/main/java/tech/mcprison/prison/output/BulletedListComponent.java index 9f3b62aab..82941c26d 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/output/BulletedListComponent.java +++ b/prison-core/src/main/java/tech/mcprison/prison/output/BulletedListComponent.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 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 462e6b481..8d3bc8e72 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 @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 @@ -74,5 +74,12 @@ public void send(CommandSender sender) { component.send(sender); } } + + public void toLog(LogLevel logLevel) { + Output.get().log( title, logLevel ); + for (DisplayComponent component : displayComponents) { + Output.get().log( component.text(), logLevel ); + } + } } diff --git a/prison-core/src/main/java/tech/mcprison/prison/output/DisplayComponent.java b/prison-core/src/main/java/tech/mcprison/prison/output/DisplayComponent.java index c239a48e4..1e790027b 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/output/DisplayComponent.java +++ b/prison-core/src/main/java/tech/mcprison/prison/output/DisplayComponent.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/output/FancyMessageComponent.java b/prison-core/src/main/java/tech/mcprison/prison/output/FancyMessageComponent.java index c90c7eb5c..c8769183b 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/output/FancyMessageComponent.java +++ b/prison-core/src/main/java/tech/mcprison/prison/output/FancyMessageComponent.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 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 de4785521..6b8c6fc68 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 @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 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 f57e6b0cb..690cb0040 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 @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 @@ -18,11 +18,11 @@ package tech.mcprison.prison.output; +import java.util.Arrays; + import tech.mcprison.prison.Prison; import tech.mcprison.prison.internal.CommandSender; -import java.util.Arrays; - /** * Standardized output to the console and to players. * @@ -64,9 +64,13 @@ public String format(String message, LogLevel level, Object... args) { * Log a message with a specified {@link LogLevel} */ public void log(String message, LogLevel level, Object... args) { - Prison.get().getPlatform().log(gen("&3Prison") + " " + (level == LogLevel.INFO ? - "&f" : - level == LogLevel.WARNING ? "&6" : "&c") + String.format(message, 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)); + } } /** diff --git a/prison-core/src/main/java/tech/mcprison/prison/output/TextComponent.java b/prison-core/src/main/java/tech/mcprison/prison/output/TextComponent.java index 19f1bcfec..7336b483b 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/output/TextComponent.java +++ b/prison-core/src/main/java/tech/mcprison/prison/output/TextComponent.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/output/package-info.java b/prison-core/src/main/java/tech/mcprison/prison/output/package-info.java index fbfbf44e3..0954a2a44 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/output/package-info.java +++ b/prison-core/src/main/java/tech/mcprison/prison/output/package-info.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/selection/Selection.java b/prison-core/src/main/java/tech/mcprison/prison/selection/Selection.java index 943260cd3..d05003fef 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/selection/Selection.java +++ b/prison-core/src/main/java/tech/mcprison/prison/selection/Selection.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/selection/SelectionListener.java b/prison-core/src/main/java/tech/mcprison/prison/selection/SelectionListener.java index b884f7d0c..4c63844d7 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/selection/SelectionListener.java +++ b/prison-core/src/main/java/tech/mcprison/prison/selection/SelectionListener.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 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 0484097ac..048e435b3 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 @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 @@ -56,7 +56,14 @@ public Selection getSelection(Player player) { } return selectionMap.get(player.getName()); } + + public void clearSelection(Player player) { + if (!selectionMap.containsKey(player.getName())) { + selectionMap.remove(player.getName()); + } + } + public void setSelection(Player player, Selection selection) { selectionMap.put(player.getName(), selection); } diff --git a/prison-core/src/main/java/tech/mcprison/prison/selection/package-info.java b/prison-core/src/main/java/tech/mcprison/prison/selection/package-info.java index 4ba71405b..38b692d05 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/selection/package-info.java +++ b/prison-core/src/main/java/tech/mcprison/prison/selection/package-info.java @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 diff --git a/prison-core/src/main/java/tech/mcprison/prison/sorting/PrisonSortable.java b/prison-core/src/main/java/tech/mcprison/prison/sorting/PrisonSortable.java new file mode 100644 index 000000000..f1dea1c2e --- /dev/null +++ b/prison-core/src/main/java/tech/mcprison/prison/sorting/PrisonSortable.java @@ -0,0 +1,5 @@ +package tech.mcprison.prison.sorting; + +public interface PrisonSortable { + +} diff --git a/prison-core/src/main/java/tech/mcprison/prison/sorting/PrisonSorter.java b/prison-core/src/main/java/tech/mcprison/prison/sorting/PrisonSorter.java new file mode 100644 index 000000000..5ff76a53f --- /dev/null +++ b/prison-core/src/main/java/tech/mcprison/prison/sorting/PrisonSorter.java @@ -0,0 +1,10 @@ +package tech.mcprison.prison.sorting; + +import java.util.Set; + +public abstract class PrisonSorter { + + + public abstract Set extends PrisonSortable> getSortedSet(); + +} 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 2623dec61..f5538f0f1 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 @@ -1,6 +1,6 @@ /* * Prison is a Minecraft plugin for the prison game mode. - * Copyright (C) 2017 The Prison Team + * 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 @@ -18,7 +18,9 @@ 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; @@ -27,7 +29,19 @@ /** - * All of the blocks in the game. + *All of the blocks in the game. + *
+ * + *The new field altNames contains a list of String values that will help + * XMaterial map these types to valid Material types. These are spigot version + * Dependent, so some blocks may have different altNames for different spigot + * versions. + *
+ * + *XMaterial support for spigot 1.8.8: + * MOSS_STONE = mossy_cobblestone, LAPIS_LAZULI_ORE = "lapis_ore", + * LAPIS_LAZULI_BLOCK = "lapis_block", PILLAR_QUARTZ_BLOCK = "quartz_pillar" + *
* * @author Faizaan A. Datoo * @author Camouflage100 @@ -44,8 +58,43 @@ public enum BlockType { * of the Material. */ + IGNORE( -1, "prison:ignore", -1, MaterialType.BLOCK ), + NULL_BLOCK( -2, "prison:null_block", -1, MaterialType.INVALID ), + + // This was auto-generated from WorldEdit's blocks.json // @formatter:off + + + // NOTE: Double slabs are ones that players cannot naturally place, and they are + // similar to the main block type. It appears like they have been replaced, + // but not sure with what. I suspect no one will use them anyway, and if they + // do, then mapping them to their counter part block. There are a few doubles + // that have been mapped to "smooth" in the later versions, so they are used when + // possible. + + + DOUBLE_STONE_SLAB( 43, "minecraft:double_stone_slab", 0, MaterialType.BLOCK, "smooth_stone" ), + DOUBLE_SANDSTONE_SLAB( 43, "minecraft:double_stone_slab", 1, MaterialType.BLOCK, "smooth_sandstone_slab" ), + DOUBLE_WOODEN_SLAB( 43, "minecraft:double_stone_slab", 2, MaterialType.BLOCK, "OAK_PLANKS" ), + DOUBLE_COBBLESTONE_SLAB( 43, "minecraft:double_stone_slab", 3, MaterialType.BLOCK, "COBBLESTONE" ), + DOUBLE_BRICK_SLAB( 43, "minecraft:double_stone_slab", 4, MaterialType.BLOCK, "BRICKS" ), + DOUBLE_STONE_BRICK_SLAB( 43, "minecraft:double_stone_slab", 5, MaterialType.BLOCK, "STONE_BRICKS" ), + DOUBLE_NETHER_BRICK_SLAB( 43, "minecraft:double_stone_slab", 6, MaterialType.BLOCK, "NETHER_BRICKS" ), + DOUBLE_QUARTZ_SLAB( 43, "minecraft:double_stone_slab", 7, MaterialType.BLOCK, "SMOOTH_QUARTZ" ), + + DOUBLE_OAK_WOOD_SLAB( 125, "minecraft:double_wooden_slab", 0, MaterialType.BLOCK, "OAK_PLANKS" ), + DOUBLE_SPRUCE_WOOD_SLAB( 125, "minecraft:double_wooden_slab", 1, MaterialType.BLOCK, "SPRUCE_PLANKS" ), + DOUBLE_BIRCH_WOOD_SLAB( 125, "minecraft:double_wooden_slab", 2, MaterialType.BLOCK, "BIRCH_PLANKS" ), + DOUBLE_JUNGLE_WOOD_SLAB( 125, "minecraft:double_wooden_slab", 3, MaterialType.BLOCK, "JUNGLE_PLANKS" ), + DOUBLE_ACACIA_WOOD_SLAB( 125, "minecraft:double_wooden_slab", 4, MaterialType.BLOCK, "ACACIA_PLANKS" ), + DOUBLE_DARK_OAK_WOOD_SLAB( 125, "minecraft:double_wooden_slab", 5, MaterialType.BLOCK, "DARK_OAK_PLANKS" ), + + DOUBLE_RED_SANDSTONE_SLAB( 181, "minecraft:double_stone_slab2", 0, MaterialType.BLOCK, "RED_SANDSTONE" ), + PURPUR_DOUBLE_SLAB( 204, "minecraft:purpur_double_slab", 0, MaterialType.BLOCK, "PURPUR_BLOCK" ), + + + AIR( 0, "minecraft:air", 0, MaterialType.BLOCK ), STONE( 1, "minecraft:stone", 0, MaterialType.BLOCK ), GRANITE( 1, "minecraft:stone", 1, MaterialType.BLOCK ), @@ -59,44 +108,52 @@ public enum BlockType { COARSE_DIRT( 3, "minecraft:dirt", 1, MaterialType.BLOCK ), PODZOL( 3, "minecraft:dirt", 2, MaterialType.BLOCK ), COBBLESTONE( 4, "minecraft:cobblestone", 0, MaterialType.BLOCK ), - OAK_WOOD_PLANK( 5, "minecraft:planks", 0, MaterialType.BLOCK ), - SPRUCE_WOOD_PLANK( 5, "minecraft:planks", 1, MaterialType.BLOCK ), - BIRCH_WOOD_PLANK( 5, "minecraft:planks", 2, MaterialType.BLOCK ), - JUNGLE_WOOD_PLANK( 5, "minecraft:planks", 3, MaterialType.BLOCK ), - ACACIA_WOOD_PLANK( 5, "minecraft:planks", 4, MaterialType.BLOCK ), - DARK_OAK_WOOD_PLANK( 5, "minecraft:planks", 5, MaterialType.BLOCK ), + + OAK_WOOD_PLANK( 5, "minecraft:planks", 0, MaterialType.BLOCK, "OAK_PLANKS" ), + SPRUCE_WOOD_PLANK( 5, "minecraft:planks", 1, MaterialType.BLOCK, "SPRUCE_PLANKS" ), + BIRCH_WOOD_PLANK( 5, "minecraft:planks", 2, MaterialType.BLOCK, "BIRCH_PLANKS" ), + JUNGLE_WOOD_PLANK( 5, "minecraft:planks", 3, MaterialType.BLOCK, "JUNGLE_PLANKS" ), + ACACIA_WOOD_PLANK( 5, "minecraft:planks", 4, MaterialType.BLOCK, "ACACIA_PLANKS" ), + DARK_OAK_WOOD_PLANK( 5, "minecraft:planks", 5, MaterialType.BLOCK, "DARK_OAK_PLANKS" ), + OAK_SAPLING( 6, "minecraft:sapling", 0, MaterialType.BLOCK ), SPRUCE_SAPLING( 6, "minecraft:sapling", 1, MaterialType.BLOCK ), BIRCH_SAPLING( 6, "minecraft:sapling", 2, MaterialType.BLOCK ), JUNGLE_SAPLING( 6, "minecraft:sapling", 3, MaterialType.BLOCK ), ACACIA_SAPLING( 6, "minecraft:sapling", 4, MaterialType.BLOCK ), DARK_OAK_SAPLING( 6, "minecraft:sapling", 5, MaterialType.BLOCK ), - BEDROCK( 7, "minecraft:bedrock", 0, MaterialType.BLOCK ), - FLOWING_WATER( 8, "minecraft:flowing_water", 0, MaterialType.BLOCK ), + BEDROCK( 7, "minecraft:bedrock", 0, MaterialType.BLOCK ), + + FLOWING_WATER( 8, "minecraft:flowing_water", 0, MaterialType.BLOCK, "WATER" ), + STILL_WATER( 9, "minecraft:water", 0, MaterialType.BLOCK ), - FLOWING_LAVA( 10, "minecraft:flowing_lava", 0, MaterialType.BLOCK ), + FLOWING_LAVA( 10, "minecraft:flowing_lava", 0, MaterialType.BLOCK, "LAVA" ), STILL_LAVA( 11, "minecraft:lava", 0, MaterialType.BLOCK ), + SAND( 12, "minecraft:sand", 0, MaterialType.BLOCK ), RED_SAND( 12, "minecraft:sand", 1, MaterialType.BLOCK ), GRAVEL( 13, "minecraft:gravel", 0, MaterialType.BLOCK ), - GOLD_ORE( 14, "minecraft:gold_ore", 0, MaterialType.BLOCK ), - IRON_ORE( 15, "minecraft:iron_ore", 0, MaterialType.BLOCK ), - COAL_ORE( 16, "minecraft:coal_ore", 0, MaterialType.BLOCK ), + GOLD_ORE( 14, "minecraft:gold_ore", 0, MaterialType.BLOCK ), + IRON_ORE( 15, "minecraft:iron_ore", 0, MaterialType.BLOCK ), + COAL_ORE( 16, "minecraft:coal_ore", 0, MaterialType.BLOCK ), + 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 ), + OAK_LEAVES( 18, "minecraft:leaves", 0, MaterialType.BLOCK ), SPRUCE_LEAVES( 18, "minecraft:leaves", 1, MaterialType.BLOCK ), BIRCH_LEAVES( 18, "minecraft:leaves", 2, MaterialType.BLOCK ), - UNGL_LEAVES( 18, "minecraft:leaves", 3, MaterialType.BLOCK ), /// ??? Should this be JUNGLE_LEAVES ??? JUNGLE_LEAVES( 18, "minecraft:leaves", 3, MaterialType.BLOCK ), SPONGE( 19, "minecraft:sponge", 0, MaterialType.BLOCK ), 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 ), + DISPENSER( 23, "minecraft:dispenser", 0, MaterialType.BLOCK ), SANDSTONE( 24, "minecraft:sandstone", 0, MaterialType.BLOCK ), CHISELED_SANDSTONE( 24, "minecraft:sandstone", 1, MaterialType.BLOCK ), @@ -107,10 +164,10 @@ public enum BlockType { DETECTOR_RAIL( 28, "minecraft:detector_rail", 0, MaterialType.BLOCK ), STICKY_PISTON( 29, "minecraft:sticky_piston", 0, MaterialType.BLOCK ), COBWEB( 30, "minecraft:web", 0, MaterialType.BLOCK ), - DEAD_SHRUB( 31, "minecraft:tallgrass", 0, MaterialType.BLOCK ), + DEAD_SHRUB( 31, "minecraft:tallgrass", 0, MaterialType.BLOCK, "DEAD_BUSH" ), TALL_GRASS( 31, "minecraft:tallgrass", 1, MaterialType.BLOCK ), FERN( 31, "minecraft:tallgrass", 2, MaterialType.BLOCK ), - DEAD_BUSH( 32, "minecraft:deadbush", 0, MaterialType.BLOCK ), + DEAD_BUSH( 32, "minecraft:deadbush", 0, MaterialType.BLOCK, "DEAD_BUSH" ), PISTON( 33, "minecraft:piston", 0, MaterialType.BLOCK ), PISTON_HEAD( 34, "minecraft:piston_head", 0, MaterialType.BLOCK ), WHITE_WOOL( 35, "minecraft:wool", 0, MaterialType.BLOCK ), @@ -129,11 +186,12 @@ public enum BlockType { GREEN_WOOL( 35, "minecraft:wool", 13, MaterialType.BLOCK ), RED_WOOL( 35, "minecraft:wool", 14, MaterialType.BLOCK ), BLACK_WOOL( 35, "minecraft:wool", 15, MaterialType.BLOCK ), + DANDELION( 37, "minecraft:yellow_flower", 0, MaterialType.BLOCK ), - POPPY( 38, "minecraft:red_flower", 0, MaterialType.BLOCK ), + POPPY( 38, "minecraft:red_flower", 0, MaterialType.BLOCK, "RED_ROSE" ), BLUE_ORCHID( 38, "minecraft:red_flower", 1, MaterialType.BLOCK ), ALLIUM( 38, "minecraft:red_flower", 2, MaterialType.BLOCK ), - AZURE_BLUET( 38, "minecraft:red_flower", 3, MaterialType.BLOCK ), + AZURE_BLUET( 38, "minecraft:red_flower", 3, MaterialType.BLOCK, "AZURE_BLUET" ), RED_TULIP( 38, "minecraft:red_flower", 4, MaterialType.BLOCK ), ORANGE_TULIP( 38, "minecraft:red_flower", 5, MaterialType.BLOCK ), WHITE_TULIP( 38, "minecraft:red_flower", 6, MaterialType.BLOCK ), @@ -143,26 +201,21 @@ public enum BlockType { RED_MUSHROOM( 40, "minecraft:red_mushroom", 0, MaterialType.BLOCK ), GOLD_BLOCK( 41, "minecraft:gold_block", 0, MaterialType.BLOCK ), IRON_BLOCK( 42, "minecraft:iron_block", 0, MaterialType.BLOCK ), - DOUBLE_STONE_SLAB( 43, "minecraft:double_stone_slab", 0, MaterialType.BLOCK ), - DOUBLE_SANDSTONE_SLAB( 43, "minecraft:double_stone_slab", 1, MaterialType.BLOCK ), - DOUBLE_WOODEN_SLAB( 43, "minecraft:double_stone_slab", 2, MaterialType.BLOCK ), - DOUBLE_COBBLESTONE_SLAB( 43, "minecraft:double_stone_slab", 3, MaterialType.BLOCK ), - DOUBLE_BRICK_SLAB( 43, "minecraft:double_stone_slab", 4, MaterialType.BLOCK ), - DOUBLE_STONE_BRICK_SLAB( 43, "minecraft:double_stone_slab", 5, MaterialType.BLOCK ), - DOUBLE_NETHER_BRICK_SLAB( 43, "minecraft:double_stone_slab", 6, MaterialType.BLOCK ), - DOUBLE_QUARTZ_SLAB( 43, "minecraft:double_stone_slab", 7, MaterialType.BLOCK ), + + STONE_SLAB( 44, "minecraft:stone_slab", 0, MaterialType.BLOCK ), SANDSTONE_SLAB( 44, "minecraft:stone_slab", 1, MaterialType.BLOCK ), WOODEN_SLAB( 44, "minecraft:stone_slab", 2, MaterialType.BLOCK ), COBBLESTONE_SLAB( 44, "minecraft:stone_slab", 3, MaterialType.BLOCK ), - BRICK_SLAB( 44, "minecraft:stone_slab", 4, MaterialType.BLOCK ), + BRICK_SLAB( 44, "minecraft:stone_slab", 4, MaterialType.BLOCK, "STONE_BRICK_SLAB" ), STONE_BRICK_SLAB( 44, "minecraft:stone_slab", 5, MaterialType.BLOCK ), NETHER_BRICK_SLAB( 44, "minecraft:stone_slab", 6, MaterialType.BLOCK ), QUARTZ_SLAB( 44, "minecraft:stone_slab", 7, MaterialType.BLOCK ), 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 ), + MOSS_STONE( 48, "minecraft:mossy_cobblestone", 0, MaterialType.BLOCK, "MOSSY_COBBLESTONE" ), + OBSIDIAN( 49, "minecraft:obsidian", 0, MaterialType.BLOCK ), TORCH( 50, "minecraft:torch", 0, MaterialType.BLOCK ), FIRE( 51, "minecraft:fire", 0, MaterialType.BLOCK ), @@ -177,7 +230,7 @@ public enum BlockType { FARMLAND( 60, "minecraft:farmland", 0, MaterialType.BLOCK ), FURNACE( 61, "minecraft:furnace", 0, MaterialType.BLOCK ), BURNING_FURNACE( 62, "minecraft:lit_furnace", 0, MaterialType.BLOCK ), - STANDING_SIGN_BLOCK( 63, "minecraft:standing_sign", 0, MaterialType.BLOCK ), + STANDING_SIGN_BLOCK( 63, "minecraft:standing_sign", 0, MaterialType.BLOCK, "OAK_SIGN" ), OAK_DOOR_BLOCK( 64, "minecraft:wooden_door", 0, MaterialType.BLOCK ), LADDER( 65, "minecraft:ladder", 0, MaterialType.BLOCK ), RAIL( 66, "minecraft:rail", 0, MaterialType.BLOCK ), @@ -186,7 +239,9 @@ public enum BlockType { LEVER( 69, "minecraft:lever", 0, MaterialType.BLOCK ), STONE_PRESSURE_PLATE( 70, "minecraft:stone_pressure_plate", 0, MaterialType.BLOCK ), IRON_DOOR_BLOCK( 71, "minecraft:iron_door", 0, MaterialType.BLOCK ), - WOODEN_PRESSURE_PLATE( 72, "minecraft:wooden_pressure_plate", 0, MaterialType.BLOCK ), + + WOODEN_PRESSURE_PLATE( 72, "minecraft:wooden_pressure_plate", 0, MaterialType.BLOCK, + "OAK_PRESSURE_PLATE", "WOOD_PLATE" ), REDSTONE_ORE( 73, "minecraft:redstone_ore", 0, MaterialType.BLOCK ), GLOWING_REDSTONE_ORE( 74, "minecraft:lit_redstone_ore", 0, MaterialType.BLOCK ), @@ -201,7 +256,7 @@ public enum BlockType { CACTUS( 81, "minecraft:cactus", 0, MaterialType.BLOCK ), CLAY( 82, "minecraft:clay", 0, MaterialType.BLOCK ), - SUGAR_CANES( 83, "minecraft:reeds", 0, MaterialType.BLOCK ), + SUGAR_CANES( 83, "minecraft:reeds", 0, MaterialType.BLOCK, "SUGAR_CANE" ), JUKEBOX( 84, "minecraft:jukebox", 0, MaterialType.BLOCK ), OAK_FENCE( 85, "minecraft:fence", 0, MaterialType.BLOCK ), PUMPKIN( 86, "minecraft:pumpkin", 0, MaterialType.BLOCK ), @@ -210,10 +265,14 @@ public enum BlockType { SOUL_SAND( 88, "minecraft:soul_sand", 0, MaterialType.BLOCK ), GLOWSTONE( 89, "minecraft:glowstone", 0, MaterialType.BLOCK ), NETHER_PORTAL( 90, "minecraft:portal", 0, MaterialType.BLOCK ), - JACK_OLANTERN( 91, "minecraft:lit_pumpkin", 0, MaterialType.BLOCK ), + + JACK_OLANTERN( 91, "minecraft:lit_pumpkin", 0, MaterialType.BLOCK, "jack_o_lantern" ), + CAKE_BLOCK( 92, "minecraft:cake", 0, MaterialType.BLOCK ), - REDSTONE_REPEATER_BLOCK_OFF( 93, "minecraft:unpowered_repeater", 0, MaterialType.BLOCK ), - REDSTONE_REPEATER_BLOCK_ON( 94, "minecraft:powered_repeater", 0, MaterialType.BLOCK ), + + REDSTONE_REPEATER_BLOCK_OFF( 93, "minecraft:unpowered_repeater", 0, MaterialType.BLOCK, "REPEATER" ), + REDSTONE_REPEATER_BLOCK_ON( 94, "minecraft:powered_repeater", 0, MaterialType.BLOCK, "REPEATER" ), + WHITE_STAINED_GLASS( 95, "minecraft:stained_glass", 0, MaterialType.BLOCK ), ORANGE_STAINED_GLASS( 95, "minecraft:stained_glass", 1, MaterialType.BLOCK ), MAGENTA_STAINED_GLASS( 95, "minecraft:stained_glass", 2, MaterialType.BLOCK ), @@ -230,19 +289,25 @@ public enum BlockType { GREEN_STAINED_GLASS( 95, "minecraft:stained_glass", 13, MaterialType.BLOCK ), RED_STAINED_GLASS( 95, "minecraft:stained_glass", 14, MaterialType.BLOCK ), BLACK_STAINED_GLASS( 95, "minecraft:stained_glass", 15, MaterialType.BLOCK ), - WOODEN_TRAPDOOR( 96, "minecraft:trapdoor", 0, MaterialType.BLOCK ), - STONE_MONSTER_EGG( 97, "minecraft:monster_egg", 0, MaterialType.BLOCK ), - COBBLESTONE_MONSTER_EGG( 97, "minecraft:monster_egg", 1, MaterialType.BLOCK ), - STONE_BRICK_MONSTER_EGG( 97, "minecraft:monster_egg", 2, MaterialType.BLOCK ), - MOSSY_STONE_BRICK_MONSTER_EGG( 97, "minecraft:monster_egg", 3, MaterialType.BLOCK ), - CRACKED_STONE_BRICK_MONSTER_EGG( 97, "minecraft:monster_egg", 4, MaterialType.BLOCK ), - CHISELED_STONE_BRICK_MONSTER_EGG( 97, "minecraft:monster_egg", 5, MaterialType.BLOCK ), - STONE_BRICKS( 98, "minecraft:stonebrick", 0, MaterialType.BLOCK ), - MOSSY_STONE_BRICKS( 98, "minecraft:stonebrick", 1, MaterialType.BLOCK ), - CRACKED_STONE_BRICKS( 98, "minecraft:stonebrick", 2, MaterialType.BLOCK ), - CHISELED_STONE_BRICKS( 98, "minecraft:stonebrick", 3, MaterialType.BLOCK ), + WOODEN_TRAPDOOR( 96, "minecraft:trapdoor", 0, MaterialType.BLOCK, "oak_trapdoor" ), + + STONE_MONSTER_EGG( 97, "minecraft:monster_egg", 0, MaterialType.BLOCK, "INFESTED_STONE" ), + COBBLESTONE_MONSTER_EGG( 97, "minecraft:monster_egg", 1, MaterialType.BLOCK, "INFESTED_COBBLESTONE" ), + STONE_BRICK_MONSTER_EGG( 97, "minecraft:monster_egg", 2, MaterialType.BLOCK, "INFESTED_STONE_BRICKS" ), + MOSSY_STONE_BRICK_MONSTER_EGG( 97, "minecraft:monster_egg", 3, MaterialType.BLOCK, "INFESTED_MOSSY_STONE_BRICKS" ), + CRACKED_STONE_BRICK_MONSTER_EGG( 97, "minecraft:monster_egg", 4, MaterialType.BLOCK, "INFESTED_CRACKED_STONE_BRICKS" ), + CHISELED_STONE_BRICK_MONSTER_EGG( 97, "minecraft:monster_egg", 5, MaterialType.BLOCK, "INFESTED_CHISELED_STONE_BRICKS" ), + + STONE_BRICKS( 98, "minecraft:stonebrick", 0, MaterialType.BLOCK, "STONE_BRICKS" ), + MOSSY_STONE_BRICKS( 98, "minecraft:stonebrick", 1, MaterialType.BLOCK, "MOSSY_STONE_BRICKS" ), + CRACKED_STONE_BRICKS( 98, "minecraft:stonebrick", 2, MaterialType.BLOCK, "CRACKED_STONE_BRICKS" ), + CHISELED_STONE_BRICKS( 98, "minecraft:stonebrick", 3, MaterialType.BLOCK, "CHISELED_STONE_BRICKS" ), + BROWN_MUSHROOM_BLOCK( 99, "minecraft:brown_mushroom_block", 0, MaterialType.BLOCK ), + HUGE_MUSHROOM_1( 99, "minecraft:brown_mushroom_block", 14, MaterialType.BLOCK ), RED_MUSHROOM_BLOCK( 100, "minecraft:red_mushroom_block", 0, MaterialType.BLOCK ), + HUGE_MUSHROOM_2( 100, "minecraft:red_mushroom_block", 14, MaterialType.BLOCK ), + IRON_BARS( 101, "minecraft:iron_bars", 0, MaterialType.BLOCK ), GLASS_PANE( 102, "minecraft:glass_pane", 0, MaterialType.BLOCK ), MELON_BLOCK( 103, "minecraft:melon_block", 0, MaterialType.BLOCK ), @@ -254,6 +319,7 @@ public enum BlockType { 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 ), + NETHER_BRICK( 112, "minecraft:nether_brick", 0, MaterialType.BLOCK ), NETHER_BRICK_FENCE( 113, "minecraft:nether_brick_fence", 0, MaterialType.BLOCK ), NETHER_BRICK_STAIRS( 114, "minecraft:nether_brick_stairs", 0, MaterialType.BLOCK ), @@ -265,14 +331,11 @@ public enum BlockType { 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 ), - REDSTONE_LAMP_INACTIVE( 123, "minecraft:redstone_lamp", 0, MaterialType.BLOCK ), - REDSTONE_LAMP_ACTIVE( 124, "minecraft:lit_redstone_lamp", 0, MaterialType.BLOCK ), - DOUBLE_OAK_WOOD_SLAB( 125, "minecraft:double_wooden_slab", 0, MaterialType.BLOCK ), - DOUBLE_SPRUCE_WOOD_SLAB( 125, "minecraft:double_wooden_slab", 1, MaterialType.BLOCK ), - DOUBLE_BIRCH_WOOD_SLAB( 125, "minecraft:double_wooden_slab", 2, MaterialType.BLOCK ), - DOUBLE_JUNGLE_WOOD_SLAB( 125, "minecraft:double_wooden_slab", 3, MaterialType.BLOCK ), - DOUBLE_ACACIA_WOOD_SLAB( 125, "minecraft:double_wooden_slab", 4, MaterialType.BLOCK ), - DOUBLE_DARK_OAK_WOOD_SLAB( 125, "minecraft:double_wooden_slab", 5, MaterialType.BLOCK ), + + 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" ), + + OAK_WOOD_SLAB( 126, "minecraft:wooden_slab", 0, MaterialType.BLOCK ), SPRUCE_WOOD_SLAB( 126, "minecraft:wooden_slab", 1, MaterialType.BLOCK ), BIRCH_WOOD_SLAB( 126, "minecraft:wooden_slab", 2, MaterialType.BLOCK ), @@ -296,40 +359,46 @@ public enum BlockType { FLOWER_POT( 140, "minecraft:flower_pot", 0, MaterialType.BLOCK ), CARROTS( 141, "minecraft:carrots", 0, MaterialType.BLOCK ), POTATOES( 142, "minecraft:potatoes", 0, MaterialType.BLOCK ), - WOODEN_BUTTON( 143, "minecraft:wooden_button", 0, MaterialType.BLOCK ), + WOODEN_BUTTON( 143, "minecraft:wooden_button", 0, MaterialType.BLOCK, "OAK_BUTTON", "wood_button" ), MOB_HEAD( 144, "minecraft:skull", 0, MaterialType.BLOCK ), ANVIL( 145, "minecraft:anvil", 0, MaterialType.BLOCK ), TRAPPED_CHEST( 146, "minecraft:trapped_chest", 0, MaterialType.BLOCK ), WEIGHTED_PRESSURE_PLATE_LIGHT( 147, "minecraft:light_weighted_pressure_plate", 0, MaterialType.BLOCK ), WEIGHTED_PRESSURE_PLATE_HEAVY( 148, "minecraft:heavy_weighted_pressure_plate", 0, MaterialType.BLOCK ), - REDSTONE_COMPARATOR_INACTIVE( 149, "minecraft:unpowered_comparator", 0, MaterialType.BLOCK ), - REDSTONE_COMPARATOR_ACTIVE( 150, "minecraft:powered_comparator", 0, MaterialType.BLOCK ), + + REDSTONE_COMPARATOR_INACTIVE( 149, "minecraft:unpowered_comparator", 0, MaterialType.BLOCK, "COMPARATOR" ), + REDSTONE_COMPARATOR_ACTIVE( 150, "minecraft:powered_comparator", 0, MaterialType.BLOCK, "COMPARATOR" ), + DAYLIGHT_SENSOR( 151, "minecraft:daylight_detector", 0, MaterialType.BLOCK ), REDSTONE_BLOCK( 152, "minecraft:redstone_block", 0, MaterialType.BLOCK ), NETHER_QUARTZ_ORE( 153, "minecraft:quartz_ore", 0, MaterialType.BLOCK ), HOPPER( 154, "minecraft:hopper", 0, MaterialType.BLOCK ), QUARTZ_BLOCK( 155, "minecraft:quartz_block", 0, MaterialType.BLOCK ), CHISELED_QUARTZ_BLOCK( 155, "minecraft:quartz_block", 1, MaterialType.BLOCK ), - PILLAR_QUARTZ_BLOCK( 155, "minecraft:quartz_block", 2, MaterialType.BLOCK ), + + PILLAR_QUARTZ_BLOCK( 155, "minecraft:quartz_block", 2, MaterialType.BLOCK, "QUARTZ_PILLAR" ), + QUARTZ_STAIRS( 156, "minecraft:quartz_stairs", 0, MaterialType.BLOCK ), ACTIVATOR_RAIL( 157, "minecraft:activator_rail", 0, MaterialType.BLOCK ), DROPPER( 158, "minecraft:dropper", 0, MaterialType.BLOCK ), - WHITE_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 0, MaterialType.BLOCK ), - ORANGE_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 1, MaterialType.BLOCK ), - MAGENTA_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 2, MaterialType.BLOCK ), - LIGHT_BLUE_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 3, MaterialType.BLOCK ), - YELLOW_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 4, MaterialType.BLOCK ), - LIME_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 5, MaterialType.BLOCK ), - PINK_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 6, MaterialType.BLOCK ), - GRAY_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 7, MaterialType.BLOCK ), - LIGHT_GRAY_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 8, MaterialType.BLOCK ), - CYAN_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 9, MaterialType.BLOCK ), - PURPLE_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 10, MaterialType.BLOCK ), - BLUE_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 11, MaterialType.BLOCK ), - BROWN_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 12, MaterialType.BLOCK ), - GREEN_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 13, MaterialType.BLOCK ), - RED_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 14, MaterialType.BLOCK ), - BLACK_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 15, MaterialType.BLOCK ), + + WHITE_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 0, MaterialType.BLOCK, "WHITE_TERRACOTTA" ), + ORANGE_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 1, MaterialType.BLOCK, "ORANGE_TERRACOTTA" ), + MAGENTA_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 2, MaterialType.BLOCK, "MAGENTA_TERRACOTTA" ), + LIGHT_BLUE_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 3, MaterialType.BLOCK, "LIGHT_BLUE_TERRACOTTA" ), + YELLOW_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 4, MaterialType.BLOCK, "YELLOW_TERRACOTTA" ), + LIME_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 5, MaterialType.BLOCK, "LIME_TERRACOTTA" ), + PINK_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 6, MaterialType.BLOCK, "PINK_TERRACOTTA" ), + GRAY_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 7, MaterialType.BLOCK, "GRAY_TERRACOTTA" ), + LIGHT_GRAY_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 8, MaterialType.BLOCK, "LIGHT_GRAY_TERRACOTTA" ), + CYAN_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 9, MaterialType.BLOCK, "CYAN_TERRACOTTA" ), + PURPLE_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 10, MaterialType.BLOCK, "PURPLE_TERRACOTTA" ), + BLUE_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 11, MaterialType.BLOCK, "BLUE_TERRACOTTA" ), + BROWN_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 12, MaterialType.BLOCK, "BROWN_TERRACOTTA" ), + GREEN_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 13, MaterialType.BLOCK, "GREEN_TERRACOTTA" ), + RED_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 14, MaterialType.BLOCK, "RED_TERRACOTTA" ), + BLACK_STAINED_CLAY( 159, "minecraft:stained_hardened_clay", 15, MaterialType.BLOCK, "BLACK_TERRACOTTA" ), + WHITE_STAINED_GLASS_PANE( 160, "minecraft:stained_glass_pane", 0, MaterialType.BLOCK ), ORANGE_STAINED_GLASS_PANE( 160, "minecraft:stained_glass_pane", 1, MaterialType.BLOCK ), MAGENTA_STAINED_GLASS_PANE( 160, "minecraft:stained_glass_pane", 2, MaterialType.BLOCK ), @@ -346,7 +415,8 @@ public enum BlockType { GREEN_STAINED_GLASS_PANE( 160, "minecraft:stained_glass_pane", 13, MaterialType.BLOCK ), RED_STAINED_GLASS_PANE( 160, "minecraft:stained_glass_pane", 14, MaterialType.BLOCK ), BLACK_STAINED_GLASS_PANE( 160, "minecraft:stained_glass_pane", 15, MaterialType.BLOCK ), - ACACIA_LEAVES( 161, "minecraft:leaves2", 0, MaterialType.BLOCK ), + + ACACIA_LEAVES( 161, "minecraft:leaves2", 0, MaterialType.BLOCK, "ACACIA_LEAVES" ), DARK_OAK_LEAVES( 161, "minecraft:leaves2", 1, MaterialType.BLOCK ), ACACIA_WOOD( 162, "minecraft:log2", 0, MaterialType.BLOCK ), DARK_OAK_WOOD( 162, "minecraft:log2", 1, MaterialType.BLOCK ), @@ -376,7 +446,7 @@ public enum BlockType { GREEN_CARPET( 171, "minecraft:carpet", 13, MaterialType.BLOCK ), 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 ), + HARDENED_CLAY( 172, "minecraft:hardened_clay", 0, MaterialType.BLOCK, "TERRACOTTA", "HARD_CLAY" ), BLOCK_OF_COAL( 173, "minecraft:coal_block", 0, MaterialType.BLOCK ), PACKED_ICE( 174, "minecraft:packed_ice", 0, MaterialType.BLOCK ), SUNFLOWER( 175, "minecraft:double_plant", 0, MaterialType.BLOCK ), @@ -392,8 +462,9 @@ public enum BlockType { CHISELED_RED_SANDSTONE( 179, "minecraft:red_sandstone", 1, MaterialType.BLOCK ), SMOOTH_RED_SANDSTONE( 179, "minecraft:red_sandstone", 2, MaterialType.BLOCK ), RED_SANDSTONE_STAIRS( 180, "minecraft:red_sandstone_stairs", 0, MaterialType.BLOCK ), - DOUBLE_RED_SANDSTONE_SLAB( 181, "minecraft:double_stone_slab2", 0, MaterialType.BLOCK ), + RED_SANDSTONE_SLAB( 182, "minecraft:stone_slab2", 0, MaterialType.BLOCK ), + SPRUCE_FENCE_GATE( 183, "minecraft:spruce_fence_gate", 0, MaterialType.BLOCK ), BIRCH_FENCE_GATE( 184, "minecraft:birch_fence_gate", 0, MaterialType.BLOCK ), JUNGLE_FENCE_GATE( 185, "minecraft:jungle_fence_gate", 0, MaterialType.BLOCK ), @@ -415,7 +486,7 @@ public enum BlockType { PURPUR_BLOCK( 201, "minecraft:purpur_block", 0, MaterialType.BLOCK ), PURPUR_PILLAR( 202, "minecraft:purpur_pillar", 0, MaterialType.BLOCK ), PURPUR_STAIRS( 203, "minecraft:purpur_stairs", 0, MaterialType.BLOCK ), - PURPUR_DOUBLE_SLAB( 204, "minecraft:purpur_double_slab", 0, MaterialType.BLOCK ), + PURPUR_SLAB( 205, "minecraft:purpur_slab", 0, MaterialType.BLOCK ), END_STONE_BRICKS( 206, "minecraft:end_bricks", 0, MaterialType.BLOCK ), BEETROOT_BLOCK( 207, "minecraft:beetroots", 0, MaterialType.BLOCK ), @@ -509,7 +580,7 @@ public enum BlockType { MILK_BUCKET( 335, "minecraft:milk_bucket", 0 ), BRICK( 336, "minecraft:brick", 0, MaterialType.BLOCK ), CLAY_BALL( 337, "minecraft:clay_ball", 0 ), - SUGAR_CANES_ITEM( 338, "minecraft:reeds", 0, MaterialType.BLOCK ), + SUGAR_CANES_ITEM( 338, "minecraft:reeds", 0, MaterialType.BLOCK, "SUGAR_CANE" ), PAPER( 339, "minecraft:paper", 0 ), BOOK( 340, "minecraft:book", 0 ), SLIMEBALL( 341, "minecraft:slime_ball", 0 ), @@ -526,11 +597,15 @@ public enum BlockType { PUFFERFISH( 349, "minecraft:fish", 3 ), COOKED_FISH( 350, "minecraft:cooked_fish", 0 ), COOKED_SALMON( 350, "minecraft:cooked_fish", 1 ), + INK_SACK( 351, "minecraft:dye", 0 ), ROSE_RED( 351, "minecraft:dye", 1 ), CACTUS_GREEN( 351, "minecraft:dye", 2 ), COCO_BEANS( 351, "minecraft:dye", 3 ), + + // NOTE: May actually be minecraft:ink_sack which is what XMaterial uses? LAPIS_LAZULI( 351, "minecraft:dye", 4 ), + PURPLE_DYE( 351, "minecraft:dye", 5 ), CYAN_DYE( 351, "minecraft:dye", 6 ), LIGHT_GRAY_DYE( 351, "minecraft:dye", 7 ), @@ -542,6 +617,8 @@ public enum BlockType { MAGENTA_DYE( 351, "minecraft:dye", 13 ), ORANGE_DYE( 351, "minecraft:dye", 14 ), BONE_MEAL( 351, "minecraft:dye", 15 ), + + BONE( 352, "minecraft:bone", 0 ), SUGAR( 353, "minecraft:sugar", 0 ), CAKE( 354, "minecraft:cake", 0 ), @@ -628,7 +705,7 @@ public enum BlockType { 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_QUARTZ( 406, "minecraft:quartz", 0, MaterialType.BLOCK ), + NETHER_QUARTZ( 406, "minecraft:quartz", 0 ), MINECART_WITH_TNT( 407, "minecraft:tnt_minecart", 0 ), MINECART_WITH_HOPPER( 408, "minecraft:hopper_minecart", 0 ), PRISMARINE_SHARD( 409, "minecraft:prismarine_shard", 0 ), @@ -683,6 +760,32 @@ public enum BlockType { DISC_11( 2266, "minecraft:record_11", 0 ), 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 ), +// + + ; // @formatter:on @@ -690,13 +793,41 @@ public enum BlockType { private final String id; private final short data; private final MaterialType materialType; + private final MaterialVersion materialVersion; + + private final ListThis function is for legacy versions of spigot that + * uses the data value. This function will returns a + * string value of a material name that + * XMaterial will be able to use to look up the correct + * bukkit material type. + *
+ * + *The way it needs to be constructed, is by taking the id, + * dropping the "minecraft:" prefix, then if data is non-zero, + * add a colon and the value of data. + *
+ * + * + * @return + */ + public String getXMaterialNameLegacy() { + String xMatName = getId().replace( "minecraft:", "" ) + + ( getData() > 0 ? ":" + getData() : "" ); + return xMatName; + } + + /** + *This function will return the lower case name of the BlockType.
+ * This should match
+ * @return
+ */
+ public String getXMaterialName() {
+ return name().toLowerCase();
+ }
+
+ public List This function will determine if the given location is within a radius of the Bounds'
+ * center. This will return a true or false value.
+ * To keep the calculations simple, if the worlds are the same, then it will create a new
+ * Bounds object and then utilize the computed values for width and length by feeding it in
+ * to a Pythagorean theorem to compute the hypotenuse (distance) between these two points.
+ * There maybe other unused values calculated, but going for the simplicity of reusing existing code.
+ * Ignore Y since this is the radius from the center axis of the mine.
+ * playerCache tries to provide a faster way to identify which mine a player is
+ * in. The theory is that there is a very high chance it will be the last mine
+ * they were in. So this records the last mine they were in, and if that is not
+ * where they are, then, and only then, do we check all mines to see if it may
+ * be something else.
+ * Search all mines to find if the given block is located within any
+ * of the mines. If not, then return a null.
+ * The following command will change the mine's time between resets. But it will
+ * not be applied until after the next reset.
+ * The following command will change the mine's time between resets. But it will
+ * not be applied until after the next reset.
+ * When a mine reaches zero blocks, a manual reset will be issued to run. By default
+ * it will have a 0 second delay before running, but this command controls how long of
+ * a delay to use.
+ * Although the delay is in seconds, it should be known that the value will be multiplied
+ * by 20 to convert it to ticks. So any value less than 0.05 will be treated as zero and
+ * effectively will be in 0.05 increments. Give or take a tick should not matter, but
+ * beware if a player, or owner, complains that 0.17 is the same as 0.15.
+ * The following command will change the mine's time between resets. But it will
+ * not be applied until after the next reset.
+ * This is called when a mine is first created.
+ * Loads a mine from a document.
+ * Note that the location where the loadFromDocument() occurs in the whole
+ * "create the objects" is in the "middle". All classes that are extended
+ * from are instantiated first due to the super() function call. So when Mine
+ * tries to be instantiated, it first drills all the way down to MineData and
+ * then runs all the initialization code within MineData and then works back
+ * through all of the classes, instantiating everything, one layer at a time.
+ * Then when it gets back up to this class, Mine, all parents have been fully
+ * instantiated so all collections will have been assigned non-null values
+ * as an example. Then this class loads the data from the document object.
+ * This is important, since all parents have been initialized, now the document
+ * loader is making it a "mine".
+ * Then at that point, after the mine data is loaded, it once again drills all the
+ * way down to the MineData ancestor class, using the initialize() functions, where
+ * it then starts to initialize all classes from MineData, back up to Mine.
+ * What this enables and allows, is when a class is initialized, it will have access
+ * to the fully loaded mine data. This is a perfect example of being able to start
+ * submitting the mine reset jobs since all data has been loaded, and all lower
+ * functions have been ran.
+ * So the over all design of the Mine objects is that all ancestors instantiate
+ * first, from MineData to Mine. Then the mine is loaded from the file system.
+ * Then all ancestors are initialized from MineData to Mine. This gives a high
+ * degree of control over when actions can be ran over a mine, and have confidence the
+ * data and conditions will be there.
+ * This initialize function gets called after the classes are
+ * instantiated, and is initiated from Mine class and propagates
+ * to the MineData class. Good for kicking off the scheduler.
+ * The loading of a mine checks to ensure if the world exists. If not, then
+ * traditionally, it would not load the mine. The problem with this model is
+ * the world may not exist yet, if running Multiverse-core (or another similar
+ * plugin) and as such, may falsely cause mine failures. This is the situation if
+ * the mine exists within a world that must be loaded by Multiverse-core. If it was
+ * a standard world, then it would be fine.
+ * Soft dependencies do not provide a solution. One bad solution for this
+ * situation, is to manually add a hard dependency to Multiverse-core. This
+ * should not be used.
+ * As a better solution to this problem, mines will be loaded as normal, but
+ * if the world does not exist, then their initialization, or enablement, will be
+ * delayed until the world is available.
+ * This function teleports players out of existing mines if they are within
- * their boundaries within the world where the Mine exists. Using only players within the existing world of the current mine, each
- * player is checked to see if they are within the mine, and if they are they
- * are teleported either to the mine's spawn location, or straight up from the
- * center of the mine, to the top of the mine (assumes air space will exist there). This function eliminates possible bug of players being teleported from other
- * worlds, and also eliminates the possibility that the destination could
- * ever be null. This function will teleport the player out of a given mine, or to the given
- * mine. It will not confirm if the player is within the mine before trying to
- * teleport.
- * This function will teleport the player to the defined spawn location, or it
- * will teleport the player to the center of the mine, but on top of the
- * mine's surface. If the player target location has an empty block under its feet, it will
- * then spawn in a single glass block so the player will not take fall damage.
- * If that block is within the mine, it will be reset at a later time when the
- * mine resets and resets that block. If it is part of spawn for the mine, then
- * the glass block will become part of the landscape.
- *
- *
- * @param player
- */
- public void teleportPlayerOut(Player player) {
-
- Location altTp = new Location( getBounds().getCenter() );
- altTp.setY( getBounds().getyBlockMax() + 1 );
- Location target = isHasSpawn() ? getSpawn() : altTp;
-
- // Player needs to stand on something. If block below feet is air, change it to a
- // glass block:
- Location targetGround = new Location( target );
- targetGround.setY( target.getBlockY() - 1 );
- if ( targetGround.getBlockAt().isEmpty() ) {
- targetGround.getBlockAt().setType( BlockType.GLASS );
- }
-
- player.teleport( target );
- PrisonMines.getInstance().getMinesMessages().getLocalizable("teleported")
- .withReplacements(this.name).sendTo(player);
+ private Location getLocation(Document doc, World world, String x, String y, String z, String pitch, String yaw) {
+ Location loc = getLocation(doc, world, x, y, z);
+ loc.setPitch( ((Double) doc.get(pitch)).floatValue() );
+ loc.setYaw( ((Double) doc.get(yaw)).floatValue() );
+ return loc;
}
- /**
- * This is a temporary fix until the Bounds.within() checks for the
- * same world. For now, it is assumed that Bounds.min and Bounds.max are
- * the same world, but that may not always be the case. This initialize function gets called after the classes are
+ * instantiated, and is initiated from Mine class and propagates
+ * to the MineData class. Good for kicking off the scheduler.
+ * A mine cannot be created without defining the bounds. Therefore,
+ * the "World" is stored within the bounds and that's where it should come from.
+ * At least this way, once the world is loaded, it will be set once and for all
+ * within the bounds and as such, it will help eliminate the overhead incurred by
+ * trying to get it from the platform object.
+ * Until the world is fully loaded and processed by the prison mine manager,
+ * this function will not be able to return a value for world.
+ * This function sets the world object for this mine, then
+ * indicates that this mine is enabled.
+ * This will be needed if the world in which the mine is located
+ * has not yet been loaded. This may be the situation when using a
+ * world generated and loaded by Multiverse-core, or similar plugin.
+ * (Re)defines the boundaries for this mine.
+ * This function used to set the world name every time the bounds would
+ * change. 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
+ * in the document loader under Mine.loadFromDocument as the first field
+ * that is set when restoring from the file.
+ * This is the remaining time until a reset, in seconds.
+ * This is based upon the getTargetResetTime() in ms and the current
+ * System.currentTimeMillis().
+ * The actual remaining time can vary greatly and is highly
+ * dependent upon the server load. Since many jobs within the whole
+ * mine reset process are scheduled to run in the future, their run
+ * time is just a request and it can vary if there are demanding jobs
+ * that are running, or if the bukkit/spigot's TPS starts dropping
+ * below 20.
+ * Minecraft ticks have 20 per seconds, which is 50 MS per tick.
+ * The value for MINE_RESET__MAX_PAGE_ELASPSED_TIME_MS is intended
+ * to be used as a threshold to determine when to stop placing blocks
+ * and resubmit in the sync job queue to allow other processes to run.
+ * This value, in milliseconds, is not hard-and-fast guaranteed to be
+ * caught exactly at that time. It is instead used to check to see if
+ * the current process has exceeded this value, which may be many times
+ * greater than this value.
+ * This value is subject to refinement and tuning to ensure better and
+ * more accurate responses.
+ * When placing blocks, this is the block count that is used to check for
+ * the elapsed time.
+ * It does not matter if some of those blocks were placed in a prior
+ * page, for it is the elapsed time that is important. It's also important
+ * that there are not too many checks since it will just contribute to lag.
+ * The value needs to be moderately large.
+ * This value is subject to refinement and tuning to ensure better and
+ * more accurate responses.
+ * This initialize function gets called after the classes are
+ * instantiated, and is initiated from Mine class and propagates
+ * to the MineData class. Good for kicking off the scheduler.
+ * Once the mine has been loaded in to memory, the number of
+ * air blocks must be counted to properly set the blockBreakCount.
+ * Optimized the mine reset to focus on itself. Also set the Y plane to refresh at the top and work its
+ * way down. That way if the play is teleported to the top, it will appear like the whole mine has reset
+ * instantly and they will not see the delay from the bottom of the mine working up to the top. This will
+ * also reduce the likelihood of the player falling back in to the mine if there is no spawn set.
+ * The ONLY code that could be asynchronous ran is the random generation of the blocks. The other
+ * lines of code is using bukkit and/or spigot api calls which MUST be ran synchronously.
+ * This function teleports players out of existing mines if they are within
+ * their boundaries within the world where the Mine exists. Using only players within the existing world of the current mine, each
+ * player is checked to see if they are within the mine, and if they are they
+ * are teleported either to the mine's spawn location, or straight up from the
+ * center of the mine, to the top of the mine (assumes air space will exist there). This function eliminates possible bug of players being teleported from other
+ * worlds, and also eliminates the possibility that the destination could
+ * ever be null. This function will teleport the player out of a given mine, or to the given
+ * mine. It will not confirm if the player is within the mine before trying to
+ * teleport.
+ * This function will teleport the player to the defined spawn location, or it
+ * will teleport the player to the center of the mine, but on top of the
+ * mine's surface. If the player target location has an empty block under its feet, it will
+ * then spawn in a single glass block so the player will not take fall damage.
+ * If that block is within the mine, it will be reset at a later time when the
+ * mine resets and resets that block. If it is part of spawn for the mine, then
+ * the glass block will become part of the landscape.
+ *
+ *
+ * Do not show any TP notifications. It will be obvious that the mine
+ * just reset and that they were teleported out of the mine. Since there is no
+ * control over this message, like enabling or disabling, then I'm just
+ * removing it since it just clutters chat and provides no real additional
+ * value.
+ *