Version 0.0.2

- Added smoke particles to fallen trees
- Integrated all the config checks
- Added more classes to give the codebase more structure
- Added a number of config options
- Added some safeguards for the falling blocks
- Added all the necessary loot
- Added permission nodes
- Added custom tree falling sounds
- Converted the animation from single-phase to 2-phase, trees now slowly tip over and then pick up speed
- Added various sapling spreading mechanics
- Added damage to entities caught in the tree falling
- Added silk touch compatibility
- Added creative mode filter, doesn't affect players in creative mode
- Added per-world filter
- Started adding reload command, not currently functional due to bad configuration file reloading
- Added axe filter, only applies effect to players wielding axes
- Tweaked the search pyramid to better fit various trees generated by minecraft
This commit is contained in:
MagmaGuy 2018-11-05 04:15:18 +00:00
parent 40b399b0b8
commit 8a0f3ee107
30 changed files with 1215 additions and 553 deletions

View File

@ -6,8 +6,11 @@
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="epictimber" />
<module name="UltimateTimber" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="UltimateTimber" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
@ -9,6 +8,6 @@
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
<output url="file://$PROJECT_DIR$/classes" />
</component>
</project>

View File

@ -1,8 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="cbe80f75-e7d6-4435-840f-16565ab9cbd6" name="Default Changelist" comment="" />
<ignored path="$PROJECT_DIR$/out/" />
<list default="true" id="b5e32c07-ebf4-41aa-9c50-de0c623af54f" name="Default Changelist" comment="Version 0.0.1&#10;&#10;- Initial commit">
<change afterPath="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/commands/CommandHandler.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/commands/ReloadCommand.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/AxeDurability.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/EventFilter.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeChecker.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeEntityDamage.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeFallAnimation.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeFallEvent.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeLoot.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeReplant.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeSounds.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/compiler.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/DefaultConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/configurations/DefaultConfig.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/TreeFallHandler.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/UltimateTimber.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/UltimateTimber.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/plugin.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/plugin.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/EpicTimber.jar" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/com/songoda/epictimber/DefaultConfig.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/com/songoda/epictimber/EpicTimber.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/com/songoda/epictimber/TreeFallHandler$1.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/com/songoda/epictimber/TreeFallHandler$2.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/com/songoda/epictimber/TreeFallHandler.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/plugin.yml" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/plugin.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/maven-archiver/pom.properties" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst" beforeDir="false" afterPath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst" beforeDir="false" afterPath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/original-EpicTimber.jar" beforeDir="false" />
</list>
<ignored path="$PROJECT_DIR$/target/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@ -11,106 +40,151 @@
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FUSProjectUsageTrigger">
<session id="404641447">
<session id="-76130593">
<usages-collector id="statistics.lifecycle.project">
<counts>
<entry key="project.closed" value="2" />
<entry key="project.open.time.14" value="1" />
<entry key="project.open.time.5" value="1" />
<entry key="project.closed" value="1" />
<entry key="project.open.time.1" value="1" />
<entry key="project.open.time.4" value="1" />
<entry key="project.opened" value="2" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.open">
<counts>
<entry key="iml" value="1" />
<entry key="java" value="3" />
<entry key="yml" value="2" />
<entry key="class" value="1" />
<entry key="java" value="23" />
<entry key="xml" value="1" />
<entry key="yml" value="1" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.open">
<counts>
<entry key="IDEA_MODULE" value="1" />
<entry key="JAVA" value="3" />
<entry key="YAML" value="2" />
<entry key="CLASS" value="1" />
<entry key="JAVA" value="23" />
<entry key="XML" value="1" />
<entry key="YAML" value="1" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.edit">
<counts>
<entry key="java" value="6988" />
<entry key="txt" value="262" />
<entry key="xml" value="15" />
<entry key="yml" value="99" />
<entry key="java" value="7922" />
<entry key="txt" value="51" />
<entry key="yml" value="618" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.edit">
<counts>
<entry key="JAVA" value="6988" />
<entry key="PLAIN_TEXT" value="262" />
<entry key="XML" value="15" />
<entry key="YAML" value="99" />
<entry key="JAVA" value="7922" />
<entry key="PLAIN_TEXT" value="51" />
<entry key="YAML" value="618" />
</counts>
</usages-collector>
</session>
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/pom.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="96">
<caret line="6" column="23" selection-start-line="6" selection-start-column="23" selection-end-line="6" selection-end-column="23" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/epictimber/EpicTimber.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="448">
<caret line="28" column="35" selection-start-line="28" selection-start-column="35" selection-end-line="28" selection-end-column="35" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/epictimber/TreeFallHandler.java">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="31" lean-forward="true" selection-start-column="31" selection-end-column="31" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/resources/config.yml">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/epictimber/DefaultConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="576">
<caret line="36" selection-start-line="36" selection-end-line="36" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/resources/plugin.yml">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="16" selection-start-column="16" selection-end-column="16" />
</state>
</provider>
</entry>
</file>
</leaf>
<splitter split-orientation="horizontal" split-proportion="0.515656">
<split-first>
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/UltimateTimber.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-7">
<caret line="16" column="21" lean-forward="true" selection-start-line="16" selection-start-column="21" selection-end-line="16" selection-end-column="21" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/commands/CommandHandler.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="144">
<caret line="9" column="101" lean-forward="true" selection-start-line="9" selection-start-column="101" selection-end-line="9" selection-end-column="101" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/commands/ReloadCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="144">
<caret line="9" column="35" selection-start-line="9" selection-start-column="35" selection-end-line="9" selection-end-column="35" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeLoot.java">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="44" lean-forward="true" selection-start-column="44" selection-end-column="44" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeReplant.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1040">
<caret line="68" lean-forward="true" selection-start-line="68" selection-end-line="68" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</split-first>
<split-second>
<leaf>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/configurations/DefaultConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="15" column="30" selection-start-line="15" selection-start-column="30" selection-end-line="15" selection-end-column="30" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeSounds.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="288">
<caret line="18" column="103" selection-start-line="18" selection-start-column="103" selection-end-line="18" selection-end-column="103" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/resources/plugin.yml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="368">
<caret line="23" column="47" lean-forward="true" selection-start-line="23" selection-start-column="47" selection-end-line="23" selection-end-column="47" />
</state>
</provider>
</entry>
</file>
</leaf>
</split-second>
</splitter>
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
@ -119,23 +193,41 @@
</list>
</option>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>inventory</find>
<find>air</find>
<find>event.getPlayer()</find>
<find>axe</find>
</findStrings>
<replaceStrings>
<replace>player</replace>
</replaceStrings>
</component>
<component name="Git.Settings">
<option name="PREVIOUS_COMMIT_AUTHORS">
<list>
<option value="MagmaGuy" />
</list>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/main/java/com/songoda/EpicTimber.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/DefaultConfig.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/TreeFallHandler.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeFallHandler.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeChecker.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeEntityDamage.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/AxeDurability.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeLoot.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/commands/CommandHandler.java" />
<option value="$PROJECT_DIR$/src/main/resources/plugin.yml" />
<option value="$PROJECT_DIR$/pom.xml" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/epictimber/EpicTimber.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/epictimber/DefaultConfig.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/epictimber/TreeFallHandler.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/EventFilter.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeImpactSound.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeFallEvent.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeSounds.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeFallAnimation.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/UltimateTimber.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeReplant.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/commands/ReloadCommand.java" />
<option value="$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/configurations/DefaultConfig.java" />
</list>
</option>
</component>
@ -145,29 +237,22 @@
<detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="MavenImportPreferences">
<option name="importingSettings">
<MavenImportingSettings>
<option name="importAutomatically" value="true" />
</MavenImportingSettings>
</option>
</component>
<component name="MavenProjectNavigator">
<treeState>
<expand>
<path>
<item name="" type="16c1761:MavenProjectsStructure$RootNode" />
<item name="EpicTimber" type="9519ce18:MavenProjectsStructure$ProjectNode" />
<item name="UltimateTimber" type="9519ce18:MavenProjectsStructure$ProjectNode" />
</path>
</expand>
<select />
</treeState>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="486" />
<option name="y" value="52" />
<option name="x" value="720" />
<option name="y" value="74" />
<option name="width" value="2576" />
<option name="height" value="1187" />
<option name="height" value="1288" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
@ -177,42 +262,66 @@
<panes>
<pane id="AndroidView" />
<pane id="Scope" />
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="epictimber" type="b2602c69:ProjectViewProjectNode" />
<item name="epictimber" type="462c0819:PsiDirectoryNode" />
<item name="UltimateTimber" type="b2602c69:ProjectViewProjectNode" />
<item name="UltimateTimber" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="epictimber" type="b2602c69:ProjectViewProjectNode" />
<item name="epictimber" type="462c0819:PsiDirectoryNode" />
<item name="UltimateTimber" type="b2602c69:ProjectViewProjectNode" />
<item name="UltimateTimber" type="462c0819:PsiDirectoryNode" />
<item name=".idea" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="UltimateTimber" type="b2602c69:ProjectViewProjectNode" />
<item name="UltimateTimber" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="epictimber" type="b2602c69:ProjectViewProjectNode" />
<item name="epictimber" type="462c0819:PsiDirectoryNode" />
<item name="UltimateTimber" type="b2602c69:ProjectViewProjectNode" />
<item name="UltimateTimber" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="epictimber" type="b2602c69:ProjectViewProjectNode" />
<item name="epictimber" type="462c0819:PsiDirectoryNode" />
<item name="UltimateTimber" type="b2602c69:ProjectViewProjectNode" />
<item name="UltimateTimber" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="epictimber" type="b2602c69:ProjectViewProjectNode" />
<item name="epictimber" type="462c0819:PsiDirectoryNode" />
<item name="UltimateTimber" type="b2602c69:ProjectViewProjectNode" />
<item name="UltimateTimber" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="epictimber" type="462c0819:PsiDirectoryNode" />
<item name="ultimatetimber" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="epictimber" type="b2602c69:ProjectViewProjectNode" />
<item name="epictimber" type="462c0819:PsiDirectoryNode" />
<item name="UltimateTimber" type="b2602c69:ProjectViewProjectNode" />
<item name="UltimateTimber" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="ultimatetimber" type="462c0819:PsiDirectoryNode" />
<item name="commands" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="UltimateTimber" type="b2602c69:ProjectViewProjectNode" />
<item name="UltimateTimber" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="ultimatetimber" type="462c0819:PsiDirectoryNode" />
<item name="treefall" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="UltimateTimber" type="b2602c69:ProjectViewProjectNode" />
<item name="UltimateTimber" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="resources" type="462c0819:PsiDirectoryNode" />
@ -221,19 +330,16 @@
<select />
</subPane>
</pane>
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="SearchEverywhereHistoryKey" value="replan&#9;FILE&#9;file://C:/Users/Tiago/Desktop/MineCraftProjects/UltimateTimber/src/main/java/com/songoda/ultimatetimber/treefall/TreeReplant.java&#10;loot&#9;FILE&#9;file://C:/Users/Tiago/Desktop/MineCraftProjects/UltimateTimber/src/main/java/com/songoda/ultimatetimber/treefall/TreeLoot.java&#10;treean&#9;FILE&#9;file://C:/Users/Tiago/Desktop/MineCraftProjects/UltimateTimber/src/main/java/com/songoda/ultimatetimber/treefall/TreeFallAnimation.java&#10;treech&#9;FILE&#9;file://C:/Users/Tiago/Desktop/MineCraftProjects/UltimateTimber/src/main/java/com/songoda/ultimatetimber/treefall/TreeChecker.java&#10;hasnear&#9;PSI&#9;JAVA://com.songoda.ultimatetimber.treefall.TreeFallAnimation#hasNearbySolidBlock&#10;hasnea&#9;PSI&#9;JAVA://com.songoda.ultimatetimber.treefall.TreeFallAnimation#hasNearbySolidBlock" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1541279531279" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1541390827852" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
@ -252,185 +358,239 @@
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="cbe80f75-e7d6-4435-840f-16565ab9cbd6" name="Default Changelist" comment="" />
<created>1541204624425</created>
<changelist id="b5e32c07-ebf4-41aa-9c50-de0c623af54f" name="Default Changelist" comment="" />
<created>1541287795357</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1541204624425</updated>
<workItem from="1541204629244" duration="14565000" />
<workItem from="1541264555718" duration="13657000" />
<updated>1541287795357</updated>
<workItem from="1541287799885" duration="1592000" />
<workItem from="1541371591623" duration="19412000" />
</task>
<task id="LOCAL-00001" summary="Version 0.0.1&#10;&#10;- Initial commit of the TreeAssist recode&#10;- Added the animation&#10;- Added solid block detection&#10;- Added prototype drop mechanic&#10;- Added the config file (not fully hooked up to the filters yet)">
<created>1541278150874</created>
<task id="LOCAL-00001" summary="Version 0.0.1&#10;&#10;- Initial commit">
<created>1541288017614</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1541278150874</updated>
<updated>1541288017614</updated>
</task>
<option name="localTasksCounter" value="2" />
<task id="LOCAL-00002" summary="Version 0.0.1&#10;&#10;- Initial commit">
<created>1541288193654</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1541288193654</updated>
</task>
<option name="localTasksCounter" value="3" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="28222000" />
<option name="totallyTimeSpent" value="21004000" />
</component>
<component name="ToolWindowManager">
<frame x="486" y="52" width="2576" height="1187" extended-state="0" />
<editor active="true" />
<frame x="720" y="74" width="2576" height="1288" extended-state="0" />
<layout>
<window_info id="Designer" order="0" />
<window_info id="Capture Tool" order="1" />
<window_info id="UI Designer" order="2" />
<window_info id="Favorites" order="3" side_tool="true" />
<window_info id="Image Layers" order="4" />
<window_info content_ui="combo" id="Project" order="5" visible="true" weight="0.12559618" />
<window_info id="Structure" order="6" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Version Control" order="0" />
<window_info anchor="bottom" id="Terminal" order="1" />
<window_info anchor="bottom" id="Event Log" order="2" side_tool="true" />
<window_info anchor="bottom" id="Statistic" order="3" />
<window_info anchor="bottom" id="Message" order="4" />
<window_info anchor="bottom" id="Find" order="5" />
<window_info anchor="bottom" id="Run" order="6" weight="0.4045584" />
<window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Debug" order="8" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="9" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="10" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="11" />
<window_info anchor="right" id="Capture Analysis" order="0" />
<window_info anchor="right" id="Theme Preview" order="1" />
<window_info anchor="right" id="Palette&#9;" order="2" />
<window_info anchor="right" id="Database" order="3" />
<window_info anchor="right" id="Maven Projects" order="4" visible="true" weight="0.11685215" />
<window_info anchor="right" id="Palette" order="5" />
<window_info anchor="right" id="Commander" order="6" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="7" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="8" weight="0.25" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25198728" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Designer" order="2" />
<window_info id="Image Layers" order="3" />
<window_info id="UI Designer" order="4" />
<window_info id="Capture Tool" order="5" />
<window_info id="Favorites" order="6" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.30069324" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Version Control" order="7" weight="0.32972136" />
<window_info anchor="bottom" id="Database Changes" order="8" show_stripe_button="false" />
<window_info anchor="bottom" id="Statistic" order="9" />
<window_info anchor="bottom" id="Terminal" order="10" />
<window_info anchor="bottom" id="Event Log" order="11" side_tool="true" />
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="right" id="Palette" order="3" />
<window_info anchor="right" id="Capture Analysis" order="4" />
<window_info anchor="right" id="Theme Preview" order="5" />
<window_info anchor="right" id="Palette&#9;" order="6" />
<window_info anchor="right" id="Database" order="7" />
<window_info anchor="right" id="Maven Projects" order="8" visible="true" weight="0.09499205" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="Vcs.Log.History.Properties">
<option name="COLUMN_ORDER">
<list>
<option value="0" />
<option value="2" />
<option value="3" />
<option value="1" />
</list>
</option>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="VcsManagerConfiguration">
<option name="CHECK_CODE_CLEANUP_BEFORE_PROJECT_COMMIT" value="true" />
<MESSAGE value="Version 0.0.1&#10;&#10;- Initial commit of the TreeAssist recode&#10;- Added the animation&#10;- Added solid block detection&#10;- Added prototype drop mechanic&#10;- Added the config file (not fully hooked up to the filters yet)" />
<option name="LAST_COMMIT_MESSAGE" value="Version 0.0.1&#10;&#10;- Initial commit of the TreeAssist recode&#10;- Added the animation&#10;- Added solid block detection&#10;- Added prototype drop mechanic&#10;- Added the config file (not fully hooked up to the filters yet)" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
<MESSAGE value="Version 0.0.1&#10;&#10;- Initial commit" />
<option name="LAST_COMMIT_MESSAGE" value="Version 0.0.1&#10;&#10;- Initial commit" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/epictimber.iml">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/epictimber/EpicTimber.java">
<entry file="file://$PROJECT_DIR$/pom.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="448">
<caret line="28" column="35" selection-start-line="28" selection-start-column="35" selection-end-line="28" selection-end-column="35" />
<folding>
<element signature="imports" expanded="true" />
</folding>
<state relative-caret-position="528">
<caret line="33" column="75" selection-start-line="33" selection-start-column="75" selection-end-line="33" selection-end-column="75" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/epictimber/DefaultConfig.java">
<entry file="jar://$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.13-R0.1-SNAPSHOT/spigot-api-1.13-R0.1-20180826.040111-146.jar!/org/bukkit/block/Block.class">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="576">
<caret line="36" selection-start-line="36" selection-end-line="36" />
<state relative-caret-position="182">
<caret line="57" column="44" selection-start-line="57" selection-start-column="40" selection-end-line="57" selection-end-column="44" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeChecker.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="241">
<caret line="103" column="81" selection-start-line="103" selection-start-column="81" selection-end-line="103" selection-end-column="81" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/resources/plugin.yml">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="16" selection-start-column="16" selection-end-column="16" />
<state relative-caret-position="368">
<caret line="23" column="47" lean-forward="true" selection-start-line="23" selection-start-column="47" selection-end-line="23" selection-end-column="47" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/epictimber/TreeFallHandler.java">
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/AxeDurability.java">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="31" lean-forward="true" selection-start-column="31" selection-end-column="31" />
<state relative-caret-position="400">
<caret line="25" column="57" lean-forward="true" selection-start-line="25" selection-start-column="57" selection-end-line="25" selection-end-column="57" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/resources/config.yml">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/pom.xml">
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/EventFilter.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="96">
<caret line="6" column="23" selection-start-line="6" selection-start-column="23" selection-end-line="6" selection-end-column="23" />
<state relative-caret-position="320">
<caret line="20" column="93" lean-forward="true" selection-start-line="20" selection-start-column="93" selection-end-line="20" selection-end-column="93" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeFallEvent.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="304">
<caret line="26" column="66" selection-start-line="26" selection-start-column="66" selection-end-line="26" selection-end-column="66" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeEntityDamage.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="176">
<caret line="11" lean-forward="true" selection-start-line="11" selection-end-line="11" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeSounds.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="288">
<caret line="18" column="103" selection-start-line="18" selection-start-column="103" selection-end-line="18" selection-end-column="103" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeFallAnimation.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="611">
<caret line="110" column="66" selection-start-line="110" selection-start-column="66" selection-end-line="110" selection-end-column="66" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/commands/CommandHandler.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="144">
<caret line="9" column="101" lean-forward="true" selection-start-line="9" selection-start-column="101" selection-end-line="9" selection-end-column="101" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/UltimateTimber.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-7">
<caret line="16" column="21" lean-forward="true" selection-start-line="16" selection-start-column="21" selection-end-line="16" selection-end-column="21" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeLoot.java">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="44" lean-forward="true" selection-start-column="44" selection-end-column="44" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/treefall/TreeReplant.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1040">
<caret line="68" lean-forward="true" selection-start-line="68" selection-end-line="68" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/commands/ReloadCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="144">
<caret line="9" column="35" selection-start-line="9" selection-start-column="35" selection-end-line="9" selection-end-column="35" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/songoda/ultimatetimber/configurations/DefaultConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="15" column="30" selection-start-line="15" selection-start-column="30" selection-end-line="15" selection-end-column="30" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
<state key="ArtifactsStructureConfigurable.UI">
<settings>
<artifact-editor />
<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>epictimber</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.42214534" />
<option value="0.6" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8</last-edited>
@ -443,17 +603,6 @@
</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>

