This commit is contained in:
disclearing 2019-01-21 21:53:08 +00:00
parent adf5909504
commit ebe5b6c5ad
1802 changed files with 98630 additions and 1 deletions

22
PrevailBunkers/.classpath Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="var" path="USER_HOME/Desktop/kitmap1/AETHER.jar"/>
<classpathentry kind="var" path="USER_HOME/Desktop/kitmap1/Base.jar"/>
<classpathentry kind="var" path="USER_HOME/Desktop/kitmap1/commons-collections4-4.0.jar"/>
<classpathentry kind="var" path="USER_HOME/Desktop/kitmap1/commons-lang3-3.5.jar"/>
<classpathentry kind="var" path="USER_HOME/Desktop/kitmap1/commons-pool2-2.4.2.jar"/>
<classpathentry kind="var" path="USER_HOME/Desktop/kitmap1/jedis-2.9.0.jar"/>
<classpathentry kind="var" path="USER_HOME/Desktop/kitmap1/lombok-1.16.6.jar"/>
<classpathentry kind="var" path="USER_HOME/Desktop/kitmap1/lombok.jar"/>
<classpathentry kind="var" path="USER_HOME/Desktop/kitmap1/mongo-java-driver-3.3.0.jar"/>
<classpathentry kind="var" path="USER_HOME/Desktop/kitmap1/paperspigot-api.jar" sourcepath="/USER_HOME/Desktop/kitmap1/paperspigot-api.jar"/>
<classpathentry kind="var" path="USER_HOME/Desktop/kitmap1/paperspigot.jar" sourcepath="/USER_HOME/Desktop/kitmap1/paperspigot.jar"/>
<classpathentry kind="var" path="USER_HOME/Desktop/kitmap1/PermissionsEx-1.23.3.jar"/>
<classpathentry kind="var" path="USER_HOME/Desktop/kitmap1/ProtocolLib.jar"/>
<classpathentry kind="var" path="USER_HOME/Desktop/kitmap1/worldedit-bukkit-6.1.7.2.jar"/>
<classpathentry kind="var" path="USER_HOME/Desktop/kitmap1/worldguard-6.1.jar"/>
<classpathentry kind="var" path="USER_HOME/Desktop/kitmap1/Vault.jar"/>
<classpathentry kind="output" path="out/production/UHC Bunkers"/>
</classpath>

View File

@ -0,0 +1 @@
UHC Bunkers

View File

@ -0,0 +1,20 @@
<component name="ArtifactManager">
<artifact type="jar" name="UHC Bunkers:jar">
<output-path>$PROJECT_DIR$/classes/artifacts/UHC_Bunkers_jar</output-path>
<root id="archive" name="UHC Bunkers.jar">
<element id="module-output" name="UHC Bunkers" />
<element id="extracted-dir" path="$USER_HOME$/Desktop/kitmap1/jedis-2.9.0.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Desktop/kitmap1/commons-pool2-2.4.2.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Desktop/kitmap1/lombok.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Desktop/KitmapDepend/worldedit-bukkit-6.1.7.2.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Desktop/kitmap1/commons-lang3-3.5.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Desktop/kitmap1/AETHER.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Desktop/kitmap1/PermissionsEx-1.23.3.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Desktop/kitmap1/paperspigot.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Desktop/kitmap1/mongo-java-driver-3.3.0.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Desktop/kitmap1/paperspigot-api.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Desktop/kitmap1/lombok-1.16.6.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/Desktop/kitmap1/commons-collections4-4.0.jar" path-in-jar="/" />
</root>
</artifact>
</component>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/commands/ForceStart.java" charset="ISO-8859-1" />
<file url="file://$PROJECT_DIR$/src/me/vertises/aztec/tablist/Tablist.java" charset="ISO-8859-1" />
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/UHC Bunkers.iml" filepath="$PROJECT_DIR$/UHC Bunkers.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,812 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ArtifactsWorkspaceSettings">
<artifacts-to-build>
<artifact name="UHC Bunkers:jar" />
</artifacts-to-build>
</component>
<component name="ChangeListManager">
<list default="true" id="f434fcb7-a206-463a-8bc8-baf0ccadb2c7" name="Default" comment="" />
<ignored path="$PROJECT_DIR$/out/production/UHC Bunkers/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="LobbySpawn.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/commands/LobbySpawn.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="340">
<caret line="26" column="0" lean-forward="false" selection-start-line="26" selection-start-column="0" selection-end-line="26" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Core.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/Core.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2000">
<caret line="204" column="83" lean-forward="false" selection-start-line="204" selection-start-column="83" selection-end-line="204" selection-end-column="83" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="ForceStart.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/commands/ForceStart.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="11" column="13" lean-forward="false" selection-start-line="11" selection-start-column="13" selection-end-line="11" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="GradleLocalSettings">
<option name="externalProjectsViewState">
<projects_view />
</option>
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$USER_HOME$/Desktop/BunkersDepend/paper1.jar!/org/bukkit/command/CommandExecutor.class" />
<option value="$PROJECT_DIR$/src/com/prevailpots/bunkers/commands/RemoveTab.java" />
<option value="$PROJECT_DIR$/src/com/prevailpots/bunkers/game/managers/TeamManager.java" />
<option value="$PROJECT_DIR$/src/com/prevailpots/bunkers/utils/BroadcastUtils.java" />
<option value="$PROJECT_DIR$/src/com/prevailpots/bunkers/commands/ForceStart.java" />
<option value="$PROJECT_DIR$/src/me/vertises/aztec/tablist/Tablist.java" />
<option value="$PROJECT_DIR$/src/com/prevailpots/bunkers/Core.java" />
</list>
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="-8" />
<option name="y" value="-8" />
<option name="width" value="1932" />
<option name="height" value="1056" />
</component>
<component name="ProjectView">
<navigator currentView="PackagesPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="UHC Bunkers" type="b2602c69:ProjectViewProjectNode" />
<item name="PrevailBunkers" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="UHC Bunkers" type="b2602c69:ProjectViewProjectNode" />
<item name="PrevailBunkers" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="UHC Bunkers" type="b2602c69:ProjectViewProjectNode" />
<item name="PrevailBunkers" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="bunkers" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="UHC Bunkers" type="b2602c69:ProjectViewProjectNode" />
<item name="PrevailBunkers" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="bunkers" type="462c0819:PsiDirectoryNode" />
<item name="commands" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="UHC Bunkers" type="b2602c69:ProjectViewProjectNode" />
<item name="PrevailBunkers" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="bunkers" type="462c0819:PsiDirectoryNode" />
<item name="game" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="UHC Bunkers" type="b2602c69:ProjectViewProjectNode" />
<item name="PrevailBunkers" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="bunkers" type="462c0819:PsiDirectoryNode" />
<item name="game" type="462c0819:PsiDirectoryNode" />
<item name="managers" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="UHC Bunkers" type="b2602c69:ProjectViewProjectNode" />
<item name="PrevailBunkers" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="bunkers" type="462c0819:PsiDirectoryNode" />
<item name="utils" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="PackagesPane">
<subPane>
<expand>
<path>
<item name="UHC Bunkers" type="58d84e3e:PackageViewProjectNode" />
<item name="UHC Bunkers" type="616d4139:PackageViewModuleNode" />
</path>
<path>
<item name="UHC Bunkers" type="58d84e3e:PackageViewProjectNode" />
<item name="UHC Bunkers" type="616d4139:PackageViewModuleNode" />
<item name="com.prevailpots.bunkers" type="1f31426a:PackageElementNode" />
</path>
<path>
<item name="UHC Bunkers" type="58d84e3e:PackageViewProjectNode" />
<item name="UHC Bunkers" type="616d4139:PackageViewModuleNode" />
<item name="com.prevailpots.bunkers" type="1f31426a:PackageElementNode" />
<item name="commands" type="1f31426a:PackageElementNode" />
</path>
<path>
<item name="UHC Bunkers" type="58d84e3e:PackageViewProjectNode" />
<item name="UHC Bunkers" type="616d4139:PackageViewModuleNode" />
<item name="com.prevailpots.bunkers" type="1f31426a:PackageElementNode" />
<item name="config" type="1f31426a:PackageElementNode" />
</path>
<path>
<item name="UHC Bunkers" type="58d84e3e:PackageViewProjectNode" />
<item name="UHC Bunkers" type="616d4139:PackageViewModuleNode" />
<item name="com.prevailpots.bunkers" type="1f31426a:PackageElementNode" />
<item name="game" type="1f31426a:PackageElementNode" />
</path>
<path>
<item name="UHC Bunkers" type="58d84e3e:PackageViewProjectNode" />
<item name="UHC Bunkers" type="616d4139:PackageViewModuleNode" />
<item name="com.prevailpots.bunkers" type="1f31426a:PackageElementNode" />
<item name="game" type="1f31426a:PackageElementNode" />
<item name="managers" type="1f31426a:PackageElementNode" />
</path>
<path>
<item name="UHC Bunkers" type="58d84e3e:PackageViewProjectNode" />
<item name="UHC Bunkers" type="616d4139:PackageViewModuleNode" />
<item name="com.prevailpots.bunkers" type="1f31426a:PackageElementNode" />
<item name="scoreboard" type="1f31426a:PackageElementNode" />
</path>
<path>
<item name="UHC Bunkers" type="58d84e3e:PackageViewProjectNode" />
<item name="UHC Bunkers" type="616d4139:PackageViewModuleNode" />
<item name="com.prevailpots.bunkers" type="1f31426a:PackageElementNode" />
<item name="scoreboard" type="1f31426a:PackageElementNode" />
<item name="provider" type="1f31426a:PackageElementNode" />
</path>
<path>
<item name="UHC Bunkers" type="58d84e3e:PackageViewProjectNode" />
<item name="UHC Bunkers" type="616d4139:PackageViewModuleNode" />
<item name="com.prevailpots.bunkers" type="1f31426a:PackageElementNode" />
<item name="task" type="1f31426a:PackageElementNode" />
</path>
<path>
<item name="UHC Bunkers" type="58d84e3e:PackageViewProjectNode" />
<item name="UHC Bunkers" type="616d4139:PackageViewModuleNode" />
<item name="com.prevailpots.bunkers" type="1f31426a:PackageElementNode" />
<item name="world" type="1f31426a:PackageElementNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="Scratches" />
<pane id="Scope" />
<pane id="AndroidView" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="last_opened_file_path" value="$PROJECT_DIR$/../hcf" />
<property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.15136719" />
<property name="project.structure.side.proportion" value="0.2" />
<property name="settings.editor.selected.configurable" value="preferences.general" />
<property name="GenerateAntBuildDialog.enableUiFormCompile" value="true" />
<property name="GenerateAntBuildDialog.forceTargetJdk" value="true" />
<property name="GenerateAntBuildDialog.backupFiles" value="true" />
<property name="GenerateAntBuildDialog.outputFileNameProperty" value="uhc_bunkers" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager" selected="JAR Application.Unnamed">
<configuration name="BuildJAR" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="com.prevailpots.bunkers.Core" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="1.8" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="UHC Bunkers" />
<envs />
<method>
<option name="Maven.BeforeRunTask" enabled="true" file="C:\Users\John\Documents\Eclipse\kitmap/pom.xml" goal="assembly:single" />
</method>
</configuration>
<configuration name="Unnamed" type="JarApplication" factoryName="JAR Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="WORKING_DIRECTORY" value="C:\Users\John\Documents\Eclipse\PrevailBunkers" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="1.8" />
<envs />
<module name="UHC Bunkers" />
<method>
<option name="Maven.BeforeRunTask" enabled="true" file="C:\Users\John\Documents\Eclipse\kitmap/pom.xml" goal="assembly:single" />
</method>
</configuration>
<configuration default="true" type="Applet" factoryName="Applet">
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<module />
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
</configuration>
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="" />
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
<option name="PROGRAM_PARAMETERS" />
<predefined_log_file id="idea.log" enabled="true" />
</configuration>
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<envs />
<properties />
<listeners />
</configuration>
<list size="2">
<item index="0" class="java.lang.String" itemvalue="Application.BuildJAR" />
<item index="1" class="java.lang.String" itemvalue="JAR Application.Unnamed" />
</list>
</component>
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="f434fcb7-a206-463a-8bc8-baf0ccadb2c7" name="Default" comment="" />
<created>1504672144081</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1504672144081</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32980973" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17604166" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32980973" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
<layout-to-restore>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="7" side_tool="false" content_ui="combo" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="5" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="true" content_ui="tabs" />
</layout-to-restore>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>jar://C:/Program Files/Java/jdk1.8.0_144/src.zip!/java/util/function/Consumer.java</url>
<line>63</line>
<properties />
<option name="timeStamp" value="1" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-method">
<url>file://$PROJECT_DIR$/src/com/prevailpots/bunkers/Core.java</url>
<line>181</line>
<properties class="com.prevailpots.bunkers.Core" method="onDisable">
<option name="EMULATED" value="true" />
</properties>
<option name="timeStamp" value="2" />
</line-breakpoint>
</breakpoints>
<option name="time" value="4" />
</breakpoint-manager>
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="jar://$USER_HOME$/Desktop/BunkersDepend/paper1.jar!/org/bukkit/command/CommandExecutor.class" />
<entry file="file://$PROJECT_DIR$/src/plugin.yml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/me/vertises/aztec/tablist/Reflection.java" />
<entry file="file://$PROJECT_DIR$/src/me/vertises/aztec/tablist/ClientVersion.java" />
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/world/WorldManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="6" column="13" lean-forward="false" selection-start-line="6" selection-start-column="13" selection-end-line="6" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/world/ConfigManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="5" column="13" lean-forward="false" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/utils/BroadcastUtils.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="16" column="1" lean-forward="false" selection-start-line="16" selection-start-column="1" selection-end-line="16" selection-end-column="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/utils/ItemUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="9" column="13" lean-forward="false" selection-start-line="9" selection-start-column="13" selection-end-line="9" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/utils/MathUtils.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="5" column="13" lean-forward="false" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/utils/ParticleEffect.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="11" column="12" lean-forward="false" selection-start-line="11" selection-start-column="12" selection-end-line="11" selection-end-column="12" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/utils/ReflectionUtils.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="6" column="19" lean-forward="false" selection-start-line="6" selection-start-column="19" selection-end-line="6" selection-end-column="19" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/utils/RegionUtils.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="8" column="13" lean-forward="false" selection-start-line="8" selection-start-column="13" selection-end-line="8" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/task/PlayerItemTask.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="6" column="13" lean-forward="false" selection-start-line="6" selection-start-column="13" selection-end-line="6" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/task/ItemDropTask.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="12" column="13" lean-forward="false" selection-start-line="12" selection-start-column="13" selection-end-line="12" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/task/DynamicTask.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
<caret line="2" column="17" lean-forward="false" selection-start-line="2" selection-start-column="17" selection-end-line="2" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/scoreboard/SidebarProvider.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="5" column="17" lean-forward="false" selection-start-line="5" selection-start-column="17" selection-end-line="5" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/scoreboard/SidebarEntry.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
<caret line="2" column="13" lean-forward="false" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/scoreboard/ScoreboardHandler.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="102">
<caret line="22" column="13" lean-forward="false" selection-start-line="22" selection-start-column="13" selection-end-line="22" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/scoreboard/PlayerBoard.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="13" column="13" lean-forward="false" selection-start-line="13" selection-start-column="13" selection-end-line="13" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/scoreboard/BufferedObjective.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="8" column="13" lean-forward="false" selection-start-line="8" selection-start-column="13" selection-end-line="8" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/scoreboard/provider/TimerSidebarProvider.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="15" column="13" lean-forward="false" selection-start-line="15" selection-start-column="13" selection-end-line="15" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/game/managers/BalanceManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="7" column="13" lean-forward="false" selection-start-line="7" selection-start-column="13" selection-end-line="7" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/game/managers/CapzoneManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
<caret line="2" column="13" lean-forward="false" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/game/managers/ChatManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="14" column="13" lean-forward="false" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/game/managers/CooldownManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="14" column="13" lean-forward="false" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/game/managers/DTRManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="7" column="13" lean-forward="false" selection-start-line="7" selection-start-column="13" selection-end-line="7" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/game/managers/FreezeManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="15" column="13" lean-forward="false" selection-start-line="15" selection-start-column="13" selection-end-line="15" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/game/managers/ItemManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="13" column="13" lean-forward="false" selection-start-line="13" selection-start-column="13" selection-end-line="13" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/game/managers/PointManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="5" column="13" lean-forward="false" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/game/managers/ShopManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="21" column="13" lean-forward="false" selection-start-line="21" selection-start-column="13" selection-end-line="21" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/game/managers/TeamJoinManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="119">
<caret line="17" column="13" lean-forward="false" selection-start-line="17" selection-start-column="13" selection-end-line="17" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/game/managers/TeamManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="572">
<caret line="105" column="54" lean-forward="false" selection-start-line="105" selection-start-column="54" selection-end-line="105" selection-end-column="54" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/game/GameHandler.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="25" column="13" lean-forward="false" selection-start-line="25" selection-start-column="13" selection-end-line="25" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/game/GameState.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
<caret line="2" column="12" lean-forward="false" selection-start-line="2" selection-start-column="12" selection-end-line="2" selection-end-column="12" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/game/Team.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="4" column="12" lean-forward="false" selection-start-line="4" selection-start-column="12" selection-end-line="4" selection-end-column="12" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/config/ConfigurationService.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="14" column="13" lean-forward="false" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/commands/RemoveTab.java" />
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/commands/TeamCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="16" column="13" lean-forward="false" selection-start-line="16" selection-start-column="13" selection-end-line="16" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="jar://C:/Program Files/Java/jdk1.8.0_144/src.zip!/java/util/function/Consumer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="731">
<caret line="66" column="0" lean-forward="false" selection-start-line="66" selection-start-column="0" selection-end-line="66" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/me/vertises/aztec/tablist/example/ExampleSupplier.java" />
<entry file="file://$PROJECT_DIR$/src/me/vertises/aztec/tablist/example/TablistPlugin.java" />
<entry file="file://$PROJECT_DIR$/src/me/vertises/aztec/tablist/reflection/ReflectionConstants.java" />
<entry file="file://$PROJECT_DIR$/src/me/vertises/aztec/tablist/TablistUpdateTask.java" />
<entry file="file://$PROJECT_DIR$/src/me/vertises/aztec/tablist/TablistEntrySupplier.java" />
<entry file="file://$PROJECT_DIR$/src/me/vertises/aztec/tablist/TablistManager.java" />
<entry file="file://$PROJECT_DIR$/src/me/vertises/aztec/tablist/Tablist.java" />
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/commands/LobbySpawn.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="340">
<caret line="26" column="0" lean-forward="false" selection-start-line="26" selection-start-column="0" selection-end-line="26" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/commands/ForceStart.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="11" column="13" lean-forward="false" selection-start-line="11" selection-start-column="13" selection-end-line="11" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/tab/TabEvent.java" />
<entry file="jar://$USER_HOME$/Desktop/kitmap1/paperspigot-api.jar!/org/bukkit/plugin/java/JavaPlugin.class" />
<entry file="file://$PROJECT_DIR$/src/com/prevailpots/bunkers/Core.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2000">
<caret line="204" column="83" lean-forward="false" selection-start-line="204" selection-start-column="83" selection-end-line="204" selection-end-column="83" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
<state key="ArtifactsStructureConfigurable.UI">
<settings>
<artifact-editor />
<last-edited>UHC Bunkers:jar</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="FacetStructureConfigurable.UI">
<settings>
<last-edited>No facets are configured</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="GlobalLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="JdkListConfigurable.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ModuleStructureConfigurable.UI">
<settings>
<last-edited>UHC Bunkers</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

15
PrevailBunkers/.project Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>UHC Bunkers</name>
<comment/>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments/>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,2 @@
Manifest-Version: 1.0

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<component inheritJdk="true">
<exclude-output/>
<contentEntry url="file://$MODULE_DIR$"/>
<lib name="paperspigot-api.jar" scope="COMPILE">
<srcroot url="jar://$USER_HOME$/Desktop/kitmap1/paperspigot-api.jar!/"/>
</lib>
<lib name="paperspigot.jar" scope="COMPILE">
<srcroot url="jar://$USER_HOME$/Desktop/kitmap1/paperspigot.jar!/"/>
</lib>
</component>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="eclipse" classpath-dir="$MODULE_DIR$" type="JAVA_MODULE" version="4" />

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<eclipse-userlibraries />

View File

@ -0,0 +1,226 @@
package com.prevailpots.bunkers;
import java.io.File;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.command.CommandExecutor;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import com.prevailpots.bunkers.commands.ForceStart;
import com.prevailpots.bunkers.commands.LobbySpawn;
import com.prevailpots.bunkers.commands.TeamCommand;
import com.prevailpots.bunkers.config.ConfigurationService;
import com.prevailpots.bunkers.game.GameHandler;
import com.prevailpots.bunkers.game.managers.BalanceManager;
import com.prevailpots.bunkers.game.managers.ChatManager;
import com.prevailpots.bunkers.game.managers.CooldownManager;
import com.prevailpots.bunkers.game.managers.DTRManager;
import com.prevailpots.bunkers.game.managers.FreezeManager;
import com.prevailpots.bunkers.game.managers.ItemManager;
import com.prevailpots.bunkers.game.managers.PointManager;
import com.prevailpots.bunkers.game.managers.ShopManager;
import com.prevailpots.bunkers.game.managers.TeamJoinManager;
import com.prevailpots.bunkers.game.managers.TeamManager;
import com.prevailpots.bunkers.scoreboard.ScoreboardHandler;
import com.prevailpots.bunkers.tab.TabEvent;
import com.prevailpots.bunkers.world.ConfigManager;
import com.prevailpots.bunkers.world.WorldManager;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import me.vertises.aztec.tablist.TablistManager;
import me.vertises.aztec.tablist.example.ExampleSupplier;
public class Core extends JavaPlugin
{
private static Core instance;
private static Plugin plugin;
private GameHandler gameHandler;
private BalanceManager balanceManager;
private PointManager pointManager;
private TeamManager teamManager;
private FreezeManager freezeManager;
private ScoreboardHandler scoreboardHandler;
private ItemManager itemManager;
private DTRManager dtrManager;
private ChatManager chatManager;
private CooldownManager cooldownManager;
private WorldEditPlugin worldEdit;
public static final Random RANDOM;
public WorldManager wm;
public ConfigManager config;
private TeamJoinManager teamjoinManager;
static {
RANDOM = new Random();
}
public static Core getInstance() {
if (Core.instance == null) {
Core.instance = new Core();
}
return Core.instance;
}
public FreezeManager getFreezeManager() {
if (this.freezeManager == null) {
this.freezeManager = new FreezeManager();
}
return this.freezeManager;
}
public Core() {
this.wm = new WorldManager();
this.config = new ConfigManager("WorldRollback", "config");
}
public BalanceManager getBalanceManager() {
if (this.balanceManager == null) {
this.balanceManager = new BalanceManager();
}
return this.balanceManager;
}
public DTRManager getDTRManager() {
if (this.dtrManager == null) {
this.dtrManager = new DTRManager();
}
return this.dtrManager;
}
public ChatManager getChatManager() {
if (this.chatManager == null) {
this.chatManager = new ChatManager();
}
return this.chatManager;
}
public ItemManager getItemManager() {
if (this.itemManager == null) {
this.itemManager = new ItemManager();
}
return this.itemManager;
}
public PointManager getPointManager() {
if (this.pointManager == null) {
this.pointManager = new PointManager();
}
return this.pointManager;
}
public ScoreboardHandler getScoreboardHandler() {
if (this.scoreboardHandler == null) {
this.scoreboardHandler = new ScoreboardHandler(getInstance());
}
return this.scoreboardHandler;
}
public GameHandler getGameHandler() {
if (this.gameHandler == null) {
this.gameHandler = new GameHandler();
}
return this.gameHandler;
}
public TeamManager getTeamManager() {
if (this.teamManager == null) {
this.teamManager = new TeamManager();
}
return this.teamManager;
}
public CooldownManager getCooldownManager() {
if (this.cooldownManager == null) {
this.cooldownManager = new CooldownManager();
}
return this.cooldownManager;
}
public void onEnable() {
Core.instance = this;
new TablistManager(this, new TabEvent(), TimeUnit.SECONDS.toMillis(5l));
this.gameHandler = new GameHandler();
this.balanceManager = new BalanceManager();
this.itemManager = new ItemManager();
this.pointManager = new PointManager();
this.chatManager = new ChatManager();
this.cooldownManager = new CooldownManager();
this.freezeManager = new FreezeManager();
this.scoreboardHandler = new ScoreboardHandler(getInstance());
this.teamManager = new TeamManager();
this.teamjoinManager = new TeamJoinManager();
this.dtrManager = new DTRManager();
final Plugin p = Bukkit.getServer().getPluginManager().getPlugin("WorldEdit");
if (p instanceof WorldEditPlugin) {
this.worldEdit = (WorldEditPlugin)p;
}
ConfigurationService.init();
this.registerEvents();
this.registerCommands();
Bukkit.getScheduler().runTaskTimer((Plugin)getInstance(), (Runnable)this.getGameHandler(), 20L, 20L);
Bukkit.broadcastMessage("<EFBFBD>cThis server is running pBunkers by PrevailPots");
Core.plugin = (Plugin)this;
if (this.config.getFile() == null) {
this.config.createFile();
this.config.saveFile();
}
if (this.config.getFile().getString("world") == null) {
this.config.getFile().set("world", (Object)"world");
this.config.getFile().set("map", (Object)"_map");
this.config.saveFile();
}
Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Bunkers] " + ChatColor.YELLOW + "The world has been refreshed for the next game!");
Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Bunkers] " + ChatColor.YELLOW + "This network is running p-1-29-Version-BETA");
Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Bunkers] " + ChatColor.YELLOW + "This plugin is only licensed to prevailpots.com");
Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[Bunkers] " + ChatColor.YELLOW + "This plugin was coded by S3ries, Clipped");
}
public void onDisable() {
for (final Player p : Bukkit.getOnlinePlayers()) {
p.kickPlayer("<EFBFBD>aServer reloading, please try again later.");
final World delete = Bukkit.getWorld(this.config.getFile().getString("world"));
final File deleteFolder = delete.getWorldFolder();
this.wm.deleteWorld(deleteFolder);
Bukkit.getServer().createWorld(new WorldCreator(this.config.getFile().getString("map")));
final World source = Bukkit.getWorld(this.config.getFile().getString("map"));
final File sourceFolder = source.getWorldFolder();
final World target = Bukkit.getWorld(this.config.getFile().getString("world"));
final File targetFolder = target.getWorldFolder();
this.wm.copyWorld(sourceFolder, targetFolder);
}
}
public WorldEditPlugin getWorldEdit() {
return this.worldEdit;
}
private void registerEvents() {
final PluginManager pm = Bukkit.getPluginManager();
pm.registerEvents((Listener)this.getGameHandler(), (Plugin)getInstance());
pm.registerEvents((Listener)new ShopManager(), (Plugin)getInstance());
pm.registerEvents((Listener)this.scoreboardHandler, (Plugin)getInstance());
new TablistManager(this, new TabEvent(), TimeUnit.SECONDS.toMillis(5l));
pm.registerEvents((Listener)this.freezeManager, (Plugin)getInstance());
pm.registerEvents((Listener)this.cooldownManager, (Plugin)getInstance());
pm.registerEvents((Listener)this.chatManager, (Plugin)getInstance());
pm.registerEvents((Listener)this.teamjoinManager, (Plugin)getInstance());
}
private void registerCommands() {
this.getCommand("setlobbyspawn").setExecutor((CommandExecutor)new LobbySpawn());
this.getCommand("removetab").setExecutor((CommandExecutor)new RemoveTab());
this.getCommand("team").setExecutor((CommandExecutor)new TeamCommand());
this.getCommand("forcestart").setExecutor((CommandExecutor)new ForceStart());
}
}

