Clean up
This commit is contained in:
1 parent
8fd88a6473
commit
394742b70c
318 files changed
+40
-10297
No files matched your search
+40
-3
@@ -1,3 +1,40 @@
|
||||
*.iml
|
||||
/.idea/
|
||||
target/
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
||||
# macOS system files
|
||||
.DS_Store
|
||||
|
||||
# gradle build output files
|
||||
build/
|
||||
.gradle/
|
||||
|
||||
# eclipse project files
|
||||
.settings/
|
||||
.project
|
||||
.classpath
|
||||
bin/
|
||||
|
||||
# IntelliJ files
|
||||
.idea/
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>BetterChairs</name>
|
||||
<comment></comment>
|
||||
<projects/>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<linkedResources/>
|
||||
<filteredResources/>
|
||||
</projectDescription>
|
||||
Vendored
BIN
Binary file not shown.
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="output" path="bin/default"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
|
||||
</classpath>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>modules</name>
|
||||
<comment></comment>
|
||||
<projects/>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<linkedResources/>
|
||||
<filteredResources/>
|
||||
</projectDescription>
|
||||
@@ -1,13 +0,0 @@
|
||||
#
|
||||
#Wed Jul 02 05:13:16 EDT 2025
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
|
||||
org.eclipse.jdt.core.compiler.source=17
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.compliance=17
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
@@ -1,96 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="output" path="bin/default"/>
|
||||
<classpathentry output="bin/main" kind="src" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="main"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/de/sprax2013/lime/lime-spigot-api/0.0.4-SNAPSHOT/lime-spigot-api-0.0.4-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry sourcepath="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/de.tr7zw/item-nbt-api/2.15.0/29689f4d8039bc2abf8e5562c5c09927f9bfc51f/item-nbt-api-2.15.0-sources.jar" kind="lib" path="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/de.tr7zw/item-nbt-api/2.15.0/52fa821ba619524cac58be6d7260e72b42ae3a0a/item-nbt-api-2.15.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry sourcepath="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/com.github.cryptomorin/XSeries/13.3.0/d079530d2976ecfae96e2e132e9b8323738d6b02/XSeries-13.3.0-sources.jar" kind="lib" path="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/com.github.cryptomorin/XSeries/13.3.0/d664a667493ae640b7a62c8add20572437a4f52d/XSeries-13.3.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/spigotmc/spigot-api/1.8-R0.1-SNAPSHOT/spigot-api-1.8-R0.1-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/de/sprax2013/lime/lime-api/0.0.4-SNAPSHOT/lime-api-0.0.4-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry sourcepath="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/26.0.2/bfa27b5e683363963c8d5e2fec39d755295cbb82/annotations-26.0.2-sources.jar" kind="lib" path="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/26.0.2/c7ce3cdeda3d18909368dfe5977332dfad326c6d/annotations-26.0.2.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/net/md-5/bungeecord-chat/1.8-SNAPSHOT/bungeecord-chat-1.8-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/avaje/ebean/2.8.1/ebean-2.8.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/yaml/snakeyaml/1.33/snakeyaml-1.33.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/junit/junit/4.10/junit-4.10.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/google/code/gson/gson/2.3.1/gson-2.3.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/jetbrains/annotations/24.1.0/annotations-24.1.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
</classpath>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>betterchairs-api</name>
|
||||
<comment></comment>
|
||||
<projects/>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<linkedResources/>
|
||||
<filteredResources/>
|
||||
</projectDescription>
|
||||
@@ -1,13 +0,0 @@
|
||||
#
|
||||
#Wed Jul 02 05:13:18 EDT 2025
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
|
||||
org.eclipse.jdt.core.compiler.source=17
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.compliance=17
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,2 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
|
||||
@@ -1,222 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="output" path="bin/default"/>
|
||||
<classpathentry output="bin/main" kind="src" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="main"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry output="bin/main" kind="src" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="main"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
|
||||
<classpathentry kind="src" path="/betterchairs-api">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_19_R3">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_19_R2">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_19_R1">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_19_0">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_18_R2">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_18_R1">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_17_R1">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_16_R3">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_16_R2">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_16_R1">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_15_R1">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_14_R1">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_13_R2">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_13_R1">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_12_R1">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_11_R1">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_10_R1">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_9_R2">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_9_R1">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_8_R3">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_8_R2">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/betterchairs-v1_8_R1">
|
||||
<attributes>
|
||||
<attribute name="without_test_code" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/spigotmc/spigot-api/1.8-R0.1-SNAPSHOT/spigot-api-1.8-R0.1-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/me/clip/placeholderapi/2.11.6/placeholderapi-2.11.6.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/de/sprax2013/lime/lime-spigot-api/0.0.4-SNAPSHOT/lime-spigot-api-0.0.4-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/de/sprax2013/lime/lime-api/0.0.4-SNAPSHOT/lime-api-0.0.4-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry sourcepath="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/26.0.2/bfa27b5e683363963c8d5e2fec39d755295cbb82/annotations-26.0.2-sources.jar" kind="lib" path="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/26.0.2/c7ce3cdeda3d18909368dfe5977332dfad326c6d/annotations-26.0.2.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/net/md-5/bungeecord-chat/1.8-SNAPSHOT/bungeecord-chat-1.8-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/avaje/ebean/2.8.1/ebean-2.8.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/yaml/snakeyaml/1.33/snakeyaml-1.33.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry sourcepath="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/de.tr7zw/item-nbt-api/2.15.0/29689f4d8039bc2abf8e5562c5c09927f9bfc51f/item-nbt-api-2.15.0-sources.jar" kind="lib" path="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/de.tr7zw/item-nbt-api/2.15.0/52fa821ba619524cac58be6d7260e72b42ae3a0a/item-nbt-api-2.15.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry sourcepath="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/com.github.cryptomorin/XSeries/13.3.0/d079530d2976ecfae96e2e132e9b8323738d6b02/XSeries-13.3.0-sources.jar" kind="lib" path="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/com.github.cryptomorin/XSeries/13.3.0/d664a667493ae640b7a62c8add20572437a4f52d/XSeries-13.3.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/junit/junit/4.10/junit-4.10.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/google/code/gson/gson/2.3.1/gson-2.3.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/jetbrains/annotations/24.1.0/annotations-24.1.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
</classpath>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>betterchairs-plugin</name>
|
||||
<comment></comment>
|
||||
<projects/>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<linkedResources/>
|
||||
<filteredResources/>
|
||||
</projectDescription>
|
||||
@@ -1,13 +0,0 @@
|
||||
#
|
||||
#Wed Jul 02 05:13:18 EDT 2025
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
|
||||
org.eclipse.jdt.core.compiler.source=17
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.compliance=17
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Christian Koop
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB |
@@ -1,43 +0,0 @@
|
||||
name: BetterChairs
|
||||
description: Players can sit on chairs and everywhere the admin wants them to be able to.
|
||||
version: unspecified
|
||||
api-version: '1.19'
|
||||
|
||||
main: de.sprax2013.betterchairs.BetterChairsPlugin
|
||||
softdepend:
|
||||
- PlaceholderAPI
|
||||
|
||||
author: SpraxDev
|
||||
authors: [ BlackScarx ]
|
||||
website: https://github.com/SpraxDev/BetterChairs
|
||||
|
||||
commands:
|
||||
BetterChairs:
|
||||
description: 'Toggle, Reload or Reset BetterChairs'
|
||||
toggleChairs:
|
||||
description: 'Allows individual players to disabled chairs for them'
|
||||
aliases: [ bct ]
|
||||
permission: BetterChairs.cmd.toggle
|
||||
sit:
|
||||
description: 'Allows a player to sit on the ground'
|
||||
permission: BetterChairs.cmd.sit
|
||||
|
||||
permissions:
|
||||
BetterChairs.use:
|
||||
description: Allows players to sit on chairs
|
||||
default: true
|
||||
BetterChairs.regeneration:
|
||||
description: Grants regeneration to a player when sitting
|
||||
BetterChairs.updater:
|
||||
description: Notifies players about updates when joining the server
|
||||
BetterChairs.cmd.toggle:
|
||||
description: Allows individual players to disabled chairs for them
|
||||
default: true
|
||||
BetterChairs.cmd.sit:
|
||||
description: Allows a player to sit on the ground
|
||||
default: true
|
||||
BetterChairs.cmd.reset:
|
||||
description: Allows admins to eject all players from their chairs
|
||||
BetterChairs.cmd.reload:
|
||||
description: Allows admins to reload the plugin's configuration files
|
||||
|
||||
-211
@@ -1,211 +0,0 @@
|
||||
package de.sprax2013.betterchairs;
|
||||
|
||||
import static de.sprax2013.betterchairs.BetterChairsPlugin.getManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
// TODO: Put all strings into messages.yml
|
||||
// TODO: Split file into smaller ones
|
||||
public class BetterChairsCommand implements CommandExecutor, TabCompleter {
|
||||
private final String permsSit, permsToggle, permsReload, permsReset;
|
||||
|
||||
protected BetterChairsCommand(JavaPlugin plugin) {
|
||||
this.permsSit = plugin.getName() + ".cmd.sit";
|
||||
this.permsToggle = plugin.getName() + ".cmd.toggle";
|
||||
|
||||
this.permsReload = plugin.getName() + ".cmd.reload";
|
||||
this.permsReset = plugin.getName() + ".cmd.reset";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!sender.hasPermission(this.permsToggle)
|
||||
&& !sender.hasPermission(this.permsReload)
|
||||
&& !sender.hasPermission(this.permsReset)
|
||||
&& !sender.hasPermission(this.permsSit)) {
|
||||
sender.sendMessage(Messages.getString(Messages.NO_PERMISSION));
|
||||
}
|
||||
|
||||
boolean showHelp = false;
|
||||
|
||||
if (cmd.getName().equalsIgnoreCase("toggleChairs")) {
|
||||
if (args.length > 0) {
|
||||
if (args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("off")) {
|
||||
handleToggleChairs(sender, args[0].equalsIgnoreCase("off"));
|
||||
} else if (args[0].equalsIgnoreCase("status")) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(Messages.getPrefix() + " §cOnly players may toggle chairs");
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(Messages.getString(
|
||||
getManager().hasChairsDisabled((Player) sender)
|
||||
? Messages.TOGGLE_STATUS_DISABLED
|
||||
: Messages.TOGGLE_STATUS_ENABLED));
|
||||
} else {
|
||||
showHelp = true;
|
||||
}
|
||||
} else {
|
||||
handleToggleChairs(sender);
|
||||
}
|
||||
} else if (cmd.getName().equalsIgnoreCase("sit")) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(Messages.getPrefix() + " §cOnly players are able to sit");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p = (Player) sender;
|
||||
|
||||
Block b = null;
|
||||
|
||||
if (p.getLocation().getBlock().getType().isSolid()) {
|
||||
b = p.getLocation().getBlock();
|
||||
} else if (p.getLocation()
|
||||
.getBlock()
|
||||
.getRelative(BlockFace.DOWN)
|
||||
.getType()
|
||||
.isSolid()) {
|
||||
b = p.getLocation().getBlock().getRelative(BlockFace.DOWN);
|
||||
}
|
||||
|
||||
if (b != null) {
|
||||
getManager().create(p, b);
|
||||
} else {
|
||||
sender.sendMessage(Messages.getPrefix() + " §cYou need to be on solid ground");
|
||||
}
|
||||
} else if (args.length >= 1) {
|
||||
if (args[0].equalsIgnoreCase("toggle")) {
|
||||
handleToggleChairs(sender);
|
||||
} else if (args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("off")) {
|
||||
handleToggleChairs(sender, args[0].equalsIgnoreCase("off"));
|
||||
} else if (args[0].equalsIgnoreCase("status")) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(Messages.getPrefix() + " §cOnly players may toggle chairs");
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(Messages.getString(
|
||||
getManager().hasChairsDisabled((Player) sender)
|
||||
? Messages.TOGGLE_STATUS_DISABLED
|
||||
: Messages.TOGGLE_STATUS_ENABLED));
|
||||
} else if (args[0].equalsIgnoreCase("reload") || args[0].equalsIgnoreCase("rl")) {
|
||||
if (sender.hasPermission(this.permsReload)) {
|
||||
if (Messages.reload()) {
|
||||
sender.sendMessage(Messages.getPrefix() + " §aSuccessfully reloaded §6messages.yml§a!");
|
||||
} else {
|
||||
sender.sendMessage(Messages.getPrefix()
|
||||
+ " §cCould not reload §6messages.yml §7- §cCheck server logs for more information");
|
||||
}
|
||||
|
||||
if (Settings.reload()) {
|
||||
sender.sendMessage(Messages.getPrefix() + " §aSuccessfully reloaded §6config.yml§a!");
|
||||
} else {
|
||||
sender.sendMessage(Messages.getPrefix()
|
||||
+ " §cCould not reload §6config.yml §7- §cCheck server logs for more information");
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(Messages.getString(Messages.NO_PERMISSION));
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("reset")) {
|
||||
if (sender.hasPermission(this.permsReset)) {
|
||||
int chairCount = getManager().destroyAll(true);
|
||||
|
||||
if (chairCount > 0) {
|
||||
sender.sendMessage(Messages.getPrefix() + " §aSuccessfully removed §6" + chairCount
|
||||
+ " players§a from their chairs");
|
||||
} else {
|
||||
sender.sendMessage(Messages.getPrefix() + " §4There are no chairs that could be removed");
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(Messages.getString(Messages.NO_PERMISSION));
|
||||
}
|
||||
} else {
|
||||
showHelp = true;
|
||||
}
|
||||
} else {
|
||||
showHelp = true;
|
||||
}
|
||||
|
||||
if (showHelp) {
|
||||
sender.sendMessage(Messages.getPrefix() + " §3/" + cmd.getName()
|
||||
+ " toggle §7(§eor §3/bct§7, §3/toggleChairs§7)"); // TODO: allow player(+ @a,@r,@p) as arg
|
||||
sender.sendMessage(Messages.getPrefix() + " §3/" + cmd.getName()
|
||||
+ " on§7/§3off §7(§eor §3/bct on§7/§3off§7)"); // TODO: allow player(+ @a,@r,@p) as arg
|
||||
sender.sendMessage(Messages.getPrefix() + " §3/" + cmd.getName() + " reload§7/§3rl");
|
||||
sender.sendMessage(
|
||||
Messages.getPrefix() + " §3/" + cmd.getName() + " reset"); // TODO: allow player(+ @a,@r,@p) as arg
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
List<String> result = new ArrayList<>();
|
||||
|
||||
if (!cmd.getName().equalsIgnoreCase("sit")) {
|
||||
if (args.length == 1) {
|
||||
String arg = args[0].toLowerCase();
|
||||
|
||||
if (sender.hasPermission(this.permsToggle)) {
|
||||
if ("toggle".startsWith(arg)) {
|
||||
result.add("toggle");
|
||||
}
|
||||
|
||||
if ("on".startsWith(arg)) {
|
||||
result.add("on");
|
||||
}
|
||||
|
||||
if ("off".startsWith(arg)) {
|
||||
result.add("off");
|
||||
}
|
||||
|
||||
if ("status".startsWith(arg)) {
|
||||
result.add("status");
|
||||
}
|
||||
}
|
||||
|
||||
if (!cmd.getName().equalsIgnoreCase("toggleChairs")) {
|
||||
if ("reload".startsWith(arg) && sender.hasPermission(this.permsReload)) {
|
||||
result.add("reload");
|
||||
}
|
||||
|
||||
if ("reset".startsWith(arg) && sender.hasPermission(this.permsReset)) {
|
||||
result.add("reset");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void handleToggleChairs(CommandSender sender) {
|
||||
handleToggleChairs(sender, sender instanceof Player && !getManager().hasChairsDisabled((Player) sender));
|
||||
}
|
||||
|
||||
private void handleToggleChairs(CommandSender sender, boolean disableChairs) {
|
||||
if (!sender.hasPermission(this.permsToggle)) {
|
||||
sender.sendMessage(Messages.getString(Messages.NO_PERMISSION));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(Messages.getPrefix() + " §cOnly players may toggle chairs");
|
||||
return;
|
||||
}
|
||||
|
||||
getManager().setChairsDisabled((Player) sender, disableChairs);
|
||||
|
||||
sender.sendMessage(Messages.getString(disableChairs ? Messages.TOGGLE_DISABLED : Messages.TOGGLE_ENABLED));
|
||||
}
|
||||
}
|
||||
-220
@@ -1,220 +0,0 @@
|
||||
package de.sprax2013.betterchairs;
|
||||
|
||||
import de.sprax2013.lime.spigot.LimeDevUtilitySpigot;
|
||||
import de.sprax2013.lime.spigot.nms.NmsVersionDetector;
|
||||
import de.tr7zw.changeme.nbtapi.utils.MinecraftVersion;
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
|
||||
import org.bukkit.material.Stairs;
|
||||
import org.bukkit.material.Step;
|
||||
import org.bukkit.material.WoodenStep;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class BetterChairsPlugin extends JavaPlugin {
|
||||
private static BetterChairsPlugin plugin;
|
||||
private static ChairManager chairManager;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
plugin = this;
|
||||
|
||||
LimeDevUtilitySpigot.init(this); // Initialize LimeDevUtility
|
||||
MinecraftVersion.disableUpdateCheck();
|
||||
MinecraftVersion.getLogger().setLevel(Level.WARNING); // Hide info messages from NBT-API
|
||||
|
||||
ChairNMS chairNMS = getNewNMSInstance();
|
||||
|
||||
if (chairNMS.getListener() != null) {
|
||||
Bukkit.getPluginManager().registerEvents(chairNMS.getListener(), this);
|
||||
}
|
||||
|
||||
// Should be initiated as soon as possible (required in API submodule)
|
||||
chairManager = new ChairManager(this, chairNMS);
|
||||
|
||||
// Init configuration files
|
||||
Settings.reload();
|
||||
Messages.reload();
|
||||
|
||||
// Start Updater
|
||||
new Updater(this);
|
||||
|
||||
// Register Bukkit Event Listener
|
||||
Bukkit.getPluginManager().registerEvents(new EventListener(), this);
|
||||
|
||||
// Register CommandExecutor
|
||||
BetterChairsCommand cmdExecutor = new BetterChairsCommand(this);
|
||||
getCommand(getName()).setExecutor(cmdExecutor);
|
||||
getCommand("toggleChairs").setExecutor(cmdExecutor);
|
||||
getCommand("sit").setExecutor(cmdExecutor);
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||
new PlaceholderApiExpansion(this).register();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
if (getManager() != null) {
|
||||
getManager().destroyAll(true, true);
|
||||
|
||||
for (Player online : Bukkit.getOnlinePlayers()) {
|
||||
getManager().onQuit(online.getUniqueId());
|
||||
}
|
||||
|
||||
Settings.reset();
|
||||
Messages.reset();
|
||||
}
|
||||
|
||||
chairManager = null;
|
||||
ChairManager.instance = null;
|
||||
ChairManager.plugin = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates an ChairNMS <i>class</i> depending on the server version
|
||||
*
|
||||
* @return new instance of {@code ChairNMS}, never null
|
||||
*/
|
||||
@NotNull
|
||||
private ChairNMS getNewNMSInstance() {
|
||||
String version = NmsVersionDetector.detect().orElse(null);
|
||||
|
||||
try {
|
||||
assert version != null;
|
||||
return (ChairNMS) Class.forName("betterchairs.nms." + version + "." + version)
|
||||
.getConstructors()[0]
|
||||
.newInstance();
|
||||
} catch (Exception ignore) {
|
||||
getLogger()
|
||||
.warning("Your server version (" + (version != null ? version : "UNKNOWN")
|
||||
+ ") is not fully supported - Loading fallback...");
|
||||
|
||||
// Loading fallback when NMS not available
|
||||
return new ChairNMS() {
|
||||
// Surrounding some code with try-catch because this is meant to be a fallback
|
||||
// So in theory it should even work on 1.4.7 servers (please don't try >_<)
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Entity spawnChairEntity(
|
||||
@NotNull Location loc, int regenerationAmplifier, boolean useArmorStand) {
|
||||
Entity chairEntity;
|
||||
|
||||
if (useArmorStand) {
|
||||
chairEntity = loc.getWorld().spawn(loc, ArmorStand.class);
|
||||
} else {
|
||||
chairEntity = loc.getWorld().spawn(loc, Arrow.class);
|
||||
}
|
||||
|
||||
ChairUtils.applyChairProtections(chairEntity);
|
||||
|
||||
// TODO: Support regeneration effect without overwriting #tick()
|
||||
|
||||
return chairEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void killChairEntity(@NotNull Entity entity) {
|
||||
entity.remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener getListener() {
|
||||
return new Listener() {
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
private void onManipulate(PlayerArmorStandManipulateEvent e) {
|
||||
if (getManager().isChair(e.getRightClicked())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
private void onDamage(EntityDamageEvent e) {
|
||||
if (e.getEntity() instanceof ArmorStand
|
||||
&& getManager().isChair(e.getEntity())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStair(@NotNull Block block) {
|
||||
return block.getState().getData() instanceof Stairs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStairUpsideDown(@NotNull Block block) {
|
||||
try {
|
||||
return ((Stairs) block.getState().getData()).isInverted();
|
||||
} catch (Exception ignore) {
|
||||
// Feature not supported on this version of the Bukkit-api
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public BlockFace getBlockRotation(@NotNull Block block) {
|
||||
return ChairUtils.getBlockRotationLegacy(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlab(@NotNull Block block) {
|
||||
return (block.getState().getData() instanceof Step
|
||||
|| block.getState().getData() instanceof WoodenStep)
|
||||
&& !block.getType().name().equals("DOUBLE_STEP")
|
||||
&& !block.getType().name().equals("WOOD_DOUBLE_STEP");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlabTop(@NotNull Block block) {
|
||||
if (block.getState().getData() instanceof Step) {
|
||||
return ((Step) block.getState().getData()).isInverted();
|
||||
} else if (block.getState().getData() instanceof WoodenStep) {
|
||||
return ((WoodenStep) block.getState().getData()).isInverted();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEmptyMainHand(@NotNull Player player) {
|
||||
return player.getInventory().getItemInHand().getType() == Material.AIR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChair(@NotNull Entity entity) {
|
||||
// We cannot check using NMS when fallback NMS does not use NMS to spawn an ArmorStand
|
||||
// Other plugins preventing our ArmorStand from spawning can thus not be prevented from such
|
||||
// behavior
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
protected static ChairManager getManager() {
|
||||
return chairManager;
|
||||
}
|
||||
|
||||
public static BetterChairsPlugin getInstance() {
|
||||
return plugin;
|
||||
}
|
||||
}
|
||||
-400
@@ -1,400 +0,0 @@
|
||||
package de.sprax2013.betterchairs;
|
||||
|
||||
import static de.sprax2013.betterchairs.BetterChairsPlugin.getInstance;
|
||||
import static de.sprax2013.betterchairs.BetterChairsPlugin.getManager;
|
||||
|
||||
import com.cryptomorin.xseries.XMaterial;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.spigotmc.event.entity.EntityDismountEvent;
|
||||
|
||||
public class EventListener implements Listener {
|
||||
private static final List<XMaterial> WALL_SIGN_MATERIALS = Arrays.asList(
|
||||
XMaterial.ACACIA_WALL_SIGN,
|
||||
XMaterial.BAMBOO_WALL_SIGN,
|
||||
XMaterial.BIRCH_WALL_SIGN,
|
||||
XMaterial.CHERRY_WALL_SIGN,
|
||||
XMaterial.CRIMSON_WALL_SIGN,
|
||||
XMaterial.DARK_OAK_WALL_SIGN,
|
||||
XMaterial.JUNGLE_WALL_SIGN,
|
||||
XMaterial.MANGROVE_WALL_SIGN,
|
||||
XMaterial.OAK_WALL_SIGN,
|
||||
XMaterial.SPRUCE_WALL_SIGN,
|
||||
XMaterial.WARPED_WALL_SIGN);
|
||||
|
||||
private List<Material> filteredMaterials;
|
||||
|
||||
public EventListener() {
|
||||
Runnable task = () -> {
|
||||
if (Settings.MATERIAL_FILTER_ENABLED.getValueAsBoolean()) {
|
||||
getMaterialFilter(); // Populate list to make sure invalid materials are logged
|
||||
}
|
||||
};
|
||||
|
||||
// Make sure that our list is up-to-date, after reloading the settings
|
||||
Settings.getConfig().addListener(() -> {
|
||||
this.filteredMaterials = null;
|
||||
|
||||
task.run();
|
||||
});
|
||||
|
||||
task.run();
|
||||
}
|
||||
|
||||
private List<Material> getMaterialFilter() {
|
||||
if (this.filteredMaterials == null) {
|
||||
this.filteredMaterials = new ArrayList<>();
|
||||
|
||||
List<String> names = Settings.MATERIAL_FILTER_NAMES.getValueAsStringList();
|
||||
if (names != null) {
|
||||
for (String name : names) {
|
||||
Optional<XMaterial> xMat = XMaterial.matchXMaterial(name);
|
||||
Material mat = null;
|
||||
|
||||
if (xMat.isPresent()) {
|
||||
mat = xMat.get().parseMaterial();
|
||||
}
|
||||
|
||||
if (mat != null) {
|
||||
this.filteredMaterials.add(mat);
|
||||
} else {
|
||||
ChairManager.getLogger()
|
||||
.warning(() -> "Invalid block type '" + name + "' in "
|
||||
+ Settings.MATERIAL_FILTER_NAMES.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this.filteredMaterials;
|
||||
}
|
||||
|
||||
/* Spawn and Destroy Chairs */
|
||||
|
||||
/**
|
||||
* If a player is interacting with a valid block to be used as a Chair,
|
||||
* we spawn a {@link Chair} and set the player as passenger of its {@link Entity}
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
private void onInteract(PlayerInteractEvent e) {
|
||||
if (e.isCancelled() && !Settings.IGNORES_INTERACT_PREVENTION.getValueAsBoolean()) return;
|
||||
if (e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
||||
|
||||
Chair chairTheCurrentPlayerIsSittingIn = getManager().getChair(e.getPlayer());
|
||||
|
||||
// Check Player
|
||||
if (!e.getClickedBlock().getWorld().equals(e.getPlayer().getLocation().getWorld())) return; // Happens sometimes
|
||||
if (e.getPlayer().isSneaking()) return;
|
||||
if (getManager().hasChairsDisabled(e.getPlayer())) return;
|
||||
if (chairTheCurrentPlayerIsSittingIn != null
|
||||
&& // This also destroys zombie chair on old spigot versions
|
||||
!Settings.ALLOW_SWITCHING_SEATS.getValueAsBoolean()) {
|
||||
return;
|
||||
}
|
||||
if (e.getPlayer().getVehicle() != null && !Settings.ALLOW_SWITCHING_SEATS.getValueAsBoolean())
|
||||
return; // Already sitting on something else
|
||||
if (!e.getPlayer().hasPermission(BetterChairsPlugin.getInstance().getName() + ".use")) return;
|
||||
if (Settings.NEEDS_EMPTY_HANDS.getValueAsBoolean()
|
||||
&& !getManager().chairNMS.hasEmptyMainHand(e.getPlayer())) return;
|
||||
|
||||
// Is world disabled?
|
||||
if (Settings.WORLD_FILTER_ENABLED.getValueAsBoolean()) {
|
||||
boolean worldInFilter = Objects.requireNonNull(Settings.WORLD_FILTER_NAMES.getValueAsStringList())
|
||||
.contains(e.getPlayer().getWorld().getName());
|
||||
|
||||
// World on Blacklist or not on Whitelist
|
||||
if (worldInFilter == Settings.WORLD_FILTER_AS_BLACKLIST.getValueAsBoolean()) return;
|
||||
}
|
||||
|
||||
/* Check Block */
|
||||
if ((!Settings.MATERIAL_FILTER_ENABLED.getValueAsBoolean()
|
||||
|| !Settings.MATERIAL_FILTER_ALLOW_ALL_TYPES.getValueAsBoolean())
|
||||
&& !getManager().chairNMS.isStair(e.getClickedBlock())
|
||||
&& !getManager().chairNMS.isSlab(e.getClickedBlock())) return; // Not a Stair or Slab
|
||||
|
||||
if (!e.getClickedBlock().getRelative(BlockFace.UP).isEmpty()
|
||||
&& Settings.CHAIR_NEED_AIR_ABOVE.getValueAsBoolean()) return; // Needs air above chair
|
||||
|
||||
if (e.getClickedBlock().getRelative(BlockFace.DOWN).isEmpty()
|
||||
&& !Settings.CHAIR_ALLOW_AIR_BELOW.getValueAsBoolean()) return; // Does not allow air below chair
|
||||
|
||||
// Block type disabled in config?
|
||||
if (!Settings.MATERIAL_FILTER_ENABLED.getValueAsBoolean()
|
||||
|| (Settings.MATERIAL_FILTER_ENABLED.getValueAsBoolean()
|
||||
&& !Settings.MATERIAL_FILTER_ALLOW_ALL_TYPES.getValueAsBoolean())) {
|
||||
if ((!Settings.USE_STAIRS.getValueAsBoolean()
|
||||
&& getManager().chairNMS.isStair(e.getClickedBlock()))
|
||||
|| (!Settings.USE_SLABS.getValueAsBoolean()
|
||||
&& getManager().chairNMS.isSlab(e.getClickedBlock()))) return;
|
||||
|
||||
if (getManager().chairNMS.isStair(e.getClickedBlock())
|
||||
&& getManager().chairNMS.isStairUpsideDown(e.getClickedBlock())) return; // Stair but upside down
|
||||
}
|
||||
|
||||
if (Settings.MATERIAL_FILTER_ENABLED.getValueAsBoolean()) {
|
||||
boolean blockInFilter =
|
||||
getMaterialFilter().contains(e.getClickedBlock().getType());
|
||||
|
||||
// Block type on Blacklist or not on Whitelist
|
||||
if (blockInFilter == Settings.MATERIAL_FILTER_AS_BLACKLIST.getValueAsBoolean()) return;
|
||||
}
|
||||
|
||||
// Check Chair
|
||||
if (getManager().isOccupied(e.getClickedBlock())) {
|
||||
if (Settings.MSG_ALREADY_OCCUPIED.getValueAsBoolean()
|
||||
&& (chairTheCurrentPlayerIsSittingIn == null
|
||||
|| !chairTheCurrentPlayerIsSittingIn.getBlock().equals(e.getClickedBlock()))) {
|
||||
e.getPlayer().sendMessage(Messages.getString(Messages.USE_ALREADY_OCCUPIED));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if Chair needs Signs
|
||||
if (Settings.NEEDS_SIGNS.getValueAsBoolean()) {
|
||||
BlockFace rotation = getManager().chairNMS.getBlockRotation(e.getClickedBlock());
|
||||
|
||||
BlockFace side1 =
|
||||
(rotation == BlockFace.NORTH || rotation == BlockFace.SOUTH) ? BlockFace.WEST : BlockFace.NORTH;
|
||||
BlockFace side2 =
|
||||
(rotation == BlockFace.NORTH || rotation == BlockFace.SOUTH) ? BlockFace.EAST : BlockFace.SOUTH;
|
||||
|
||||
Block block1 = e.getClickedBlock().getRelative(side1);
|
||||
Block block2 = e.getClickedBlock().getRelative(side2);
|
||||
|
||||
// Are WALL_SIGNs placed?
|
||||
if (!WALL_SIGN_MATERIALS.contains(XMaterial.matchXMaterial(block1.getType()))
|
||||
|| !WALL_SIGN_MATERIALS.contains(XMaterial.matchXMaterial(block2.getType()))) {
|
||||
if (Settings.MSG_NEEDS_SIGNS.getValueAsBoolean()) {
|
||||
e.getPlayer().sendMessage(Messages.getString(Messages.USE_NEEDS_SIGNS));
|
||||
}
|
||||
|
||||
return; // No
|
||||
}
|
||||
|
||||
// Block rotation changed between versions (both options needed for backwards compatibility)
|
||||
boolean signOption1 = side1
|
||||
!= getManager().chairNMS.getBlockRotation(block1).getOppositeFace()
|
||||
|| side2 != getManager().chairNMS.getBlockRotation(block2).getOppositeFace();
|
||||
boolean signOption2 = side2
|
||||
!= getManager().chairNMS.getBlockRotation(block1).getOppositeFace()
|
||||
|| side1 != getManager().chairNMS.getBlockRotation(block2).getOppositeFace();
|
||||
|
||||
// Are they attached to the chair?
|
||||
if (!signOption1 && !signOption2) {
|
||||
if (Settings.MSG_NEEDS_SIGNS.getValueAsBoolean()) {
|
||||
e.getPlayer().sendMessage(Messages.getString(Messages.USE_NEEDS_SIGNS));
|
||||
}
|
||||
|
||||
return; // No
|
||||
}
|
||||
}
|
||||
|
||||
// Check the distance to the chair
|
||||
if (Settings.ALLOWED_DISTANCE_TO_CHAIR.getValueAsInt() > 0
|
||||
&& e.getPlayer()
|
||||
.getLocation()
|
||||
.distance(e.getClickedBlock()
|
||||
.getLocation()
|
||||
// Use block center for distance calculation
|
||||
.add(
|
||||
e.getClickedBlock().getX() > 0 ? 0.5 : -0.5,
|
||||
0,
|
||||
e.getClickedBlock().getZ() > 0 ? 0.5 : -0.5))
|
||||
> Settings.ALLOWED_DISTANCE_TO_CHAIR.getValueAsInt()) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean createChairOnNextTick = false;
|
||||
|
||||
Chair currentChair = getManager().getChair(e.getPlayer());
|
||||
if (currentChair != null) {
|
||||
createChairOnNextTick = true;
|
||||
getManager().destroy(currentChair, true, true);
|
||||
}
|
||||
|
||||
Runnable createChairTask = () -> {
|
||||
// Spawn Chair
|
||||
if (getManager().create(e.getPlayer(), e.getClickedBlock())) {
|
||||
e.setCancelled(true);
|
||||
|
||||
if (Settings.MSG_NOW_SITTING.getValueAsBoolean()) {
|
||||
e.getPlayer().sendMessage(Messages.getString(Messages.USE_NOW_SITTING));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (createChairOnNextTick) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(getInstance(), createChairTask);
|
||||
} else {
|
||||
createChairTask.run();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This Event only works in latest spigot-1.8.8 and newer
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
private void onDismount(EntityDismountEvent e) {
|
||||
Chair c = getManager().getChair(e.getDismounted());
|
||||
|
||||
if (c != null) {
|
||||
getManager().destroy(c, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a player is sitting on a chair when logging out<br>
|
||||
* Using {@link EventPriority#LOWEST} so other plugins have the right {@link Location}
|
||||
* after the player leaving the chair
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
private void onQuit(PlayerQuitEvent e) {
|
||||
Entity vehicle = e.getPlayer().getVehicle();
|
||||
|
||||
Chair c = getManager().getChair(vehicle);
|
||||
|
||||
if (c != null) {
|
||||
getManager().destroy(c, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
private void onQuitMonitor(PlayerQuitEvent e) {
|
||||
getManager().onQuit(e.getPlayer().getUniqueId());
|
||||
}
|
||||
|
||||
/* Protect Chairs */
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onEntitySpawn(EntitySpawnEvent e) {
|
||||
if (!e.isCancelled()) return;
|
||||
|
||||
if (getManager().isChair(e.getEntity())) {
|
||||
e.setCancelled(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent a chair's Entity to be teleported by accident
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
private void onTeleport(EntityTeleportEvent e) {
|
||||
if (getManager().isChair(e.getEntity())) {
|
||||
// We don't want our Entity used as a chair to be teleported by accident
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if another plugin insists on a chair's Entity to be teleported<br>
|
||||
* if so, destroy the chair
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
private void onTeleportMonitor(EntityTeleportEvent e) {
|
||||
Chair chair = getManager().getChair(e.getEntity());
|
||||
|
||||
if (chair != null) {
|
||||
getManager().destroy(chair, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Protect a chair's block from being destroyed while a player is sitting on it
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
private void onBlockBreak(BlockBreakEvent e) {
|
||||
if (getManager().isOccupied(e.getBlock())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if another plugin insists on breaking a chair's block<br>
|
||||
* if so, destroy the chair too
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
private void onBlockBreakMonitor(BlockBreakEvent e) {
|
||||
Chair chair = getManager().getChair(e.getBlock());
|
||||
|
||||
if (chair != null) {
|
||||
getManager().destroy(chair, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a piston tries to move a chair's block
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
private void onPistonExtend(BlockPistonExtendEvent e) {
|
||||
for (Block b : e.getBlocks()) {
|
||||
if (getManager().isOccupied(b)) {
|
||||
e.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if another plugin insists on a chair's block being moved by an piston<br>
|
||||
* if so, destroy the chair
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
private void onPistonExtendMonitor(BlockPistonExtendEvent e) {
|
||||
for (Block b : e.getBlocks()) {
|
||||
Chair chair = getManager().getChair(b);
|
||||
|
||||
if (chair != null) {
|
||||
getManager().destroy(chair, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a piston tries to move a chair's block
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
private void onPistonRetract(BlockPistonRetractEvent e) {
|
||||
for (Block b : e.getBlocks()) {
|
||||
if (getManager().isOccupied(b)) {
|
||||
e.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if another plugin insists on a chair's block being moved by an piston<br>
|
||||
* if so, destroy the chair
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
private void onPistonRetractMonitor(BlockPistonRetractEvent e) {
|
||||
for (Block b : e.getBlocks()) {
|
||||
Chair chair = getManager().getChair(b);
|
||||
|
||||
if (chair != null) {
|
||||
getManager().destroy(chair, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
package de.sprax2013.betterchairs;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PlaceholderApiExpansion extends PlaceholderExpansion {
|
||||
private final BetterChairsPlugin plugin;
|
||||
|
||||
public PlaceholderApiExpansion(BetterChairsPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getIdentifier() {
|
||||
return this.plugin.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getVersion() {
|
||||
return "1.0.0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getAuthor() {
|
||||
return this.plugin.getDescription().getAuthors().get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean persist() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<String> getPlaceholders() {
|
||||
return Arrays.asList("chairs_enabled", "sitting");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onRequest(OfflinePlayer player, @NotNull String placeholder) {
|
||||
if (placeholder.equalsIgnoreCase("chairs_enabled")) {
|
||||
if (ChairManager.getInstance() == null) {
|
||||
return Boolean.TRUE.toString();
|
||||
}
|
||||
|
||||
return Boolean.valueOf(!ChairManager.getInstance().hasChairsDisabled(player))
|
||||
.toString();
|
||||
}
|
||||
|
||||
if (placeholder.equalsIgnoreCase("sitting")) {
|
||||
if (ChairManager.getInstance() == null || player.getPlayer() == null) {
|
||||
return Boolean.FALSE.toString();
|
||||
}
|
||||
|
||||
return Boolean.valueOf(ChairManager.getInstance().getChair(player.getPlayer()) != null)
|
||||
.toString();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
-225
@@ -1,225 +0,0 @@
|
||||
package de.sprax2013.betterchairs;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
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.server.PluginDisableEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class Updater implements Listener {
|
||||
public static final String VERSION_TXT_URL = "https://spraxdev.github.io/BetterChairs/version.txt";
|
||||
|
||||
public static final String MODRINTH_URL = "https://modrinth.com/plugin/betterchairs";
|
||||
public static final String HANGAR_URL = "https://hangar.papermc.io/Sprax/BetterChairs";
|
||||
public static final String SPIGOT_MC_URL = "https://r.spiget.org/84809";
|
||||
public static final String GITHUB_URL = "https://github.com/SpraxDev/BetterChairs/releases";
|
||||
|
||||
public static final String CHANGELOG_URL = "https://github.com/SpraxDev/BetterChairs/blob/main/CHANGELOG.md";
|
||||
|
||||
private final JavaPlugin plugin;
|
||||
|
||||
private Timer timer;
|
||||
private String newerVersion;
|
||||
|
||||
public Updater(JavaPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
Settings.getConfig().addListener(this::reInit);
|
||||
|
||||
reInit();
|
||||
}
|
||||
|
||||
private void reInit() {
|
||||
if (Settings.UPDATER_ENABLED.getValueAsBoolean()) {
|
||||
if (this.timer != null) return;
|
||||
|
||||
this.timer = new Timer(true);
|
||||
this.timer.scheduleAtFixedRate(
|
||||
new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Updater.this.plugin.isEnabled() && Settings.UPDATER_ENABLED.getValueAsBoolean()) {
|
||||
try {
|
||||
checkForUpdates();
|
||||
} catch (Exception ex) {
|
||||
ChairManager.getLogger()
|
||||
.warning("Could not check for updates"
|
||||
+ (ex.getMessage() == null ? "!" : ": " + ex.getMessage()));
|
||||
}
|
||||
} else {
|
||||
Updater.this.timer.cancel();
|
||||
}
|
||||
}
|
||||
},
|
||||
2000,
|
||||
1000 * 60 * 60 * 3); // Check every 3h
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(this, this.plugin);
|
||||
} else if (this.timer != null) {
|
||||
// Stop Update-Timer
|
||||
HandlerList.unregisterAll(this);
|
||||
this.timer.cancel();
|
||||
this.timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void checkForUpdates() throws IOException {
|
||||
URL website = new URL(VERSION_TXT_URL);
|
||||
URLConnection connection = website.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
|
||||
StringBuilder versionTxt = new StringBuilder();
|
||||
|
||||
String inputLine;
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
versionTxt.append(inputLine.trim());
|
||||
}
|
||||
in.close();
|
||||
|
||||
String versionStr = versionTxt.toString().split("\n")[0];
|
||||
String currVersion = this.plugin.getDescription().getVersion();
|
||||
|
||||
if (isNewerVersion(currVersion, versionStr)) {
|
||||
this.newerVersion = versionStr;
|
||||
|
||||
ChairManager.getLogger()
|
||||
.info(() -> String.format(
|
||||
"Found a new update v%s -> v%s — Download the update from: %nmodrinth: %s%nHangar: %s%nSpigotMC: %s%nGitHub: %s%n%nChangelog: %s",
|
||||
currVersion,
|
||||
versionStr,
|
||||
MODRINTH_URL,
|
||||
HANGAR_URL,
|
||||
SPIGOT_MC_URL,
|
||||
GITHUB_URL,
|
||||
getChangelogUrl(versionStr)));
|
||||
} else {
|
||||
this.newerVersion = null;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onJoin(PlayerJoinEvent e) {
|
||||
if (this.newerVersion == null) return;
|
||||
if (!Settings.UPDATER_ENABLED.getValueAsBoolean()) return;
|
||||
if (!Settings.UPDATER_NOTIFY_ON_JOIN.getValueAsBoolean()) return;
|
||||
if (!e.getPlayer().hasPermission(this.plugin.getName() + ".updater")) return;
|
||||
|
||||
e.getPlayer()
|
||||
.spigot()
|
||||
.sendMessage(new ComponentBuilder("[")
|
||||
.color(ChatColor.GRAY)
|
||||
.append(BetterChairsPlugin.getInstance().getName())
|
||||
.color(ChatColor.GOLD)
|
||||
.append("] ")
|
||||
.color(ChatColor.GRAY)
|
||||
.append("Found a new update v"
|
||||
+ this.plugin.getDescription().getVersion() + " -> v" + this.newerVersion)
|
||||
.color(ChatColor.YELLOW)
|
||||
.append(" [modrinth] ")
|
||||
.color(ChatColor.GREEN)
|
||||
.event(new ClickEvent(ClickEvent.Action.OPEN_URL, MODRINTH_URL))
|
||||
.event(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
TextComponent.fromLegacyText("§2Click to visit the download page on modrinth")))
|
||||
.append(" [Hangar] ")
|
||||
.color(ChatColor.GREEN)
|
||||
.event(new ClickEvent(ClickEvent.Action.OPEN_URL, HANGAR_URL))
|
||||
.event(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
TextComponent.fromLegacyText("§2Click to visit the download page on Hangar")))
|
||||
.append(" [SpigotMC] ")
|
||||
.color(ChatColor.GREEN)
|
||||
.event(new ClickEvent(ClickEvent.Action.OPEN_URL, SPIGOT_MC_URL))
|
||||
.event(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
TextComponent.fromLegacyText("§2Click to visit the download page on SpigotMC")))
|
||||
.append("[GitHub] ")
|
||||
.color(ChatColor.GREEN)
|
||||
.event(new ClickEvent(ClickEvent.Action.OPEN_URL, GITHUB_URL))
|
||||
.event(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
TextComponent.fromLegacyText("§2Click to visit the download page on GitHub")))
|
||||
.append("[Changelog]")
|
||||
.color(ChatColor.DARK_GREEN)
|
||||
.event(new ClickEvent(ClickEvent.Action.OPEN_URL, getChangelogUrl(this.newerVersion)))
|
||||
.event(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
TextComponent.fromLegacyText("§aClick to see the Changelogs at GitHub.com")))
|
||||
.create());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onPluginDisable(PluginDisableEvent e) {
|
||||
if (e.getPlugin() == this.plugin) {
|
||||
this.timer.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if {@code ver1} is newer that {@code ver2}.<br>
|
||||
* Expects <a href="https://semver.org/">SemVer</a>
|
||||
*
|
||||
* @return true, if {@code ver1} is newer than {@code ver2}, false otherwise
|
||||
*/
|
||||
public boolean isNewerVersion(String ver1, String ver2) {
|
||||
int[] ver1Num;
|
||||
int[] ver2Num;
|
||||
|
||||
String[] ver1Args = ver1.split("-")[0].split("\\.");
|
||||
String[] ver2Args = ver2.split("-")[0].split("\\.");
|
||||
|
||||
ver1Num = new int[ver1Args.length];
|
||||
for (int i = 0; i < ver1Args.length; i++) {
|
||||
ver1Num[i] = Integer.parseInt(ver1Args[i]);
|
||||
}
|
||||
|
||||
ver2Num = new int[ver2Args.length];
|
||||
for (int i = 0; i < ver2Args.length; i++) {
|
||||
ver2Num[i] = Integer.parseInt(ver2Args[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < Math.max(ver1Num.length, ver2Num.length); i++) {
|
||||
int left = i < ver1Num.length ? ver1Num[i] : 0;
|
||||
int right = i < ver2Num.length ? ver2Num[i] : 0;
|
||||
|
||||
if (left != right) {
|
||||
return left < right;
|
||||
}
|
||||
}
|
||||
|
||||
if (ver1.contains("-")) {
|
||||
if (!ver2.contains("-"))
|
||||
return true; // true, if they have same SemVer but ver1 has a suffix attached while ver2 does not
|
||||
|
||||
String suffix1 = ver1.substring(ver1.lastIndexOf('-'));
|
||||
String suffix2 = ver2.substring(ver2.lastIndexOf('-'));
|
||||
|
||||
return !suffix1.equals(suffix2); // true, if versions have suffix like '-SNAPSHOT' while being same SemVer
|
||||
}
|
||||
|
||||
return false; // Same version
|
||||
}
|
||||
|
||||
private static String getChangelogUrl(@Nullable String semVersion) {
|
||||
if (semVersion != null) {
|
||||
return CHANGELOG_URL + "#version-" + semVersion.replace(".", "");
|
||||
}
|
||||
|
||||
return CHANGELOG_URL;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,2 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
|
||||
Binary file not shown.
@@ -1,2 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="output" path="bin/default"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
|
||||
</classpath>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>nms</name>
|
||||
<comment></comment>
|
||||
<projects/>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<linkedResources/>
|
||||
<filteredResources/>
|
||||
</projectDescription>
|
||||
@@ -1,13 +0,0 @@
|
||||
#
|
||||
#Wed Jul 02 05:13:18 EDT 2025
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
|
||||
org.eclipse.jdt.core.compiler.source=17
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.compliance=17
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
@@ -1,96 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="output" path="bin/default"/>
|
||||
<classpathentry output="bin/main" kind="src" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="main"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/spigotmc/spigot-api/1.10.2-R0.1-SNAPSHOT/spigot-api-1.10.2-R0.1-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/spigotmc/spigot/1.10.2-R0.1-SNAPSHOT/spigot-1.10.2-R0.1-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/de/sprax2013/lime/lime-spigot-api/0.0.4-SNAPSHOT/lime-spigot-api-0.0.4-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry sourcepath="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/de.tr7zw/item-nbt-api/2.15.0/29689f4d8039bc2abf8e5562c5c09927f9bfc51f/item-nbt-api-2.15.0-sources.jar" kind="lib" path="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/de.tr7zw/item-nbt-api/2.15.0/52fa821ba619524cac58be6d7260e72b42ae3a0a/item-nbt-api-2.15.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry sourcepath="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/com.github.cryptomorin/XSeries/13.3.0/d079530d2976ecfae96e2e132e9b8323738d6b02/XSeries-13.3.0-sources.jar" kind="lib" path="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/com.github.cryptomorin/XSeries/13.3.0/d664a667493ae640b7a62c8add20572437a4f52d/XSeries-13.3.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/net/md-5/bungeecord-chat/1.10-SNAPSHOT/bungeecord-chat-1.10-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/google/code/gson/gson/2.3.1/gson-2.3.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/avaje/ebean/2.8.1/ebean-2.8.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/de/sprax2013/lime/lime-api/0.0.4-SNAPSHOT/lime-api-0.0.4-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/yaml/snakeyaml/1.33/snakeyaml-1.33.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/jetbrains/annotations/24.1.0/annotations-24.1.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/junit/junit/4.10/junit-4.10.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
</classpath>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>betterchairs-v1_10_R1</name>
|
||||
<comment></comment>
|
||||
<projects/>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<linkedResources/>
|
||||
<filteredResources/>
|
||||
</projectDescription>
|
||||
@@ -1,13 +0,0 @@
|
||||
#
|
||||
#Wed Jul 02 05:13:18 EDT 2025
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
|
||||
org.eclipse.jdt.core.compiler.source=17
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.compliance=17
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
-67
@@ -1,67 +0,0 @@
|
||||
package betterchairs.nms.v1_10_R1;
|
||||
|
||||
import de.sprax2013.betterchairs.ChairUtils;
|
||||
import de.sprax2013.betterchairs.CustomChairEntity;
|
||||
import net.minecraft.server.v1_10_R1.Entity;
|
||||
import net.minecraft.server.v1_10_R1.EntityArmorStand;
|
||||
import net.minecraft.server.v1_10_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_10_R1.World;
|
||||
import org.bukkit.Location;
|
||||
|
||||
class CustomArmorStand extends EntityArmorStand implements CustomChairEntity {
|
||||
private boolean remove = false;
|
||||
private final int regenerationAmplifier;
|
||||
|
||||
private final Location expectedLocation;
|
||||
|
||||
/**
|
||||
* @param regenerationAmplifier provide a negative value to disable regeneration
|
||||
*/
|
||||
public CustomArmorStand(World world, double d0, double d1, double d2, int regenerationAmplifier) {
|
||||
super(world, d0, d1, d2);
|
||||
|
||||
this.regenerationAmplifier = regenerationAmplifier;
|
||||
this.expectedLocation = new Location(null, d0, d1, d2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markAsRemoved() {
|
||||
this.remove = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void g(float f, float f2) {
|
||||
if (this.remove) return; // If the ArmorStand is being removed, no need to bother
|
||||
if (this.ticksLived % 10 == 0) return; // Only run every 10 ticks
|
||||
|
||||
Entity passenger = this.passengers.isEmpty() ? null : this.passengers.get(0);
|
||||
|
||||
if (!(passenger instanceof EntityHuman)) {
|
||||
this.remove = true;
|
||||
this.getBukkitEntity().remove();
|
||||
return;
|
||||
}
|
||||
|
||||
// Rotate the ArmorStand together with its passenger
|
||||
this.setYawPitch(passenger.yaw, 0);
|
||||
|
||||
if (ChairUtils.didChairEntityMove(this.expectedLocation, this.locX, this.locY, this.locZ)) {
|
||||
this.enderTeleportTo(
|
||||
this.expectedLocation.getX(),
|
||||
Math.min(this.locY, this.expectedLocation.getY()),
|
||||
this.expectedLocation.getZ());
|
||||
}
|
||||
|
||||
ChairUtils.applyRegeneration(((EntityHuman) passenger).getBukkitEntity(), this.regenerationAmplifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevents the ArmorStand from getting killed unexpectedly
|
||||
if (shouldDie()) super.die();
|
||||
}
|
||||
|
||||
private boolean shouldDie() {
|
||||
return this.remove || this.passengers.isEmpty() || !(this.passengers.get(0) instanceof EntityHuman);
|
||||
}
|
||||
}
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
package betterchairs.nms.v1_10_R1;
|
||||
|
||||
import de.sprax2013.betterchairs.ChairUtils;
|
||||
import de.sprax2013.betterchairs.CustomChairEntity;
|
||||
import net.minecraft.server.v1_10_R1.Entity;
|
||||
import net.minecraft.server.v1_10_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_10_R1.EntityTippedArrow;
|
||||
import net.minecraft.server.v1_10_R1.World;
|
||||
|
||||
class CustomArrow extends EntityTippedArrow implements CustomChairEntity {
|
||||
private boolean remove = false;
|
||||
private final int regenerationAmplifier;
|
||||
|
||||
/**
|
||||
* @param regenerationAmplifier provide a negative value to disable regeneration
|
||||
*/
|
||||
public CustomArrow(World world, double d0, double d1, double d2, int regenerationAmplifier) {
|
||||
super(world, d0, d1, d2);
|
||||
|
||||
this.regenerationAmplifier = regenerationAmplifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markAsRemoved() {
|
||||
this.remove = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void m() {
|
||||
if (this.remove) return; // If the entity is being removed, no need to bother
|
||||
if (this.ticksLived % 10 == 0) return; // Only run every 10 ticks
|
||||
|
||||
Entity passenger = this.passengers.isEmpty() ? null : this.passengers.get(0);
|
||||
|
||||
if (!(passenger instanceof EntityHuman)) {
|
||||
this.remove = true;
|
||||
this.getBukkitEntity().remove();
|
||||
return;
|
||||
}
|
||||
|
||||
// Rotate the entity together with its passenger
|
||||
this.setYawPitch(passenger.yaw, 0);
|
||||
|
||||
ChairUtils.applyRegeneration(((EntityHuman) passenger).getBukkitEntity(), this.regenerationAmplifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevents the ArmorStand from getting killed unexpectedly
|
||||
if (shouldDie()) super.die();
|
||||
}
|
||||
|
||||
private boolean shouldDie() {
|
||||
return this.remove || this.passengers.isEmpty() || !(this.passengers.get(0) instanceof EntityHuman);
|
||||
}
|
||||
}
|
||||
-103
@@ -1,103 +0,0 @@
|
||||
package betterchairs.nms.v1_10_R1;
|
||||
|
||||
import de.sprax2013.betterchairs.ChairManager;
|
||||
import de.sprax2013.betterchairs.ChairNMS;
|
||||
import de.sprax2013.betterchairs.ChairUtils;
|
||||
import de.sprax2013.betterchairs.CustomChairEntity;
|
||||
import de.sprax2013.betterchairs.Messages;
|
||||
import java.util.Objects;
|
||||
import net.minecraft.server.v1_10_R1.Entity;
|
||||
import net.minecraft.server.v1_10_R1.WorldServer;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.material.Stairs;
|
||||
import org.bukkit.material.Step;
|
||||
import org.bukkit.material.WoodenStep;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class v1_10_R1 extends ChairNMS {
|
||||
@Override
|
||||
public @NotNull org.bukkit.entity.Entity spawnChairEntity(
|
||||
@NotNull Location loc, int regenerationAmplifier, boolean useArmorStand) {
|
||||
WorldServer nmsWorld = ((CraftWorld) Objects.requireNonNull(loc.getWorld())).getHandle();
|
||||
|
||||
Entity nmsEntity;
|
||||
|
||||
if (useArmorStand) {
|
||||
nmsEntity = new CustomArmorStand(nmsWorld, loc.getX(), loc.getY(), loc.getZ(), regenerationAmplifier);
|
||||
} else {
|
||||
nmsEntity = new CustomArrow(nmsWorld, loc.getX(), loc.getY() + .3, loc.getZ() + .25, regenerationAmplifier);
|
||||
}
|
||||
|
||||
org.bukkit.entity.Entity bukkitEntity = nmsEntity.getBukkitEntity();
|
||||
|
||||
ChairUtils.applyChairProtections(bukkitEntity);
|
||||
|
||||
if (!nmsWorld.addEntity(nmsEntity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
|
||||
ChairManager.getLogger().warning(Messages.ERR_ANOTHER_PLUGIN_PREVENTING_SPAWN);
|
||||
}
|
||||
|
||||
return bukkitEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void killChairEntity(@NotNull org.bukkit.entity.Entity entity) {
|
||||
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||
|
||||
if (!(nmsEntity instanceof CustomChairEntity)) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(Messages.ERR_NOT_CUSTOM_ENTITY, CustomChairEntity.class.getName()));
|
||||
}
|
||||
|
||||
((CustomChairEntity) nmsEntity).markAsRemoved();
|
||||
entity.remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStair(@NotNull Block block) {
|
||||
return block.getState().getData() instanceof Stairs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStairUpsideDown(@NotNull Block block) {
|
||||
return ((Stairs) block.getState().getData()).isInverted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull BlockFace getBlockRotation(@NotNull Block block) {
|
||||
return ChairUtils.getBlockRotationLegacy(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlab(@NotNull Block block) {
|
||||
return (block.getState().getData() instanceof Step || block.getState().getData() instanceof WoodenStep)
|
||||
&& block.getType() != Material.DOUBLE_STEP
|
||||
&& block.getType() != Material.WOOD_DOUBLE_STEP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlabTop(@NotNull Block block) {
|
||||
if (block.getState().getData() instanceof Step) {
|
||||
return ((Step) block.getState().getData()).isInverted();
|
||||
}
|
||||
|
||||
return ((WoodenStep) block.getState().getData()).isInverted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEmptyMainHand(@NotNull Player player) {
|
||||
return player.getInventory().getItemInMainHand().getType() == Material.AIR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChair(@NotNull org.bukkit.entity.Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle() instanceof CustomChairEntity;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,2 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="output" path="bin/default"/>
|
||||
<classpathentry output="bin/main" kind="src" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="main"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/spigotmc/spigot-api/1.11.2-R0.1-SNAPSHOT/spigot-api-1.11.2-R0.1-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/spigotmc/spigot/1.11.2-R0.1-SNAPSHOT/spigot-1.11.2-R0.1-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/de/sprax2013/lime/lime-spigot-api/0.0.4-SNAPSHOT/lime-spigot-api-0.0.4-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry sourcepath="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/de.tr7zw/item-nbt-api/2.15.0/29689f4d8039bc2abf8e5562c5c09927f9bfc51f/item-nbt-api-2.15.0-sources.jar" kind="lib" path="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/de.tr7zw/item-nbt-api/2.15.0/52fa821ba619524cac58be6d7260e72b42ae3a0a/item-nbt-api-2.15.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry sourcepath="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/com.github.cryptomorin/XSeries/13.3.0/d079530d2976ecfae96e2e132e9b8323738d6b02/XSeries-13.3.0-sources.jar" kind="lib" path="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/com.github.cryptomorin/XSeries/13.3.0/d664a667493ae640b7a62c8add20572437a4f52d/XSeries-13.3.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/net/md-5/bungeecord-chat/1.10-SNAPSHOT/bungeecord-chat-1.10-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/google/code/gson/gson/2.3.1/gson-2.3.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/avaje/ebean/2.8.1/ebean-2.8.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/de/sprax2013/lime/lime-api/0.0.4-SNAPSHOT/lime-api-0.0.4-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/yaml/snakeyaml/1.33/snakeyaml-1.33.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/jetbrains/annotations/24.1.0/annotations-24.1.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/junit/junit/4.10/junit-4.10.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
</classpath>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>betterchairs-v1_11_R1</name>
|
||||
<comment></comment>
|
||||
<projects/>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<linkedResources/>
|
||||
<filteredResources/>
|
||||
</projectDescription>
|
||||
@@ -1,13 +0,0 @@
|
||||
#
|
||||
#Wed Jul 02 05:13:18 EDT 2025
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
|
||||
org.eclipse.jdt.core.compiler.source=17
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.compliance=17
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
-67
@@ -1,67 +0,0 @@
|
||||
package betterchairs.nms.v1_11_R1;
|
||||
|
||||
import de.sprax2013.betterchairs.ChairUtils;
|
||||
import de.sprax2013.betterchairs.CustomChairEntity;
|
||||
import net.minecraft.server.v1_11_R1.Entity;
|
||||
import net.minecraft.server.v1_11_R1.EntityArmorStand;
|
||||
import net.minecraft.server.v1_11_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_11_R1.World;
|
||||
import org.bukkit.Location;
|
||||
|
||||
class CustomArmorStand extends EntityArmorStand implements CustomChairEntity {
|
||||
private boolean remove = false;
|
||||
private final int regenerationAmplifier;
|
||||
|
||||
private final Location expectedLocation;
|
||||
|
||||
/**
|
||||
* @param regenerationAmplifier provide a negative value to disable regeneration
|
||||
*/
|
||||
public CustomArmorStand(World world, double d0, double d1, double d2, int regenerationAmplifier) {
|
||||
super(world, d0, d1, d2);
|
||||
|
||||
this.regenerationAmplifier = regenerationAmplifier;
|
||||
this.expectedLocation = new Location(null, d0, d1, d2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markAsRemoved() {
|
||||
this.remove = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void g(float f, float f2) {
|
||||
if (this.remove) return; // If the ArmorStand is being removed, no need to bother
|
||||
if (this.ticksLived % 10 == 0) return; // Only run every 10 ticks
|
||||
|
||||
Entity passenger = this.passengers.isEmpty() ? null : this.passengers.get(0);
|
||||
|
||||
if (!(passenger instanceof EntityHuman)) {
|
||||
this.remove = true;
|
||||
this.getBukkitEntity().remove();
|
||||
return;
|
||||
}
|
||||
|
||||
// Rotate the ArmorStand together with its passenger
|
||||
this.setYawPitch(passenger.yaw, 0);
|
||||
|
||||
if (ChairUtils.didChairEntityMove(this.expectedLocation, this.locX, this.locY, this.locZ)) {
|
||||
this.enderTeleportTo(
|
||||
this.expectedLocation.getX(),
|
||||
Math.min(this.locY, this.expectedLocation.getY()),
|
||||
this.expectedLocation.getZ());
|
||||
}
|
||||
|
||||
ChairUtils.applyRegeneration(((EntityHuman) passenger).getBukkitEntity(), this.regenerationAmplifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevents the ArmorStand from getting killed unexpectedly
|
||||
if (shouldDie()) super.die();
|
||||
}
|
||||
|
||||
private boolean shouldDie() {
|
||||
return this.remove || this.passengers.isEmpty() || !(this.passengers.get(0) instanceof EntityHuman);
|
||||
}
|
||||
}
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
package betterchairs.nms.v1_11_R1;
|
||||
|
||||
import de.sprax2013.betterchairs.ChairUtils;
|
||||
import de.sprax2013.betterchairs.CustomChairEntity;
|
||||
import net.minecraft.server.v1_11_R1.Entity;
|
||||
import net.minecraft.server.v1_11_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_11_R1.EntityTippedArrow;
|
||||
import net.minecraft.server.v1_11_R1.World;
|
||||
|
||||
class CustomArrow extends EntityTippedArrow implements CustomChairEntity {
|
||||
private boolean remove = false;
|
||||
private final int regenerationAmplifier;
|
||||
|
||||
/**
|
||||
* @param regenerationAmplifier provide a negative value to disable regeneration
|
||||
*/
|
||||
public CustomArrow(World world, double d0, double d1, double d2, int regenerationAmplifier) {
|
||||
super(world, d0, d1, d2);
|
||||
|
||||
this.regenerationAmplifier = regenerationAmplifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markAsRemoved() {
|
||||
this.remove = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void A_() {
|
||||
if (this.remove) return; // If the entity is being removed, no need to bother
|
||||
if (this.ticksLived % 10 == 0) return; // Only run every 10 ticks
|
||||
|
||||
Entity passenger = this.passengers.isEmpty() ? null : this.passengers.get(0);
|
||||
|
||||
if (!(passenger instanceof EntityHuman)) {
|
||||
this.remove = true;
|
||||
this.getBukkitEntity().remove();
|
||||
return;
|
||||
}
|
||||
|
||||
// Rotate the entity together with its passenger
|
||||
this.setYawPitch(passenger.yaw, 0);
|
||||
|
||||
ChairUtils.applyRegeneration(((EntityHuman) passenger).getBukkitEntity(), this.regenerationAmplifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevents the ArmorStand from getting killed unexpectedly
|
||||
if (shouldDie()) super.die();
|
||||
}
|
||||
|
||||
private boolean shouldDie() {
|
||||
return this.remove || this.passengers.isEmpty() || !(this.passengers.get(0) instanceof EntityHuman);
|
||||
}
|
||||
}
|
||||
-104
@@ -1,104 +0,0 @@
|
||||
package betterchairs.nms.v1_11_R1;
|
||||
|
||||
import de.sprax2013.betterchairs.ChairManager;
|
||||
import de.sprax2013.betterchairs.ChairNMS;
|
||||
import de.sprax2013.betterchairs.ChairUtils;
|
||||
import de.sprax2013.betterchairs.CustomChairEntity;
|
||||
import de.sprax2013.betterchairs.Messages;
|
||||
import java.util.Objects;
|
||||
import net.minecraft.server.v1_11_R1.Entity;
|
||||
import net.minecraft.server.v1_11_R1.WorldServer;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.material.Stairs;
|
||||
import org.bukkit.material.Step;
|
||||
import org.bukkit.material.WoodenStep;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class v1_11_R1 extends ChairNMS {
|
||||
@Override
|
||||
@NotNull
|
||||
public org.bukkit.entity.Entity spawnChairEntity(
|
||||
@NotNull Location loc, int regenerationAmplifier, boolean useArmorStand) {
|
||||
WorldServer nmsWorld = ((CraftWorld) Objects.requireNonNull(loc.getWorld())).getHandle();
|
||||
|
||||
Entity nmsEntity;
|
||||
|
||||
if (useArmorStand) {
|
||||
nmsEntity = new CustomArmorStand(nmsWorld, loc.getX(), loc.getY(), loc.getZ(), regenerationAmplifier);
|
||||
} else {
|
||||
nmsEntity = new CustomArrow(nmsWorld, loc.getX(), loc.getY() + .3, loc.getZ() + .25, regenerationAmplifier);
|
||||
}
|
||||
|
||||
org.bukkit.entity.Entity bukkitEntity = nmsEntity.getBukkitEntity();
|
||||
|
||||
ChairUtils.applyChairProtections(bukkitEntity);
|
||||
|
||||
if (!nmsWorld.addEntity(nmsEntity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
|
||||
ChairManager.getLogger().warning(Messages.ERR_ANOTHER_PLUGIN_PREVENTING_SPAWN);
|
||||
}
|
||||
|
||||
return bukkitEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void killChairEntity(@NotNull org.bukkit.entity.Entity entity) {
|
||||
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||
|
||||
if (!(nmsEntity instanceof CustomChairEntity)) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(Messages.ERR_NOT_CUSTOM_ENTITY, CustomChairEntity.class.getName()));
|
||||
}
|
||||
|
||||
((CustomChairEntity) nmsEntity).markAsRemoved();
|
||||
entity.remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStair(@NotNull Block block) {
|
||||
return block.getState().getData() instanceof Stairs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStairUpsideDown(@NotNull Block block) {
|
||||
return ((Stairs) block.getState().getData()).isInverted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull BlockFace getBlockRotation(@NotNull Block block) {
|
||||
return ChairUtils.getBlockRotationLegacy(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlab(@NotNull Block block) {
|
||||
return (block.getState().getData() instanceof Step || block.getState().getData() instanceof WoodenStep)
|
||||
&& block.getType() != Material.DOUBLE_STEP
|
||||
&& block.getType() != Material.WOOD_DOUBLE_STEP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlabTop(@NotNull Block block) {
|
||||
if (block.getState().getData() instanceof Step) {
|
||||
return ((Step) block.getState().getData()).isInverted();
|
||||
}
|
||||
|
||||
return ((WoodenStep) block.getState().getData()).isInverted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEmptyMainHand(@NotNull Player player) {
|
||||
return player.getInventory().getItemInMainHand().getType() == Material.AIR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChair(@NotNull org.bukkit.entity.Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle() instanceof CustomChairEntity;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,2 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="output" path="bin/default"/>
|
||||
<classpathentry output="bin/main" kind="src" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="main"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/spigot-api-1.12.2-R0.1-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/spigotmc/spigot/1.12.2-R0.1-SNAPSHOT/spigot-1.12.2-R0.1-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/de/sprax2013/lime/lime-spigot-api/0.0.4-SNAPSHOT/lime-spigot-api-0.0.4-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry sourcepath="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/de.tr7zw/item-nbt-api/2.15.0/29689f4d8039bc2abf8e5562c5c09927f9bfc51f/item-nbt-api-2.15.0-sources.jar" kind="lib" path="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/de.tr7zw/item-nbt-api/2.15.0/52fa821ba619524cac58be6d7260e72b42ae3a0a/item-nbt-api-2.15.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry sourcepath="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/com.github.cryptomorin/XSeries/13.3.0/d079530d2976ecfae96e2e132e9b8323738d6b02/XSeries-13.3.0-sources.jar" kind="lib" path="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/com.github.cryptomorin/XSeries/13.3.0/d664a667493ae640b7a62c8add20572437a4f52d/XSeries-13.3.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/google/guava/guava/21.0/guava-21.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/de/sprax2013/lime/lime-api/0.0.4-SNAPSHOT/lime-api-0.0.4-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/yaml/snakeyaml/1.33/snakeyaml-1.33.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/jetbrains/annotations/24.1.0/annotations-24.1.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/junit/junit/4.10/junit-4.10.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
</classpath>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>betterchairs-v1_12_R1</name>
|
||||
<comment></comment>
|
||||
<projects/>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<linkedResources/>
|
||||
<filteredResources/>
|
||||
</projectDescription>
|
||||
@@ -1,13 +0,0 @@
|
||||
#
|
||||
#Wed Jul 02 05:13:18 EDT 2025
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
|
||||
org.eclipse.jdt.core.compiler.source=17
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.compliance=17
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
-73
@@ -1,73 +0,0 @@
|
||||
package betterchairs.nms.v1_12_R1;
|
||||
|
||||
import de.sprax2013.betterchairs.ChairUtils;
|
||||
import de.sprax2013.betterchairs.CustomChairEntity;
|
||||
import net.minecraft.server.v1_12_R1.Entity;
|
||||
import net.minecraft.server.v1_12_R1.EntityArmorStand;
|
||||
import net.minecraft.server.v1_12_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_12_R1.World;
|
||||
import org.bukkit.Location;
|
||||
|
||||
class CustomArmorStand extends EntityArmorStand implements CustomChairEntity {
|
||||
private boolean remove = false;
|
||||
private final int regenerationAmplifier;
|
||||
|
||||
private final Location expectedLocation;
|
||||
|
||||
/**
|
||||
* @param regenerationAmplifier provide a negative value to disable regeneration
|
||||
*/
|
||||
public CustomArmorStand(World world, double d0, double d1, double d2, int regenerationAmplifier) {
|
||||
super(world, d0, d1, d2);
|
||||
|
||||
this.regenerationAmplifier = regenerationAmplifier;
|
||||
this.expectedLocation = new Location(null, d0, d1, d2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markAsRemoved() {
|
||||
this.remove = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(float f1, float f2, float f3) {
|
||||
if (this.remove) return; // If the ArmorStand is being removed, no need to bother
|
||||
if (this.ticksLived % 10 == 0) return; // Only run every 10 ticks
|
||||
|
||||
Entity passenger = this.passengers.isEmpty() ? null : this.passengers.get(0);
|
||||
|
||||
if (!(passenger instanceof EntityHuman)) {
|
||||
this.remove = true;
|
||||
this.getBukkitEntity().remove();
|
||||
return;
|
||||
}
|
||||
|
||||
// Rotate the ArmorStand together with its passenger
|
||||
this.setYawPitch(passenger.yaw, 0);
|
||||
|
||||
if (ChairUtils.didChairEntityMove(this.expectedLocation, this.locX, this.locY, this.locZ)) {
|
||||
this.enderTeleportTo(
|
||||
this.expectedLocation.getX(),
|
||||
Math.min(this.locY, this.expectedLocation.getY()),
|
||||
this.expectedLocation.getZ());
|
||||
}
|
||||
|
||||
ChairUtils.applyRegeneration(((EntityHuman) passenger).getBukkitEntity(), this.regenerationAmplifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void killEntity() {
|
||||
// Prevents the ArmorStand from getting killed unexpectedly
|
||||
if (shouldDie()) super.killEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevents the ArmorStand from getting killed unexpectedly
|
||||
if (shouldDie()) super.die();
|
||||
}
|
||||
|
||||
private boolean shouldDie() {
|
||||
return this.remove || this.passengers.isEmpty() || !(this.passengers.get(0) instanceof EntityHuman);
|
||||
}
|
||||
}
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
package betterchairs.nms.v1_12_R1;
|
||||
|
||||
import de.sprax2013.betterchairs.ChairUtils;
|
||||
import de.sprax2013.betterchairs.CustomChairEntity;
|
||||
import net.minecraft.server.v1_12_R1.Entity;
|
||||
import net.minecraft.server.v1_12_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_12_R1.EntityTippedArrow;
|
||||
import net.minecraft.server.v1_12_R1.World;
|
||||
|
||||
class CustomArrow extends EntityTippedArrow implements CustomChairEntity {
|
||||
private boolean remove = false;
|
||||
private final int regenerationAmplifier;
|
||||
|
||||
/**
|
||||
* @param regenerationAmplifier provide a negative value to disable regeneration
|
||||
*/
|
||||
public CustomArrow(World world, double d0, double d1, double d2, int regenerationAmplifier) {
|
||||
super(world, d0, d1, d2);
|
||||
|
||||
this.regenerationAmplifier = regenerationAmplifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markAsRemoved() {
|
||||
this.remove = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void B_() {
|
||||
if (this.remove) return; // If the entity is being removed, no need to bother
|
||||
if (this.ticksLived % 10 == 0) return; // Only run every 10 ticks
|
||||
|
||||
Entity passenger = this.passengers.isEmpty() ? null : this.passengers.get(0);
|
||||
|
||||
if (!(passenger instanceof EntityHuman)) {
|
||||
this.remove = true;
|
||||
this.getBukkitEntity().remove();
|
||||
return;
|
||||
}
|
||||
|
||||
// Rotate the entity together with its passenger
|
||||
this.setYawPitch(passenger.yaw, 0);
|
||||
|
||||
ChairUtils.applyRegeneration(((EntityHuman) passenger).getBukkitEntity(), this.regenerationAmplifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void killEntity() {
|
||||
// Prevents the ArmorStand from getting killed unexpectedly
|
||||
if (shouldDie()) super.killEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevents the ArmorStand from getting killed unexpectedly
|
||||
if (shouldDie()) super.die();
|
||||
}
|
||||
|
||||
private boolean shouldDie() {
|
||||
return this.remove || this.passengers.isEmpty() || !(this.passengers.get(0) instanceof EntityHuman);
|
||||
}
|
||||
}
|
||||
-104
@@ -1,104 +0,0 @@
|
||||
package betterchairs.nms.v1_12_R1;
|
||||
|
||||
import de.sprax2013.betterchairs.ChairManager;
|
||||
import de.sprax2013.betterchairs.ChairNMS;
|
||||
import de.sprax2013.betterchairs.ChairUtils;
|
||||
import de.sprax2013.betterchairs.CustomChairEntity;
|
||||
import de.sprax2013.betterchairs.Messages;
|
||||
import java.util.Objects;
|
||||
import net.minecraft.server.v1_12_R1.Entity;
|
||||
import net.minecraft.server.v1_12_R1.WorldServer;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.material.Stairs;
|
||||
import org.bukkit.material.Step;
|
||||
import org.bukkit.material.WoodenStep;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class v1_12_R1 extends ChairNMS {
|
||||
@Override
|
||||
@NotNull
|
||||
public org.bukkit.entity.Entity spawnChairEntity(
|
||||
@NotNull Location loc, int regenerationAmplifier, boolean useArmorStand) {
|
||||
WorldServer nmsWorld = ((CraftWorld) Objects.requireNonNull(loc.getWorld())).getHandle();
|
||||
|
||||
Entity nmsEntity;
|
||||
|
||||
if (useArmorStand) {
|
||||
nmsEntity = new CustomArmorStand(nmsWorld, loc.getX(), loc.getY(), loc.getZ(), regenerationAmplifier);
|
||||
} else {
|
||||
nmsEntity = new CustomArrow(nmsWorld, loc.getX(), loc.getY() + .3, loc.getZ() + .25, regenerationAmplifier);
|
||||
}
|
||||
|
||||
org.bukkit.entity.Entity bukkitEntity = nmsEntity.getBukkitEntity();
|
||||
|
||||
ChairUtils.applyChairProtections(bukkitEntity);
|
||||
|
||||
if (!nmsWorld.addEntity(nmsEntity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
|
||||
ChairManager.getLogger().warning(Messages.ERR_ANOTHER_PLUGIN_PREVENTING_SPAWN);
|
||||
}
|
||||
|
||||
return bukkitEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void killChairEntity(@NotNull org.bukkit.entity.Entity entity) {
|
||||
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||
|
||||
if (!(nmsEntity instanceof CustomChairEntity)) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(Messages.ERR_NOT_CUSTOM_ENTITY, CustomChairEntity.class.getName()));
|
||||
}
|
||||
|
||||
((CustomChairEntity) nmsEntity).markAsRemoved();
|
||||
entity.remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStair(@NotNull Block block) {
|
||||
return block.getState().getData() instanceof Stairs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStairUpsideDown(@NotNull Block block) {
|
||||
return ((Stairs) block.getState().getData()).isInverted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull BlockFace getBlockRotation(@NotNull Block block) {
|
||||
return ChairUtils.getBlockRotationLegacy(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlab(@NotNull Block block) {
|
||||
return (block.getState().getData() instanceof Step || block.getState().getData() instanceof WoodenStep)
|
||||
&& block.getType() != Material.DOUBLE_STEP
|
||||
&& block.getType() != Material.WOOD_DOUBLE_STEP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlabTop(@NotNull Block block) {
|
||||
if (block.getState().getData() instanceof Step) {
|
||||
return ((Step) block.getState().getData()).isInverted();
|
||||
}
|
||||
|
||||
return ((WoodenStep) block.getState().getData()).isInverted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEmptyMainHand(@NotNull Player player) {
|
||||
return player.getInventory().getItemInMainHand().getType() == Material.AIR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChair(@NotNull org.bukkit.entity.Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle() instanceof CustomChairEntity;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,2 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="output" path="bin/default"/>
|
||||
<classpathentry output="bin/main" kind="src" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="main"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/spigotmc/spigot-api/1.13-R0.1-SNAPSHOT/spigot-api-1.13-R0.1-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/spigotmc/spigot/1.13-R0.1-SNAPSHOT/spigot-1.13-R0.1-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/de/sprax2013/lime/lime-spigot-api/0.0.4-SNAPSHOT/lime-spigot-api-0.0.4-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry sourcepath="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/de.tr7zw/item-nbt-api/2.15.0/29689f4d8039bc2abf8e5562c5c09927f9bfc51f/item-nbt-api-2.15.0-sources.jar" kind="lib" path="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/de.tr7zw/item-nbt-api/2.15.0/52fa821ba619524cac58be6d7260e72b42ae3a0a/item-nbt-api-2.15.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry sourcepath="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/com.github.cryptomorin/XSeries/13.3.0/d079530d2976ecfae96e2e132e9b8323738d6b02/XSeries-13.3.0-sources.jar" kind="lib" path="/home/notalexnoyle/.gradle/caches/modules-2/files-2.1/com.github.cryptomorin/XSeries/13.3.0/d664a667493ae640b7a62c8add20572437a4f52d/XSeries-13.3.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/net/md-5/bungeecord-chat/1.13-SNAPSHOT/bungeecord-chat-1.13-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/google/guava/guava/21.0/guava-21.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/de/sprax2013/lime/lime-api/0.0.4-SNAPSHOT/lime-api-0.0.4-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/yaml/snakeyaml/1.33/snakeyaml-1.33.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/jetbrains/annotations/24.1.0/annotations-24.1.0.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/junit/junit/4.10/junit-4.10.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/notalexnoyle/.m2/repository/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar">
|
||||
<attributes>
|
||||
<attribute name="gradle_used_by_scope" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
</classpath>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>betterchairs-v1_13_R1</name>
|
||||
<comment></comment>
|
||||
<projects/>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<linkedResources/>
|
||||
<filteredResources/>
|
||||
</projectDescription>
|
||||
@@ -1,13 +0,0 @@
|
||||
#
|
||||
#Wed Jul 02 05:13:18 EDT 2025
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
|
||||
org.eclipse.jdt.core.compiler.source=17
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.compliance=17
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
-73
@@ -1,73 +0,0 @@
|
||||
package betterchairs.nms.v1_13_R1;
|
||||
|
||||
import de.sprax2013.betterchairs.ChairUtils;
|
||||
import de.sprax2013.betterchairs.CustomChairEntity;
|
||||
import net.minecraft.server.v1_13_R1.Entity;
|
||||
import net.minecraft.server.v1_13_R1.EntityArmorStand;
|
||||
import net.minecraft.server.v1_13_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_13_R1.World;
|
||||
import org.bukkit.Location;
|
||||
|
||||
class CustomArmorStand extends EntityArmorStand implements CustomChairEntity {
|
||||
private boolean remove = false;
|
||||
private final int regenerationAmplifier;
|
||||
|
||||
private final Location expectedLocation;
|
||||
|
||||
/**
|
||||
* @param regenerationAmplifier provide a negative value to disable regeneration
|
||||
*/
|
||||
public CustomArmorStand(World world, double d0, double d1, double d2, int regenerationAmplifier) {
|
||||
super(world, d0, d1, d2);
|
||||
|
||||
this.regenerationAmplifier = regenerationAmplifier;
|
||||
this.expectedLocation = new Location(null, d0, d1, d2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markAsRemoved() {
|
||||
this.remove = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
if (this.remove) return; // If the ArmorStand is being removed, no need to bother
|
||||
if (this.ticksLived % 10 == 0) return; // Only run every 10 ticks
|
||||
|
||||
Entity passenger = this.passengers.isEmpty() ? null : this.passengers.get(0);
|
||||
|
||||
if (!(passenger instanceof EntityHuman)) {
|
||||
this.remove = true;
|
||||
this.getBukkitEntity().remove();
|
||||
return;
|
||||
}
|
||||
|
||||
// Rotate the ArmorStand together with its passenger
|
||||
this.setYawPitch(passenger.yaw, 0);
|
||||
|
||||
if (ChairUtils.didChairEntityMove(this.expectedLocation, this.locX, this.locY, this.locZ)) {
|
||||
this.enderTeleportTo(
|
||||
this.expectedLocation.getX(),
|
||||
Math.min(this.locY, this.expectedLocation.getY()),
|
||||
this.expectedLocation.getZ());
|
||||
}
|
||||
|
||||
ChairUtils.applyRegeneration(((EntityHuman) passenger).getBukkitEntity(), this.regenerationAmplifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void killEntity() {
|
||||
// Prevents the ArmorStand from getting killed unexpectedly
|
||||
if (shouldDie()) super.killEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevents the ArmorStand from getting killed unexpectedly
|
||||
if (shouldDie()) super.die();
|
||||
}
|
||||
|
||||
private boolean shouldDie() {
|
||||
return this.remove || this.passengers.isEmpty() || !(this.passengers.get(0) instanceof EntityHuman);
|
||||
}
|
||||
}
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
package betterchairs.nms.v1_13_R1;
|
||||
|
||||
import de.sprax2013.betterchairs.ChairUtils;
|
||||
import de.sprax2013.betterchairs.CustomChairEntity;
|
||||
import net.minecraft.server.v1_13_R1.Entity;
|
||||
import net.minecraft.server.v1_13_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_13_R1.EntityTippedArrow;
|
||||
import net.minecraft.server.v1_13_R1.World;
|
||||
|
||||
class CustomArrow extends EntityTippedArrow implements CustomChairEntity {
|
||||
private boolean remove = false;
|
||||
private final int regenerationAmplifier;
|
||||
|
||||
/**
|
||||
* @param regenerationAmplifier provide a negative value to disable regeneration
|
||||
*/
|
||||
public CustomArrow(World world, double d0, double d1, double d2, int regenerationAmplifier) {
|
||||
super(world, d0, d1, d2);
|
||||
|
||||
this.regenerationAmplifier = regenerationAmplifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markAsRemoved() {
|
||||
this.remove = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
if (this.remove) return; // If the entity is being removed, no need to bother
|
||||
if (this.ticksLived % 10 == 0) return; // Only run every 10 ticks
|
||||
|
||||
Entity passenger = this.passengers.isEmpty() ? null : this.passengers.get(0);
|
||||
|
||||
if (!(passenger instanceof EntityHuman)) {
|
||||
this.remove = true;
|
||||
this.getBukkitEntity().remove();
|
||||
return;
|
||||
}
|
||||
|
||||
// Rotate the entity together with its passenger
|
||||
this.setYawPitch(passenger.yaw, 0);
|
||||
|
||||
ChairUtils.applyRegeneration(((EntityHuman) passenger).getBukkitEntity(), this.regenerationAmplifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void killEntity() {
|
||||
// Prevents the ArmorStand from getting killed unexpectedly
|
||||
if (shouldDie()) super.killEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevents the ArmorStand from getting killed unexpectedly
|
||||
if (shouldDie()) super.die();
|
||||
}
|
||||
|
||||
private boolean shouldDie() {
|
||||
return this.remove || this.passengers.isEmpty() || !(this.passengers.get(0) instanceof EntityHuman);
|
||||
}
|
||||
}
|
||||
-98
@@ -1,98 +0,0 @@
|
||||
package betterchairs.nms.v1_13_R1;
|
||||
|
||||
import de.sprax2013.betterchairs.ChairManager;
|
||||
import de.sprax2013.betterchairs.ChairNMS;
|
||||
import de.sprax2013.betterchairs.ChairUtils;
|
||||
import de.sprax2013.betterchairs.CustomChairEntity;
|
||||
import de.sprax2013.betterchairs.Messages;
|
||||
import java.util.Objects;
|
||||
import net.minecraft.server.v1_13_R1.Entity;
|
||||
import net.minecraft.server.v1_13_R1.WorldServer;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.Bisected;
|
||||
import org.bukkit.block.data.Directional;
|
||||
import org.bukkit.block.data.type.Slab;
|
||||
import org.bukkit.block.data.type.Stairs;
|
||||
import org.bukkit.craftbukkit.v1_13_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_13_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class v1_13_R1 extends ChairNMS {
|
||||
@Override
|
||||
public @NotNull org.bukkit.entity.Entity spawnChairEntity(
|
||||
@NotNull Location loc, int regenerationAmplifier, boolean useArmorStand) {
|
||||
WorldServer nmsWorld = ((CraftWorld) Objects.requireNonNull(loc.getWorld())).getHandle();
|
||||
|
||||
Entity nmsEntity;
|
||||
|
||||
if (useArmorStand) {
|
||||
nmsEntity = new CustomArmorStand(nmsWorld, loc.getX(), loc.getY(), loc.getZ(), regenerationAmplifier);
|
||||
} else {
|
||||
nmsEntity = new CustomArrow(nmsWorld, loc.getX(), loc.getY() + .3, loc.getZ() + .25, regenerationAmplifier);
|
||||
}
|
||||
|
||||
org.bukkit.entity.Entity bukkitEntity = nmsEntity.getBukkitEntity();
|
||||
|
||||
ChairUtils.applyChairProtections(bukkitEntity);
|
||||
|
||||
if (!nmsWorld.addEntity(nmsEntity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
|
||||
ChairManager.getLogger().warning(Messages.ERR_ANOTHER_PLUGIN_PREVENTING_SPAWN);
|
||||
}
|
||||
|
||||
return bukkitEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void killChairEntity(@NotNull org.bukkit.entity.Entity entity) {
|
||||
Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||
|
||||
if (!(nmsEntity instanceof CustomChairEntity)) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(Messages.ERR_NOT_CUSTOM_ENTITY, CustomChairEntity.class.getName()));
|
||||
}
|
||||
|
||||
((CustomChairEntity) nmsEntity).markAsRemoved();
|
||||
entity.remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStair(@NotNull Block block) {
|
||||
return block.getBlockData() instanceof Stairs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStairUpsideDown(@NotNull Block block) {
|
||||
return ((Stairs) block.getBlockData()).getHalf() == Bisected.Half.TOP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull BlockFace getBlockRotation(@NotNull Block block) {
|
||||
return ((Directional) block.getBlockData()).getFacing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlab(@NotNull Block block) {
|
||||
return block.getBlockData() instanceof Slab && ((Slab) block.getBlockData()).getType() != Slab.Type.DOUBLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlabTop(@NotNull Block block) {
|
||||
return ((Slab) block.getBlockData()).getType() == Slab.Type.TOP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEmptyMainHand(@NotNull Player player) {
|
||||
return player.getInventory().getItemInMainHand().getType() == Material.AIR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChair(@NotNull org.bukkit.entity.Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle() instanceof CustomChairEntity;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,2 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
|
||||
Loaded 100 of 318 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user