View File

@ -1,40 +0,0 @@
package com.songoda.ultimatetimber;
import org.bukkit.configuration.Configuration;
public class DefaultConfig {
/*
This value is just cached so it can easily and safely be accessed during runtime
*/
public static Configuration configuration;
/*
Storing these values in final strings makes it so you can change the keys or refactor their names later on without
ever having to alter any code directly.
Also they are easier to refer to using an IDE.
*/
public static final String AXES_ONLY = "Only topple down trees cut down using axes";
public static final String ACCURATE_AXE_DURABILITY = "Lower durability proportionately to the amount of blocks toppled down";
public static final String CREATIVE_DISALLOWED = "Players in creative mode can't topple down trees";
public static final String PERMISSIONS_ONLY = "Only allow players with the permission node to topple down trees";
public static void initialize() {
Configuration newConfiguration = UltimateTimber.plugin.getConfig();
newConfiguration.addDefault(AXES_ONLY, true);
newConfiguration.addDefault(ACCURATE_AXE_DURABILITY, true);
newConfiguration.addDefault(CREATIVE_DISALLOWED, true);
newConfiguration.addDefault(PERMISSIONS_ONLY, true);
newConfiguration.options().copyDefaults(true);
UltimateTimber.plugin.saveDefaultConfig();
configuration = newConfiguration;
}
}