View File

@ -0,0 +1,36 @@
package com.prevailpots.bunkers.commands;
import org.bukkit.command.*;
import org.bukkit.entity.*;
import com.prevailpots.bunkers.*;
import com.prevailpots.bunkers.game.*;
import com.prevailpots.bunkers.utils.*;
import ru.tehkode.permissions.bukkit.*;
public class ForceStart implements CommandExecutor
{
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("§c§lPLAYERS ONLY!");
return true;
}
final Player player = (Player)sender;
if (!PermissionsEx.getUser(player).has("uhcb.forcestart") && !player.isOp()) {
player.sendMessage("§c§lNO PERMISSIONS...");
return true;
}
if (args.length != 0) {
player.sendMessage("§cCorrect usage: " + command.getUsage());
return true;
}
if (!Core.getInstance().getGameHandler().getGameState().equals(GameState.LOBBY)) {
player.sendMessage("§cThe game is already running!");
return true;
}
Core.getInstance().getGameHandler().startGame();
BroadcastUtils.broadcastToPerm("§7[" + player.getName() + ": §oForce started the game.§7]", "uhcb.forcestart");
return true;
}
}

View File

@ -0,0 +1,31 @@
package com.prevailpots.bunkers.commands;
import org.bukkit.command.*;
import org.bukkit.entity.*;
import com.prevailpots.bunkers.config.*;
import com.prevailpots.bunkers.utils.*;
import ru.tehkode.permissions.bukkit.*;
public class LobbySpawn implements CommandExecutor
{
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("§c§lPLAYERS ONLY!");
return true;
}
final Player player = (Player)sender;
if (!PermissionsEx.getUser(player).has("uhcb.setlobbyspawn") && !player.isOp()) {
player.sendMessage("§c§lNO PERMISSIONS...");
return true;
}
if (args.length != 0) {
player.sendMessage("§cCorrect usage: " + command.getUsage());
return true;
}
ConfigurationService.setLobbySpawn(player.getLocation());
BroadcastUtils.broadcastToPerm("§7[" + player.getName() + ": §oSet the lobby spawn to " + (int)player.getLocation().getX() + "x, " + (int)player.getLocation().getY() + "y, " + (int)player.getLocation().getZ() + "z§7]", "uhcb.setlobbyspawn");
return true;
}
}

View File

@ -0,0 +1,44 @@
package com.prevailpots.bunkers.commands;
import java.util.ArrayList;
import java.util.Collection;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import com.prevailpots.bunkers.Core;
import me.vertises.aztec.tablist.ClientVersion;
public class RemoveTab implements CommandExecutor {
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if(!(commandSender instanceof Player)) {
return true;
}
return true;
}
public boolean getEntries(Player player) {
Table<Integer, Integer, String> table = HashBasedTable.create();
int index = 0;
int magic = ClientVersion.getVersion(player).ordinal() != 0 ? 4 : 3;
for (Player next : Bukkit.getOnlinePlayers()) {
int x = index % magic;
int y = index / magic;
table.put(x, y, next.getName());
player.sendMessage("§eYou have §6§lremoved §eyour custom tab!");
}
return true;
}
}

View File

@ -0,0 +1,144 @@
package com.prevailpots.bunkers.commands;
import org.bukkit.command.*;
import org.bukkit.entity.*;
import ru.tehkode.permissions.bukkit.*;
import org.bukkit.*;
import org.apache.commons.lang3.*;
import org.bukkit.util.*;
import com.prevailpots.bunkers.*;
import com.prevailpots.bunkers.config.*;
import com.prevailpots.bunkers.game.*;
import com.prevailpots.bunkers.utils.*;
import com.sk89q.worldedit.bukkit.selections.*;
public class TeamCommand implements CommandExecutor
{
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("§c§lPLAYERS ONLY!");
return true;
}
final Player player = (Player)sender;
if (args.length == 0) {
player.sendMessage("§cCorrect usage: " + command.getUsage());
return true;
}
if (args[0].equalsIgnoreCase("setspawn")) {
if (!PermissionsEx.getUser(player).has("uhcb.setteamspawn") && !player.isOp()) {
player.sendMessage("§c§lNO PERMISSIONS...");
return true;
}
if (args.length != 2) {
player.sendMessage("§cCorrect usage: /team setspawn <team>");
return true;
}
final String team = args[1];
if (Team.fromString(team) == null) {
player.sendMessage("§eInvalid team.");
return true;
}
ConfigurationService.setTeamSpawn(player.getLocation(), Team.fromString(team));
BroadcastUtils.broadcastToPerm("§7[" + player.getName() + ": §oSet the " + team + " team spawn to " + (int)player.getLocation().getX() + "x, " + (int)player.getLocation().getY() + "y, " + (int)player.getLocation().getZ() + "z§7]", "uhcb.setteamspawn");
}
else if (args[0].equalsIgnoreCase("info") || args[0].equalsIgnoreCase("stats") || args[0].equalsIgnoreCase("show") || args[0].equalsIgnoreCase("who")) {
if (args.length != 2) {
player.sendMessage("§cCorrect usage: /team " + args[0] + " <team>");
return true;
}
String team = args[1];
if (Team.fromString(team) == null) {
team = (Core.getInstance().getGameHandler().getPlayers().containsKey(team) ? StringUtils.capitalize(Core.getInstance().getGameHandler().getPlayers().get(Bukkit.getPlayer(team).getName()).toString().toLowerCase()) : "NULLBLOCK");
}
final Team tem = Team.fromString(team);
if (tem == null) {
player.sendMessage("§eInvalid team.");
return true;
}
String toSend = "";
toSend = String.valueOf(toSend) + "§7§m------------------------------------\n";
toSend = String.valueOf(toSend) + "§7[" + tem.getColor().toString() + "Team " + StringUtils.capitalize(tem.toString().toLowerCase()) + "§7]\n";
toSend = String.valueOf(toSend) + " \n";
toSend = String.valueOf(toSend) + "§aTeam members" + tem.getColor().toString() + ":\n";
String[] members;
for (int length = (members = Core.getInstance().getTeamManager().getMembers(tem)).length, i = 0; i < length; ++i) {
final String s = members[i];
toSend = String.valueOf(toSend) + "§7[" + (Core.getInstance().getGameHandler().getPlayersDeadOrRespawning().contains(Bukkit.getPlayer(s).getName()) ? "§c" : "§a") + s + "§7]" + "\n";
}
toSend = String.valueOf(toSend) + " \n";
toSend = String.valueOf(toSend) + "§aTeam info" + tem.getColor().toString() + ":\n";
toSend = String.valueOf(toSend) + "§aTotal team balance" + tem.getColor().toString() + ": " + Core.getInstance().getTeamManager().getTeamBalanceFormatted(tem) + "\n";
toSend = String.valueOf(toSend) + "§aTotal team kills" + tem.getColor().toString() + ": " + Core.getInstance().getTeamManager().getTotalKills(tem) + "\n";
toSend = String.valueOf(toSend) + "§aTotal team deaths" + tem.getColor().toString() + ": " + Core.getInstance().getTeamManager().getTotalDeaths(tem) + "\n";
toSend = String.valueOf(toSend) + "§aTotal team points" + tem.getColor().toString() + ": " + Core.getInstance().getTeamManager().getTeamPoints(tem) + "\n";
toSend = String.valueOf(toSend) + "§aDTR" + tem.getColor().toString() + ": " + Core.getInstance().getDTRManager().getDTRFormatted(tem) + "\n";
toSend = String.valueOf(toSend) + "§7§m------------------------------------\n";
player.sendMessage(toSend);
}
else if (args[0].equalsIgnoreCase("setregion")) {
if (args.length != 2) {
player.sendMessage("§cCorrect usage: /team setregion <team>");
return true;
}
final String team = args[1];
if (!PermissionsEx.getUser(player).has("uhcb.setteamregion") && !player.isOp()) {
player.sendMessage("§c§lNO PERMISSIONS...");
return true;
}
if (Team.fromString(team) == null) {
player.sendMessage("§cInvalid team.");
return true;
}
final Selection s2 = Core.getInstance().getWorldEdit().getSelection(player);
if (s2 == null) {
player.sendMessage("§cNo region selected. Select one with WorldEdit.");
return true;
}
final Vector point1 = new Vector(s2.getMinimumPoint().getX(), 0.0, s2.getMinimumPoint().getZ());
final Vector point2 = new Vector(s2.getMaximumPoint().getX(), 255.0, s2.getMaximumPoint().getZ());
ConfigurationService.setRegions(Team.fromString(team), new Vector[] { point1, point2 });
BroadcastUtils.broadcastToPerm("§7[" + player.getName() + ": §oSet the " + team + " team region.§7]", "uhcb.setteamregion");
}
else if (args[0].equalsIgnoreCase("setcapzone")) {
if (args.length != 2) {
player.sendMessage("§cCorrect usage: /team setcapzone <team>");
return true;
}
final String team = args[1];
if (!PermissionsEx.getUser(player).has("uhcb.setteamcapzone") && !player.isOp()) {
player.sendMessage("§c§lNO PERMISSIONS...");
return true;
}
if (Team.fromString(team) == null) {
player.sendMessage("§cInvalid team.");
return true;
}
final Selection s2 = Core.getInstance().getWorldEdit().getSelection(player);
if (s2 == null) {
player.sendMessage("§cNo region selected. Select one with WorldEdit.");
return true;
}
final Vector point1 = new Vector(s2.getMinimumPoint().getX(), s2.getMinimumPoint().getY(), s2.getMinimumPoint().getZ());
final Vector point2 = new Vector(s2.getMaximumPoint().getX(), 255.0, s2.getMaximumPoint().getZ());
ConfigurationService.setCapzone(Team.fromString(team), new Vector[] { point1, point2 });
BroadcastUtils.broadcastToPerm("§7[" + player.getName() + ": §oSet the " + team + " team capzone.§7]", "uhcb.setteamcapzone");
}
else if (args[0].equalsIgnoreCase("chat") || args[0].equalsIgnoreCase("c")) {
if (args.length != 1) {
player.sendMessage("§cCorrect usage: /team chat");
return true;
}
if (Core.getInstance().getChatManager().isTeamChat(player)) {
Core.getInstance().getChatManager().setTeamChat(player, false);
player.sendMessage("§aYou are no longer talking in team chat.");
}
else {
Core.getInstance().getChatManager().setTeamChat(player, true);
player.sendMessage("§aYou are now talking in team chat.");
}
}
return true;
}
}

View File