View File

@ -1,230 +0,0 @@
package com.songoda.ultimatetimber;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.block.Block;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class TreeFallHandler implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onTreeBreak(BlockBreakEvent event) {
if (event.isCancelled()) return;
parseTree(event.getBlock(), event.getPlayer());
}
/*
Incorporate all checks that would disqualify this event from happening
*/
private static boolean eventIsValid(BlockBreakEvent event) {
/*
General catchers
*/
if (event.isCancelled()) return false;
if (!validMaterials.contains(event.getBlock().getType())) return false;
/*
Config-based catchers
*/
if (DefaultConfig.configuration.getBoolean(DefaultConfig.CREATIVE_DISALLOWED) &&
event.getPlayer().getGameMode().equals(GameMode.CREATIVE))
return false;
return !DefaultConfig.configuration.getBoolean(DefaultConfig.AXES_ONLY) ||
(event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.DIAMOND_AXE) ||
event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.GOLDEN_AXE) ||
event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.IRON_AXE) ||
event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.STONE_AXE) ||
event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.WOODEN_AXE));
}
/*
Used to check if a tree is a tree
*/
private static List<Material> validMaterials = new ArrayList<>(Arrays.asList(
Material.ACACIA_LOG,
Material.BIRCH_LOG,
Material.DARK_OAK_LOG,
Material.JUNGLE_LOG,
Material.OAK_LOG,
Material.SPRUCE_LOG
));
/*
Used to limit the blocks that constitute a tree
*/
private static List<Material> validSurroundingMaterials = new ArrayList<>(Arrays.asList(
Material.ACACIA_LEAVES,
Material.BIRCH_LEAVES,
Material.DARK_OAK_LEAVES,
Material.JUNGLE_LEAVES,
Material.OAK_LEAVES,
Material.SPRUCE_LEAVES,
Material.COCOA_BEANS
));
private static void parseTree(Block block, Player player) {
/*
Check if material is valid
*/
if (!validMaterials.contains(block.getType())) return;
ArrayList<Block> blocks = new ArrayList<>();
boolean containsSecondaryBlock = false;
/*
Check if block is surrounded by air (bottom blocks are)
Every third block expand one block laterally until the main block line reaches air or the max height is reached
*/
int offset = 1;
int maxHeight = 31; //make configurable
for (int i = 0; i < maxHeight; i++) {
if ((i + 1) % 3 == 0)
offset++;
/*
This expands the inverted search pyramid vertically
*/
int xOffset = -offset;
for (int j = xOffset - 1; j < offset; j++) {
int zOffset = -offset;
for (int k = zOffset - 1; k < offset; k++) {
Block thisBlock = block.getLocation().clone().add(new Vector(xOffset, i, zOffset)).getBlock();
/*
This exclusion list should include everything you may find near trees as to not invalidate trees
in natural forests and such
Construction blocks aren't included because that would bust buildings.
*/
if (!thisBlock.getType().equals(block.getType()) &&
!validSurroundingMaterials.contains(thisBlock.getType()) &&
!thisBlock.getType().equals(Material.AIR) &&
!thisBlock.getType().equals(Material.VINE) &&
!thisBlock.getType().equals(Material.ROSE_BUSH) &&
!thisBlock.getType().equals(Material.ORANGE_TULIP) &&
!thisBlock.getType().equals(Material.PINK_TULIP) &&
!thisBlock.getType().equals(Material.RED_TULIP) &&
!thisBlock.getType().equals(Material.WHITE_TULIP) &&
!thisBlock.getType().equals(Material.TALL_GRASS) &&
!thisBlock.getType().equals(Material.FERN) &&
!thisBlock.getType().equals(Material.LARGE_FERN) &&
!thisBlock.getType().equals(Material.DEAD_BUSH) &&
!thisBlock.getType().equals(Material.BROWN_MUSHROOM) &&
!thisBlock.getType().equals(Material.RED_MUSHROOM))
return;
if (validSurroundingMaterials.contains(thisBlock.getType()))
containsSecondaryBlock = true;
if (!thisBlock.getType().equals(Material.AIR))
blocks.add(thisBlock);
zOffset++;
}
xOffset++;
}
if (block.getLocation().clone().add(new Vector(0, i, 0)).getBlock().getType().equals(Material.AIR))
if (i > 1)
break;
else
return;
}
/*
If there are no leaves, don't see it as a tree
*/
if (!containsSecondaryBlock) return;
toppleAnimation(block, blocks, player);
}
private static void toppleAnimation(Block originalBlock, ArrayList<Block> blocks, Player player) {
Vector velocityVector = originalBlock.getLocation().clone().subtract(player.getLocation().clone()).toVector().normalize().setY(0);
for (Block block : blocks) {
if (block.getType().equals(Material.AIR)) continue;
FallingBlock fallingBlock = block.getWorld().spawnFallingBlock(block.getLocation(), block.getBlockData());
/*
Set tipping over effect
The horizontal velocity going away from the player increases as the Y moves away from the player
*/
block.setType(Material.AIR);
double multiplier = (block.getLocation().getY() - player.getLocation().getY()) * 0.1;
fallingBlock.setVelocity(velocityVector.clone().multiply(multiplier));
fallingBlock.setDropItem(true);
fallingBlock.setGravity(false);
new BukkitRunnable() {
@Override
public void run() {
fallingBlock.setGravity(true);
}
}.runTaskLater(UltimateTimber.plugin, 5);
new BukkitRunnable() {
@Override
public void run() {
fallingBlock.setVelocity(fallingBlock.getVelocity().subtract(new Vector(0, 0.05, 0)));
if (hasNearbySolidBlock(fallingBlock)) {
cancel();
fallingBlock.getWorld().dropItem(fallingBlock.getLocation(), new ItemStack(fallingBlock.getBlockData().getMaterial(), 1));
fallingBlock.remove();
fallingBlock.getLocation().getWorld().spawnParticle(Particle.SMOKE_LARGE, fallingBlock.getLocation(), 3, 0.2, 0.2, 0.2, 0.05);
}
}
}.runTaskTimer(UltimateTimber.plugin, 0, 1);
}
}
/*
Since the block accelerates as it falls, increase the search radius the longer it has been falling for
*/
private static boolean hasNearbySolidBlock(FallingBlock fallingBlock) {
if (!fallingBlock.getLocation().subtract(new Vector(0, 1, 0)).getBlock().getType().equals(Material.AIR))
return true;
/*
Lower comparative intensity by predicting the blocks through which the falling block will pass by by checking
its velocity
*/
Location predictedLocation = fallingBlock.getLocation().clone().add(fallingBlock.getVelocity());
return !predictedLocation.getBlock().getType().equals(Material.AIR);
}
}

View File

@ -1,9 +1,16 @@
package com.songoda.ultimatetimber;
import com.songoda.ultimatetimber.commands.CommandHandler;
import com.songoda.ultimatetimber.configurations.DefaultConfig;
import com.songoda.ultimatetimber.treefall.TreeFallEvent;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList;
import java.util.List;
/*
Note: In this plugin, I have called the act of a tree falling over with pseudo-physics "toppling over". This is reflected
in the documentation, config files and variable names.
@ -13,6 +20,7 @@ PS: MagmaGuy was here
public class UltimateTimber extends JavaPlugin {
public static Plugin plugin;
public static List<World> validWorlds = new ArrayList<>();
@Override
public void onEnable() {
@ -21,18 +29,29 @@ public class UltimateTimber extends JavaPlugin {
/*
Register the main event that handles toppling down trees
*/
Bukkit.getServer().getPluginManager().registerEvents(new TreeFallHandler(), this);
Bukkit.getServer().getPluginManager().registerEvents(new TreeFallEvent(), this);
/*
Initialize and cache config
*/
DefaultConfig.initialize();
/*
Cache valid worlds for later use
*/
for (World world : Bukkit.getWorlds())
if (DefaultConfig.configuration.getBoolean(DefaultConfig.VALID_WORLDS + world.getName()))
validWorlds.add(world);
this.getCommand("ultimatetimber").setExecutor(new CommandHandler());
}
@Override
public void onDisable() {
validWorlds.clear();
}
}