@ -0,0 +1,212 @@
package com.prevailpots.bunkers.config;
import org.bukkit.configuration.file.*;
import org.bukkit.util.*;
import com.prevailpots.bunkers.*;
import com.prevailpots.bunkers.game.*;
import com.sk89q.worldedit.Vector;
import java.util.*;
import org.bukkit.entity.*;
import java.io.*;
import org.bukkit.*;
public class ConfigurationService
{
private static final File databaseFile;
private static YamlConfiguration database;
private static final File playerDatabaseFile;
private static YamlConfiguration playerDatabase;
public static final String NO_PERMISSIONS = "§c§lNO PERMISSIONS...";
public static final String PLAYERS_ONLY = "§c§lPLAYERS ONLY!";
public static final String PERM_SET_LOBBY_SPAWN = "uhcb.setlobbyspawn";
public static final String PERM_SET_TEAM_SPAWN = "uhcb.setteamspawn";
public static final String PERM_SET_TEAM_REGION = "uhcb.setteamregion";
public static final String PERM_SET_TEAM_CAPZONE = "uhcb.setteamcapzone";
public static final String PERM_FORCE_START = "uhcb.forcestart";
public static final String SCOREBOARD_TITLE = "§6§lPURGE §c[UHCBunkers]";
public static final int GAME_MAX_TIME_MINUTES = 35;
public static final int GAME_MAX_PLAYERS = 16;
public static final int GAME_MIN_PLAYERS = 4;
public static final int GAME_MAX_TEAM_SIZE = 4;
public static final int GAME_COUNTDOWN_TIME = 10;
public static final int GAME_START_FREEZE_SECONDS = 5;
public static final int GAME_DEATH_FREEZE_SECONDS = 5;
public static final double GAME_BALANCE_PER_2_SECONDS = 0.55;
public static final int GAME_COBBLESTONE_ORE_RESPAWN_SECONDS = 5;
public static final int TEAM_POINTS_TO_WIN = 125;
public static final int POINTS_LOST_ON_DEATH = 5;
public static final int POINTS_GAINED_ON_KILL = 5;
public static final double IRON_SELL_PRICE = 10.0;
public static final double GOLD_SELL_PRICE = 15.0;
public static final double DIAMOND_SELL_PRICE = 20.0;
private static Vector lobbySpawn;
private static Map<Team, Vector[]> teamRegions;
private static Map<Team, Vector[]> teamCapzones;
private static HashMap<Team, Vector> teamSpawns1;
private static HashMap<String, Integer> statKills;
private static HashMap<String, Integer> statDeaths;
private static Object teamSpawns;
static {
databaseFile = new File(Core.getInstance().getDataFolder() + File.separator + "database.yml");
playerDatabaseFile = new File(Core.getInstance().getDataFolder() + File.separator + "playerDatabase.yml");
ConfigurationService.teamRegions = new HashMap<Team, Vector[]>();
ConfigurationService.teamCapzones = new HashMap<Team, Vector[]>();
ConfigurationService.teamSpawns1 = new HashMap<Team, Vector>();
ConfigurationService.statKills = new HashMap<String, Integer>();
ConfigurationService.statDeaths = new HashMap<String, Integer>();
}
public static void init() {
ConfigurationService.database = YamlConfiguration.loadConfiguration(ConfigurationService.databaseFile);
ConfigurationService.playerDatabase = YamlConfiguration.loadConfiguration(ConfigurationService.playerDatabaseFile);
registerShit();
}
private static void registerShit() {
ConfigurationService.lobbySpawn = new Vector(ConfigurationService.database.getDouble("lobbySpawn.x"), ConfigurationService.database.getDouble("lobbySpawn.y"), ConfigurationService.database.getDouble("lobbySpawn.z"));
Team[] values;
for (int length = (values = Team.values()).length, i = 0; i < length; ++i) {
final Team t = values[i];
ConfigurationService.teamSpawns1.put(t, new Vector(ConfigurationService.database.getDouble("teamSpawn." + t.toString().toLowerCase() + ".x"), ConfigurationService.database.getDouble("teamSpawn." + t.toString().toLowerCase() + ".y"), ConfigurationService.database.getDouble("teamSpawn." + t.toString().toLowerCase() + ".z")));
}
for (final String s : ConfigurationService.playerDatabase.getKeys(false)) {
if (s == null) {
continue;
}
if (!ConfigurationService.playerDatabase.contains(String.valueOf(s) + ".kills")) {
continue;
}
if (!ConfigurationService.playerDatabase.contains(String.valueOf(s) + ".deaths")) {
continue;
}
ConfigurationService.statKills.put(s, ConfigurationService.playerDatabase.getInt(String.valueOf(s) + ".kills"));
ConfigurationService.statDeaths.put(s, ConfigurationService.playerDatabase.getInt(String.valueOf(s) + ".deaths"));
}
Team[] values2;
for (int length2 = (values2 = Team.values()).length, j = 0; j < length2; ++j) {
final Team t = values2[j];
ConfigurationService.teamRegions.put(t, new Vector[] { new Vector(ConfigurationService.database.getDouble("teamRegion1." + t.name().toLowerCase() + ".x"), 0.0, ConfigurationService.database.getDouble("teamRegion1." + t.name().toLowerCase() + ".z")), new Vector(ConfigurationService.database.getDouble("teamRegion2." + t.name().toLowerCase() + ".x"), 255.0, ConfigurationService.database.getDouble("teamRegion2." + t.name().toLowerCase() + ".z")) });
ConfigurationService.teamCapzones.put(t, new Vector[] { new Vector(ConfigurationService.database.getDouble("teamCapzone1." + t.name().toLowerCase() + ".x"), ConfigurationService.database.getDouble("teamCapzone1." + t.name().toLowerCase() + ".y"), ConfigurationService.database.getDouble("teamCapzone1." + t.name().toLowerCase() + ".z")), new Vector(ConfigurationService.database.getDouble("teamCapzone2." + t.name().toLowerCase() + ".x"), 255.0, ConfigurationService.database.getDouble("teamCapzone2." + t.name().toLowerCase() + ".z")) });
}
}
public static Integer getStatKills(final Player p) {
return ConfigurationService.statKills.containsKey(p.getUniqueId().toString()) ? ConfigurationService.statKills.get(p.getUniqueId().toString()) : 0;
}
public static Vector[] getRegions(final Team t) {
return ConfigurationService.teamRegions.get(t);
}
public static Vector[] getCapzone(final Team t) {
return ConfigurationService.teamCapzones.get(t);
}
public static void setRegions(final Team t, final Vector[] vectors) {
if (ConfigurationService.teamRegions.containsKey(t)) {
ConfigurationService.teamRegions.remove(t);
}
ConfigurationService.database.set("teamRegion1." + t.toString().toLowerCase() + ".x", (Object)vectors[0].getX());
ConfigurationService.database.set("teamRegion1." + t.toString().toLowerCase() + ".y", (Object)vectors[0].getY());
ConfigurationService.database.set("teamRegion1." + t.toString().toLowerCase() + ".z", (Object)vectors[0].getZ());
ConfigurationService.database.set("teamRegion2." + t.toString().toLowerCase() + ".x", (Object)vectors[1].getX());
ConfigurationService.database.set("teamRegion2." + t.toString().toLowerCase() + ".y", (Object)vectors[1].getY());
ConfigurationService.database.set("teamRegion2." + t.toString().toLowerCase() + ".z", (Object)vectors[1].getZ());
saveDatabase();
ConfigurationService.teamRegions.put(t, vectors);
}
public static void setCapzone(final Team t, final Vector[] points) {
if (ConfigurationService.teamCapzones.containsKey(t)) {
ConfigurationService.teamCapzones.remove(t);
}
ConfigurationService.database.set("teamCapzone1." + t.toString().toLowerCase() + ".x", (Object)points[0].getX());
ConfigurationService.database.set("teamCapzone1." + t.toString().toLowerCase() + ".y", (Object)points[0].getY());
ConfigurationService.database.set("teamCapzone1." + t.toString().toLowerCase() + ".z", (Object)points[0].getZ());
ConfigurationService.database.set("teamCapzone2." + t.toString().toLowerCase() + ".x", (Object)points[1].getX());
ConfigurationService.database.set("teamCapzone2." + t.toString().toLowerCase() + ".y", (Object)points[1].getY());
ConfigurationService.database.set("teamCapzone2." + t.toString().toLowerCase() + ".z", (Object)points[1].getZ());
saveDatabase();
ConfigurationService.teamCapzones.put(t, points);
}
private static void saveDatabase() {
try {
ConfigurationService.database.save(ConfigurationService.databaseFile);
}
catch (IOException ex) {}
}
private static void savePlayerDatabase() {
try {
ConfigurationService.playerDatabase.save(ConfigurationService.playerDatabaseFile);
}
catch (IOException ex) {}
}
public static void setStatKills(final Player p, final int kills) {
if (ConfigurationService.statKills.containsKey(p.getUniqueId().toString())) {
ConfigurationService.statKills.remove(p.getUniqueId().toString());
}
ConfigurationService.statKills.put(p.getUniqueId().toString(), kills);
ConfigurationService.playerDatabase.set(String.valueOf(p.getUniqueId().toString()) + ".kills", (Object)kills);
savePlayerDatabase();
}
public static Integer getStatDeaths(final Player p) {
return ConfigurationService.statDeaths.containsKey(p.getUniqueId().toString()) ? ConfigurationService.statDeaths.get(p.getUniqueId().toString()) : 0;
}
public static void setStatDeaths(final Player p, final int deaths) {
if (ConfigurationService.statDeaths.containsKey(p.getUniqueId().toString())) {
ConfigurationService.statDeaths.remove(p.getUniqueId().toString());
}
ConfigurationService.statDeaths.put(p.getUniqueId().toString(), deaths);
ConfigurationService.playerDatabase.set(String.valueOf(p.getUniqueId().toString()) + ".deaths", (Object)deaths);
savePlayerDatabase();
}
public static Vector getLobbySpawn() {
return ConfigurationService.lobbySpawn;
}
public static Vector getTeamSpawn(final Team t) {
return ConfigurationService.teamSpawns1.get(t);
}
public static void setTeamSpawn(final Location loc, final Team team) {
if (team != null) {
if (ConfigurationService.teamSpawns1.containsKey(team)) {
ConfigurationService.teamSpawns1.remove(team);
}
ConfigurationService.teamSpawns1.put(team, new Vector(loc.getX(), loc.getY(), loc.getZ()));
ConfigurationService.database.set("teamSpawn." + team.toString().toLowerCase() + ".x", (Object)loc.getX());
ConfigurationService.database.set("teamSpawn." + team.toString().toLowerCase() + ".y", (Object)loc.getY());
ConfigurationService.database.set("teamSpawn." + team.toString().toLowerCase() + ".z", (Object)loc.getZ());
saveDatabase();
}
}
public static void setLobbySpawn(final Location lobbySpawn) {
ConfigurationService.lobbySpawn = new Vector(lobbySpawn.getX(), lobbySpawn.getY(), lobbySpawn.getZ());
ConfigurationService.database.set("lobbySpawn.x", (Object)lobbySpawn.getX());
ConfigurationService.database.set("lobbySpawn.y", (Object)lobbySpawn.getY());
ConfigurationService.database.set("lobbySpawn.z", (Object)lobbySpawn.getZ());
saveDatabase();
}
public static void setCapzone(Team fromString, org.bukkit.util.Vector[] vectors) {
// TODO Auto-generated method stub
}
public static void setRegions(Team fromString, org.bukkit.util.Vector[] vectors) {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,587 @@
package com.prevailpots.bunkers.game;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.util.*;
import org.bukkit.event.*;
import org.bukkit.inventory.*;
import java.util.*;
import org.bukkit.scheduler.*;
import org.bukkit.plugin.*;
import org.bukkit.entity.*;
import java.util.concurrent.*;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.event.entity.*;
import com.prevailpots.bunkers.*;
import com.prevailpots.bunkers.config.*;
import com.prevailpots.bunkers.task.*;
import com.prevailpots.bunkers.utils.*;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.bukkit.selections.*;
import org.bukkit.event.player.*;
import org.bukkit.event.block.*;
public class GameHandler implements Listener, Runnable
{
public Map<String, Team> players;
private List<String> playersDeadOrRespawning;
private long actualTime;
private GameState gameState;
private int lastTeam;
public long gameStartCountdown;
private ArrayList<Vector> bloq;
private Object bloq1;
public GameHandler() {
this.players = new HashMap<String, Team>();
this.playersDeadOrRespawning = new ArrayList<String>();
this.actualTime = 0L;
this.gameState = GameState.LOBBY;
this.lastTeam = 0;
this.gameStartCountdown = 10L;
this.bloq = new ArrayList<Vector>();
}
public int teamSize(final Team t) {
int siz = 0;
for (final String s : this.players.keySet()) {
if (this.players.get(s).equals(t)) {
++siz;
}
}
return siz;
}
public Team autoAssign() {
++this.lastTeam;
if (this.lastTeam == 5) {
this.lastTeam = 1;
}
return Team.values()[this.lastTeam - 1];
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void asyncJoin(final AsyncPlayerPreLoginEvent e) {
if (this.gameState != GameState.LOBBY) {
e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, "§7[§cUHCBunkers§7] §cThe game has already started!");
}
else if (this.players.size() > 16) {
e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, "§7[§cUHCBunkers§7] §cThe game is full.");
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void join(final PlayerJoinEvent e) {
e.setJoinMessage(null);
if (this.gameState == GameState.LOBBY) {
e.getPlayer().teleport(new Location(e.getPlayer().getWorld(), ConfigurationService.getLobbySpawn().getX(), ConfigurationService.getLobbySpawn().getY(), ConfigurationService.getLobbySpawn().getZ()));
e.getPlayer().setHealth(20.0);
e.getPlayer().setFoodLevel(20);
e.getPlayer().getInventory().clear();
e.getPlayer().getInventory().setHelmet((ItemStack)null);
e.getPlayer().getInventory().setChestplate((ItemStack)null);
e.getPlayer().getActivePotionEffects().clear();
e.getPlayer().getInventory().setLeggings((ItemStack)null);
e.getPlayer().getInventory().setBoots((ItemStack)null);
e.getPlayer().setFireTicks(0);
try {
e.getPlayer().giveExpLevels(-e.getPlayer().getExpToLevel());
}
catch (Exception ex) {}
players.put(e.getPlayer().getName(), autoAssign());
Core.getInstance().getItemManager().giveTeamItems(e.getPlayer());
Bukkit.broadcastMessage("§6§l" + e.getPlayer().getName() + " §ehas joined the game. §c§l(" + Bukkit.getOnlinePlayers().size() + "/16)");
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void leave(final PlayerQuitEvent e) {
e.setQuitMessage((String)null);
if (this.gameState == GameState .LOBBY) {
if (this.players.containsKey(e.getPlayer().getName())) {
this.players.remove(e.getPlayer().getName());
}
if (this.playersDeadOrRespawning.contains(e.getPlayer().getName())) {
this.playersDeadOrRespawning.remove(e.getPlayer().getName());
}
Bukkit.broadcastMessage("§6§l" + e.getPlayer().getName() + " §ehas left the game. §c§l(" + Bukkit.getOnlinePlayers().size() + "/16)");
}
else {
Bukkit.broadcastMessage(String.valueOf(this.players.get(e.getPlayer().getName()).getColor().toString()) + e.getPlayer().getName() + " §7has quit!");
if (this.players.containsKey(e.getPlayer().getName())) {
this.players.remove(e.getPlayer().getName());
}
if (this.playersDeadOrRespawning.contains(e.getPlayer().getName())) {
this.playersDeadOrRespawning.remove(e.getPlayer().getName());
}
Core.getInstance().getPointManager().removePoints(e.getPlayer(), 5);
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void kill(final PlayerDeathEvent e) {
e.setDeathMessage(null);
if (this.gameState != GameState.GAME) {
return;
}
new ItemDropTask(new ArrayList<>(e.getDrops()), e.getEntity().getLocation().clone()).execute();
e.setDroppedExp(0);
e.getDrops().clear();
e.getEntity().setHealth(20.0);
e.getEntity().setFoodLevel(20);
e.getEntity().setFireTicks(0);
final Team t = this.players.get(e.getEntity().getName());
if (t != null) {
if (Core.getInstance().getDTRManager().isRaidable(t)) {
e.getEntity().kickPlayer("§aYour team went §4RAIDABLE§a. §aThanks for playing.");
return;
}
e.getEntity().teleport(new Location(e.getEntity().getWorld(), ConfigurationService.getTeamSpawn(t).getX(), ConfigurationService.getTeamSpawn(t).getY(), ConfigurationService.getTeamSpawn(t).getZ()));
}
Core.getInstance().getTeamManager().setDeaths(e.getEntity(), Core.getInstance().getTeamManager().getDeaths(e.getEntity()) + 1);
ConfigurationService.setStatDeaths(e.getEntity(), ConfigurationService.getStatDeaths(e.getEntity()) + 1);
this.playersDeadOrRespawning.add(e.getEntity().getName());
Core.getInstance().getDTRManager().removeDTR(this.players.get(e.getEntity().getName()), 1.0);
Core.getInstance().getPointManager().removePoints(e.getEntity(), 5);
new BukkitRunnable() {
public void run() {
if (GameHandler.this.playersDeadOrRespawning.contains(e.getEntity().getName())) {
GameHandler.this.playersDeadOrRespawning.remove(e.getEntity().getName());
}
}
}.runTaskLater((Plugin)Core.getInstance(), 100L);
Core.getInstance().getFreezeManager().addFrozen(e.getEntity(), 5, new PlayerItemTask(e.getEntity()));
if (e.getEntity().getKiller() == null || !(e.getEntity().getKiller() instanceof Player)) {
e.setDeathMessage(String.valueOf(this.players.get(e.getEntity().getName()).getColor().toString()) + e.getEntity().getName() + "§7[" + Core.getInstance().getDTRManager().getDTRFormatted(this.players.get(e.getEntity().getName())) + "§7]" + " §edied" + "§e, " + this.players.get(e.getEntity().getName()).getColor().toString() + StringUtils.capitalize(this.players.get(e.getEntity().getName()).toString().toLowerCase()) + "§e now has §6" + Core.getInstance().getTeamManager().getTeamPoints(this.players.get(e.getEntity().getName())) + " §epoints.");
return;
}
if (e.getEntity().getKiller() != null) {
Core.getInstance().getTeamManager().setKills(e.getEntity(), Core.getInstance().getTeamManager().getKills(e.getEntity().getKiller()) + 1);
ConfigurationService.setStatKills(e.getEntity().getKiller(), ConfigurationService.getStatKills(e.getEntity().getKiller()) + 1);
}
Core.getInstance().getPointManager().addPoints(e.getEntity().getKiller(), 5);
if (e.getEntity().getKiller() != null) {
e.setDeathMessage(String.valueOf(this.players.get(e.getEntity().getName()).getColor().toString()) + e.getEntity().getName() + "§7[" + Core.getInstance().getDTRManager().getDTRFormatted(this.players.get(e.getEntity().getName())) + "§7]" + " §ewas slain by " + this.players.get(e.getEntity().getKiller().getName()).getColor().toString() + e.getEntity().getKiller().getName() + "§7[" + Core.getInstance().getDTRManager().getDTRFormatted(this.players.get(e.getEntity().getKiller().getName())) + "§7]" + "§e, " + this.players.get(e.getEntity().getName()).getColor().toString() + StringUtils.capitalize(this.players.get(e.getEntity().getName()).toString().toLowerCase()) + "§e now has §6" + Core.getInstance().getTeamManager().getTeamPoints(this.players.get(e.getEntity().getName())) + " §epoints.");
}
}
public String getTime() {
final int minutes = (int)(this.actualTime % 3600L / 60L);
final int seconds = (int)(this.actualTime % 60L);
return (this.gameState == GameState.LOBBY) ? "Pre Game" : ((this.gameState == GameState.ENDING) ? "Ending" : String.valueOf(String.valueOf(minutes) + "m " + seconds + "s"));
}
public Map<String, Team> getPlayers() {
return this.players;
}
public List<String> getPlayersDeadOrRespawning() {
return this.playersDeadOrRespawning;
}
public void endGame(final Team winningTeam) {
if (winningTeam == null) {
this.resetGame();
return;
}
Bukkit.broadcastMessage("§7[§cUHCBunkers§7] §aCongratiulations to the " + winningTeam.getColor().toString() + winningTeam.name() + " §ateam for winning!");
new BukkitRunnable() {
public void run() {
Bukkit.broadcastMessage("§7[§cUHCBunkers§7] §aThanks for playing, you will be kicked in §e10 §aseconds.");
}
}.runTaskLater((Plugin)Core.getInstance(), 60L);
new BukkitRunnable() {
public void run() {
GameHandler.this.resetGame();
}
}.runTaskLater((Plugin)Core.getInstance(), 200L);
}
private void resetGame() {
this.gameState = GameState.LOBBY;
for (final Player p : Bukkit.getOnlinePlayers()) {
p.kickPlayer("§aThank you for playing!");
}
Bukkit.getServer().reload();
}
public void startGame() {
this.gameState = GameState.GAME;
for (final String s : this.players.keySet()) {
final Player p = Bukkit.getPlayer(s);
if (p != null) {
p.setHealth(20.0);
p.setFoodLevel(20);
p.getInventory().clear();
p.getInventory().setHelmet((ItemStack)null);
p.setFireTicks(0);
p.getInventory().setChestplate((ItemStack)null);
p.getInventory().setLeggings((ItemStack)null);
p.getActivePotionEffects().clear();
try {
p.giveExpLevels(-p.getExpToLevel());
}
catch (Exception ex) {}
p.getInventory().setBoots((ItemStack)null);
p.closeInventory();
p.teleport(new Location(p.getWorld(), ThreadLocalRandom.current().nextDouble(ConfigurationService.getTeamSpawn(this.players.get(s)).getX(), ConfigurationService.getTeamSpawn(this.players.get(s)).getX() + 6.0), ConfigurationService.getTeamSpawn(this.players.get(s)).getY(), ThreadLocalRandom.current().nextDouble(ConfigurationService.getTeamSpawn(this.players.get(s)).getZ(), ConfigurationService.getTeamSpawn(this.players.get(s)).getZ() + 6.0)));
Core.getInstance().getFreezeManager().addFrozen(p, 5, new PlayerItemTask(p));
}
}
}
@EventHandler
public void onAttack(final EntityDamageByEntityEvent e) {
if (this.gameState == GameState.LOBBY) {
if (e.getDamager() != null && e.getDamager() instanceof Player) {
e.setCancelled(true);
}
if (e.getEntity() != null && e.getEntity() instanceof Player) {
e.setCancelled(true);
}
}
if(this.gameState == GameState.GAME) {
if(e.getDamager() instanceof Player && e.getEntity() instanceof Player) {
Player damager = (Player)e.getDamager();
Player damaged = (Player)e.getEntity();
if(players.get(damager.getName()) == players.get(damaged.getName())) {
e.setCancelled(true);
}
}
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onBlockBreak(final BlockBreakEvent event) {
final Player player = event.getPlayer();
if (player.getGameMode() != GameMode.CREATIVE && player.hasPermission("bunkers.mine")) {
final ItemStack stack = player.getItemInHand();
if (stack != null && stack.getType() != Material.AIR && !stack.containsEnchantment(Enchantment.SILK_TOUCH)) {
final Block block = event.getBlock();
Material dropType = null;
switch (block.getType()) {
case IRON_ORE: {
dropType = Material.IRON_INGOT;
break;
}
case GOLD_ORE: {
dropType = Material.GOLD_INGOT;
break;
}
case DIAMOND_ORE: {
dropType = Material.DIAMOND;
break;
}
default: {
return;
}
}
}
}
}
@EventHandler
public void ores(final BlockBreakEvent e) {
if (e.isCancelled()) {
return;
}
if (e.getBlock().getType().equals((Object)Material.GOLD_ORE) && !e.getPlayer().getItemInHand().getType().equals((Object)Material.IRON_PICKAXE)) {
e.setCancelled(true);
e.getBlock().setType(Material.COBBLESTONE);
final org.bukkit.util.Vector v = e.getBlock().getLocation().toVector();
if (!this.bloq.contains(v)) {
this.bloq.addAll((Collection<? extends Vector>) v);
}
new BukkitRunnable() {
public void run() {
e.getBlock().setType(Material.GOLD_ORE);
if (GameHandler.this.bloq.contains(e.getBlock().getLocation().toVector())) {
GameHandler.this.bloq.remove(e.getBlock().getLocation().toVector());
}
ParticleEffect.PORTAL.display(0.0f, 0.0f, 0.0f, 1.0f, 10, e.getBlock().getLocation(), 10.0);
}
}.runTaskLater((Plugin)Core.getInstance(), 100L);
e.getPlayer().getWorld().dropItem(e.getBlock().getLocation(), new ItemStack(Material.GOLD_INGOT));
e.getPlayer().giveExp(2);
}
else if (e.getBlock().getType().equals((Object)Material.IRON_ORE) && !e.getPlayer().getItemInHand().getType().equals((Object)Material.IRON_PICKAXE)) {
e.setCancelled(true);
e.getBlock().setType(Material.IRON_ORE);
final org.bukkit.util.Vector v = e.getBlock().getLocation().toVector();
if (!this.bloq.contains(v)) {
this.bloq.addAll((Collection<? extends Vector>) v);
}
new BukkitRunnable() {
public void run() {
e.getBlock().setType(Material.IRON_ORE);
if (GameHandler.this.bloq.contains(e.getBlock().getLocation().toVector())) {
GameHandler.this.bloq.remove(e.getBlock().getLocation().toVector());
}
ParticleEffect.PORTAL.display(0.0f, 0.0f, 0.0f, 1.0f, 10, e.getBlock().getLocation(), 10.0);
}
}.runTaskLater((Plugin)Core.getInstance(), 100L);
e.getPlayer().getWorld().dropItem(e.getBlock().getLocation(), new ItemStack(Material.IRON_INGOT));
e.getPlayer().giveExp(2);
}
else if (e.getBlock().getType().equals((Object)Material.DIAMOND_ORE) &&!e.getPlayer().getItemInHand().getType().equals((Object)Material.IRON_PICKAXE)) {
e.setCancelled(true);
e.getBlock().setType(Material.GOLD_ORE);
final org.bukkit.util.Vector v = e.getBlock().getLocation().toVector();
if (!this.bloq.contains(v)) {
this.bloq.addAll((Collection<? extends Vector>) v);
}
new BukkitRunnable() {
public void run() {
e.getBlock().setType(Material.DIAMOND_ORE);
if (GameHandler.this.bloq.contains(e.getBlock().getLocation().toVector())) {
GameHandler.this.bloq.remove(e.getBlock().getLocation().toVector());
}
ParticleEffect.PORTAL.display(0.0f, 0.0f, 0.0f, 1.0f, 10, e.getBlock().getLocation(), 10.0);
}
}.runTaskLater((Plugin)Core.getInstance(), 100L);
e.getPlayer().getWorld().dropItem(e.getBlock().getLocation(), new ItemStack(Material.DIAMOND));
e.getPlayer().giveExp(2);
}
}
@EventHandler
public void hunger(final FoodLevelChangeEvent e) {
if (this.gameState == GameState.LOBBY) {
e.setCancelled(true);
e.setFoodLevel(20);
}
}
@EventHandler
public void move(final PlayerMoveEvent e) {
if (this.gameState == GameState.GAME) {
Team[] values;
for (int length = (values = Team.values()).length, i = 0; i < length; ++i) {
final Team t = values[i];
final CuboidSelection sel = RegionUtils.getSelectionFromRegion(e.getPlayer().getWorld(), t);
if (sel.contains(e.getTo()) && !sel.contains(e.getFrom())) {
//e.getPlayer().sendMessage("§eNow entering the territory of " + t.getColor().toString() + t.name() + "§e.");
e.getPlayer().sendMessage("§eNow entering the territory of " + t.getColor().toString() + t.name() + "§e.");
return;
}
if (!sel.contains(e.getTo()) && sel.contains(e.getFrom())) {
e.getPlayer().sendMessage("§eNow leaving the territory of " + t.getColor().toString() + t.name() + "§e.");
return;
}
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void place(final BlockPlaceEvent e) {
if (this.gameState != GameState.GAME) {
if (e.getPlayer() != null) {
e.setCancelled(true);
}
}
else {
final Player placer = e.getPlayer();
final Team team = this.players.get(placer.getName());
if (team == null) {
return;
}
final CuboidSelection sel = RegionUtils.getSelectionFromRegion(e.getBlockPlaced().getWorld(), team);
if (!sel.contains(e.getBlockPlaced().getLocation())) {
if(!Core.getInstance().getDTRManager().isRaidable(team)) {
e.setCancelled(true);
Team[] values;
for (int length = (values = Team.values()).length, i = 0; i < length; ++i) {
final Team t = values[i];
final CuboidSelection sels = RegionUtils.getSelectionFromRegion(e.getBlockPlaced().getWorld(), t);
if (sels.contains(e.getBlockPlaced().getLocation())) {
e.getPlayer().sendMessage("§eYou cannot place this in the territory of " + t.getColor().toString() + t.name() + "§e.");
return;
}
}
e.getPlayer().sendMessage("§eYou cannot place this here!");
}
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void breaak(final BlockBreakEvent e) {
if (e.getBlock() != null && this.bloq.contains(e.getBlock().getLocation().toVector())) {
e.setCancelled(true);
return;
}
if (this.gameState != GameState.GAME) {
if (e.getPlayer() != null) {
e.setCancelled(true);
}
}
else {
final Player breaker = e.getPlayer();
final Team team = this.players.get(breaker.getName());
if (team == null) {
return;
}
final CuboidSelection sel = RegionUtils.getSelectionFromRegion(e.getBlock().getWorld(), team);
if (!sel.contains(e.getBlock().getLocation())) {
if(!Core.getInstance().getDTRManager().isRaidable(team)) {
e.setCancelled(true);
Team[] values;
for (int length = (values = Team.values()).length, i = 0; i < length; ++i) {
final Team t = values[i];
final CuboidSelection sels = RegionUtils.getSelectionFromRegion(e.getBlock().getWorld(), t);
if (sels.contains(e.getBlock().getLocation())) {
e.getPlayer().sendMessage("§eYou cannot break this in the territory of " + t.getColor().toString() + t.name() + "§e.");
return;
}
}
e.getPlayer().sendMessage("§eYou cannot break this here!");
}
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void bloks(final PlayerInteractEvent e) {
if (this.gameState == GameState.GAME) {
final Team t = this.players.get(e.getPlayer().getName());
if (t != null) {
if (Core.getInstance().getDTRManager().isRaidable(t)) {
e.setCancelled(true);
}
if (!e.getAction().equals((Object)Action.RIGHT_CLICK_BLOCK)) {
return;
}
if (e.getClickedBlock() != null && e.getClickedBlock().getType() != null && ItemUtil.isInteractable(e.getClickedBlock().getType())) {
final Player abuser = e.getPlayer();
final Team team = this.players.get(abuser.getName());
if (team == null) {
return;
}
final CuboidSelection sel = RegionUtils.getSelectionFromRegion(e.getClickedBlock().getWorld(), team);
if (!Core.getInstance().getDTRManager().isRaidable(team) && !sel.contains(e.getClickedBlock().getLocation())) {
e.setCancelled(true);
Team[] values;
for (int length = (values = Team.values()).length, i = 0; i < length; ++i) {
final Team t1 = values[i];
final CuboidSelection sels = RegionUtils.getSelectionFromRegion(e.getClickedBlock().getWorld(), t1);
if (sels.contains(e.getClickedBlock().getLocation())) {
e.getPlayer().sendMessage("§eYou cannot use this in the territory of " + t1.getColor().toString() + t1.name() + "§e.");
return;
}
}
e.getPlayer().sendMessage("§eYou cannot use this here!");
}
}
}
}
}
public void run() {
this.update();
}
public GameState getGameState() {
return this.gameState;
}
private Team getBestTeamToWin() {
final double[] points = new double[4];
int i = 0;
Team[] values;
for (int length = (values = Team.values()).length, j = 0; j < length; ++j) {
final Team t = values[j];
points[i] = Core.getInstance().getTeamManager().getTeamPoints(t);
++i;
}
return Team.values()[MathUtils.indexOfMax(points)];
}
private void checkEndGame() {
if (this.players.size() == 0) {
this.endGame(null);
return;
}
final int minutes = (int)(this.actualTime % 3600L / 60L);
if (minutes >= 35) {
this.endGame(this.getBestTeamToWin());
return;
}
final ArrayList<Team> raidable = new ArrayList<Team>();
Team[] values;
for (int length = (values = Team.values()).length, j = 0; j < length; ++j) {
final Team t = values[j];
if (Core.getInstance().getDTRManager().isRaidable(t)) {
raidable.add(t);
}
}
if (raidable.size() != 0 && raidable.size() >= 3) {
Team[] values2;
for (int length2 = (values2 = Team.values()).length, k = 0; k < length2; ++k) {
final Team t = values2[k];
if (!raidable.contains(t)) {
this.endGame(t);
return;
}
}
}
final ArrayList<Team> tied = new ArrayList<Team>();
Team[] values3;
for (int length3 = (values3 = Team.values()).length, l = 0; l < length3; ++l) {
final Team t2 = values3[l];
if (Core.getInstance().getTeamManager().getTeamPoints(t2) >= 125.0) {
tied.add(t2);
}
}
if (tied.size() != 0) {
if (tied.size() == 1) {
this.endGame(tied.get(0));
}
else {
final double[] leastDeaths = new double[tied.size()];
int i = 0;
for (final Team t3 : tied) {
leastDeaths[i] = Core.getInstance().getTeamManager().getTotalDeaths(t3);
++i;
}
Team winningTeam = tied.get(MathUtils.indexOfMin(leastDeaths));
if (winningTeam == null) {
winningTeam = tied.get(Core.RANDOM.nextInt(tied.size()));
}
this.endGame(winningTeam);
}
}
}
private void update() {
if (this.gameState == GameState.LOBBY && this.players.size() >= 4) {
if (this.gameStartCountdown <= 0L) {
this.startGame();
}
else {
--this.gameStartCountdown;
}
}
if (this.gameState == GameState.GAME) {
this.checkEndGame();
++this.actualTime;
if (this.actualTime % 2L == 0L) {
for (final String s : this.players.keySet()) {
if (!this.playersDeadOrRespawning.contains(s)) {
final Player p = Bukkit.getPlayer(s);
if (p == null) {
continue;
}
Core.getInstance().getBalanceManager().addBalance(p, 0.55);
}
}
}
}
}
}

View File

@ -0,0 +1,11 @@
package com.prevailpots.bunkers.game;
public enum GameState
{
LOBBY("LOBBY", 0),
GAME("GAME", 1),
ENDING("ENDING", 2);
private GameState(final String s, final int n) {
}
}

View File

@ -0,0 +1,32 @@
package com.prevailpots.bunkers.game;
import org.bukkit.*;
public enum Team
{
RED("RED", 0, ChatColor.RED),
GREEN("GREEN", 1, ChatColor.GREEN),
BLUE("BLUE", 2, ChatColor.BLUE),
YELLOW("YELLOW", 3, ChatColor.YELLOW);
private ChatColor color;
private Team(final String s, final int n, final ChatColor color) {
this.color = color;
}
public static Team fromString(final String s) {
Team[] values;
for (int length = (values = values()).length, i = 0; i < length; ++i) {
final Team t = values[i];
if (t.toString().equalsIgnoreCase(s)) {
return t;
}
}
return null;
}
public ChatColor getColor() {
return this.color;
}
}

View File

@ -0,0 +1,58 @@
package com.prevailpots.bunkers.game.managers;
import java.util.*;
import org.bukkit.entity.*;
import com.prevailpots.bunkers.utils.*;
public class BalanceManager
{
public HashMap<String, Double> balances;
public static final String BALANCE_SYMBOL = "$";
public static final int STARTING_BALANCE = 100;
public BalanceManager() {
this.balances = new HashMap<String, Double>();
}
public double getBalance(final Player p) {
return this.balances.containsKey(p.getName()) ? MathUtils.round(this.balances.get(p.getName()), 2) : 100;
}
public boolean hasEnoughMoney(final Player p, final double price) {
return this.getBalance(p) >= price;
}
public String getBalanceFormatted(final Player p) {
return "$" + this.getBalance(p);
}
public void addBalance(final Player p, final double bal) {
final double oldBal = this.getBalance(p);
if (this.balances.containsKey(p.getName())) {
this.balances.remove(p.getName());
}
this.balances.put(p.getName(), MathUtils.round(oldBal + bal, 2));
}
public void removeBalance(final Player p, final double bal) {
final double oldBal = this.getBalance(p);
if (oldBal - bal < 0.0) {
return;
}
if (this.balances.containsKey(p.getName())) {
this.balances.remove(p.getName());
}
this.balances.put(p.getName(), MathUtils.round(oldBal - bal, 2));
}
public void setBalance(final Player p, final double bal) {
if (bal < 0.0) {
return;
}
if (this.balances.containsKey(p.getName())) {
this.balances.remove(p.getName());
}
this.balances.put(p.getName(), MathUtils.round(bal, 2));
}
}

View File

@ -0,0 +1,5 @@
package com.prevailpots.bunkers.game.managers;
public class CapzoneManager
{
}

View File

@ -0,0 +1,54 @@
package com.prevailpots.bunkers.game.managers;
import org.bukkit.entity.*;
import org.bukkit.event.player.*;
import com.prevailpots.bunkers.*;
import com.prevailpots.bunkers.game.*;
import org.bukkit.*;
import ru.tehkode.permissions.bukkit.*;
import java.util.*;
import org.bukkit.event.*;
public class ChatManager implements Listener
{
private ArrayList<String> teamChat;
public ChatManager() {
this.teamChat = new ArrayList<String>();
}
public boolean isTeamChat(final Player p) {
return this.teamChat.contains(p.getName());
}
public void setTeamChat(final Player p, final boolean tc) {
if (this.teamChat.contains(p.getName())) {
this.teamChat.remove(p.getName());
}
if (tc) {
this.teamChat.add(p.getName());
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void chat(final AsyncPlayerChatEvent e) {
if (this.isTeamChat(e.getPlayer())) {
e.setCancelled(true);
for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) {
final Player p = Bukkit.getPlayer(s);
if (p != null) {
final Team t = Core.getInstance().getGameHandler().getPlayers().get(s);
if (t == null || !t.equals(Core.getInstance().getGameHandler().getPlayers().get(e.getPlayer().getName()))) {
continue;
}
p.sendMessage(String.valueOf(t.getColor().toString()) + "[TEAM] " + t.toString() + ": " + e.getPlayer().getName() + " - §7" + e.getMessage());
}
}
return;
}
e.setFormat(String.valueOf(Core.getInstance().getGameHandler().getPlayers().get(e.getPlayer().getName()).getColor().toString()) + "[" + Core.getInstance().getGameHandler().getPlayers().get(e.getPlayer().getName()).toString() + "] " + "§r" + PermissionsEx.getUser(e.getPlayer()).getPrefix() + ((PermissionsEx.getUser(e.getPlayer()).getPrefix() == "") ? "" : " ") + e.getPlayer().getDisplayName() + "§7: " + "§r" + e.getMessage());
}
}

View File

@ -0,0 +1,200 @@
package com.prevailpots.bunkers.game.managers;
import java.util.*;
import org.bukkit.scheduler.*;
import com.prevailpots.bunkers.*;
import org.bukkit.plugin.*;
import org.bukkit.event.entity.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import org.bukkit.event.player.*;
import org.bukkit.*;
public class CooldownManager implements Listener
{
private Map<String, Long> enderPearl;
private Map<String, Long> gapple;
public CooldownManager() {
this.enderPearl = new HashMap<String, Long>();
this.gapple = new HashMap<String, Long>();
}
public boolean hasCooldown(final Player p, final Type cooldownType) {
return (cooldownType == Type.GAPPLE) ? this.gapple.containsKey(p.getName()) : this.enderPearl.containsKey(p.getName());
}
public long getCooldown(final Player p, final Type cooldownType) {
switch (cooldownType) {
case GAPPLE: {
return this.gapple.containsKey(p.getName()) ? this.gapple.get(p.getName()) : 0L;
}
case EPEARL: {
return this.enderPearl.containsKey(p.getName()) ? this.enderPearl.get(p.getName()) : 0L;
}
default: {
return 0L;
}
}
}
public String getCooldownFormatted(final Player p, final Type cooldownType) {
return String.valueOf(this.getCooldown(p, cooldownType)) + "s";
}
private void deincrementCooldown(final Player p, final Type cooldownType) {
switch (cooldownType) {
case GAPPLE: {
long old = 0L;
if (this.gapple.get(p.getName()) != null) {
old = this.gapple.get(p.getName());
}
if (old != 0L) {
if (this.gapple.containsKey(p.getName())) {
this.gapple.remove(p.getName());
}
this.gapple.put(p.getName(), old - 1L);
break;
}
if (this.gapple.containsKey(p.getName())) {
this.gapple.remove(p.getName());
break;
}
break;
}
case EPEARL: {
long old = 0L;
if (this.enderPearl.get(p.getName()) != null) {
old = this.enderPearl.get(p.getName());
}
if (old != 0L) {
if (this.enderPearl.containsKey(p.getName())) {
this.enderPearl.remove(p.getName());
}
this.enderPearl.put(p.getName(), old - 1L);
break;
}
if (this.enderPearl.containsKey(p.getName())) {
this.enderPearl.remove(p.getName());
break;
}
break;
}
}
}
public void putCooldown(final Player p, final Type cooldownType, long cooldown) {
++cooldown;
switch (cooldownType) {
case GAPPLE: {
if (this.gapple.containsKey(p.getName())) {
this.gapple.remove(p.getName());
}
this.gapple.put(p.getName(), cooldown);
new BukkitRunnable() {
public void run() {
if (CooldownManager.this.getCooldown(p, cooldownType) == 0L) {
CooldownManager.this.removeCooldown(p, cooldownType);
p.sendMessage("§aYou can now gapple.");
this.cancel();
}
CooldownManager.this.deincrementCooldown(p, cooldownType);
}
}.runTaskTimer((Plugin)Core.getInstance(), 0L, 20L);
break;
}
case EPEARL: {
if (this.enderPearl.containsKey(p.getName())) {
this.enderPearl.remove(p.getName());
}
this.enderPearl.put(p.getName(), cooldown);
new BukkitRunnable() {
public void run() {
if (CooldownManager.this.getCooldown(p, cooldownType) == 0L) {
CooldownManager.this.removeCooldown(p, cooldownType);
p.sendMessage("§aYou can now enderpearl.");
this.cancel();
}
CooldownManager.this.deincrementCooldown(p, cooldownType);
}
}.runTaskTimer((Plugin)Core.getInstance(), 0L, 20L);
break;
}
}
}
public void removeCooldown(final Player p, final Type t) {
switch (t) {
case GAPPLE: {
if (this.gapple.containsKey(p.getName())) {
this.gapple.remove(p.getName());
break;
}
break;
}
case EPEARL: {
if (this.enderPearl.containsKey(p.getName())) {
this.enderPearl.remove(p.getName());
break;
}
break;
}
}
}
@EventHandler
public void pearl(final ProjectileLaunchEvent e) {
if (e.getEntity() == null) {
return;
}
if (e.getEntity().getShooter() == null) {
return;
}
if (!(e.getEntity().getShooter() instanceof Player)) {
return;
}
if (!(e.getEntity() instanceof EnderPearl)) {
return;
}
if (this.hasCooldown((Player)e.getEntity().getShooter(), Type.EPEARL)) {
e.setCancelled(true);
((Player)e.getEntity().getShooter()).sendMessage("§eYou are still on §9Enderpearl§e cooldown for another §9" + this.getCooldownFormatted((Player)e.getEntity().getShooter(), Type.EPEARL));
return;
}
if (e.getEntity() instanceof EnderPearl && !e.isCancelled()) {
this.putCooldown((Player)e.getEntity().getShooter(), Type.EPEARL, 16L);
}
}
@EventHandler
public void consume(final PlayerItemConsumeEvent e) {
if (e.getItem() == null) {
return;
}
if (e.getItem().getType() == null) {
return;
}
if (e.getItem().getType() != Material.GOLDEN_APPLE) {
return;
}
if (this.hasCooldown(e.getPlayer(), Type.GAPPLE)) {
e.setCancelled(true);
e.getPlayer().sendMessage("§eYou are still on §6Apple§e cooldown for another §9" + this.getCooldownFormatted(e.getPlayer(), Type.GAPPLE));
return;
}
if (!e.isCancelled()) {
this.putCooldown(e.getPlayer(), Type.GAPPLE, 4L);
}
}
public enum Type
{
GAPPLE("GAPPLE", 0),
EPEARL("EPEARL", 1);
private Type(final String s, final int n) {
}
}
}

View File

@ -0,0 +1,72 @@
package com.prevailpots.bunkers.game.managers;
import java.util.*;
import com.prevailpots.bunkers.Core;
import com.prevailpots.bunkers.game.*;
public class DTRManager
{
public HashMap<Team, Double> dtr;
public static final double STARTING_DTR = 5.0;
public DTRManager() {
this.dtr = new HashMap<Team, Double>();
}
public double getDTR(final Team p) {
return this.dtr.containsKey(p) ? this.dtr.get(p) : 5.0;
}
public String getDTRFormatted(final Team t) {
final double dtr = this.getDTR(t);
if (dtr <= 0.0) {
return "§4§lRAIDABLE";
}
if (dtr >= 5.0) {
return "§a§l" + dtr;
}
if (dtr <= 2.0 && dtr > 1.0) {
return "§e§l" + dtr;
}
if (dtr <= 1.0) {
return "§c§l" + dtr;
}
return "§2§l" + dtr;
}
public boolean isRaidable(final Team t) {
return this.getDTR(t) <= 0.0;
}
public void addDTR(final Team p, final double dtr) {
final double oldBal = this.getDTR(p);
if (this.dtr.containsKey(p)) {
this.dtr.remove(p);
}
this.dtr.put(p, oldBal + dtr);
}
public void removeDTR(final Team p, final double dtr) {
final double oldBal = this.getDTR(p);
if (oldBal - dtr < 0.0) {
return;
}
if (this.dtr.containsKey(p)) {
this.dtr.remove(p);
}
this.dtr.put(p, oldBal - dtr);
}
public void setDTR(final Team p, final double dtr) {
if (dtr < 0.0) {
return;
}
if (this.dtr.containsKey(p)) {
this.dtr.remove(p);
}
this.dtr.put(p, dtr);
}
}

View File

@ -0,0 +1,159 @@
package com.prevailpots.bunkers.game.managers;
import java.util.*;
import org.bukkit.entity.*;
import org.bukkit.scheduler.*;
import com.prevailpots.bunkers.*;
import com.prevailpots.bunkers.task.*;
import org.bukkit.plugin.*;
import org.bukkit.event.*;
import org.bukkit.event.entity.*;
import org.bukkit.event.player.*;
import org.bukkit.event.block.*;
public class FreezeManager implements Listener
{
private ArrayList<String> frozen;
public FreezeManager() {
this.frozen = new ArrayList<String>();
}
private boolean isFrozen(final Player p) {
return this.frozen.contains(p.getName());
}
public void addFrozen(final Player p, final int seconds) {
if (p == null) {
return;
}
if (this.frozen.contains(p.getName())) {
new BukkitRunnable() {
public void run() {
if (FreezeManager.this.frozen.contains(p.getName())) {
FreezeManager.this.frozen.remove(p.getName());
if (p.getInventory() != null) {
p.getInventory().clear();
}
}
}
}.runTaskLater((Plugin)Core.getInstance(), (long)(20 * seconds));
return;
}
this.frozen.add(p.getName());
new BukkitRunnable() {
public void run() {
if (FreezeManager.this.frozen.contains(p.getName())) {
FreezeManager.this.frozen.remove(p.getName());
if (p.getInventory() != null) {
p.getInventory().clear();
}
}
}
}.runTaskLater((Plugin)Core.getInstance(), (long)(20 * seconds));
}
public void addFrozen(final Player p, final int seconds, final DynamicTask taskLater) {
if (p == null) {
return;
}
if (this.frozen.contains(p.getName())) {
new BukkitRunnable() {
public void run() {
if (FreezeManager.this.frozen.contains(p.getName())) {
FreezeManager.this.frozen.remove(p.getName());
if (p.getInventory() != null) {
p.getInventory().clear();
}
taskLater.execute();
}
}
}.runTaskLater((Plugin)Core.getInstance(), (long)(20 * seconds));
return;
}
this.frozen.add(p.getName());
new BukkitRunnable() {
public void run() {
if (FreezeManager.this.frozen.contains(p.getName())) {
FreezeManager.this.frozen.remove(p.getName());
if (p.getInventory() != null) {
p.getInventory().clear();
}
taskLater.execute();
}
}
}.runTaskLater((Plugin)Core.getInstance(), (long)(20 * seconds));
}
@EventHandler
public void onAttack(final EntityDamageByEntityEvent e) {
if (e.getDamager() != null && e.getDamager() instanceof Player && this.isFrozen((Player)e.getDamager())) {
e.setCancelled(true);
}
if (e.getEntity() != null && e.getEntity() instanceof Player && this.isFrozen((Player)e.getEntity())) {
e.setCancelled(true);
}
}
@EventHandler
public void dmg(final EntityDamageEvent e) {
if (!(e.getEntity() instanceof Player)) {
return;
}
if (this.isFrozen((Player)e.getEntity())) {
e.setCancelled(true);
}
}
@EventHandler
public void hunger(final FoodLevelChangeEvent e) {
e.setCancelled(true);
e.setFoodLevel(20);
}
@EventHandler
public void place(final BlockPlaceEvent e) {
if (e.getPlayer() != null && this.isFrozen(e.getPlayer())) {
e.setCancelled(true);
}
}
@EventHandler
public void kick(final PlayerKickEvent e) {
if (e.getReason().toLowerCase().contains("flying is not enabled")) {
e.setCancelled(true);
}
}
@EventHandler
public void throwProjEvent(final ProjectileLaunchEvent e) {
if (e.getEntity().getShooter() instanceof Player && this.isFrozen((Player)e.getEntity().getShooter())) {
e.setCancelled(true);
}
}
@EventHandler
public void cons(final PlayerItemConsumeEvent e) {
if (this.isFrozen(e.getPlayer())) {
e.setCancelled(true);
}
}
@EventHandler
public void drop(final PlayerDropItemEvent e) {
if (this.isFrozen(e.getPlayer())) {
e.setCancelled(true);
}
}
@EventHandler
public void breaak(final BlockBreakEvent e) {
if (e.getPlayer() != null && this.isFrozen(e.getPlayer())) {
e.setCancelled(true);
}
}
}

View File

@ -0,0 +1,65 @@
package com.prevailpots.bunkers.game.managers;
import org.bukkit.inventory.*;
import org.bukkit.inventory.meta.ItemMeta;
import com.prevailpots.bunkers.utils.*;
import org.bukkit.*;
import org.bukkit.entity.*;
import org.bukkit.material.Wool;
import java.util.*;
public class ItemManager
{
private ArrayList<ItemStack> starterItems;
public ItemManager() {
(this.starterItems = new ArrayList<ItemStack>()).add(ItemUtil.getItem("§fStarter Sword", Material.STONE_SWORD, 1, "§7Just an ordinary §8Stone Sword§7."));
this.starterItems.add(ItemUtil.getItem("§fStarter Pick", Material.IRON_PICKAXE, 1, "§7Just an ordinary §fIron Pickaxe§7."));
}
public void giveStarterItems(final Player p) {
for (final ItemStack i : this.starterItems) {
p.getInventory().addItem(new ItemStack[] { i });
}
}
public void giveTeamItems(Player p) {
ItemStack blue, green, red, leave, yellow;
blue = new Wool(DyeColor.BLUE).toItemStack(1);
green = new Wool(DyeColor.GREEN).toItemStack(1);
red = new Wool(DyeColor.RED).toItemStack(1);
yellow = new Wool(DyeColor.YELLOW).toItemStack(1);
leave = new Wool(DyeColor.WHITE).toItemStack(1);
//blue
ItemMeta imMeta = blue.getItemMeta();
imMeta.setDisplayName("§bRight Click to join Blue Team!");
blue.setItemMeta(imMeta);
//red
ItemMeta imMeta1 = red.getItemMeta();
imMeta1.setDisplayName("§CRight Click to join Red Team!");
red.setItemMeta(imMeta1);
//green
ItemMeta imMeta2 = green.getItemMeta();
imMeta2.setDisplayName("§ARight Click to join GREEN Team!");
green.setItemMeta(imMeta2);
//yellow
ItemMeta imMeta3 = yellow.getItemMeta();
imMeta3.setDisplayName("§ERight Click to join Yellow Team!");
yellow.setItemMeta(imMeta3);
//leave
ItemMeta imMeta4 = leave.getItemMeta();
imMeta4.setDisplayName("§EClick here to leave the bunkers game!");
leave.setItemMeta(imMeta4);
p.getInventory().setItem(0, blue); // 4, 5, 6, 7
p.getInventory().setItem(1, green); // 4, 5, 6, 7
p.getInventory().setItem(2, red); // 4, 5, 6, 7
p.getInventory().setItem(3, yellow); // 4, 5, 6, 7
p.getInventory().setItem(8, leave); // 4, 5, 6, 7
p.updateInventory();
}
}

View File

@ -0,0 +1,47 @@
package com.prevailpots.bunkers.game.managers;
import java.util.*;
import org.bukkit.entity.*;
public class PointManager
{
public HashMap<String, Integer> points;
public static final int STARTING_POINTS = 5;
public PointManager() {
this.points = new HashMap<String, Integer>();
}
public int getPoints(final Player p) {
return this.points.containsKey(p.getName()) ? this.points.get(p.getName()) : 5;
}
public void addPoints(final Player p, final int points) {
final int oldBal = this.getPoints(p);
if (this.points.containsKey(p.getName())) {
this.points.remove(p.getName());
}
this.points.put(p.getName(), oldBal + points);
}
public void removePoints(final Player p, final int points) {
final int oldBal = this.getPoints(p);
if (oldBal - points < 0) {
return;
}
if (this.points.containsKey(p.getName())) {
this.points.remove(p.getName());
}
this.points.put(p.getName(), oldBal - points);
}
public void setPoints(final Player p, final int points) {
if (points < 0) {
return;
}
if (this.points.containsKey(p.getName())) {
this.points.remove(p.getName());
}
this.points.put(p.getName(), points);
}
}

View File

@ -0,0 +1,289 @@
package com.prevailpots.bunkers.game.managers;
import org.bukkit.potion.*;
import com.prevailpots.bunkers.*;
import com.prevailpots.bunkers.game.*;
import com.prevailpots.bunkers.utils.*;
import org.bukkit.enchantments.*;
import org.bukkit.*;
import org.bukkit.inventory.*;
import org.bukkit.inventory.meta.*;
import org.bukkit.entity.*;
import java.util.*;
import org.bukkit.event.inventory.*;
import org.bukkit.event.player.*;
import org.bukkit.event.block.*;
import org.bukkit.event.*;
public class ShopManager implements Listener
{
private List<ShopItem> shopItems;
private Inventory shopGui;
public ShopManager() {
(this.shopItems = new ArrayList<ShopItem>()).add(new ShopItem(ItemUtil.getItem("§fDiamond Sword", Material.DIAMOND_SWORD, 1, (String[])null), 100.0, ShopItemType.ITEM));
this.shopItems.add(new ShopItem(ItemUtil.getItem("§fDiamond Helmet", Material.DIAMOND_HELMET, 1, (String[])null), 150.0, ShopItemType.ITEM));
this.shopItems.add(new ShopItem(ItemUtil.getItem("§fDiamond Chestplate", Material.DIAMOND_CHESTPLATE, 1, (String[])null), 150.0, ShopItemType.ITEM));
this.shopItems.add(new ShopItem(ItemUtil.getItem("§fDiamond Leggings", Material.DIAMOND_LEGGINGS, 1, (String[])null), 150.0, ShopItemType.ITEM));
this.shopItems.add(new ShopItem(ItemUtil.getItem("§fDiamond Boots", Material.DIAMOND_BOOTS, 1, (String[])null), 150.0, ShopItemType.ITEM));
this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bSharpness 1", Material.DIAMOND_SWORD, 1, Enchantment.DAMAGE_ALL, 1, "§bApplies sharpness 1 to your sword."), 150.0, ShopItemType.ENCHANT, Enchantment.DAMAGE_ALL, 1));
this.shopItems.add(new ShopItem(ItemUtil.getItem("§fFishing Rod", Material.FISHING_ROD, 1, (String[])null), 75.0, ShopItemType.ITEM));
this.shopItems.add(new ShopItem(ItemUtil.getPotion("§fHealth Pot", PotionType.INSTANT_HEAL, true, 2, false, 1, (String[])null), 10.0, ShopItemType.ITEM));
this.shopItems.add(new ShopItem(ItemUtil.getPotion("§fSpeed Pot", PotionType.SPEED, false, 2, true, 1, (String[])null), 75.0, ShopItemType.ITEM));
this.shopItems.add(new ShopItem(ItemUtil.getPotion("§fInvis Pot", PotionType.INVISIBILITY, false, 1, false, 1, (String[])null), 300.0, ShopItemType.ITEM));
this.shopItems.add(new ShopItem(ItemUtil.getItem("§fEnder Pearl", Material.ENDER_PEARL, 3, (String[])null), 125.0, ShopItemType.ITEM));
this.shopItems.add(new ShopItem(ItemUtil.getPotion("§fSlowness Pot", PotionType.SLOWNESS, true, 1, false, 1, (String[])null), 120.0, ShopItemType.ITEM));
this.shopItems.add(new ShopItem(ItemUtil.getPotion("§fPoison Pot", PotionType.POISON, true, 1, false, 1, (String[])null), 120.0, ShopItemType.ITEM));
this.shopItems.add(new ShopItem(ItemUtil.getItem("§fBow", Material.BOW, 1, (String[])null), 150.0, ShopItemType.ITEM));
this.shopItems.add(new ShopItem(ItemUtil.getItem("§fArrow", Material.ARROW, 16, (String[])null), 50.0, ShopItemType.ITEM));
this.shopItems.add(new ShopItem(ItemUtil.getItem("§fGapple", Material.GOLDEN_APPLE, 1, (String[])null), 25.0, ShopItemType.ITEM));
this.shopItems.add(new ShopItem(ItemUtil.getItem("§fSteak", Material.COOKED_BEEF, 16, (String[])null), 25.0, ShopItemType.ITEM));
this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bProt 1 Helmet", Material.DIAMOND_HELMET, 1, Enchantment.PROTECTION_ENVIRONMENTAL, 1, "§bApplies protection 1", "§bto your helmet."), 260.0, ShopItemType.ENCHANT, Enchantment.PROTECTION_ENVIRONMENTAL, 1));
this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bProt 1 Chestplate", Material.DIAMOND_CHESTPLATE, 1, Enchantment.PROTECTION_ENVIRONMENTAL, 1, "§bApplies protection 1", "§bto your chestplate."), 300.0, ShopItemType.ENCHANT, Enchantment.PROTECTION_ENVIRONMENTAL, 1));
this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bProt 1 Leggings", Material.DIAMOND_LEGGINGS, 1, Enchantment.PROTECTION_ENVIRONMENTAL, 1, "§bApplies protection 1", "§bto your leggings."), 300.0, ShopItemType.ENCHANT, Enchantment.PROTECTION_ENVIRONMENTAL, 1));
this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bProt 1 Boots", Material.DIAMOND_BOOTS, 1, Enchantment.PROTECTION_ENVIRONMENTAL, 1, "§bApplies protection 1", "§bto your boots."), 260.0, ShopItemType.ENCHANT, Enchantment.PROTECTION_ENVIRONMENTAL, 1));
this.shopItems.add(new ShopItem(ItemUtil.getEnchantedItem("§bPower 1", Material.BOW, 1, Enchantment.ARROW_DAMAGE, 1, "§bApplies power 1 to your bow."), 150.0, ShopItemType.ENCHANT, Enchantment.ARROW_DAMAGE, 1));
this.shopGui = Bukkit.createInventory((InventoryHolder)null, 54, "§aShop");
int index = 10;
for (final ShopItem x : this.shopItems) {
final ItemStack ix = x.getItem();
final ItemMeta meta = ix.getItemMeta();
final ArrayList<String> lore = new ArrayList<String>();
if (meta.getLore() != null) {
lore.addAll(meta.getLore());
}
if (ix.getItemMeta().hasLore()) {
lore.add(" ");
}
lore.add("§7Price: $" + x.getPrice());
meta.setLore((List)lore);
ix.setItemMeta(meta);
this.shopGui.setItem(index, ix);
if (index == 16 || index == 25 || index == 34 || index == 43 || index == 52 || index == 61 || index == 70 || index == 79 || index == 87) {
index += 2;
}
++index;
}
this.shopGui.setItem(49, ItemUtil.getItem("§bSell items", Material.GOLD_BLOCK, 1, "§7Sells all gold, iron and diamonds", "§7in your inventory."));
}
private void buyItem(final Player p, final ItemStack i) {
if (this.getActualItem(i) == null) {
return;
}
if (Core.getInstance().getBalanceManager().hasEnoughMoney(p, this.getPrice(i))) {
if (this.getActualItem(i).getType().equals(ShopItemType.ITEM)) {
final ItemStack toadd = i.clone();
final ItemMeta nigmeta = toadd.getItemMeta();
nigmeta.setDisplayName(new ItemStack(i.getType()).getItemMeta().getDisplayName());
nigmeta.setLore((List)Arrays.asList("§7Just a regular " + this.getActualItem(i).getItem().getItemMeta().getDisplayName()));
toadd.setItemMeta(nigmeta);
p.getInventory().addItem(new ItemStack[] { toadd });
p.sendMessage("§aBought §e" + i.getAmount() + " " + i.getItemMeta().getDisplayName() + " §afor §e" + "$" + this.getPrice(i) + "§a.");
Core.getInstance().getBalanceManager().removeBalance(p, this.getPrice(i));
}
else {
ItemStack[] contents;
for (int length = (contents = p.getInventory().getContents()).length, j = 0; j < length; ++j) {
final ItemStack x = contents[j];
if (x != null) {
if (x.getType() != null) {
if (x.getType().equals((Object)i.getType()) && !x.getEnchantments().containsKey(this.getActualItem(i).ench)) {
x.addUnsafeEnchantment(this.getActualItem(i).ench, this.getActualItem(i).enchLevel);
p.sendMessage("§aBought §e" + i.getAmount() + " " + i.getItemMeta().getDisplayName() + " §afor §e" + "$" + this.getPrice(i) + "§a.");
Core.getInstance().getBalanceManager().removeBalance(p, this.getPrice(i));
return;
}
}
}
}
ItemStack[] armorContents;
for (int length2 = (armorContents = p.getInventory().getArmorContents()).length, k = 0; k < length2; ++k) {
final ItemStack x = armorContents[k];
if (x != null) {
if (x.getType() != null) {
if (x.getType().equals((Object)i.getType()) && !x.getEnchantments().containsKey(this.getActualItem(i).ench)) {
x.addUnsafeEnchantment(this.getActualItem(i).ench, this.getActualItem(i).enchLevel);
p.sendMessage("§aBought §e" + i.getAmount() + " " + i.getItemMeta().getDisplayName() + " §afor §e" + "$" + this.getPrice(i) + "§a.");
Core.getInstance().getBalanceManager().removeBalance(p, this.getPrice(i));
return;
}
}
}
}
}
}
else {
p.sendMessage("§cYou don't have enough money!");
}
}
public void sellItems(final Player p) {
final ArrayList<ItemStack> items = new ArrayList<ItemStack>();
ItemStack[] contents;
for (int length = (contents = p.getInventory().getContents()).length, k = 0; k < length; ++k) {
final ItemStack i = contents[k];
if (i != null) {
if (i.getType().equals((Object)Material.GOLD_INGOT) || i.getType().equals((Object)Material.IRON_INGOT) || i.getType().equals((Object)Material.DIAMOND)) {
items.add(i);
}
}
}
for (final ItemStack x : items) {
if (x.getType().equals((Object)Material.GOLD_INGOT)) {
for (int j = 0; j < x.getAmount(); ++j) {
Core.getInstance().getBalanceManager().addBalance(p, 15.0);
}
p.getInventory().remove(x);
}
if (x.getType().equals((Object)Material.IRON_INGOT)) {
for (int j = 0; j < x.getAmount(); ++j) {
Core.getInstance().getBalanceManager().addBalance(p, 10.0);
}
p.getInventory().remove(x);
}
if (x.getType().equals((Object)Material.DIAMOND)) {
for (int j = 0; j < x.getAmount(); ++j) {
Core.getInstance().getBalanceManager().addBalance(p, 20.0);
}
p.getInventory().remove(x);
}
}
items.clear();
}
private double getPrice(final ItemStack i) {
return this.getActualItem(i).getPrice();
}
private ShopItem getActualItem(final ItemStack i) {
for (int ix = 0; ix < this.shopItems.size(); ++ix) {
if (this.shopItems.get(ix).getItem().equals((Object)i)) {
return this.shopItems.get(ix);
}
}
return null;
}
public void openShop(final Player p) {
p.openInventory(this.shopGui);
}
@EventHandler
public void click(final InventoryClickEvent e) {
if (!Core.getInstance().getGameHandler().getGameState().equals(GameState.GAME)) {
return;
}
if (e.getInventory() == null) {
return;
}
if (e.getInventory().getHolder() != null) {
return;
}
if (!e.getInventory().getTitle().toLowerCase().contains("shop")) {
return;
}
if (e.getCurrentItem() == null) {
return;
}
if (e.getWhoClicked() == null || !(e.getWhoClicked() instanceof Player)) {
return;
}
if (!e.getCurrentItem().hasItemMeta()) {
return;
}
if (e.getClick().equals((Object)ClickType.CONTROL_DROP)) {
e.setCancelled(true);
return;
}
if (e.getClick().equals((Object)ClickType.NUMBER_KEY)) {
e.setCancelled(true);
return;
}
if (e.getClick().equals((Object)ClickType.DOUBLE_CLICK)) {
e.setCancelled(true);
return;
}
if (e.getClick().equals((Object)ClickType.DROP)) {
e.setCancelled(true);
return;
}
if (e.getClick().toString().toLowerCase().contains("shift")) {
e.setCancelled(true);
return;
}
if (!e.getSlotType().equals((Object)InventoryType.SlotType.CONTAINER) || e.getSlotType().equals((Object)InventoryType.SlotType.OUTSIDE)) {
return;
}
e.setCancelled(true);
final Player p = (Player)e.getWhoClicked();
if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§bSell items")) {
this.sellItems(p);
}
else {
this.buyItem(p, e.getCurrentItem());
}
}
@EventHandler(priority = EventPriority.HIGH)
public void bloks(final PlayerInteractEvent e) {
if (!Core.getInstance().getGameHandler().getGameState().equals(GameState.GAME)) {
return;
}
if (!e.getAction().equals((Object)Action.RIGHT_CLICK_BLOCK)) {
return;
}
if (e.getClickedBlock() != null && e.getClickedBlock().getType() != null && e.getClickedBlock().getType().equals((Object)Material.WORKBENCH)) {
e.setCancelled(true);
this.openShop(e.getPlayer());
}
}
public enum ShopItemType
{
ITEM("ITEM", 0),
ENCHANT("ENCHANT", 1);
private ShopItemType(final String s, final int n) {
}
}
public class ShopItem
{
private ItemStack item;
private double price;
private ShopItemType type;
public Enchantment ench;
public int enchLevel;
public ShopItem(final ItemStack item, final double price, final ShopItemType type) {
this.item = item;
this.price = price;
this.type = type;
}
public ShopItem(final ItemStack item, final double price, final ShopItemType type, final Enchantment ench, final int enchLevel) {
this.item = item;
this.price = price;
this.type = type;
this.ench = ench;
this.enchLevel = enchLevel;
}
public ItemStack getItem() {
return this.item;
}
public ShopItemType getType() {
return this.type;
}
public double getPrice() {
return this.price;
}
}
}

View File

@ -0,0 +1,54 @@
package com.prevailpots.bunkers.game.managers;
import com.prevailpots.bunkers.Core;
import com.prevailpots.bunkers.game.GameState;
import com.prevailpots.bunkers.game.Team;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.material.Wool;
/**
* Created by Spirit on 09/08/2017.
*/
public class TeamJoinManager implements Listener {
@EventHandler
public void onInteract(PlayerInteractEvent e) {
if(Core.getInstance().getGameHandler().getGameState().equals(GameState.LOBBY)) {
if (e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR) {
if (e.getPlayer().getItemInHand().getType() == Material.WOOL) {
Wool wool = (Wool) e.getPlayer().getItemInHand().getData();
// blue green red yellow
if(Core.getInstance().getGameHandler().players.containsKey(e.getPlayer().getName()))
Core.getInstance().getGameHandler().players.remove(e.getPlayer().getName());
// e.setCancelled(true);
if(wool.getColor() == DyeColor.BLUE) {
Core.getInstance().getGameHandler().players.put(e.getPlayer().getName(), Team.BLUE);
e.getPlayer().sendMessage(ChatColor.YELLOW + "You are now on the " + ChatColor.BLUE + "Blue" + ChatColor.YELLOW + " team.");
}
if(wool.getColor() == DyeColor.GREEN) {
Core.getInstance().getGameHandler().players.put(e.getPlayer().getName(), Team.GREEN);
e.getPlayer().sendMessage(ChatColor.YELLOW + "You are now on the " + ChatColor.GREEN + "Green" + ChatColor.YELLOW + " team.");
}
if(wool.getColor() == DyeColor.RED) {
Core.getInstance().getGameHandler().players.put(e.getPlayer().getName(), Team.RED);
e.getPlayer().sendMessage(ChatColor.YELLOW + "You are now on the " + ChatColor.RED + "Red" + ChatColor.YELLOW + " team.");
}
if(wool.getColor() == DyeColor.YELLOW) {
Core.getInstance().getGameHandler().players.put(e.getPlayer().getName(), Team.YELLOW);
e.getPlayer().sendMessage(ChatColor.YELLOW + "You are now on the " + ChatColor.GOLD + "Yellow" + ChatColor.YELLOW + " team.");
}
if(wool.getColor() == DyeColor.WHITE) {
Core.getInstance().getGameHandler().players.remove(e.getPlayer().getName());
e.getPlayer().kickPlayer("§eYou have kicked yourself from the Bunkers game!");
}
}
}
}
}
}

View File

@ -0,0 +1,115 @@
package com.prevailpots.bunkers.game.managers;
import org.bukkit.entity.*;
import com.prevailpots.bunkers.*;
import com.prevailpots.bunkers.game.*;
import org.bukkit.*;
import java.util.*;
public class TeamManager
{
public HashMap<String, Integer> kills;
public HashMap<String, Integer> deaths;
public TeamManager() {
this.kills = new HashMap<String, Integer>();
this.deaths = new HashMap<String, Integer>();
}
public int getKills(final Player p) {
return this.kills.containsKey(p.getName()) ? this.kills.get(p.getName()) : 0;
}
public int getDeaths(final Player p) {
return this.deaths.containsKey(p.getName()) ? this.deaths.get(p.getName()) : 0;
}
public void setDeaths(final Player p, final int deaths) {
if (this.deaths.containsKey(p.getName())) {
this.deaths.remove(p.getName());
}
this.deaths.put(p.getName(), deaths);
}
public void setKills(final Player p, final int kills) {
if (this.kills.containsKey(p.getName())) {
this.kills.remove(p.getName());
}
this.kills.put(p.getName(), kills);
}
public double getTeamBalance(final Team t) {
double totalBal = 0.0;
for (final Player p : Bukkit.getOnlinePlayers()) {
for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) {
if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) {
totalBal += Core.getInstance().getBalanceManager().getBalance(p);
}
}
}
return totalBal;
}
public String getTeamBalanceFormatted(final Team t) {
double totalBal = 0.0;
for (final Player p : Bukkit.getOnlinePlayers()) {
for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) {
if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) {
totalBal += Core.getInstance().getBalanceManager().getBalance(p);
}
}
}
return "$" + totalBal;
}
public double getTeamPoints(final Team t) {
double totalBal = 0.0;
for (final Player p : Bukkit.getOnlinePlayers()) {
for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) {
if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) {
totalBal += Core.getInstance().getPointManager().getPoints(p);
}
}
}
return totalBal;
}
public String[] getMembers(final Team t) {
final ArrayList<String> members = new ArrayList<String>();
for (final Player p : Bukkit.getOnlinePlayers()) {
for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) {
if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) {
members.add(p.getName());
}
}
}
return members.toArray(new String[0]);
}
public int getTotalKills(final Team t) {
int totalKills = 0;
for (final Player p : Bukkit.getOnlinePlayers()) {
for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) {
if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) {
totalKills += this.getKills(p);
}
}
}
return totalKills;
}
public int getTotalDeaths(final Team t) {
int totalDeaths = 0;
for (final Player p : Bukkit.getOnlinePlayers()) {
for (final String s : Core.getInstance().getGameHandler().getPlayers().keySet()) {
if (p.getName().equalsIgnoreCase(s) && Core.getInstance().getGameHandler().getPlayers().get(s).equals(t)) {
totalDeaths += this.getDeaths(p);
}
}
}
return totalDeaths;
}
}

View File

@ -0,0 +1,121 @@
package com.prevailpots.bunkers.scoreboard;
import net.minecraft.util.gnu.trove.map.hash.*;
import org.apache.commons.lang3.*;
import net.minecraft.util.gnu.trove.procedure.*;
import org.bukkit.scoreboard.*;
import java.util.*;
public class BufferedObjective
{
private static final int MAX_SIDEBAR_ENTRIES = 32;
private static final int MAX_NAME_LENGTH = 32;
private static final int MAX_PREFIX_LENGTH = 32;
private static final int MAX_SUFFIX_LENGTH = 32;
private final Scoreboard scoreboard;
private Set<String> previousLines;
private TIntObjectHashMap<SidebarEntry> contents;
private boolean requiresUpdate;
private String title;
private Objective current;
private DisplaySlot displaySlot;
public BufferedObjective(final Scoreboard scoreboard) {
this.previousLines = new HashSet<String>();
this.contents = (TIntObjectHashMap<SidebarEntry>)new TIntObjectHashMap();
this.requiresUpdate = false;
this.scoreboard = scoreboard;
this.title = RandomStringUtils.randomAlphabetic(4);
this.current = scoreboard.registerNewObjective("buffered", "dummy");
}
public void setTitle(final String title) {
if (this.title == null || !this.title.equals(title)) {
this.title = title;
this.requiresUpdate = true;
}
}
public void setDisplaySlot(final DisplaySlot slot) {
this.displaySlot = slot;
this.current.setDisplaySlot(slot);
}
public void setAllLines(final List<SidebarEntry> lines) {
if (lines.size() != this.contents.size()) {
this.contents.clear();
if (lines.isEmpty()) {
this.requiresUpdate = true;
return;
}
}
final int size = Math.min(32, lines.size());
int count = 0;
for (final SidebarEntry sidebarEntry : lines) {
this.setLine(size - count++, sidebarEntry);
}
}
public void setLine(final int lineNumber, final SidebarEntry sidebarEntry) {
final SidebarEntry value = (SidebarEntry)this.contents.get(lineNumber);
if (value == null || value != sidebarEntry) {
this.contents.put(lineNumber, (SidebarEntry)sidebarEntry);
this.requiresUpdate = true;
}
}
public void flip() {
if (!this.requiresUpdate) {
return;
}
final Set<String> adding = new HashSet<String>();
this.contents.forEachEntry((TIntObjectProcedure)new TIntObjectProcedure<SidebarEntry>() {
public boolean execute(final int i, final SidebarEntry sidebarEntry) {
String name = sidebarEntry.name;
if (name.length() > 32) {
name = name.substring(0, 32);
}
Team team = BufferedObjective.this.scoreboard.getTeam(name);
if (team == null) {
team = BufferedObjective.this.scoreboard.registerNewTeam(name);
}
if (sidebarEntry.prefix != null) {
team.setPrefix((sidebarEntry.prefix.length() > 32) ? sidebarEntry.prefix.substring(0, 32) : sidebarEntry.prefix);
}
if (sidebarEntry.suffix != null) {
team.setSuffix((sidebarEntry.suffix.length() > 32) ? sidebarEntry.suffix.substring(0, 32) : sidebarEntry.suffix);
}
adding.add(name);
if (!team.hasEntry(name)) {
team.addEntry(name);
}
BufferedObjective.this.current.getScore(name).setScore(i);
return true;
}
});
this.previousLines.removeAll(adding);
final Iterator<String> iterator = this.previousLines.iterator();
while (iterator.hasNext()) {
final String last = iterator.next();
final Team team = this.scoreboard.getTeam(last);
if (team != null) {
team.removeEntry(last);
}
this.scoreboard.resetScores(last);
iterator.remove();
}
this.previousLines = adding;
this.current.setDisplayName(this.title);
this.requiresUpdate = false;
}
public void setVisible(final boolean value) {
if (this.displaySlot != null && !value) {
this.scoreboard.clearSlot(this.displaySlot);
this.displaySlot = null;
}
else if (this.displaySlot == null && value) {
this.current.setDisplaySlot(this.displaySlot = DisplaySlot.SIDEBAR);
}
}
}

View File

@ -0,0 +1,179 @@
package com.prevailpots.bunkers.scoreboard;
import org.bukkit.scheduler.*;
import java.util.concurrent.atomic.*;
import org.bukkit.entity.*;
import org.bukkit.scoreboard.*;
import com.prevailpots.bunkers.*;
import org.bukkit.plugin.*;
import java.util.*;
import org.bukkit.*;
public class PlayerBoard
{
private boolean sidebarVisible;
private SidebarProvider defaultProvider;
private SidebarProvider temporaryProvider;
private BukkitRunnable runnable;
private final AtomicBoolean removed;
private final Team red;
private final Team green;
private final Team blue;
private final Team yellow;
private final BufferedObjective bufferedObjective;
private final Scoreboard scoreboard;
private final Player player;
private final Core plugin;
public PlayerBoard(final Core plugin, final Player player) {
this.sidebarVisible = false;
this.removed = new AtomicBoolean(false);
this.plugin = plugin;
this.player = player;
this.scoreboard = plugin.getServer().getScoreboardManager().getNewScoreboard();
this.bufferedObjective = new BufferedObjective(this.scoreboard);
(this.red = this.scoreboard.registerNewTeam("red")).setPrefix(com.prevailpots.bunkers.game.Team.RED.getColor().toString());
this.red.setCanSeeFriendlyInvisibles(true);
(this.green = this.scoreboard.registerNewTeam("green")).setPrefix(com.prevailpots.bunkers.game.Team.GREEN.getColor().toString());
this.green.setCanSeeFriendlyInvisibles(true);
(this.blue = this.scoreboard.registerNewTeam("blue")).setPrefix(com.prevailpots.bunkers.game.Team.BLUE.getColor().toString());
this.blue.setCanSeeFriendlyInvisibles(true);
(this.yellow = this.scoreboard.registerNewTeam("yellow")).setPrefix(com.prevailpots.bunkers.game.Team.YELLOW.getColor().toString());
this.yellow.setCanSeeFriendlyInvisibles(true);
player.setScoreboard(this.scoreboard);
}
public void remove() {
if (!this.removed.getAndSet(true) && this.scoreboard != null) {
for (final Team team : this.scoreboard.getTeams()) {
team.unregister();
}
for (final Objective objective : this.scoreboard.getObjectives()) {
objective.unregister();
}
}
}
public Player getPlayer() {
return this.player;
}
public Scoreboard getScoreboard() {
return this.scoreboard;
}
public boolean isSidebarVisible() {
return this.sidebarVisible;
}
public void setSidebarVisible(final boolean visible) {
this.sidebarVisible = visible;
this.bufferedObjective.setDisplaySlot(visible ? DisplaySlot.SIDEBAR : null);
}
public void setDefaultSidebar(final SidebarProvider provider, final long updateInterval) {
if (provider != this.defaultProvider) {
this.defaultProvider = provider;
if (this.runnable != null) {
this.runnable.cancel();
}
if (provider == null) {
this.scoreboard.clearSlot(DisplaySlot.SIDEBAR);
return;
}
(this.runnable = new BukkitRunnable() {
public void run() {
if (PlayerBoard.this.removed.get()) {
this.cancel();
return;
}
if (provider == PlayerBoard.this.defaultProvider) {
PlayerBoard.this.updateObjective();
}
}
}).runTaskTimerAsynchronously((Plugin)this.plugin, updateInterval, updateInterval);
}
}
public void setTemporarySidebar(final SidebarProvider provider, final long expiration) {
if (this.removed.get()) {
throw new IllegalStateException("Cannot update whilst board is removed");
}
this.temporaryProvider = provider;
this.updateObjective();
new BukkitRunnable() {
public void run() {
if (PlayerBoard.this.removed.get()) {
this.cancel();
return;
}
if (PlayerBoard.this.temporaryProvider == provider) {
PlayerBoard.access$4(PlayerBoard.this, null);
PlayerBoard.this.updateObjective();
}
}
}.runTaskLaterAsynchronously((Plugin)this.plugin, expiration);
}
private void updateObjective() {
if (this.removed.get()) {
throw new IllegalStateException("Cannot update whilst board is removed");
}
final SidebarProvider provider = (this.temporaryProvider != null) ? this.temporaryProvider : this.defaultProvider;
if (provider == null) {
this.bufferedObjective.setVisible(false);
}
else {
try {
this.bufferedObjective.setTitle(provider.getTitle());
this.bufferedObjective.setAllLines(provider.getLines(this.player));
this.bufferedObjective.flip();
}
catch (Exception ex) {}
}
}
public void addUpdate(final Player target) {
this.addUpdates(Collections.singleton(target));
}
public void addUpdates(final Iterable<? extends Player> updates) {
if (this.removed.get()) {
throw new IllegalStateException("Cannot update whilst board is removed");
}
new BukkitRunnable() {
public void run() {
if (PlayerBoard.this.removed.get()) {
this.cancel();
return;
}
for (final Player update : updates) {
if (!PlayerBoard.this.plugin.getGameHandler().getPlayers().containsKey(update.getName())) {
continue;
}
if (PlayerBoard.this.plugin.getGameHandler().getPlayers().get(update.getName()).equals(com.prevailpots.bunkers.game.Team.RED)) {
PlayerBoard.this.red.addPlayer((OfflinePlayer)update);
}
else if (PlayerBoard.this.plugin.getGameHandler().getPlayers().get(update.getName()).equals(com.prevailpots.bunkers.game.Team.GREEN)) {
PlayerBoard.this.green.addPlayer((OfflinePlayer)update);
}
else if (PlayerBoard.this.plugin.getGameHandler().getPlayers().get(update.getName()).equals(com.prevailpots.bunkers.game.Team.BLUE)) {
PlayerBoard.this.blue.addPlayer((OfflinePlayer)update);
}
else {
if (!PlayerBoard.this.plugin.getGameHandler().getPlayers().get(update.getName()).equals(com.prevailpots.bunkers.game.Team.YELLOW)) {
continue;
}
PlayerBoard.this.yellow.addPlayer((OfflinePlayer)update);
}
}
}
}.runTaskAsynchronously((Plugin)this.plugin);
}
static /* synthetic */ void access$4(final PlayerBoard playerBoard, final SidebarProvider temporaryProvider) {
playerBoard.temporaryProvider = temporaryProvider;
}
}

View File

@ -0,0 +1,80 @@
package com.prevailpots.bunkers.scoreboard;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.Plugin;
import com.prevailpots.bunkers.Core;
import com.prevailpots.bunkers.scoreboard.provider.TimerSidebarProvider;
public class ScoreboardHandler implements Listener
{
private static final long UPDATE_TICK_INTERVAL = 2L;
private final Map<UUID, PlayerBoard> playerBoards;
private final TimerSidebarProvider timerSidebarProvider;
private final Core plugin;
public ScoreboardHandler(final Core plugin) {
this.playerBoards = new HashMap<UUID, PlayerBoard>();
this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents((Listener)this, (Plugin)plugin);
this.timerSidebarProvider = new TimerSidebarProvider(plugin);
final Set<Player> players = new HashSet<Player>();
for (final Player player : players) {
this.applyBoard(player).addUpdates(players);
}
}
@EventHandler(ignoreCancelled = true)
public void onPlayerJoin(final PlayerJoinEvent event) {
final Player player = event.getPlayer();
for (final PlayerBoard board : this.playerBoards.values()) {
board.addUpdate(player);
}
final Set<Player> players = new HashSet<Player>();
this.applyBoard(player).addUpdates(players);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerQuit(final PlayerQuitEvent event) {
if (this.playerBoards.containsKey(event.getPlayer().getUniqueId())) {
this.playerBoards.remove(event.getPlayer().getUniqueId()).remove();
}
}
public PlayerBoard getPlayerBoard(final UUID uuid) {
return this.playerBoards.get(uuid);
}
public PlayerBoard applyBoard(final Player player) {
final PlayerBoard board = new PlayerBoard(this.plugin, player);
final PlayerBoard previous = this.playerBoards.put(player.getUniqueId(), board);
if (previous != null && previous != board) {
previous.remove();
}
board.setSidebarVisible(true);
board.setDefaultSidebar(this.timerSidebarProvider, 2L);
return board;
}
public void clearBoards() {
final Iterator<PlayerBoard> iterator = this.playerBoards.values().iterator();
while (iterator.hasNext()) {
iterator.next().remove();
iterator.remove();
}
}
}

View File

@ -0,0 +1,67 @@
package com.prevailpots.bunkers.scoreboard;
public class SidebarEntry
{
public final String name;
public String prefix;
public String suffix;
public SidebarEntry(final String name) {
this.name = name;
}
public SidebarEntry(final Object name) {
this.name = String.valueOf(name);
}
public SidebarEntry(final String prefix, final String name, final String suffix) {
this.name = name;
this.prefix = prefix;
this.suffix = suffix;
}
public SidebarEntry(final Object prefix, final Object name, final Object suffix) {
this(name);
this.prefix = String.valueOf(prefix);
this.suffix = String.valueOf(suffix);
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (!(o instanceof SidebarEntry)) {
return false;
}
final SidebarEntry that = (SidebarEntry)o;
Label_0054: {
if (this.name != null) {
if (this.name.equals(that.name)) {
break Label_0054;
}
}
else if (that.name == null) {
break Label_0054;
}
return false;
}
if (this.prefix != null) {
if (this.prefix.equals(that.prefix)) {
return !((this.suffix != null) ? (!this.suffix.equals(that.suffix)) : (that.suffix != null));
}
}
else if (that.prefix == null) {
return !((this.suffix != null) ? (!this.suffix.equals(that.suffix)) : (that.suffix != null));
}
return false;
}
@Override
public int hashCode() {
int result = (this.name != null) ? this.name.hashCode() : 0;
result = 31 * result + ((this.prefix != null) ? this.prefix.hashCode() : 0);
result = 31 * result + ((this.suffix != null) ? this.suffix.hashCode() : 0);
return result;
}
}

View File

@ -0,0 +1,11 @@
package com.prevailpots.bunkers.scoreboard;
import org.bukkit.entity.*;
import java.util.*;
public interface SidebarProvider
{
String getTitle();
List<SidebarEntry> getLines(final Player p0);
}

View File

@ -0,0 +1,72 @@
package com.prevailpots.bunkers.scoreboard.provider;
import org.bukkit.entity.*;
import com.prevailpots.bunkers.*;
import com.prevailpots.bunkers.game.*;
import com.prevailpots.bunkers.game.managers.*;
import com.prevailpots.bunkers.scoreboard.*;
import java.util.*;
import org.apache.commons.lang3.*;
import org.bukkit.*;
public class TimerSidebarProvider implements SidebarProvider
{
public static final String STRAIGHT_LINE;
private final Core plugin;
private boolean add;
static {
STRAIGHT_LINE = "------------------------------------".substring(0, 14);
}
public TimerSidebarProvider(final Core plugin) {
this.plugin = plugin;
}
@Override
public String getTitle() {
return "§b§lPrevailPots §c[Bunkers]";
}
@Override
public List<SidebarEntry> getLines(final Player player) {
final List<SidebarEntry> lines = new ArrayList<SidebarEntry>();
if (!this.plugin.getGameHandler().getTime().equalsIgnoreCase("pre game")) {
lines.add(new SidebarEntry("", "§aGame Time§7: ", "§f" + this.plugin.getGameHandler().getTime()));
final Team t = this.plugin.getGameHandler().getPlayers().get(player.getName());
lines.add(new SidebarEntry("", "§aTeam§7: ", t.getColor() + StringUtils.capitalize(t.toString().toLowerCase())));
lines.add(new SidebarEntry(" §b» ", "§aKills§7: ", "§f" + this.plugin.getTeamManager().getKills(player)));
lines.add(new SidebarEntry(" §b» §aBala", "§ance§7: §f", this.plugin.getBalanceManager().getBalanceFormatted(player)));
lines.add(new SidebarEntry(" §b» ", "§aPoints§7: ", "§f" + this.plugin.getPointManager().getPoints(player)));
lines.add(new SidebarEntry(" §b» ", "§aDTR§7: ", this.plugin.getDTRManager().getDTRFormatted(Core.getInstance().getGameHandler().getPlayers().get(player.getName()))));
}
else {
if (this.plugin.getGameHandler().gameStartCountdown != 10L) {
lines.add(new SidebarEntry("", "§6Countdown§7: ", "§f" + this.plugin.getGameHandler().gameStartCountdown + "s"));
}
else {
lines.add(new SidebarEntry("", "§6Game State§7: ", "§eLobby"));
}
lines.add(new SidebarEntry("", "§6Players§7: ", "§e" + String.valueOf(this.plugin.getGameHandler().getPlayers().size()) + "/" + 16 + ":"));
lines.add(new SidebarEntry(" §b» ", "§cRed§7: ", "§e" + this.plugin.getGameHandler().teamSize(Team.RED) + "/" + 4));
lines.add(new SidebarEntry(" §b» ", "§aGreen§7: ", "§e" + this.plugin.getGameHandler().teamSize(Team.GREEN) + "/" + 4));
lines.add(new SidebarEntry(" §b» ", "§9Blue§7: ", "§e" + this.plugin.getGameHandler().teamSize(Team.BLUE) + "/" + 4));
lines.add(new SidebarEntry(" §b» ", "§eYellow§7: ", "§e" + this.plugin.getGameHandler().teamSize(Team.YELLOW) + "/" + 4));
}
if (Core.getInstance().getCooldownManager().hasCooldown(player, CooldownManager.Type.EPEARL)) {
lines.add(new SidebarEntry(" * ", "§9§lEnder", "pearl§7: §f" + Core.getInstance().getCooldownManager().getCooldownFormatted(player, CooldownManager.Type.EPEARL)));
}
if (Core.getInstance().getCooldownManager().hasCooldown(player, CooldownManager.Type.GAPPLE)) {
lines.add(new SidebarEntry(" * ", "§6§lApple", "§7: §f" + Core.getInstance().getCooldownManager().getCooldownFormatted(player, CooldownManager.Type.GAPPLE)));
}
if (!lines.isEmpty()) {
lines.add(0, new SidebarEntry(String.valueOf(ChatColor.GRAY.toString()) + ChatColor.STRIKETHROUGH.toString(), TimerSidebarProvider.STRAIGHT_LINE, TimerSidebarProvider.STRAIGHT_LINE));
lines.add(lines.size(), new SidebarEntry(ChatColor.GRAY.toString(), String.valueOf(ChatColor.STRIKETHROUGH.toString()) + TimerSidebarProvider.STRAIGHT_LINE, TimerSidebarProvider.STRAIGHT_LINE));
}
return lines;
}
}

View File

@ -0,0 +1,53 @@
package com.prevailpots.bunkers.tab;
import org.bukkit.entity.Player;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import me.vertises.aztec.tablist.TablistEntrySupplier;
import net.md_5.bungee.api.ChatColor;
public class TabEvent implements TablistEntrySupplier {
@Override
public Table<Integer, Integer, String> getEntries(Player player) {
Table<Integer, Integer, String> table = HashBasedTable.create();
table.put(1, 0, ChatColor.AQUA + "Prevail" + ChatColor.GRAY + " [Bunkers]");
table.put(0, 3, ChatColor.AQUA + "Bunkers:" + ChatColor.GRAY + " [Online]");
table.put(0, 4, ChatColor.AQUA + "HCFactions:" + ChatColor.GRAY + " [Offline]");
table.put(0, 5, ChatColor.AQUA + "Practice:" + ChatColor.GRAY + " [Offline]");
//mid
table.put(1, 3, ChatColor.AQUA + "Wins:" + ChatColor.GRAY + " [3]");
table.put(1, 4, ChatColor.AQUA + "Team:" + ChatColor.GRAY + " [Blue]");
table.put(1, 5, ChatColor.AQUA + "Proxy:" + ChatColor.GRAY + " [EU-1]");
table.put(2, 3, ChatColor.AQUA + "Kills:" + ChatColor.GRAY + " [13]");
table.put(2, 4, ChatColor.AQUA + "Deaths:" + ChatColor.GRAY + " [41]");
table.put(2, 5, ChatColor.AQUA + "Online:" + ChatColor.GRAY + " [1]");
table.put(0, 19, ChatColor.AQUA + "1.8 Fixed" + ChatColor.GRAY + "");
table.put(1, 19, ChatColor.AQUA + "1.8 Fixed" + ChatColor.GRAY + "");
table.put(2, 19, ChatColor.AQUA + "1.8 Fixed" + ChatColor.GRAY + "");
table.put(3, 19, ChatColor.AQUA + "1.8 Fixed" + ChatColor.GRAY + "");
//
table.put(3, 0, ChatColor.GRAY + "You are using 1.8" + ChatColor.YELLOW + "");
table.put(3, 1, ChatColor.GRAY + "Please use 1.7 for" + ChatColor.YELLOW + "");
table.put(3, 2, ChatColor.GRAY + "For the best quality!" + ChatColor.YELLOW + "");
return table;
}
@Override
public String getHeader(Player player) {
return "§bYou are connected to 1.8 Bunkers!";
}
@Override
public String getFooter(Player player) {
return "§CWe suggest using 1.7 for the highest quality!";
}
}

View File

@ -0,0 +1,6 @@
package com.prevailpots.bunkers.task;
public interface DynamicTask
{
void execute();
}

View File

@ -0,0 +1,34 @@
package com.prevailpots.bunkers.task;
import org.bukkit.inventory.*;
import org.bukkit.*;
import org.bukkit.scheduler.*;
import com.prevailpots.bunkers.*;
import java.util.*;
import org.bukkit.plugin.*;
public class ItemDropTask implements DynamicTask
{
private List<ItemStack> drops;
private Location drop;
public ItemDropTask(final List<ItemStack> dropd, final Location drop) {
this.drops = new ArrayList<ItemStack>();
this.drops = dropd;
this.drop = drop;
}
@Override
public void execute() {
new BukkitRunnable() {
public void run() {
for (final ItemStack i : ItemDropTask.this.drops) {
ItemDropTask.this.drop.getWorld().dropItemNaturally(ItemDropTask.this.drop, i);
}
}
}.runTaskLater((Plugin)Core.getInstance(), 2L);
}
}

View File

@ -0,0 +1,19 @@
package com.prevailpots.bunkers.task;
import org.bukkit.entity.*;
import com.prevailpots.bunkers.*;
public class PlayerItemTask implements DynamicTask
{
private Player player;
public PlayerItemTask(final Player p) {
this.player = p;
}
@Override
public void execute() {
Core.getInstance().getItemManager().giveStarterItems(this.player);
}
}

View File

@ -0,0 +1,17 @@
package com.prevailpots.bunkers.utils;
import org.bukkit.*;
import org.bukkit.entity.*;
import ru.tehkode.permissions.bukkit.*;
import java.util.*;
public class BroadcastUtils
{
public static void broadcastToPerm(final String msg, final String permission) {
for (final Player p : Bukkit.getOnlinePlayers() {
if (PermissionsEx.getUser(p).has(permission) || p.isOp()) {
p.sendMessage(msg);
}
}
}
}

View File

@ -0,0 +1,184 @@
package com.prevailpots.bunkers.utils;
import org.bukkit.*;
import org.bukkit.inventory.*;
import java.util.*;
import org.bukkit.inventory.meta.*;
import org.bukkit.enchantments.*;
import org.bukkit.potion.*;
public class ItemUtil
{
public static boolean isInteractable(final Material m) {
switch (m) {
case ENCHANTMENT_TABLE: {
return true;
}
case ANVIL: {
return true;
}
case BREWING_STAND: {
return true;
}
case BREWING_STAND_ITEM: {
return true;
}
case CAULDRON: {
return true;
}
case CAULDRON_ITEM: {
return true;
}
case TRAPPED_CHEST: {
return true;
}
case TRAP_DOOR: {
return true;
}
case FENCE_GATE: {
return true;
}
case NOTE_BLOCK: {
return true;
}
case FURNACE: {
return true;
}
case JUKEBOX: {
return true;
}
case BOAT: {
return true;
}
case GOLD_PLATE: {
return true;
}
case IRON_PLATE: {
return true;
}
case STONE_PLATE: {
return true;
}
case WOOD_PLATE: {
return true;
}
case BED: {
return true;
}
case IRON_DOOR: {
return true;
}
case WOOD_DOOR: {
return true;
}
case IRON_DOOR_BLOCK: {
return true;
}
case WOODEN_DOOR: {
return true;
}
case CHEST: {
return true;
}
case WORKBENCH: {
return true;
}
case MINECART: {
return true;
}
case COMMAND_MINECART: {
return true;
}
case EXPLOSIVE_MINECART: {
return true;
}
case HOPPER_MINECART: {
return true;
}
case POWERED_MINECART: {
return true;
}
case STORAGE_MINECART: {
return true;
}
case HOPPER: {
return true;
}
case BEACON: {
return true;
}
case COMMAND: {
return true;
}
case CAKE_BLOCK: {
return true;
}
case CAKE: {
return true;
}
case WATER: {
return true;
}
case STATIONARY_WATER: {
return true;
}
case LAVA: {
return true;
}
case STATIONARY_LAVA: {
return true;
}
case BURNING_FURNACE: {
return true;
}
case LEVER: {
return true;
}
case DISPENSER: {
return true;
}
case DROPPER: {
return true;
}
default: {
return false;
}
}
}
public static ItemStack getItem(final String displayName, final Material type, final int count, final String... lore) {
final ItemStack toReturn = new ItemStack(type, count);
final ItemMeta meta = toReturn.getItemMeta();
meta.setDisplayName(displayName);
if (lore != null) {
meta.setLore((List)Arrays.asList(lore));
}
toReturn.setItemMeta(meta);
return toReturn;
}
public static ItemStack getEnchantedItem(final String displayName, final Material type, final int count, final Enchantment enchantment, final int enchLevel, final String... lore) {
final ItemStack toReturn = new ItemStack(type, count);
toReturn.addUnsafeEnchantment(enchantment, enchLevel);
final ItemMeta meta = toReturn.getItemMeta();
meta.setDisplayName(displayName);
if (lore != null) {
meta.setLore((List)Arrays.asList(lore));
}
toReturn.setItemMeta(meta);
return toReturn;
}
public static ItemStack getPotion(final String displayName, final PotionType type, final boolean splash, final int level, final boolean extendDuration, final int count, final String... lore) {
final ItemStack toReturn = getItem(displayName, Material.POTION, count, lore);
final Potion pot = new Potion(1);
pot.setType(type);
if (!type.toString().toLowerCase().contains("instant") && extendDuration) {
pot.setHasExtendedDuration(true);
}
pot.setSplash(splash);
pot.setLevel(level);
pot.apply(toReturn);
return toReturn;
}
}

View File

@ -0,0 +1,32 @@
package com.prevailpots.bunkers.utils;
import java.math.*;
import java.util.*;
public class MathUtils
{
public static double round(final double value, final int places) {
if (places < 0) {
throw new IllegalArgumentException();
}
BigDecimal bd = new BigDecimal(value);
bd = bd.setScale(places, RoundingMode.HALF_UP);
return bd.doubleValue();
}
public static int indexOfMax(final double[] array) {
final List<Double> list = new ArrayList<Double>();
for (int i = 0; i < array.length; ++i) {
list.add(array[i]);
}
return list.indexOf(Collections.max(null));
}
public static int indexOfMin(final double[] array) {
final List<Double> list = new ArrayList<Double>();
for (int i = 0; i < array.length; ++i) {
list.add(array[i]);
}
return list.indexOf(Collections.min(null));
}
}

View File

@ -0,0 +1,674 @@
package com.prevailpots.bunkers.utils;
import java.util.*;
import org.bukkit.entity.*;
import org.bukkit.util.*;
import com.sk89q.worldedit.Vector;
import java.lang.reflect.*;
import org.bukkit.*;
public enum ParticleEffect
{
EXPLOSION_NORMAL("EXPLOSION_NORMAL", 0, "explode", 0, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }),
EXPLOSION_LARGE("EXPLOSION_LARGE", 1, "largeexplode", 1, -1, new ParticleProperty[0]),
EXPLOSION_HUGE("EXPLOSION_HUGE", 2, "hugeexplosion", 2, -1, new ParticleProperty[0]),
FIREWORKS_SPARK("FIREWORKS_SPARK", 3, "fireworksSpark", 3, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }),
WATER_BUBBLE("WATER_BUBBLE", 4, "bubble", 4, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_WATER }),
WATER_SPLASH("WATER_SPLASH", 5, "splash", 5, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }),
WATER_WAKE("WATER_WAKE", 6, "wake", 6, 7, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }),
SUSPENDED("SUSPENDED", 7, "suspended", 7, -1, new ParticleProperty[] { ParticleProperty.REQUIRES_WATER }),
SUSPENDED_DEPTH("SUSPENDED_DEPTH", 8, "depthSuspend", 8, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }),
CRIT("CRIT", 9, "crit", 9, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }),
CRIT_MAGIC("CRIT_MAGIC", 10, "magicCrit", 10, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }),
SMOKE_NORMAL("SMOKE_NORMAL", 11, "smoke", 11, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }),
SMOKE_LARGE("SMOKE_LARGE", 12, "largesmoke", 12, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }),
SPELL("SPELL", 13, "spell", 13, -1, new ParticleProperty[0]),
SPELL_INSTANT("SPELL_INSTANT", 14, "instantSpell", 14, -1, new ParticleProperty[0]),
SPELL_MOB("SPELL_MOB", 15, "mobSpell", 15, -1, new ParticleProperty[] { ParticleProperty.COLORABLE }),
SPELL_MOB_AMBIENT("SPELL_MOB_AMBIENT", 16, "mobSpellAmbient", 16, -1, new ParticleProperty[] { ParticleProperty.COLORABLE }),
SPELL_WITCH("SPELL_WITCH", 17, "witchMagic", 17, -1, new ParticleProperty[0]),
DRIP_WATER("DRIP_WATER", 18, "dripWater", 18, -1, new ParticleProperty[0]),
DRIP_LAVA("DRIP_LAVA", 19, "dripLava", 19, -1, new ParticleProperty[0]),
VILLAGER_ANGRY("VILLAGER_ANGRY", 20, "angryVillager", 20, -1, new ParticleProperty[0]),
VILLAGER_HAPPY("VILLAGER_HAPPY", 21, "happyVillager", 21, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }),
TOWN_AURA("TOWN_AURA", 22, "townaura", 22, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }),
NOTE("NOTE", 23, "note", 23, -1, new ParticleProperty[] { ParticleProperty.COLORABLE }),
PORTAL("PORTAL", 24, "portal", 24, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }),
ENCHANTMENT_TABLE("ENCHANTMENT_TABLE", 25, "enchantmenttable", 25, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }),
FLAME("FLAME", 26, "flame", 26, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }),
LAVA("LAVA", 27, "lava", 27, -1, new ParticleProperty[0]),
FOOTSTEP("FOOTSTEP", 28, "footstep", 28, -1, new ParticleProperty[0]),
CLOUD("CLOUD", 29, "cloud", 29, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }),
REDSTONE("REDSTONE", 30, "reddust", 30, -1, new ParticleProperty[] { ParticleProperty.COLORABLE }),
SNOWBALL("SNOWBALL", 31, "snowballpoof", 31, -1, new ParticleProperty[0]),
SNOW_SHOVEL("SNOW_SHOVEL", 32, "snowshovel", 32, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL }),
SLIME("SLIME", 33, "slime", 33, -1, new ParticleProperty[0]),
HEART("HEART", 34, "heart", 34, -1, new ParticleProperty[0]),
BARRIER("BARRIER", 35, "barrier", 35, 8, new ParticleProperty[0]),
ITEM_CRACK("ITEM_CRACK", 36, "iconcrack", 36, -1, new ParticleProperty[] { ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_DATA }),
BLOCK_CRACK("BLOCK_CRACK", 37, "blockcrack", 37, -1, new ParticleProperty[] { ParticleProperty.REQUIRES_DATA }),
BLOCK_DUST("BLOCK_DUST", 38, "blockdust", 38, 7, new ParticleProperty[] { ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_DATA }),
WATER_DROP("WATER_DROP", 39, "droplet", 39, 8, new ParticleProperty[0]),
ITEM_TAKE("ITEM_TAKE", 40, "take", 40, 8, new ParticleProperty[0]),
MOB_APPEARANCE("MOB_APPEARANCE", 41, "mobappearance", 41, 8, new ParticleProperty[0]);
private static final Map<String, ParticleEffect> NAME_MAP;
private static final Map<Integer, ParticleEffect> ID_MAP;
private final String name;
private final int id;
private final int requiredVersion;
private final List<ParticleProperty> properties;
static {
NAME_MAP = new HashMap<String, ParticleEffect>();
ID_MAP = new HashMap<Integer, ParticleEffect>();
ParticleEffect[] values;
for (int length = (values = values()).length, i = 0; i < length; ++i) {
final ParticleEffect effect = values[i];
ParticleEffect.NAME_MAP.put(effect.name, effect);
ParticleEffect.ID_MAP.put(effect.id, effect);
}
}
private ParticleEffect(final String s, final int n, final String name, final int id, final int requiredVersion, final ParticleProperty... properties) {
this.name = name;
this.id = id;
this.requiredVersion = requiredVersion;
this.properties = Arrays.asList(properties);
}
public String getName() {
return this.name;
}
public int getId() {
return this.id;
}
public int getRequiredVersion() {
return this.requiredVersion;
}
public boolean hasProperty(final ParticleProperty property) {
return this.properties.contains(property);
}
public boolean isSupported() {
return this.requiredVersion == -1 || ParticlePacket.getVersion() >= this.requiredVersion;
}
public static ParticleEffect fromName(final String name) {
for (final Map.Entry<String, ParticleEffect> entry : ParticleEffect.NAME_MAP.entrySet()) {
if (!entry.getKey().equalsIgnoreCase(name)) {
continue;
}
return entry.getValue();
}
return null;
}
public static ParticleEffect fromId(final int id) {
for (final Map.Entry<Integer, ParticleEffect> entry : ParticleEffect.ID_MAP.entrySet()) {
if (entry.getKey() != id) {
continue;
}
return entry.getValue();
}
return null;
}
private static boolean isWater(final Location location) {
final Material material = location.getBlock().getType();
return material == Material.WATER || material == Material.STATIONARY_WATER;
}
private static boolean isLongDistance(final Location location, final List<Player> players) {
final String world = location.getWorld().getName();
for (final Player player : players) {
final Location playerLocation = player.getLocation();
if (world.equals(playerLocation.getWorld().getName())) {
if (playerLocation.distanceSquared(location) < 65536.0) {
continue;
}
return true;
}
}
return false;
}
private static boolean isDataCorrect(final ParticleEffect effect, final ParticleData data) {
return ((effect == ParticleEffect.BLOCK_CRACK || effect == ParticleEffect.BLOCK_DUST) && data instanceof BlockData) || (effect == ParticleEffect.ITEM_CRACK && data instanceof ItemData);
}
private static boolean isColorCorrect(final ParticleEffect effect, final ParticleColor color) {
return ((effect == ParticleEffect.SPELL_MOB || effect == ParticleEffect.SPELL_MOB_AMBIENT || effect == ParticleEffect.REDSTONE) && color instanceof OrdinaryColor) || (effect == ParticleEffect.NOTE && color instanceof NoteColor);
}
public void display(final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final double range) throws ParticleVersionException, ParticleDataException, IllegalArgumentException {
if (!this.isSupported()) {
throw new ParticleVersionException("This particle effect is not supported by your server version");
}
if (this.hasProperty(ParticleProperty.REQUIRES_DATA)) {
throw new ParticleDataException("This particle effect requires additional data");
}
if (this.hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) {
throw new IllegalArgumentException("There is no water at the center location");
}
new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, range > 256.0, null).sendTo(center, range);
}
public void display(final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final List<Player> players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException {
if (!this.isSupported()) {
throw new ParticleVersionException("This particle effect is not supported by your server version");
}
if (this.hasProperty(ParticleProperty.REQUIRES_DATA)) {
throw new ParticleDataException("This particle effect requires additional data");
}
if (this.hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) {
throw new IllegalArgumentException("There is no water at the center location");
}
new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, isLongDistance(center, players), null).sendTo(center, players);
}
public void display(final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final Player... players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException {
this.display(offsetX, offsetY, offsetZ, speed, amount, center, Arrays.asList(players));
}
public void display(final Vector direction, final float speed, final Location center, final double range) throws ParticleVersionException, ParticleDataException, IllegalArgumentException {
if (!this.isSupported()) {
throw new ParticleVersionException("This particle effect is not supported by your server version");
}
if (this.hasProperty(ParticleProperty.REQUIRES_DATA)) {
throw new ParticleDataException("This particle effect requires additional data");
}
if (!this.hasProperty(ParticleProperty.DIRECTIONAL)) {
throw new IllegalArgumentException("This particle effect is not directional");
}
if (this.hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) {
throw new IllegalArgumentException("There is no water at the center location");
}
new ParticlePacket(this, direction, speed, range > 256.0, null).sendTo(center, range);
}
public void display(final Vector direction, final float speed, final Location center, final List<Player> players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException {
if (!this.isSupported()) {
throw new ParticleVersionException("This particle effect is not supported by your server version");
}
if (this.hasProperty(ParticleProperty.REQUIRES_DATA)) {
throw new ParticleDataException("This particle effect requires additional data");
}
if (!this.hasProperty(ParticleProperty.DIRECTIONAL)) {
throw new IllegalArgumentException("This particle effect is not directional");
}
if (this.hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) {
throw new IllegalArgumentException("There is no water at the center location");
}
new ParticlePacket(this, direction, speed, isLongDistance(center, players), null).sendTo(center, players);
}
public void display(final Vector direction, final float speed, final Location center, final Player... players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException {
this.display(direction, speed, center, Arrays.asList(players));
}
public void display(final ParticleColor color, final Location center, final double range) throws ParticleVersionException, ParticleColorException {
if (!this.isSupported()) {
throw new ParticleVersionException("This particle effect is not supported by your server version");
}
if (!this.hasProperty(ParticleProperty.COLORABLE)) {
throw new ParticleColorException("This particle effect is not colorable");
}
if (!isColorCorrect(this, color)) {
throw new ParticleColorException("The particle color type is incorrect");
}
new ParticlePacket(this, color, range > 256.0).sendTo(center, range);
}
public void display(final ParticleColor color, final Location center, final List<Player> players) throws ParticleVersionException, ParticleColorException {
if (!this.isSupported()) {
throw new ParticleVersionException("This particle effect is not supported by your server version");
}
if (!this.hasProperty(ParticleProperty.COLORABLE)) {
throw new ParticleColorException("This particle effect is not colorable");
}
if (!isColorCorrect(this, color)) {
throw new ParticleColorException("The particle color type is incorrect");
}
new ParticlePacket(this, color, isLongDistance(center, players)).sendTo(center, players);
}
public void display(final ParticleColor color, final Location center, final Player... players) throws ParticleVersionException, ParticleColorException {
this.display(color, center, Arrays.asList(players));
}
public void display(final ParticleData data, final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final double range) throws ParticleVersionException, ParticleDataException {
if (!this.isSupported()) {
throw new ParticleVersionException("This particle effect is not supported by your server version");
}
if (!this.hasProperty(ParticleProperty.REQUIRES_DATA)) {
throw new ParticleDataException("This particle effect does not require additional data");
}
if (!isDataCorrect(this, data)) {
throw new ParticleDataException("The particle data type is incorrect");
}
new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, range > 256.0, data).sendTo(center, range);
}
public void display(final ParticleData data, final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final List<Player> players) throws ParticleVersionException, ParticleDataException {
if (!this.isSupported()) {
throw new ParticleVersionException("This particle effect is not supported by your server version");
}
if (!this.hasProperty(ParticleProperty.REQUIRES_DATA)) {
throw new ParticleDataException("This particle effect does not require additional data");
}
if (!isDataCorrect(this, data)) {
throw new ParticleDataException("The particle data type is incorrect");
}
new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, isLongDistance(center, players), data).sendTo(center, players);
}
public void display(final ParticleData data, final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final Location center, final Player... players) throws ParticleVersionException, ParticleDataException {
this.display(data, offsetX, offsetY, offsetZ, speed, amount, center, Arrays.asList(players));
}
public void display(final ParticleData data, final Vector direction, final float speed, final Location center, final double range) throws ParticleVersionException, ParticleDataException {
if (!this.isSupported()) {
throw new ParticleVersionException("This particle effect is not supported by your server version");
}
if (!this.hasProperty(ParticleProperty.REQUIRES_DATA)) {
throw new ParticleDataException("This particle effect does not require additional data");
}
if (!isDataCorrect(this, data)) {
throw new ParticleDataException("The particle data type is incorrect");
}
new ParticlePacket(this, direction, speed, range > 256.0, data).sendTo(center, range);
}
public void display(final ParticleData data, final Vector direction, final float speed, final Location center, final List<Player> players) throws ParticleVersionException, ParticleDataException {
if (!this.isSupported()) {
throw new ParticleVersionException("This particle effect is not supported by your server version");
}
if (!this.hasProperty(ParticleProperty.REQUIRES_DATA)) {
throw new ParticleDataException("This particle effect does not require additional data");
}
if (!isDataCorrect(this, data)) {
throw new ParticleDataException("The particle data type is incorrect");
}
new ParticlePacket(this, direction, speed, isLongDistance(center, players), data).sendTo(center, players);
}
public void display(final ParticleData data, final Vector direction, final float speed, final Location center, final Player... players) throws ParticleVersionException, ParticleDataException {
this.display(data, direction, speed, center, Arrays.asList(players));
}
public enum ParticleProperty
{
REQUIRES_WATER("REQUIRES_WATER", 0),
REQUIRES_DATA("REQUIRES_DATA", 1),
DIRECTIONAL("DIRECTIONAL", 2),
COLORABLE("COLORABLE", 3);
private ParticleProperty(final String s, final int n) {
}
}
public abstract static class ParticleData
{
private final Material material;
private final byte data;
private final int[] packetData;
public ParticleData(final Material material, final byte data) {
this.material = material;
this.data = data;
this.packetData = new int[] { material.getId(), data };
}
public Material getMaterial() {
return this.material;
}
public byte getData() {
return this.data;
}
public int[] getPacketData() {
return this.packetData;
}
public String getPacketDataString() {
return "_" + this.packetData[0] + "_" + this.packetData[1];
}
}
public static final class ItemData extends ParticleData
{
public ItemData(final Material material, final byte data) {
super(material, data);
}
}
public static final class BlockData extends ParticleData
{
public BlockData(final Material material, final byte data) throws IllegalArgumentException {
super(material, data);
if (!material.isBlock()) {
throw new IllegalArgumentException("The material is not a block");
}
}
}
public abstract static class ParticleColor
{
public abstract float getValueX();
public abstract float getValueY();
public abstract float getValueZ();
}
public static final class OrdinaryColor extends ParticleColor
{
private final int red;
private final int green;
private final int blue;
public OrdinaryColor(final int red, final int green, final int blue) throws IllegalArgumentException {
if (red < 0) {
throw new IllegalArgumentException("The red value is lower than 0");
}
if (red > 255) {
throw new IllegalArgumentException("The red value is higher than 255");
}
this.red = red;
if (green < 0) {
throw new IllegalArgumentException("The green value is lower than 0");
}
if (green > 255) {
throw new IllegalArgumentException("The green value is higher than 255");
}
this.green = green;
if (blue < 0) {
throw new IllegalArgumentException("The blue value is lower than 0");
}
if (blue > 255) {
throw new IllegalArgumentException("The blue value is higher than 255");
}
this.blue = blue;
}
public OrdinaryColor(final Color color) {
this(color.getRed(), color.getGreen(), color.getBlue());
}
public int getRed() {
return this.red;
}
public int getGreen() {
return this.green;
}
public int getBlue() {
return this.blue;
}
@Override
public float getValueX() {
return this.red / 255.0f;
}
@Override
public float getValueY() {
return this.green / 255.0f;
}
@Override
public float getValueZ() {
return this.blue / 255.0f;
}
}
public static final class NoteColor extends ParticleColor
{
private final int note;
public NoteColor(final int note) throws IllegalArgumentException {
if (note < 0) {
throw new IllegalArgumentException("The note value is lower than 0");
}
if (note > 24) {
throw new IllegalArgumentException("The note value is higher than 24");
}
this.note = note;
}
@Override
public float getValueX() {
return this.note / 24.0f;
}
@Override
public float getValueY() {
return 0.0f;
}
@Override
public float getValueZ() {
return 0.0f;
}
}
private static final class ParticleDataException extends RuntimeException
{
private static final long serialVersionUID = 3203085387160737484L;
public ParticleDataException(final String message) {
super(message);
}
}
private static final class ParticleColorException extends RuntimeException
{
private static final long serialVersionUID = 3203085387160737484L;
public ParticleColorException(final String message) {
super(message);
}
}
private static final class ParticleVersionException extends RuntimeException
{
private static final long serialVersionUID = 3203085387160737484L;
public ParticleVersionException(final String message) {
super(message);
}
}
public static final class ParticlePacket
{
private static int version;
private static Class<?> enumParticle;
private static Constructor<?> packetConstructor;
private static Method getHandle;
private static Field playerConnection;
private static Method sendPacket;
private static boolean initialized;
private final ParticleEffect effect;
private float offsetX;
private final float offsetY;
private final float offsetZ;
private final float speed;
private final int amount;
private final boolean longDistance;
private final ParticleData data;
private Object packet;
public ParticlePacket(final ParticleEffect effect, final float offsetX, final float offsetY, final float offsetZ, final float speed, final int amount, final boolean longDistance, final ParticleData data) throws IllegalArgumentException {
initialize();
if (speed < 0.0f) {
throw new IllegalArgumentException("The speed is lower than 0");
}
if (amount < 0) {
throw new IllegalArgumentException("The amount is lower than 0");
}
this.effect = effect;
this.offsetX = offsetX;
this.offsetY = offsetY;
this.offsetZ = offsetZ;
this.speed = speed;
this.amount = amount;
this.longDistance = longDistance;
this.data = data;
}
public ParticlePacket(final ParticleEffect effect, final Vector direction, final float speed, final boolean longDistance, final ParticleData data) throws IllegalArgumentException {
this(effect, (float)direction.getX(), (float)direction.getY(), (float)direction.getZ(), speed, 0, longDistance, data);
}
public ParticlePacket(final ParticleEffect effect, final ParticleColor color, final boolean longDistance) {
this(effect, color.getValueX(), color.getValueY(), color.getValueZ(), 1.0f, 0, longDistance, null);
if (effect == ParticleEffect.REDSTONE && color instanceof OrdinaryColor && ((OrdinaryColor)color).getRed() == 0) {
this.offsetX = Float.MIN_NORMAL;
}
}
public static void initialize() throws VersionIncompatibleException {
if (ParticlePacket.initialized) {
return;
}
try {
ParticlePacket.version = Integer.parseInt(Character.toString(ReflectionUtils.PackageType.getServerVersion().charAt(3)));
if (ParticlePacket.version > 7) {
ParticlePacket.enumParticle = ReflectionUtils.PackageType.MINECRAFT_SERVER.getClass("EnumParticle");
}
final Class<?> packetClass = ReflectionUtils.PackageType.MINECRAFT_SERVER.getClass((ParticlePacket.version < 7) ? "Packet63WorldParticles" : "PacketPlayOutWorldParticles");
ParticlePacket.packetConstructor = ReflectionUtils.getConstructor(packetClass, (Class<?>[])new Class[0]);
ParticlePacket.getHandle = ReflectionUtils.getMethod("CraftPlayer", ReflectionUtils.PackageType.CRAFTBUKKIT_ENTITY, "getHandle", (Class<?>[])new Class[0]);
ParticlePacket.playerConnection = ReflectionUtils.getField("EntityPlayer", ReflectionUtils.PackageType.MINECRAFT_SERVER, false, "playerConnection");
ParticlePacket.sendPacket = ReflectionUtils.getMethod(ParticlePacket.playerConnection.getType(), "sendPacket", ReflectionUtils.PackageType.MINECRAFT_SERVER.getClass("Packet"));
}
catch (Exception exception) {
throw new VersionIncompatibleException("Your current bukkit version seems to be incompatible with this library", exception);
}
ParticlePacket.initialized = true;
}
public static int getVersion() {
if (!ParticlePacket.initialized) {
initialize();
}
return ParticlePacket.version;
}
public static boolean isInitialized() {
return ParticlePacket.initialized;
}
private void initializePacket(final Location center) throws PacketInstantiationException {
if (this.packet != null) {
return;
}
try {
this.packet = ParticlePacket.packetConstructor.newInstance(new Object[0]);
if (ParticlePacket.version < 8) {
String name = this.effect.getName();
if (this.data != null) {
name = String.valueOf(name) + this.data.getPacketDataString();
}
ReflectionUtils.setValue(this.packet, true, "a", name);
}
else {
ReflectionUtils.setValue(this.packet, true, "a", ParticlePacket.enumParticle.getEnumConstants()[this.effect.getId()]);
ReflectionUtils.setValue(this.packet, true, "j", this.longDistance);
if (this.data != null) {
final int[] packetData = this.data.getPacketData();
final Object packet = this.packet;
final boolean declared = true;
final String fieldName = "k";
int[] value = null;
if (this.effect != ParticleEffect.ITEM_CRACK) {
value = new int[] { packetData[0] | packetData[1] << 12 };
}
ReflectionUtils.setValue(packet, declared, fieldName, value);
}
}
ReflectionUtils.setValue(this.packet, true, "b", (float)center.getX());
ReflectionUtils.setValue(this.packet, true, "c", (float)center.getY());
ReflectionUtils.setValue(this.packet, true, "d", (float)center.getZ());
ReflectionUtils.setValue(this.packet, true, "e", this.offsetX);
ReflectionUtils.setValue(this.packet, true, "f", this.offsetY);
ReflectionUtils.setValue(this.packet, true, "g", this.offsetZ);
ReflectionUtils.setValue(this.packet, true, "h", this.speed);
ReflectionUtils.setValue(this.packet, true, "i", this.amount);
}
catch (Exception exception) {
throw new PacketInstantiationException("Packet instantiation failed", exception);
}
}
public void sendTo(final Location center, final Player player) throws PacketInstantiationException, PacketSendingException {
this.initializePacket(center);
try {
ParticlePacket.sendPacket.invoke(ParticlePacket.playerConnection.get(ParticlePacket.getHandle.invoke(player, new Object[0])), this.packet);
}
catch (Exception exception) {
throw new PacketSendingException("Failed to send the packet to player '" + player.getName() + "'", exception);
}
}
public void sendTo(final Location center, final List<Player> players) throws IllegalArgumentException {
if (players.isEmpty()) {
throw new IllegalArgumentException("The player list is empty");
}
for (final Player player : players) {
this.sendTo(center, player);
}
}
public void sendTo(final Location center, final double range) throws IllegalArgumentException {
if (range < 1.0) {
throw new IllegalArgumentException("The range is lower than 1");
}
final String worldName = center.getWorld().getName();
final double squared = range * range;
for (final Player player : Bukkit.getOnlinePlayers()) {
if (player.getWorld().getName().equals(worldName)) {
if (player.getLocation().distanceSquared(center) > squared) {
continue;
}
this.sendTo(center, player);
}
}
}
private static final class VersionIncompatibleException extends RuntimeException
{
private static final long serialVersionUID = 3203085387160737484L;
public VersionIncompatibleException(final String message, final Throwable cause) {
super(message, cause);
}
}
private static final class PacketInstantiationException extends RuntimeException
{
private static final long serialVersionUID = 3203085387160737484L;
public PacketInstantiationException(final String message, final Throwable cause) {
super(message, cause);
}
}
private static final class PacketSendingException extends RuntimeException
{
private static final long serialVersionUID = 3203085387160737484L;
public PacketSendingException(final String message, final Throwable cause) {
super(message, cause);
}
}
}
}