View File

@ -0,0 +1,23 @@
package com.songoda.ultimatetimber.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class CommandHandler implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
if (args.length > 0)
if (args[0].equalsIgnoreCase("reload")) {
ReloadCommand.reloadConfig(commandSender);
return true;
}
commandSender.sendMessage("[UltimateTimber] Command usage: /em reload");
return true;
}
}

View File

@ -0,0 +1,16 @@
package com.songoda.ultimatetimber.commands;
import com.songoda.ultimatetimber.configurations.DefaultConfig;
import org.bukkit.command.CommandSender;
public class ReloadCommand {
public static void reloadConfig(CommandSender commandSender) {
DefaultConfig.initialize();
commandSender.sendMessage("[UltimateTimber] - Configuration reloaded");
}
}

View File

@ -0,0 +1,56 @@
package com.songoda.ultimatetimber.configurations;
import com.songoda.ultimatetimber.UltimateTimber;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.configuration.Configuration;
public class DefaultConfig {
/*
This value is just cached so it can easily and safely be accessed during runtime
*/
public static Configuration configuration;
/*
Storing these values in final strings makes it so you can change the keys or refactor their names later on without
ever having to alter any code directly.
Also they are easier to refer to using an IDE.
*/
public static final String AXES_ONLY = "Only topple down trees cut down using axes";
public static final String ACCURATE_AXE_DURABILITY = "Lower durability proportionately to the amount of blocks toppled down";
public static final String CREATIVE_DISALLOWED = "Players in creative mode can't topple down trees";
public static final String PERMISSIONS_ONLY = "Only allow players with the permission node to topple down trees";
public static final String VALID_WORLDS = "Valid worlds.";
public static final String DAMAGE_PLAYERS = "Damage players when trees fall on them";
public static final String REPLANT_SAPLING = "Replant sapling when tree is cut down";
public static final String REPLANT_FROM_LEAVES = "Fallen leaves have a chance to plant saplings";
public static final String CUSTOM_AUDIO = "Use custom sounds for trees falling";
public static void initialize() {
configuration = UltimateTimber.plugin.getConfig();
configuration.addDefault(AXES_ONLY, true);
configuration.addDefault(ACCURATE_AXE_DURABILITY, true);
configuration.addDefault(CREATIVE_DISALLOWED, true);
configuration.addDefault(PERMISSIONS_ONLY, true);
configuration.addDefault(DAMAGE_PLAYERS, true);
configuration.addDefault(REPLANT_SAPLING, true);
configuration.addDefault(REPLANT_FROM_LEAVES, true);
configuration.addDefault(CUSTOM_AUDIO, true);
/*
Add all worlds that exist in the world at startup
*/
for (World world : Bukkit.getServer().getWorlds())
configuration.addDefault(VALID_WORLDS + world.getName(), true);
configuration.options().copyDefaults(true);
UltimateTimber.plugin.saveConfig();
UltimateTimber.plugin.saveDefaultConfig();
}
}

View File

@ -0,0 +1,30 @@
package com.songoda.ultimatetimber.treefall;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.Damageable;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
public class AxeDurability {
public static void adjustAxeDamage(ArrayList<Block> blocks, Player player) {
if (!(player.getInventory().getItemInMainHand().getType().equals(Material.DIAMOND_AXE) ||
player.getInventory().getItemInMainHand().getType().equals(Material.GOLDEN_AXE) ||
player.getInventory().getItemInMainHand().getType().equals(Material.IRON_AXE) ||
player.getInventory().getItemInMainHand().getType().equals(Material.STONE_AXE) ||
player.getInventory().getItemInMainHand().getType().equals(Material.WOODEN_AXE))) return;
ItemStack itemStack = player.getInventory().getItemInMainHand();
ItemMeta itemMeta = itemStack.getItemMeta();
Damageable damageableMeta = (Damageable) itemMeta;
damageableMeta.setDamage(damageableMeta.getDamage() + blocks.size());
itemStack.setItemMeta((ItemMeta) damageableMeta);
}
}

View File

@ -0,0 +1,47 @@
package com.songoda.ultimatetimber.treefall;
import com.songoda.ultimatetimber.UltimateTimber;
import com.songoda.ultimatetimber.configurations.DefaultConfig;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.event.block.BlockBreakEvent;
public class EventFilter {
/*
Incorporate all checks that would disqualify this event from happening
Mostly config settings, also permissions
*/
public static boolean eventIsValid(BlockBreakEvent event) {
/*
General catchers
*/
if (event.isCancelled()) return false;
if (!UltimateTimber.validWorlds.contains(event.getPlayer().getWorld())) return false;
if (!TreeChecker.validMaterials.contains(event.getBlock().getType())) return false;
/*
Config-based catchers
*/
if (DefaultConfig.configuration.getBoolean(DefaultConfig.CREATIVE_DISALLOWED) &&
event.getPlayer().getGameMode().equals(GameMode.CREATIVE))
return false;
if (DefaultConfig.configuration.getBoolean(DefaultConfig.AXES_ONLY) &&
!(event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.DIAMOND_AXE) ||
event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.GOLDEN_AXE) ||
event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.IRON_AXE) ||
event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.STONE_AXE) ||
event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.WOODEN_AXE)))
return false;
if (DefaultConfig.configuration.getBoolean(DefaultConfig.PERMISSIONS_ONLY) &&
!event.getPlayer().hasPermission("ultimatetimber.chop"))
return false;
return true;
}
}

View File

@ -0,0 +1,138 @@
package com.songoda.ultimatetimber.treefall;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class TreeChecker {
/*
Used to check if a tree is a tree
*/
public static List<Material> validMaterials = new ArrayList<>(Arrays.asList(
Material.ACACIA_LOG,
Material.STRIPPED_ACACIA_LOG,
Material.BIRCH_LOG,
Material.STRIPPED_BIRCH_LOG,
Material.DARK_OAK_LOG,
Material.STRIPPED_DARK_OAK_LOG,
Material.JUNGLE_LOG,
Material.STRIPPED_JUNGLE_LOG,
Material.OAK_LOG,
Material.STRIPPED_OAK_LOG,
Material.SPRUCE_LOG,
Material.STRIPPED_SPRUCE_LOG
));
/*
Used to limit the blocks that constitute a tree
*/
private static List<Material> validSurroundingMaterials = new ArrayList<>(Arrays.asList(
Material.ACACIA_LEAVES,
Material.BIRCH_LEAVES,
Material.DARK_OAK_LEAVES,
Material.JUNGLE_LEAVES,
Material.OAK_LEAVES,
Material.SPRUCE_LEAVES,
Material.COCOA_BEANS
));
public static ArrayList<Block> parseTree(Block block) {
/*
Check if material is valid
*/
if (!validMaterials.contains(block.getType())) return null;
ArrayList<Block> blocks = new ArrayList<>();
boolean containsSecondaryBlock = false;
/*
Check if block is surrounded by air (bottom blocks are)
Every third block expand one block laterally until the main block line reaches air or the max height is reached
*/
int offset = 1;
int maxHeight = 31;
for (int i = 0; i < maxHeight; i++) {
if ((i + 1) % 2 == 0 && offset < 6)
offset++;
/*
This expands the inverted search pyramid vertically
*/
int xOffset = -offset;
for (int j = xOffset - 1; j < offset; j++) {
int zOffset = -offset;
for (int k = zOffset - 1; k < offset; k++) {
Block thisBlock = block.getLocation().clone().add(new Vector(xOffset, i, zOffset)).getBlock();
/*
This exclusion list should include everything you may find near trees as to not invalidate trees
in natural forests and such
Construction blocks aren't included because that would bust buildings.
*/
if (!thisBlock.getType().equals(block.getType()) &&
!validSurroundingMaterials.contains(thisBlock.getType()) &&
!thisBlock.getType().equals(Material.AIR) &&
!thisBlock.getType().equals(Material.VINE) &&
!thisBlock.getType().equals(Material.ROSE_BUSH) &&
!thisBlock.getType().equals(Material.ORANGE_TULIP) &&
!thisBlock.getType().equals(Material.PINK_TULIP) &&
!thisBlock.getType().equals(Material.RED_TULIP) &&
!thisBlock.getType().equals(Material.WHITE_TULIP) &&
!thisBlock.getType().equals(Material.TALL_GRASS) &&
!thisBlock.getType().equals(Material.FERN) &&
!thisBlock.getType().equals(Material.LARGE_FERN) &&
!thisBlock.getType().equals(Material.DEAD_BUSH) &&
!thisBlock.getType().equals(Material.BROWN_MUSHROOM) &&
!thisBlock.getType().equals(Material.RED_MUSHROOM) &&
!thisBlock.getType().equals(Material.GRASS) &&
!thisBlock.getType().equals(Material.SPRUCE_SAPLING) &&
!thisBlock.getType().equals(Material.OAK_SAPLING) &&
!thisBlock.getType().equals(Material.JUNGLE_SAPLING) &&
!thisBlock.getType().equals(Material.ACACIA_SAPLING) &&
!thisBlock.getType().equals(Material.BIRCH_SAPLING) &&
!thisBlock.getType().equals(Material.DARK_OAK_SAPLING))
return null;
if (validSurroundingMaterials.contains(thisBlock.getType()))
containsSecondaryBlock = true;
if (!thisBlock.getType().equals(Material.AIR))
blocks.add(thisBlock);
zOffset++;
}
xOffset++;
}
if (block.getLocation().clone().add(new Vector(0, i, 0)).getBlock().getType().equals(Material.AIR))
if (i > 1)
break;
else
return null;
}
/*
If there are no leaves, don't see it as a tree
*/
if (!containsSecondaryBlock) return null;
return blocks;
}
}

View File

@ -0,0 +1,23 @@
package com.songoda.ultimatetimber.treefall;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.LivingEntity;
public class TreeEntityDamage {
public static void runDamage(FallingBlock fallingBlock) {
for (Entity entity : fallingBlock.getNearbyEntities(0.5, 0.5, 0.5)) {
if (entity instanceof LivingEntity) {
((LivingEntity) entity).damage(1);
}
}
}
}

View File

@ -0,0 +1,139 @@
package com.songoda.ultimatetimber.treefall;
import com.songoda.ultimatetimber.UltimateTimber;
import com.songoda.ultimatetimber.configurations.DefaultConfig;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.block.Block;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
import java.util.ArrayList;
public class TreeFallAnimation {
/*
This animation has multiple phases.
Initially, the tree will start slowly toppling over.
After a short while, it goes over the tipping point and the fall accelerates.
*/
public static void startAnimation(Block originalBlock, ArrayList<Block> blocks, Player player) {
/*
This vector makes sure that the entire tree falls in the same direction from the same reference point
*/
Vector velocityVector = originalBlock.getLocation().clone().subtract(player.getLocation().clone()).toVector().normalize().setY(0);
for (Block block : blocks) {
if (block.getType().equals(Material.AIR)) continue;
FallingBlock fallingBlock = block.getWorld().spawnFallingBlock(block.getLocation(), block.getBlockData());
/*
Remove original block
*/
TreeReplant.replaceOriginalBlock(block);
/*
Set tipping over effect
The horizontal velocity going away from the player increases as the Y moves away from the player
*/
double multiplier = (block.getLocation().getY() - player.getLocation().getY()) * 0.1;
startPhaseOneAnimation(fallingBlock, velocityVector, multiplier, player);
}
}
/*
Phase one of the animation, the tree starts slowly tipping over
*/
private static void startPhaseOneAnimation(FallingBlock fallingBlock, Vector velocityVector, double multiplier, Player player) {
/*
Vertical offset so top of the tree sways faster than the base
*/
fallingBlock.setVelocity(velocityVector.clone().multiply(multiplier));
fallingBlock.setDropItem(true);
/*
No gravity helps with the initial surrounding block detection (somehow) and with the initial trunk rigidity aspect
required for the effect to look convincing
*/
fallingBlock.setGravity(false);
fallingBlock.setVelocity(fallingBlock.getVelocity().multiply(0.2));
new BukkitRunnable() {
@Override
public void run() {
fallingBlock.setGravity(true);
/*
Phase 2 has to be launched from here as to not override effects
*/
runPhaseTwoAnimation(fallingBlock, player);
}
}.runTaskLater(UltimateTimber.plugin, 20);
}
/*
Phase two of the animation, the tree picks up speed until it is on the ground
For safety's sake, it disintegrates after a 4 seconds
*/
private static void runPhaseTwoAnimation(FallingBlock fallingBlock, Player player) {
new BukkitRunnable() {
int counter = 0;
@Override
public void run() {
if (counter < 10)
fallingBlock.setVelocity(fallingBlock.getVelocity().multiply(1.3));
if (counter > 20 * 3 || hasNearbySolidBlock(fallingBlock)) {
cancel();
TreeLoot.convertFallingBlock(fallingBlock, player);
fallingBlock.remove();
fallingBlock.getLocation().getWorld().spawnParticle(Particle.SMOKE_LARGE, fallingBlock.getLocation(), 3, 0.2, 0.2, 0.2, 0.05);
if (DefaultConfig.configuration.getBoolean(DefaultConfig.REPLANT_FROM_LEAVES))
TreeReplant.leafFallReplant(fallingBlock);
if (DefaultConfig.configuration.getBoolean(DefaultConfig.DAMAGE_PLAYERS))
TreeEntityDamage.runDamage(fallingBlock);
if (DefaultConfig.configuration.getBoolean(DefaultConfig.CUSTOM_AUDIO))
TreeSounds.fallNoise(fallingBlock, counter);
}
counter++;
}
}.runTaskTimer(UltimateTimber.plugin, 0, 1);
}
/*
Since the block accelerates as it falls, increase the search radius the longer it has been falling for
*/
private static boolean hasNearbySolidBlock(FallingBlock fallingBlock) {
if (!fallingBlock.getLocation().clone().subtract(new Vector(0, 1, 0)).getBlock().getType().equals(Material.AIR))
return true;
/*
Lower comparative intensity by predicting the blocks through which the falling block will pass by by checking
its velocity
*/
Location predictedLocation = fallingBlock.getLocation().clone().add(fallingBlock.getVelocity().multiply(2));
if (predictedLocation.getY() < 1) return true;
return !predictedLocation.getBlock().getType().equals(Material.AIR);
}
}