View File

@ -0,0 +1,248 @@
package com.prevailpots.bunkers.utils;
import java.lang.reflect.*;
import java.util.*;
import org.bukkit.*;
public final class ReflectionUtils
{
public static Constructor<?> getConstructor(final Class<?> clazz, final Class<?>... parameterTypes) throws NoSuchMethodException {
final Class[] primitiveTypes = DataType.getPrimitive(parameterTypes);
Constructor<?>[] constructors;
for (int length = (constructors = clazz.getConstructors()).length, i = 0; i < length; ++i) {
final Constructor<?> constructor = constructors[i];
if (DataType.compare(DataType.getPrimitive(constructor.getParameterTypes()), primitiveTypes)) {
return constructor;
}
}
throw new NoSuchMethodException("There is no such constructor in this class with the specified parameter types");
}
public static Constructor<?> getConstructor(final String className, final PackageType packageType, final Class<?>... parameterTypes) throws NoSuchMethodException, ClassNotFoundException {
return getConstructor(packageType.getClass(className), parameterTypes);
}
public static Object instantiateObject(final Class<?> clazz, final Object... arguments) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException {
return getConstructor(clazz, DataType.getPrimitive(arguments)).newInstance(arguments);
}
public static Object instantiateObject(final String className, final PackageType packageType, final Object... arguments) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
return instantiateObject(packageType.getClass(className), arguments);
}
public static Method getMethod(final Class<?> clazz, final String methodName, final Class<?>... parameterTypes) throws NoSuchMethodException {
final Class[] primitiveTypes = DataType.getPrimitive(parameterTypes);
Method[] methods;
for (int length = (methods = clazz.getMethods()).length, i = 0; i < length; ++i) {
final Method method = methods[i];
if (method.getName().equals(methodName) && DataType.compare(DataType.getPrimitive(method.getParameterTypes()), primitiveTypes)) {
return method;
}
}
throw new NoSuchMethodException("There is no such method in this class with the specified name and parameter types");
}
public static Method getMethod(final String className, final PackageType packageType, final String methodName, final Class<?>... parameterTypes) throws NoSuchMethodException, ClassNotFoundException {
return getMethod(packageType.getClass(className), methodName, parameterTypes);
}
public static Object invokeMethod(final Object instance, final String methodName, final Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException {
return getMethod(instance.getClass(), methodName, DataType.getPrimitive(arguments)).invoke(instance, arguments);
}
public static Object invokeMethod(final Object instance, final Class<?> clazz, final String methodName, final Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException {
return getMethod(clazz, methodName, DataType.getPrimitive(arguments)).invoke(instance, arguments);
}
public static Object invokeMethod(final Object instance, final String className, final PackageType packageType, final String methodName, final Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
return invokeMethod(instance, packageType.getClass(className), methodName, arguments);
}
public static Field getField(final Class<?> clazz, final boolean declared, final String fieldName) throws NoSuchFieldException, SecurityException {
final Field field = declared ? clazz.getDeclaredField(fieldName) : clazz.getField(fieldName);
field.setAccessible(true);
return field;
}
public static Field getField(final String className, final PackageType packageType, final boolean declared, final String fieldName) throws NoSuchFieldException, SecurityException, ClassNotFoundException {
return getField(packageType.getClass(className), declared, fieldName);
}
public static Object getValue(final Object instance, final Class<?> clazz, final boolean declared, final String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
return getField(clazz, declared, fieldName).get(instance);
}
public static Object getValue(final Object instance, final String className, final PackageType packageType, final boolean declared, final String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, ClassNotFoundException {
return getValue(instance, packageType.getClass(className), declared, fieldName);
}
public static Object getValue(final Object instance, final boolean declared, final String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
return getValue(instance, instance.getClass(), declared, fieldName);
}
public static void setValue(final Object instance, final Class<?> clazz, final boolean declared, final String fieldName, final Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
getField(clazz, declared, fieldName).set(instance, value);
}
public static void setValue(final Object instance, final String className, final PackageType packageType, final boolean declared, final String fieldName, final Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, ClassNotFoundException {
setValue(instance, packageType.getClass(className), declared, fieldName, value);
}
public static void setValue(final Object instance, final boolean declared, final String fieldName, final Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
setValue(instance, instance.getClass(), declared, fieldName, value);
}
public enum DataType
{
BYTE((Class<?>)Byte.TYPE, (Class<?>)Byte.class),
SHORT((Class<?>)Short.TYPE, (Class<?>)Short.class),
INTEGER((Class<?>)Integer.TYPE, (Class<?>)Integer.class),
LONG((Class<?>)Long.TYPE, (Class<?>)Long.class),
CHARACTER((Class<?>)Character.TYPE, (Class<?>)Character.class),
FLOAT((Class<?>)Float.TYPE, (Class<?>)Float.class),
DOUBLE((Class<?>)Double.TYPE, (Class<?>)Double.class),
BOOLEAN((Class<?>)Boolean.TYPE, (Class<?>)Boolean.class);
private static final Map<Class<?>, DataType> CLASS_MAP;
private final Class<?> primitive;
private final Class<?> reference;
static {
CLASS_MAP = new HashMap<Class<?>, DataType>();
DataType[] values;
for (int length = (values = values()).length, i = 0; i < length; ++i) {
final DataType type = values[i];
DataType.CLASS_MAP.put(type.primitive, type);
DataType.CLASS_MAP.put(type.reference, type);
}
}
private DataType(final Class<?> primitive, final Class<?> reference) {
this.primitive = primitive;
this.reference = reference;
}
public Class<?> getPrimitive() {
return this.primitive;
}
public Class<?> getReference() {
return this.reference;
}
public static DataType fromClass(final Class<?> clazz) {
return DataType.CLASS_MAP.get(clazz);
}
public static Class<?> getPrimitive(final Class<?> clazz) {
final DataType type = fromClass(clazz);
return (type == null) ? clazz : type.getPrimitive();
}
public static Class<?> getReference(final Class<?> clazz) {
final DataType type = fromClass(clazz);
return (type == null) ? clazz : type.getReference();
}
public static Class<?>[] getPrimitive(final Class<?>[] classes) {
final int length = (classes == null) ? 0 : classes.length;
final Class[] types = new Class[length];
for (int index = 0; index < length; ++index) {
types[index] = getPrimitive(classes[index]);
}
return (Class<?>[])types;
}
public static Class<?>[] getReference(final Class<?>[] classes) {
final int length = (classes == null) ? 0 : classes.length;
final Class[] types = new Class[length];
for (int index = 0; index < length; ++index) {
types[index] = getReference(classes[index]);
}
return (Class<?>[])types;
}
public static Class<?>[] getPrimitive(final Object[] objects) {
final int length = (objects == null) ? 0 : objects.length;
final Class[] types = new Class[length];
for (int index = 0; index < length; ++index) {
types[index] = getPrimitive(objects[index].getClass());
}
return (Class<?>[])types;
}
public static Class<?>[] getReference(final Object[] objects) {
final int length = (objects == null) ? 0 : objects.length;
final Class[] types = new Class[length];
for (int index = 0; index < length; ++index) {
types[index] = getReference(objects[index].getClass());
}
return (Class<?>[])types;
}
public static boolean compare(final Class<?>[] primary, final Class<?>[] secondary) {
if (primary == null || secondary == null || primary.length != secondary.length) {
return false;
}
for (int index = 0; index < primary.length; ++index) {
final Class<?> primaryClass = primary[index];
final Class<?> secondaryClass = secondary[index];
if (!primaryClass.equals(secondaryClass) && !primaryClass.isAssignableFrom(secondaryClass)) {
return false;
}
}
return true;
}
}
public enum PackageType
{
MINECRAFT_SERVER("MINECRAFT_SERVER", 0, "net.minecraft.server." + getServerVersion()),
CRAFTBUKKIT("CRAFTBUKKIT", 1, "org.bukkit.craftbukkit." + getServerVersion()),
CRAFTBUKKIT_BLOCK("CRAFTBUKKIT_BLOCK", 2, PackageType.CRAFTBUKKIT, "block"),
CRAFTBUKKIT_CHUNKIO("CRAFTBUKKIT_CHUNKIO", 3, PackageType.CRAFTBUKKIT, "chunkio"),
CRAFTBUKKIT_COMMAND("CRAFTBUKKIT_COMMAND", 4, PackageType.CRAFTBUKKIT, "command"),
CRAFTBUKKIT_CONVERSATIONS("CRAFTBUKKIT_CONVERSATIONS", 5, PackageType.CRAFTBUKKIT, "conversations"),
CRAFTBUKKIT_ENCHANTMENS("CRAFTBUKKIT_ENCHANTMENS", 6, PackageType.CRAFTBUKKIT, "enchantments"),
CRAFTBUKKIT_ENTITY("CRAFTBUKKIT_ENTITY", 7, PackageType.CRAFTBUKKIT, "entity"),
CRAFTBUKKIT_EVENT("CRAFTBUKKIT_EVENT", 8, PackageType.CRAFTBUKKIT, "event"),
CRAFTBUKKIT_GENERATOR("CRAFTBUKKIT_GENERATOR", 9, PackageType.CRAFTBUKKIT, "generator"),
CRAFTBUKKIT_HELP("CRAFTBUKKIT_HELP", 10, PackageType.CRAFTBUKKIT, "help"),
CRAFTBUKKIT_INVENTORY("CRAFTBUKKIT_INVENTORY", 11, PackageType.CRAFTBUKKIT, "inventory"),
CRAFTBUKKIT_MAP("CRAFTBUKKIT_MAP", 12, PackageType.CRAFTBUKKIT, "map"),
CRAFTBUKKIT_METADATA("CRAFTBUKKIT_METADATA", 13, PackageType.CRAFTBUKKIT, "metadata"),
CRAFTBUKKIT_POTION("CRAFTBUKKIT_POTION", 14, PackageType.CRAFTBUKKIT, "potion"),
CRAFTBUKKIT_PROJECTILES("CRAFTBUKKIT_PROJECTILES", 15, PackageType.CRAFTBUKKIT, "projectiles"),
CRAFTBUKKIT_SCHEDULER("CRAFTBUKKIT_SCHEDULER", 16, PackageType.CRAFTBUKKIT, "scheduler"),
CRAFTBUKKIT_SCOREBOARD("CRAFTBUKKIT_SCOREBOARD", 17, PackageType.CRAFTBUKKIT, "scoreboard"),
CRAFTBUKKIT_UPDATER("CRAFTBUKKIT_UPDATER", 18, PackageType.CRAFTBUKKIT, "updater"),
CRAFTBUKKIT_UTIL("CRAFTBUKKIT_UTIL", 19, PackageType.CRAFTBUKKIT, "util");
private final String path;
private PackageType(final String s, final int n, final String path) {
this.path = path;
}
private PackageType(final String s, final int n, final PackageType parent, final String path) {
this(s, n, parent + "." + path);
}
public String getPath() {
return this.path;
}
public Class<?> getClass(final String className) throws ClassNotFoundException {
return Class.forName(this + "." + className);
}
@Override
public String toString() {
return this.path;
}
public static String getServerVersion() {
return Bukkit.getServer().getClass().getPackage().getName().substring(23);
}
}
}

View File

@ -0,0 +1,17 @@
package com.prevailpots.bunkers.utils;
import com.prevailpots.bunkers.config.*;
import com.prevailpots.bunkers.game.*;
import com.sk89q.worldedit.bukkit.selections.*;
import org.bukkit.*;
public class RegionUtils
{
public static CuboidSelection getSelectionFromRegion(final World w, final Team team) {
final Location p1 = new Location(w, ConfigurationService.getRegions(team)[0].getX(), 0.0, ConfigurationService.getRegions(team)[0].getZ());
final Location p2 = new Location(w, ConfigurationService.getRegions(team)[1].getX(), 255.0, ConfigurationService.getRegions(team)[1].getZ());
final CuboidSelection sel = new CuboidSelection(w, p1, p2);
return sel;
}
}

View File

@ -0,0 +1,43 @@
package com.prevailpots.bunkers.world;
import org.bukkit.configuration.file.*;
import java.io.*;
public class ConfigManager
{
String path;
String plugin;
File Data;
FileConfiguration DataFile;
public ConfigManager(final String plugin, final String path) {
this.path = null;
this.plugin = null;
this.path = path;
this.plugin = plugin;
this.Data = new File("plugins/" + plugin + "/" + path + ".yml");
this.DataFile = (FileConfiguration)YamlConfiguration.loadConfiguration(this.Data);
}
public void createFile() {
try {
this.Data.createNewFile();
}
catch (IOException e) {
e.printStackTrace();
}
}
public FileConfiguration getFile() {
return this.DataFile;
}
public void saveFile() {
try {
this.getFile().save(this.Data);
}
catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,62 @@
package com.prevailpots.bunkers.world;
import org.bukkit.*;
import java.util.*;
import java.io.*;
public class WorldManager
{
public void unloadWorld(final World world) {
if (!world.equals(null)) {
Bukkit.getServer().unloadWorld(world, true);
}
}
public boolean deleteWorld(final File path) {
if (path.exists()) {
final File[] files = path.listFiles();
for (int i = 0; i < files.length; ++i) {
if (files[i].isDirectory()) {
this.deleteWorld(files[i]);
}
else {
files[i].delete();
}
}
}
return path.delete();
}
public void copyWorld(final File source, final File target) {
try {
final ArrayList<String> ignore = new ArrayList<String>(Arrays.asList("uid.dat", "session.lock"));
if (!ignore.contains(source.getName())) {
if (source.isDirectory()) {
if (!target.exists()) {
target.mkdirs();
}
final String[] files = source.list();
String[] array;
for (int length2 = (array = files).length, i = 0; i < length2; ++i) {
final String file = array[i];
final File srcFile = new File(source, file);
final File destFile = new File(target, file);
this.copyWorld(srcFile, destFile);
}
}
else {
final InputStream in = new FileInputStream(source);
final OutputStream out = new FileOutputStream(target);
final byte[] buffer = new byte[1024];
int length;
while ((length = in.read(buffer)) > 0) {
out.write(buffer, 0, length);
}
in.close();
out.close();
}
}
}
catch (IOException ex) {}
}
}

View File

@ -0,0 +1,22 @@
package me.vertises.aztec.tablist;
import org.bukkit.entity.Player;
import me.vertises.aztec.tablist.reflection.ReflectionConstants;
public enum ClientVersion {
v1_7, v1_8;
public static ClientVersion getVersion(Player player) {
Object handle = ReflectionConstants.GET_HANDLE_METHOD.invoke(player);
Object connection = ReflectionConstants.PLAYER_CONNECTION.get(handle);
Object manager = ReflectionConstants.NETWORK_MANAGER.get(connection);
Object version = ReflectionConstants.VERSION_METHOD.invoke(manager);
if (version instanceof Integer) {
return (int) version > 5 ? v1_8 : v1_7;
}
return v1_7;
}
}

View File

@ -0,0 +1,404 @@
package me.vertises.aztec.tablist;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.bukkit.Bukkit;
/**
* An utility class that simplifies reflection in Bukkit plugins.
*
* @author Kristian
*/
public final class Reflection {
/**
* An interface for invoking a specific constructor.
*/
public interface ConstructorInvoker {
/**
* Invoke a constructor for a specific class.
*
* @param arguments - the arguments to pass to the constructor.
* @return The constructed object.
*/
public Object invoke(Object... arguments);
}
/**
* An interface for invoking a specific method.
*/
public interface MethodInvoker {
/**
* Invoke a method on a specific target object.
*
* @param target - the target object, or NULL for a static method.
* @param arguments - the arguments to pass to the method.
* @return The return value, or NULL if is void.
*/
public Object invoke(Object target, Object... arguments);
}
/**
* An interface for retrieving the field content.
*
* @param <T> - field type.
*/
public interface FieldAccessor<T> {
/**
* Retrieve the content of a field.
*
* @param target - the target object, or NULL for a static field.
* @return The value of the field.
*/
public T get(Object target);
/**
* Set the content of a field.
*
* @param target - the target object, or NULL for a static field.
* @param value - the new value of the field.
*/
public void set(Object target, Object value);
/**
* Determine if the given object has this field.
*
* @param target - the object to test.
* @return TRUE if it does, FALSE otherwise.
*/
public boolean hasField(Object target);
}
// Deduce the net.minecraft.server.v* package
private static String OBC_PREFIX = Bukkit.getServer().getClass().getPackage().getName();
private static String NMS_PREFIX = OBC_PREFIX.replace("org.bukkit.craftbukkit", "net.minecraft.server");
private static String VERSION = OBC_PREFIX.replace("org.bukkit.craftbukkit", "").replace(".", "");
// Variable replacement
private static Pattern MATCH_VARIABLE = Pattern.compile("\\{([^\\}]+)\\}");
private Reflection() {
// Seal class
}
/**
* Retrieve a field accessor for a specific field type and name.
*
* @param target - the target type.
* @param name - the name of the field, or NULL to ignore.
* @param fieldType - a compatible field type.
* @return The field accessor.
*/
public static <T> FieldAccessor<T> getField(Class<?> target, String name, Class<T> fieldType) {
return getField(target, name, fieldType, 0);
}
/**
* Retrieve a field accessor for a specific field type and name.
*
* @param className - lookup name of the class, see {@link #getClass(String)}.
* @param name - the name of the field, or NULL to ignore.
* @param fieldType - a compatible field type.
* @return The field accessor.
*/
public static <T> FieldAccessor<T> getField(String className, String name, Class<T> fieldType) {
return getField(getClass(className), name, fieldType, 0);
}
/**
* Retrieve a field accessor for a specific field type and name.
*
* @param target - the target type.
* @param fieldType - a compatible field type.
* @param index - the number of compatible fields to skip.
* @return The field accessor.
*/
public static <T> FieldAccessor<T> getField(Class<?> target, Class<T> fieldType, int index) {
return getField(target, null, fieldType, index);
}
/**
* Retrieve a field accessor for a specific field type and name.
*
* @param className - lookup name of the class, see {@link #getClass(String)}.
* @param fieldType - a compatible field type.
* @param index - the number of compatible fields to skip.
* @return The field accessor.
*/
public static <T> FieldAccessor<T> getField(String className, Class<T> fieldType, int index) {
return getField(getClass(className), fieldType, index);
}
// Common method
private static <T> FieldAccessor<T> getField(Class<?> target, String name, Class<T> fieldType, int index) {
for (final Field field : target.getDeclaredFields()) {
if ((name == null || field.getName().equals(name)) && fieldType.isAssignableFrom(field.getType()) && index-- <= 0) {
field.setAccessible(true);
// A function for retrieving a specific field value
return new FieldAccessor<T>() {
@Override
@SuppressWarnings("unchecked")
public T get(Object target) {
try {
return (T) field.get(target);
} catch (IllegalAccessException e) {
throw new RuntimeException("Cannot access reflection.", e);
}
}
@Override
public void set(Object target, Object value) {
try {
field.set(target, value);
} catch (IllegalAccessException e) {
throw new RuntimeException("Cannot access reflection.", e);
}
}
@Override
public boolean hasField(Object target) {
// target instanceof DeclaringClass
return field.getDeclaringClass().isAssignableFrom(target.getClass());
}
};
}
}
// Search in parent classes
if (target.getSuperclass() != null)
return getField(target.getSuperclass(), name, fieldType, index);
throw new IllegalArgumentException("Cannot find field with type " + fieldType);
}
/**
* Search for the first publically and privately defined method of the given name and parameter count.
*
* @param className - lookup name of the class, see {@link #getClass(String)}.
* @param methodName - the method name, or NULL to skip.
* @param params - the expected parameters.
* @return An object that invokes this specific method.
* @throws IllegalStateException If we cannot find this method.
*/
public static MethodInvoker getMethod(String className, String methodName, Class<?>... params) {
return getTypedMethod(getClass(className), methodName, null, params);
}
/**
* Search for the first publically and privately defined method of the given name and parameter count.
*
* @param clazz - a class to start with.
* @param methodName - the method name, or NULL to skip.
* @param params - the expected parameters.
* @return An object that invokes this specific method.
* @throws IllegalStateException If we cannot find this method.
*/
public static MethodInvoker getMethod(Class<?> clazz, String methodName, Class<?>... params) {
return getTypedMethod(clazz, methodName, null, params);
}
/**
* Search for the first publically and privately defined method of the given name and parameter count.
*
* @param clazz - a class to start with.
* @param methodName - the method name, or NULL to skip.
* @param returnType - the expected return type, or NULL to ignore.
* @param params - the expected parameters.
* @return An object that invokes this specific method.
* @throws IllegalStateException If we cannot find this method.
*/
public static MethodInvoker getTypedMethod(Class<?> clazz, String methodName, Class<?> returnType, Class<?>... params) {
for (final Method method : clazz.getDeclaredMethods()) {
if ((methodName == null || method.getName().equals(methodName))
&& (returnType == null || method.getReturnType().equals(returnType))
&& Arrays.equals(method.getParameterTypes(), params)) {
method.setAccessible(true);
return new MethodInvoker() {
@Override
public Object invoke(Object target, Object... arguments) {
try {
return method.invoke(target, arguments);
} catch (Exception e) {
throw new RuntimeException("Cannot invoke method " + method, e);
}
}
};
}
}
// Search in every superclass
if (clazz.getSuperclass() != null)
return getMethod(clazz.getSuperclass(), methodName, params);
throw new IllegalStateException(String.format("Unable to find method %s (%s).", methodName, Arrays.asList(params)));
}
/**
* Search for the first publically and privately defined constructor of the given name and parameter count.
*
* @param className - lookup name of the class, see {@link #getClass(String)}.
* @param params - the expected parameters.
* @return An object that invokes this constructor.
* @throws IllegalStateException If we cannot find this method.
*/
public static ConstructorInvoker getConstructor(String className, Class<?>... params) {
return getConstructor(getClass(className), params);
}
/**
* Search for the first publically and privately defined constructor of the given name and parameter count.
*
* @param clazz - a class to start with.
* @param params - the expected parameters.
* @return An object that invokes this constructor.
* @throws IllegalStateException If we cannot find this method.
*/
public static ConstructorInvoker getConstructor(Class<?> clazz, Class<?>... params) {
for (final Constructor<?> constructor : clazz.getDeclaredConstructors()) {
if (Arrays.equals(constructor.getParameterTypes(), params)) {
constructor.setAccessible(true);
return new ConstructorInvoker() {
@Override
public Object invoke(Object... arguments) {
try {
return constructor.newInstance(arguments);
} catch (Exception e) {
throw new RuntimeException("Cannot invoke constructor " + constructor, e);
}
}
};
}
}
throw new IllegalStateException(String.format("Unable to find constructor for %s (%s).", clazz, Arrays.asList(params)));
}
/**
* Retrieve a class from its full name, without knowing its type on compile time.
* <p>
* This is useful when looking up fields by a NMS or OBC type.
* <p>
*
* @see {@link #getClass()} for more information.
* @param lookupName - the class name with variables.
* @return The class.
*/
public static Class<Object> getUntypedClass(String lookupName) {
@SuppressWarnings({ "rawtypes", "unchecked" })
Class<Object> clazz = (Class) getClass(lookupName);
return clazz;
}
/**
* Retrieve a class from its full name.
* <p>
* Strings enclosed with curly brackets - such as {TEXT} - will be replaced according to the following table:
* <p>
* <table border="1">
* <tr>
* <th>Variable</th>
* <th>Content</th>
* </tr>
* <tr>
* <td>{nms}</td>
* <td>Actual package name of net.minecraft.server.VERSION</td>
* </tr>
* <tr>
* <td>{obc}</td>
* <td>Actual pacakge name of org.bukkit.craftbukkit.VERSION</td>
* </tr>
* <tr>
* <td>{version}</td>
* <td>The current Minecraft package VERSION, if any.</td>
* </tr>
* </table>
*
* @param lookupName - the class name with variables.
* @return The looked up class.
* @throws IllegalArgumentException If a variable or class could not be found.
*/
public static Class<?> getClass(String lookupName) {
return getCanonicalClass(expandVariables(lookupName));
}
/**
* Retrieve a class in the net.minecraft.server.VERSION.* package.
*
* @param name - the name of the class, excluding the package.
* @throws IllegalArgumentException If the class doesn't exist.
*/
public static Class<?> getMinecraftClass(String name) {
return getCanonicalClass(NMS_PREFIX + "." + name);
}
/**
* Retrieve a class in the org.bukkit.craftbukkit.VERSION.* package.
*
* @param name - the name of the class, excluding the package.
* @throws IllegalArgumentException If the class doesn't exist.
*/
public static Class<?> getCraftBukkitClass(String name) {
return getCanonicalClass(OBC_PREFIX + "." + name);
}
/**
* Retrieve a class by its canonical name.
*
* @param canonicalName - the canonical name.
* @return The class.
*/
private static Class<?> getCanonicalClass(String canonicalName) {
try {
return Class.forName(canonicalName);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Cannot find " + canonicalName, e);
}
}
/**
* Expand variables such as "{nms}" and "{obc}" to their corresponding packages.
*
* @param name - the full name of the class.
* @return The expanded string.
*/
private static String expandVariables(String name) {
StringBuffer output = new StringBuffer();
Matcher matcher = MATCH_VARIABLE.matcher(name);
while (matcher.find()) {
String variable = matcher.group(1);
String replacement = "";
// Expand all detected variables
if ("nms".equalsIgnoreCase(variable))
replacement = NMS_PREFIX;
else if ("obc".equalsIgnoreCase(variable))
replacement = OBC_PREFIX;
else if ("version".equalsIgnoreCase(variable))
replacement = VERSION;
else
throw new IllegalArgumentException("Unknown variable: " + variable);
// Assume the expanded variables are all packages, and append a dot
if (replacement.length() > 0 && matcher.end() < name.length() && name.charAt(matcher.end()) != '.')
replacement += ".";
matcher.appendReplacement(output, Matcher.quoteReplacement(replacement));
}
matcher.appendTail(output);
return output.toString();
}
}

View File

@ -0,0 +1,189 @@
package me.vertises.aztec.tablist;
import java.util.Arrays;
import java.util.UUID;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.Team;
import org.spigotmc.ProtocolInjector;
import com.google.common.collect.Table;
import lombok.Getter;
import me.vertises.aztec.tablist.reflection.ReflectionConstants;
import net.minecraft.server.v1_7_R4.ChatSerializer;
public class Tablist {
public static final Object[] GAME_PROFILES;
public static final String[] TAB_NAMES;
public static String[] BLANK_SKIN = {"eyJ0aW1lc3RhbXAiOjE0MTEyNjg3OTI3NjUsInByb2ZpbGVJZCI6IjNmYmVjN2RkMGE1ZjQwYmY5ZDExODg1YTU0NTA3MTEyIiwicHJvZmlsZU5hbWUiOiJsYXN0X3VzZXJuYW1lIiwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzg0N2I1Mjc5OTg0NjUxNTRhZDZjMjM4YTFlM2MyZGQzZTMyOTY1MzUyZTNhNjRmMzZlMTZhOTQwNWFiOCJ9fX0=", "u8sG8tlbmiekrfAdQjy4nXIcCfNdnUZzXSx9BE1X5K27NiUvE1dDNIeBBSPdZzQG1kHGijuokuHPdNi/KXHZkQM7OJ4aCu5JiUoOY28uz3wZhW4D+KG3dH4ei5ww2KwvjcqVL7LFKfr/ONU5Hvi7MIIty1eKpoGDYpWj3WjnbN4ye5Zo88I2ZEkP1wBw2eDDN4P3YEDYTumQndcbXFPuRRTntoGdZq3N5EBKfDZxlw4L3pgkcSLU5rWkd5UH4ZUOHAP/VaJ04mpFLsFXzzdU4xNZ5fthCwxwVBNLtHRWO26k/qcVBzvEXtKGFJmxfLGCzXScET/OjUBak/JEkkRG2m+kpmBMgFRNtjyZgQ1w08U6HHnLTiAiio3JswPlW5v56pGWRHQT5XWSkfnrXDalxtSmPnB5LmacpIImKgL8V9wLnWvBzI7SHjlyQbbgd+kUOkLlu7+717ySDEJwsFJekfuR6N/rpcYgNZYrxDwe4w57uDPlwNL6cJPfNUHV7WEbIU1pMgxsxaXe8WSvV87qLsR7H06xocl2C0JFfe2jZR4Zh3k9xzEnfCeFKBgGb4lrOWBu1eDWYgtKV67M2Y+B3W5pjuAjwAxn0waODtEn/3jKPbc/sxbPvljUCw65X+ok0UUN1eOwXV5l2EGzn05t3Yhwq19/GxARg63ISGE8CKw="};
@Getter
private final ClientVersion version;
@Getter
private final Player player;
@Getter
private boolean initiated;
private Scoreboard scoreboard;
public Tablist(Player player) {
this.player = player;
this.version = ClientVersion.getVersion(player);
Scoreboard scoreboard = player.getScoreboard();
if (scoreboard == Bukkit.getScoreboardManager().getMainScoreboard()) {
scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
}
player.setScoreboard(scoreboard);
this.scoreboard = scoreboard;
addFakePlayers();
update();
}
public void sendPacket(Player player, Object packet) {
Object handle = ReflectionConstants.GET_HANDLE_METHOD.invoke(player);
Object connection = ReflectionConstants.PLAYER_CONNECTION.get(handle);
ReflectionConstants.SEND_PACKET.invoke(connection, packet);
}
public Tablist update() {
TablistManager manager = TablistManager.INSTANCE;
if (!initiated || manager == null) return this;
Table<Integer, Integer, String> entries = manager.getSupplier().getEntries(player);
boolean useProfiles = version.ordinal() != 0;
int magic = useProfiles ? 4 : 3;
if (useProfiles) {
String header = manager.getSupplier().getHeader(player);
if (header == null) {
header = "";
}
String footer = manager.getSupplier().getFooter(player);
if (footer == null) {
footer = "";
}
ProtocolInjector.PacketTabHeader packet = new ProtocolInjector.PacketTabHeader(ChatSerializer.a("{text:\"" + StringEscapeUtils.escapeJava(header) + "\"}"), ChatSerializer.a("{text:\"" + StringEscapeUtils.escapeJava(footer) + "\"}"));
sendPacket(player, packet);
}
for (int i = 0; i < (magic * 20); i ++) {
int x = i % magic;
int y = i / magic;
String text = entries.get(x, y);
if (text == null) {
text = "";
}
String name = TAB_NAMES[i];
Team team = scoreboard.getTeam(name);
if (team == null) {
team = scoreboard.registerNewTeam(name);
}
if (!team.hasEntry(name)) {
team.addEntry(name);
}
String prefix = "", suffix = "";
if (text.length() < 17) {
prefix = text;
} else {
String left = text.substring(0, 16), right = text.substring(16, text.length());
if (left.endsWith("§")) {
left = left.substring(0, left.length() - 1);
right = "§" + right;
}
String last = ChatColor.getLastColors(left);
right = last + right;
prefix = left;
suffix = StringUtils.left(right, 16);
}
team.setPrefix(prefix);
team.setSuffix(suffix);
}
return this;
}
public Tablist hideRealPlayers() {
if (!initiated) return this;
boolean useProfiles = version.ordinal() != 0;
Bukkit.getOnlinePlayers().forEach(other -> {
if (!player.canSee(other)) return;
Object packet = ReflectionConstants.TAB_PACKET_CONSTRUCTOR.invoke();
if (useProfiles) {
Object profile = ReflectionConstants.GET_PROFILE_METHOD.invoke(other);
ReflectionConstants.TAB_PACKET_PROFILE.set(packet, profile);
} else {
ReflectionConstants.TAB_PACKET_NAME.set(packet, other.getName());
}
ReflectionConstants.TAB_PACKET_ACTION.set(packet, 4);
sendPacket(player, packet);
});
return this;
}
public Tablist hideFakePlayers() {
if (!initiated) return this;
boolean useProfiles = version.ordinal() != 0;
Arrays.stream(GAME_PROFILES).forEach(other -> {
Object packet = ReflectionConstants.TAB_PACKET_CONSTRUCTOR.invoke();
if (useProfiles) {
ReflectionConstants.TAB_PACKET_PROFILE.set(packet, other);
} else {
String name = ReflectionConstants.GAME_PROFILE_NAME.get(other);
ReflectionConstants.TAB_PACKET_NAME.set(packet, name);
}
ReflectionConstants.TAB_PACKET_ACTION.set(packet, 4);
sendPacket(player, packet);
});
return this;
}
public Tablist addFakePlayers() {
if (initiated) return this;
boolean useProfiles = version.ordinal() != 0;
int magic = useProfiles ? 4 : 3;
for (int i = 0; i < (magic * 20); i ++) {
int x = i % magic;
int y = i / magic;
Object packet = ReflectionConstants.TAB_PACKET_CONSTRUCTOR.invoke();
Object profile = GAME_PROFILES[i];
if (useProfiles) {
ReflectionConstants.TAB_PACKET_PROFILE.set(packet, profile);
} else {
String name = ReflectionConstants.GAME_PROFILE_NAME.get(profile);
ReflectionConstants.TAB_PACKET_NAME.set(packet, name);
}
ReflectionConstants.TAB_PACKET_ACTION.set(packet, 0);
sendPacket(player, packet);
}
initiated = true;
return this;
}
public void clear() {
player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
scoreboard.getTeams().forEach(team -> team.unregister());
scoreboard = null;
System.gc();
}
static {
GAME_PROFILES = new Object[80];
TAB_NAMES = new String[80];
for (int i = 0; i < 80; i ++) {
int x = i % 4;
int y = i / 4;
String name = (x > 9 ? ("§" + String.valueOf(x).toCharArray()[0] + "§" + String.valueOf(x).toCharArray()[1]) : "§0§" + x) + (y > 9 ? ("§" + String.valueOf(y).toCharArray()[0] + "§" + String.valueOf(y).toCharArray()[1]) : "§0§" + String.valueOf(y).toCharArray()[0]);
UUID id = UUID.randomUUID();
Object profile = ReflectionConstants.GAME_PROFILE_CONSTRUCTOR.invoke(id, name);
TAB_NAMES[i] = name;
GAME_PROFILES[i] = profile;
}
}
}

View File

@ -0,0 +1,15 @@
package me.vertises.aztec.tablist;
import org.bukkit.entity.Player;
import com.google.common.collect.Table;
public interface TablistEntrySupplier {
Table<Integer, Integer, String> getEntries(Player player);
String getHeader(Player player);
String getFooter(Player player);
}

View File

@ -0,0 +1,124 @@
package me.vertises.aztec.tablist;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.plugin.java.JavaPlugin;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
public class TablistManager implements Listener {
public static TablistManager INSTANCE;
@Getter
private final JavaPlugin plugin;
private final Map<UUID, Tablist> tablists;
@Setter @NonNull @Getter
private TablistEntrySupplier supplier;
private int updateTaskId = -1;
public TablistManager(@NonNull JavaPlugin plugin, @NonNull TablistEntrySupplier supplier, long updateTime) {
boolean startUpdater = true;
if (TablistManager.INSTANCE != null) {
for (int i = 0; i < 7; i ++) {
Bukkit.getLogger().warning("");
}
Bukkit.getLogger().warning("WARNING! AN INSTANCE OF TABLISTMANAGER ALREADY EXISTS!");
Bukkit.getLogger().warning("IT IS RECOMMENDED TO ONLY USE ONE OTHERWISE IT CAN CAUSE FLICKERING AND OTHER ISSUES!");
for (int i = 0; i < 7; i ++) {
Bukkit.getLogger().warning("");
}
}
updateTime: {
long remainder = updateTime % 50l;
if (remainder != 0l) {
updateTime = updateTime - remainder;
Bukkit.getLogger().info("FIXING UPDATE TIME TO VALID TICK-COUNT...");
}
break updateTime;
}
if (updateTime < 50l) {
startUpdater = false;
for (int i = 0; i < 7; i ++) {
Bukkit.getLogger().warning("");
}
Bukkit.getLogger().warning("WARNING! TABLIST UPDATE TASK NOT STARTED!");
Bukkit.getLogger().warning("REASON: UPDATE TIME IS TOO SHORT.");
for (int i = 0; i < 7; i ++) {
Bukkit.getLogger().warning("");
}
}
TablistManager.INSTANCE = this;
this.tablists = new ConcurrentHashMap<>();
this.supplier = supplier;
this.plugin = plugin;
if (startUpdater) {
updateTaskId = Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new TablistUpdateTask(), updateTime / 50, updateTime / 50).getTaskId();
}
Bukkit.getPluginManager().registerEvents(this, plugin);
Bukkit.getOnlinePlayers().forEach(player -> {
getTablist(player, true);
});
}
@Deprecated
public Tablist getTablist(Player player) {
return getTablist(player, false);
}
@Deprecated
public Tablist getTablist(Player player, boolean create) {
UUID uniqueId = player.getUniqueId();
Tablist tablist = tablists.get(uniqueId);
if (tablist == null && create) {
tablists.put(uniqueId, tablist = new Tablist(player));
}
return tablist;
}
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
Tablist tablist = getTablist(player, true);
}
@EventHandler
public void onDisable(PluginDisableEvent event) {
if (event.getPlugin() == plugin) {
tablists.forEach((id, tablist) -> {
tablist.hideFakePlayers().clear();
});
tablists.clear();
HandlerList.unregisterAll(this);
if (updateTaskId != -1) {
Bukkit.getScheduler().cancelTask(updateTaskId);
}
}
}
@EventHandler
public void onQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
UUID uniqueId = player.getUniqueId();
Tablist tablist;
if ((tablist = tablists.remove(uniqueId)) != null) {
tablist.hideFakePlayers().clear();
}
}
}

View File

@ -0,0 +1,20 @@
package me.vertises.aztec.tablist;
import org.bukkit.Bukkit;
public class TablistUpdateTask implements Runnable {
@Override
public void run() {
TablistManager manager = TablistManager.INSTANCE;
if (manager == null) return;
Bukkit.getOnlinePlayers().forEach(player -> {
Tablist tablist = manager.getTablist(player);
if (tablist != null) {
tablist.hideRealPlayers().update();
}
});
}
}

View File

@ -0,0 +1,38 @@
package me.vertises.aztec.tablist.example;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import me.vertises.aztec.tablist.TablistEntrySupplier;
import net.md_5.bungee.api.ChatColor;
public class ExampleSupplier implements TablistEntrySupplier {
@Override
public Table<Integer, Integer, String> getEntries(Player player) {
Table<Integer, Integer, String> table = HashBasedTable.create();
table.put(1, 0, ChatColor.AQUA + "Prevail" + ChatColor.GRAY + " [Bunkers]");
table.put(1, 2, ChatColor.AQUA + "Bunkers:" + ChatColor.GRAY + " [Offline]");
table.put(1, 3, ChatColor.AQUA + "HCFactions:" + ChatColor.GRAY + " [Offline]");
table.put(1, 4, ChatColor.AQUA + "Practice:" + ChatColor.GRAY + " [Offline]");
return table;
}
@Override
public String getHeader(Player player) {
return "Godly header";
}
@Override
public String getFooter(Player player) {
return "Godly footer";
}
}

View File

@ -0,0 +1,16 @@
package me.vertises.aztec.tablist.example;
import java.util.concurrent.TimeUnit;
import org.bukkit.plugin.java.JavaPlugin;
import me.vertises.aztec.tablist.TablistManager;
public class TablistPlugin extends JavaPlugin {
@Override
public void onEnable() {
new TablistManager(this, new ExampleSupplier(), TimeUnit.SECONDS.toMillis(5l));
}
}

View File

@ -0,0 +1,54 @@
package me.vertises.aztec.tablist.reflection;
import java.util.Map;
import java.util.UUID;
import net.minecraft.server.v1_7_R4.EnumProtocol;
import me.vertises.aztec.tablist.*;
public class ReflectionConstants {
//base tablist
public static final Class<?> TAB_PACKET_CLASS = Reflection.getMinecraftClass("PacketPlayOutPlayerInfo");
public static final Reflection.ConstructorInvoker TAB_PACKET_CONSTRUCTOR = Reflection.getConstructor(TAB_PACKET_CLASS);
public static final Reflection.FieldAccessor<Integer> TAB_PACKET_ACTION = Reflection.getField(TAB_PACKET_CLASS, int.class, 5);
//1.7 tablist
public static final Reflection.FieldAccessor<String> TAB_PACKET_NAME = Reflection.getField(TAB_PACKET_CLASS, String.class, 0);
//1.8 tablist
public static final Class<Object> GAME_PROFILE_CLASS = getUntypedClasses("net.minecraft.util.com.mojang.authlib.GameProfile", "com.mojang.authlib.GameProfile");
public static final Reflection.ConstructorInvoker GAME_PROFILE_CONSTRUCTOR = Reflection.getConstructor(GAME_PROFILE_CLASS, UUID.class, String.class);
public static final Reflection.FieldAccessor<String> GAME_PROFILE_NAME = Reflection.getField(GAME_PROFILE_CLASS, String.class, 0);
public static final Reflection.FieldAccessor<Object> TAB_PACKET_PROFILE = Reflection.getField(TAB_PACKET_CLASS, GAME_PROFILE_CLASS, 0);
//misc
public static final Class<?> CRAFT_PLAYER_CLASS = Reflection.getCraftBukkitClass("entity.CraftPlayer");
public static final Class<?> NMS_PACKET_CLASS = Reflection.getMinecraftClass("Packet");
public static final Class<?> NMS_PLAYER_CLASS = Reflection.getMinecraftClass("EntityPlayer");
public static final Class<?> PLAYER_CONNECTION_CLASS = Reflection.getMinecraftClass("PlayerConnection");
public static final Class<?> NETWORK_MANAGER_CLASS = Reflection.getMinecraftClass("NetworkManager");
public static final Reflection.MethodInvoker GET_HANDLE_METHOD = Reflection.getMethod(CRAFT_PLAYER_CLASS, "getHandle");
public static final Reflection.MethodInvoker GET_PROFILE_METHOD = Reflection.getMethod(CRAFT_PLAYER_CLASS, "getProfile");
public static final Reflection.MethodInvoker VERSION_METHOD = Reflection.getMethod(NETWORK_MANAGER_CLASS, "getVersion");
public static final Reflection.MethodInvoker SEND_PACKET = Reflection.getMethod(PLAYER_CONNECTION_CLASS, "sendPacket", NMS_PACKET_CLASS);
public static final Reflection.FieldAccessor<?> PLAYER_CONNECTION = Reflection.getField(NMS_PLAYER_CLASS, PLAYER_CONNECTION_CLASS, 0);
public static final Reflection.FieldAccessor<?> NETWORK_MANAGER = Reflection.getField(PLAYER_CONNECTION_CLASS, NETWORK_MANAGER_CLASS, 0);
//packet registry
public static final Class<?> ENUM_PROTOCOL_CLASS = Reflection.getMinecraftClass("EnumProtocol");
public static final Reflection.FieldAccessor<?> ENUM_PROTOCOL_PLAY = Reflection.getField(ENUM_PROTOCOL_CLASS, ENUM_PROTOCOL_CLASS, 1);
public static final Reflection.FieldAccessor<Map> ENUM_PROTOCOL_REGISTRY = Reflection.getField(ENUM_PROTOCOL_CLASS, Map.class, 0);
public static Class<Object> getUntypedClasses(String ...lookupNames) {
EnumProtocol.class.getName();
for (String lookupName : lookupNames) {
try {
return Reflection.getUntypedClass(lookupName);
} catch (IllegalArgumentException e) {
continue;
}
}
throw new IllegalArgumentException("No class found in selection given");
}
}

View File

@ -0,0 +1,19 @@
name: PrevailBunkers
main: com.prevailpots.bunkers.Core
author: s3ries
version: 1
dependencies: [WorldEdit, PermissionsEx]
commands:
setlobbyspawn:
description: 'Sets the lobby spawn.'
aliases: [sls]
usage: '/setlobbyspawn'
team:
description: 'Team command.'
aliases: [f, t]
usage: '/team <args> <team>'
forcestart:
description: 'Starts game no matter what (Might be unsafe).'
aliases: [fs]
usage: '/forcestart'
removetab:

View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: com.prevailpots.bunkers.Core

Some files were not shown because too many files have changed in this diff Show More