View File

@ -0,0 +1,32 @@
package com.songoda.ultimatetimber.treefall;
import com.songoda.ultimatetimber.configurations.DefaultConfig;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import java.util.ArrayList;
public class TreeFallEvent implements Listener {
/*
This is the starting point for the whole effect
It's been broken up instead of chained in order to make step-by-step debugging easier
*/
@EventHandler(priority = EventPriority.HIGHEST)
public void onTreeBreak(BlockBreakEvent event) {
if (!EventFilter.eventIsValid(event)) return;
ArrayList<Block> blocks = TreeChecker.parseTree(event.getBlock());
if (blocks == null) return;
if (DefaultConfig.configuration.getBoolean(DefaultConfig.ACCURATE_AXE_DURABILITY))
AxeDurability.adjustAxeDamage(blocks, event.getPlayer());
if (DefaultConfig.configuration.getBoolean(DefaultConfig.CUSTOM_AUDIO))
TreeSounds.tipOverNoise(event.getBlock().getLocation());
TreeFallAnimation.startAnimation(event.getBlock(), blocks, event.getPlayer());
}
}

View File

@ -0,0 +1,72 @@
package com.songoda.ultimatetimber.treefall;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.concurrent.ThreadLocalRandom;
public class TreeLoot {
public static void convertFallingBlock(FallingBlock fallingBlock, Player player) {
Material material;
switch (fallingBlock.getBlockData().getMaterial()) {
case ACACIA_LEAVES:
material = Material.ACACIA_SAPLING;
break;
case BIRCH_LEAVES:
material = Material.BIRCH_SAPLING;
break;
case DARK_OAK_LEAVES:
material = Material.DARK_OAK_SAPLING;
break;
case JUNGLE_LEAVES:
material = Material.JUNGLE_SAPLING;
break;
case OAK_LEAVES:
material = Material.OAK_SAPLING;
break;
case SPRUCE_LEAVES:
material = Material.SPRUCE_SAPLING;
break;
default:
material = fallingBlock.getBlockData().getMaterial();
}
if (material.equals(Material.VINE))
return;
if (player.getInventory().getItemInMainHand().getType().equals(Material.DIAMOND_AXE) ||
player.getInventory().getItemInMainHand().getType().equals(Material.GOLDEN_AXE) ||
player.getInventory().getItemInMainHand().getType().equals(Material.IRON_AXE) ||
player.getInventory().getItemInMainHand().getType().equals(Material.STONE_AXE) ||
player.getInventory().getItemInMainHand().getType().equals(Material.WOODEN_AXE))
if (player.getInventory().getItemInMainHand().getEnchantments().containsKey(Enchantment.SILK_TOUCH))
fallingBlock.getWorld().dropItem(fallingBlock.getLocation(), new ItemStack(fallingBlock.getBlockData().getMaterial(), 1));
if (material.equals(Material.ACACIA_SAPLING) ||
material.equals(Material.BIRCH_SAPLING) ||
material.equals(Material.DARK_OAK_SAPLING) ||
material.equals(Material.JUNGLE_SAPLING) ||
material.equals(Material.OAK_SAPLING) ||
material.equals(Material.SPRUCE_SAPLING))
if (ThreadLocalRandom.current().nextDouble() < 0.05) {
if (player.hasPermission("ultimatetimber.bonusloot"))
fallingBlock.getWorld().dropItem(fallingBlock.getLocation(), new ItemStack(material, 1));
fallingBlock.getWorld().dropItem(fallingBlock.getLocation(), new ItemStack(material, 1));
return;
}
if (player.hasPermission("ultimatetimber.bonusloot"))
fallingBlock.getWorld().dropItem(fallingBlock.getLocation(), new ItemStack(material, 1));
fallingBlock.getWorld().dropItem(fallingBlock.getLocation(), new ItemStack(material, 1));
}
}

View File

@ -0,0 +1,110 @@
package com.songoda.ultimatetimber.treefall;
import com.songoda.ultimatetimber.UltimateTimber;
import com.songoda.ultimatetimber.configurations.DefaultConfig;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.FallingBlock;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
import java.util.concurrent.ThreadLocalRandom;
public class TreeReplant {
public static void replaceOriginalBlock(Block block) {
if (!DefaultConfig.configuration.getBoolean(DefaultConfig.REPLANT_SAPLING)) {
block.setType(Material.AIR);
return;
}
if (!block.getLocation().clone().subtract(new Vector(0, 1, 0)).getBlock().getType().equals(Material.DIRT) &&
!block.getLocation().clone().subtract(new Vector(0, 1, 0)).getBlock().getType().equals(Material.COARSE_DIRT)) {
block.setType(Material.AIR);
return;
}
Material material = block.getType();
new BukkitRunnable() {
@Override
public void run() {
switch (material) {
case ACACIA_LOG:
case STRIPPED_ACACIA_LOG:
block.setType(Material.ACACIA_SAPLING);
return;
case BIRCH_LOG:
case STRIPPED_BIRCH_LOG:
block.setType(Material.BIRCH_SAPLING);
return;
case DARK_OAK_LOG:
case STRIPPED_DARK_OAK_LOG:
block.setType(Material.DARK_OAK_SAPLING);
return;
case JUNGLE_LOG:
case STRIPPED_JUNGLE_LOG:
block.setType(Material.JUNGLE_SAPLING);
return;
case OAK_LOG:
case STRIPPED_OAK_LOG:
block.setType(Material.OAK_SAPLING);
return;
case SPRUCE_LOG:
case STRIPPED_SPRUCE_LOG:
block.setType(Material.SPRUCE_SAPLING);
return;
default:
block.setType(Material.AIR);
}
}
}.runTaskLater(UltimateTimber.plugin, 1);
}
public static void leafFallReplant(FallingBlock fallingBlock) {
Material material;
switch (fallingBlock.getBlockData().getMaterial()) {
case ACACIA_LEAVES:
material = Material.ACACIA_SAPLING;
break;
case BIRCH_LEAVES:
material = Material.BIRCH_SAPLING;
break;
case DARK_OAK_LEAVES:
material = Material.DARK_OAK_SAPLING;
break;
case JUNGLE_LEAVES:
material = Material.JUNGLE_SAPLING;
break;
case OAK_LEAVES:
material = Material.OAK_SAPLING;
break;
case SPRUCE_LEAVES:
material = Material.SPRUCE_SAPLING;
break;
default:
material = null;
}
if (material == null) return;
if (ThreadLocalRandom.current().nextDouble() > 0.05) return;
Block block = fallingBlock.getLocation().clone().subtract(new Vector(0, 1, 0)).getBlock();
if (block.getType().equals(Material.DIRT) || block.getType().equals(Material.COARSE_DIRT) || block.getType().equals(Material.GRASS_BLOCK)) {
Block blockAbove = block.getLocation().clone().add(new Vector(0, 1, 0)).getBlock();
if (blockAbove.getType().equals(Material.AIR))
fallingBlock.getLocation().getBlock().setType(material);
}
}
}

View File

@ -0,0 +1,23 @@
package com.songoda.ultimatetimber.treefall;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.FallingBlock;
public class TreeSounds {
public static void tipOverNoise(Location location) {
location.getWorld().playSound(location, Sound.BLOCK_CHEST_OPEN, 3F, 0.1F);
}
public static void fallNoise(FallingBlock fallingBlock, int counter) {
if (counter < 20)
fallingBlock.getWorld().playSound(fallingBlock.getLocation(), Sound.BLOCK_ANVIL_FALL, 3F, 0.1F);
else
fallingBlock.getWorld().playSound(fallingBlock.getLocation(), Sound.BLOCK_WOOD_FALL, 3F, 0.1F);
}
}

View File

@ -1,10 +1,25 @@
name: UltimateTimber
version: 0.0.1
version: 0.0.2
author: Songoda
main: com.songoda.ultimatetimber.UltimateTimber
api-version: 1.13
commands:
epictimber:
description: Does something, probably
usage: /ultimatetimber
aliases: [ep]
ultimatetimber:
description: Reloads the configuration file
usage: /ultimatetimber reload
aliases: [ut]
permissions:
ultimatetimber.*:
description: Inherits all plugin permissions
children:
ultimatetimber.chop: true
ultimatetimber.bonusloot: true
ultimatetimber.chop:
description: Allows players to trigger the trees toppling down effect
default: op
ultimatetimber.bonusloot:
description: Doubles the loot obtained from trees
default: op
ultimatetimber.reload:
description: Reloads the configuration file
default: op

Binary file not shown.

View File

@ -1,10 +1,25 @@
name: EpicTimber
version: 0.0.1
name: UltimateTimber
version: 0.0.2
author: Songoda
main: com.songoda.epictimber.EpicTimber
main: com.songoda.ultimatetimber.UltimateTimber
api-version: 1.13
commands:
epictimber:
description: Does something, probably
usage: /epictimber
aliases: [ep]
ultimatetimber:
description: Reloads the configuration file
usage: /ultimatetimber reload
aliases: [ut]
permissions:
ultimatetimber.*:
description: Inherits all plugin permissions
children:
ultimatetimber.chop: true
ultimatetimber.bonusloot: true
ultimatetimber.chop:
description: Allows players to trigger the trees toppling down effect
default: op
ultimatetimber.bonusloot:
description: Doubles the loot obtained from trees
default: op
ultimatetimber.reload:
description: Reloads the configuration file
default: op

View File

@ -1,5 +1,5 @@
#Generated by Maven
#Sat Nov 03 20:03:28 GMT 2018
#Mon Nov 05 04:04:50 GMT 2018
version=1.0-SNAPSHOT
groupId=epictimber
artifactId=EpicTimber
groupId=ultimatetimber
artifactId=UltimateTimber

View File

@ -1,5 +1,18 @@
com\songoda\epictimber\EpicTimber.class
com\songoda\epictimber\TreeFallHandler$1.class
com\songoda\epictimber\TreeFallHandler$2.class
com\songoda\epictimber\DefaultConfig.class
com\songoda\epictimber\TreeFallHandler.class
com\songoda\ultimatetimber\treefall\TreeReplant$1.class
com\songoda\ultimatetimber\treefall\TreeSounds.class
com\songoda\ultimatetimber\treefall\TreeReplant$2.class
com\songoda\ultimatetimber\treefall\AxeDurability.class
com\songoda\ultimatetimber\treefall\TreeReplant.class
com\songoda\ultimatetimber\configurations\DefaultConfig.class
com\songoda\ultimatetimber\treefall\TreeEntityDamage.class
com\songoda\ultimatetimber\treefall\TreeFallAnimation$1.class
com\songoda\ultimatetimber\treefall\TreeFallEvent.class
com\songoda\ultimatetimber\commands\CommandHandler.class
com\songoda\ultimatetimber\treefall\TreeFallAnimation$2.class
com\songoda\ultimatetimber\treefall\EventFilter.class
com\songoda\ultimatetimber\treefall\TreeLoot$1.class
com\songoda\ultimatetimber\treefall\TreeLoot.class
com\songoda\ultimatetimber\commands\ReloadCommand.class
com\songoda\ultimatetimber\treefall\TreeFallAnimation.class
com\songoda\ultimatetimber\UltimateTimber.class
com\songoda\ultimatetimber\treefall\TreeChecker.class

View File

@ -1,3 +1,13 @@
C:\Users\Tiago\Desktop\MineCraftProjects\epictimber\src\main\java\com\songoda\epictimber\DefaultConfig.java
C:\Users\Tiago\Desktop\MineCraftProjects\epictimber\src\main\java\com\songoda\epictimber\TreeFallHandler.java
C:\Users\Tiago\Desktop\MineCraftProjects\epictimber\src\main\java\com\songoda\epictimber\EpicTimber.java
C:\Users\Tiago\Desktop\MineCraftProjects\UltimateTimber\src\main\java\com\songoda\ultimatetimber\treefall\TreeFallEvent.java
C:\Users\Tiago\Desktop\MineCraftProjects\UltimateTimber\src\main\java\com\songoda\ultimatetimber\treefall\AxeDurability.java
C:\Users\Tiago\Desktop\MineCraftProjects\UltimateTimber\src\main\java\com\songoda\ultimatetimber\configurations\DefaultConfig.java
C:\Users\Tiago\Desktop\MineCraftProjects\UltimateTimber\src\main\java\com\songoda\ultimatetimber\treefall\TreeSounds.java
C:\Users\Tiago\Desktop\MineCraftProjects\UltimateTimber\src\main\java\com\songoda\ultimatetimber\commands\ReloadCommand.java
C:\Users\Tiago\Desktop\MineCraftProjects\UltimateTimber\src\main\java\com\songoda\ultimatetimber\treefall\TreeEntityDamage.java
C:\Users\Tiago\Desktop\MineCraftProjects\UltimateTimber\src\main\java\com\songoda\ultimatetimber\commands\CommandHandler.java
C:\Users\Tiago\Desktop\MineCraftProjects\UltimateTimber\src\main\java\com\songoda\ultimatetimber\treefall\TreeLoot.java
C:\Users\Tiago\Desktop\MineCraftProjects\UltimateTimber\src\main\java\com\songoda\ultimatetimber\treefall\EventFilter.java
C:\Users\Tiago\Desktop\MineCraftProjects\UltimateTimber\src\main\java\com\songoda\ultimatetimber\treefall\TreeReplant.java
C:\Users\Tiago\Desktop\MineCraftProjects\UltimateTimber\src\main\java\com\songoda\ultimatetimber\UltimateTimber.java
C:\Users\Tiago\Desktop\MineCraftProjects\UltimateTimber\src\main\java\com\songoda\ultimatetimber\treefall\TreeChecker.java
C:\Users\Tiago\Desktop\MineCraftProjects\UltimateTimber\src\main\java\com\songoda\ultimatetimber\treefall\TreeFallAnimation.java

Binary file not shown.