Merge pull request #73 from TBMCPlugins/dev
1.14 support, (sub)command tabcomplete
This commit is contained in:
commit
7de1d0575c
61 changed files with 885 additions and 632 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -220,8 +220,8 @@ pip-log.txt
|
||||||
TheButtonAutoFlair/out/artifacts/Autoflair/Autoflair.jar
|
TheButtonAutoFlair/out/artifacts/Autoflair/Autoflair.jar
|
||||||
#*.iml
|
#*.iml
|
||||||
*.name
|
*.name
|
||||||
.idea/compiler.xml
|
.idea
|
||||||
*.xml
|
dependency-reduced-pom.xml
|
||||||
|
|
||||||
TBMC/
|
TBMC/
|
||||||
/.apt_generated/
|
/.apt_generated/
|
||||||
|
|
|
@ -3,25 +3,60 @@
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<annotationProcessing>
|
<annotationProcessing>
|
||||||
<profile default="true" name="Default" enabled="true" />
|
<profile default="true" name="Default" enabled="true" />
|
||||||
<profile name="Maven default annotation processors profile" enabled="true">
|
<profile name="Annotation profile for BuildConfigUpdater" enabled="true">
|
||||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
<outputRelativeToContentRoot value="true" />
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<processorPath useClasspath="false">
|
||||||
|
<entry name="$PROJECT_DIR$/ButtonProcessor/target/classes" />
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.21/snakeyaml-1.21.jar" />
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/spigot-api-1.12.2-R0.1-SNAPSHOT.jar" />
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6.jar" />
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar" />
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/com/google/guava/guava/21.0/guava-21.0.jar" />
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar" />
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-20180712.114550-97.jar" />
|
||||||
|
</processorPath>
|
||||||
<module name="BuildConfigUpdater" />
|
<module name="BuildConfigUpdater" />
|
||||||
|
</profile>
|
||||||
|
<profile name="Annotation profile for ButtonCore Parent" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<processor name="com.github.bsideup.jabel.JabelJavacProcessor" />
|
||||||
|
<processor name="lombok.launch.AnnotationProcessorHider$AnnotationProcessor" />
|
||||||
|
<processor name="buttondevteam.buttonproc.ButtonProcessor" />
|
||||||
|
<processorPath useClasspath="false">
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/com/github/bsideup/jabel/jabel-javac-plugin/0.2.0/jabel-javac-plugin-0.2.0.jar" />
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy/1.10.1/byte-buddy-1.10.1.jar" />
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy-agent/1.10.1/byte-buddy-agent-1.10.1.jar" />
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.10/lombok-1.18.10.jar" />
|
||||||
|
<entry name="$PROJECT_DIR$/ButtonProcessor/target/classes" />
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.21/snakeyaml-1.21.jar" />
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/spigot-api-1.12.2-R0.1-SNAPSHOT.jar" />
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6.jar" />
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar" />
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/com/google/guava/guava/21.0/guava-21.0.jar" />
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar" />
|
||||||
|
<entry name="$MAVEN_REPOSITORY$/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-20180712.114550-97.jar" />
|
||||||
|
</processorPath>
|
||||||
<module name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
<module name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
||||||
</profile>
|
</profile>
|
||||||
</annotationProcessing>
|
</annotationProcessing>
|
||||||
<bytecodeTargetLevel>
|
<bytecodeTargetLevel>
|
||||||
<module name="BuildConfigUpdater" target="1.8" />
|
<module name="BuildConfigUpdater" target="8" />
|
||||||
<module name="ButtonCore" target="1.5" />
|
<module name="ButtonCore" target="1.5" />
|
||||||
<module name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" target="1.8" />
|
<module name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" target="13" />
|
||||||
<module name="ButtonProcessor" target="1.8" />
|
<module name="ButtonProcessor" target="8" />
|
||||||
<module name="ChunkArchive" target="1.8" />
|
<module name="ChunkArchive" target="1.8" />
|
||||||
|
<module name="CorePOM" target="13" />
|
||||||
<module name="RandomTeleport" target="1.8" />
|
<module name="RandomTeleport" target="1.8" />
|
||||||
</bytecodeTargetLevel>
|
</bytecodeTargetLevel>
|
||||||
</component>
|
</component>
|
||||||
<component name="JavacSettings">
|
<component name="JavacSettings">
|
||||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||||
|
<module name="BuildConfigUpdater" options="" />
|
||||||
|
<module name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" options="--enable-preview" />
|
||||||
<module name="ButtonProcessor" options="-proc:none" />
|
<module name="ButtonProcessor" options="-proc:none" />
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: com.google.code.findbugs:annotations:2.0.1">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/findbugs/annotations/2.0.1/annotations-2.0.1.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/findbugs/annotations/2.0.1/annotations-2.0.1-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/findbugs/annotations/2.0.1/annotations-2.0.1-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: com.google.code.gson:gson:2.8.0">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.0/gson-2.8.0-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.0/gson-2.8.0-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: com.google.guava:guava:15.0">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/15.0/guava-15.0.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/15.0/guava-15.0-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/15.0/guava-15.0-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: com.google.guava:guava:21.0">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/21.0/guava-21.0.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/21.0/guava-21.0-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/21.0/guava-21.0-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: com.googlecode.json-simple:json-simple:1.1.1">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: commons-io:commons-io:1.3.2">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/1.3.2/commons-io-1.3.2.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/1.3.2/commons-io-1.3.2-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/1.3.2/commons-io-1.3.2-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: commons-io:commons-io:2.6">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.6/commons-io-2.6.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.6/commons-io-2.6-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.6/commons-io-2.6-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: commons-lang:commons-lang:2.6">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: junit:junit:3.8.1">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/3.8.1/junit-3.8.1.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/3.8.1/junit-3.8.1-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/3.8.1/junit-3.8.1-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: net.bytebuddy:byte-buddy:1.6.11">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy/1.6.11/byte-buddy-1.6.11.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy/1.6.11/byte-buddy-1.6.11-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy/1.6.11/byte-buddy-1.6.11-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: net.bytebuddy:byte-buddy-agent:1.6.11">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy-agent/1.6.11/byte-buddy-agent-1.6.11.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy-agent/1.6.11/byte-buddy-agent-1.6.11-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy-agent/1.6.11/byte-buddy-agent-1.6.11-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: net.ess3:Essentials:2.13.1">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/ess3/Essentials/2.13.1/Essentials-2.13.1.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/ess3/Essentials/2.13.1/Essentials-2.13.1-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/ess3/Essentials/2.13.1/Essentials-2.13.1-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: net.md-5:bungeecord-chat:1.12-SNAPSHOT">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-20180712.114550-97.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-20180712.114550-97-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-20180712.114550-97-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/bukkit/1.13.1-R0.1-SNAPSHOT/bukkit-1.13.1-R0.1-20181022.190036-99.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/bukkit/1.13.1-R0.1-SNAPSHOT/bukkit-1.13.1-R0.1-20181022.190036-99-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/bukkit/1.13.1-R0.1-SNAPSHOT/bukkit-1.13.1-R0.1-20181022.190036-99-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: org.javassist:javassist:3.20.0-GA">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: org.mockito:mockito-core:2.7.20">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/mockito/mockito-core/2.7.20/mockito-core-2.7.20.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/mockito/mockito-core/2.7.20/mockito-core-2.7.20-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/mockito/mockito-core/2.7.20/mockito-core-2.7.20-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: org.objenesis:objenesis:2.5">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/objenesis/objenesis/2.5/objenesis-2.5.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/objenesis/objenesis/2.5/objenesis-2.5-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/objenesis/objenesis/2.5/objenesis-2.5-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: org.reflections:reflections:0.9.10">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/reflections/reflections/0.9.10/reflections-0.9.10.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/reflections/reflections/0.9.10/reflections-0.9.10-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/reflections/reflections/0.9.10/reflections-0.9.10-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/spigot-api-1.12.2-R0.1-SNAPSHOT.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/spigot-api-1.12.2-R0.1-SNAPSHOT-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/spigot-api-1.12.2-R0.1-SNAPSHOT-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Maven: org.yaml:snakeyaml:1.19">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.19/snakeyaml-1.19.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.19/snakeyaml-1.19-javadoc.jar!/" />
|
|
||||||
</JAVADOC>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.19/snakeyaml-1.19-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -17,7 +17,7 @@
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_12" default="false" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -5,6 +5,7 @@
|
||||||
<module fileurl="file://$PROJECT_DIR$/BuildConfigUpdater/BuildConfigUpdater.iml" filepath="$PROJECT_DIR$/BuildConfigUpdater/BuildConfigUpdater.iml" />
|
<module fileurl="file://$PROJECT_DIR$/BuildConfigUpdater/BuildConfigUpdater.iml" filepath="$PROJECT_DIR$/BuildConfigUpdater/BuildConfigUpdater.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/ButtonCore/ButtonCore (1) (com.github.TBMCPlugins.ButtonCore).iml" filepath="$PROJECT_DIR$/ButtonCore/ButtonCore (1) (com.github.TBMCPlugins.ButtonCore).iml" />
|
<module fileurl="file://$PROJECT_DIR$/ButtonCore/ButtonCore (1) (com.github.TBMCPlugins.ButtonCore).iml" filepath="$PROJECT_DIR$/ButtonCore/ButtonCore (1) (com.github.TBMCPlugins.ButtonCore).iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/ButtonProcessor/ButtonProcessor.iml" filepath="$PROJECT_DIR$/ButtonProcessor/ButtonProcessor.iml" />
|
<module fileurl="file://$PROJECT_DIR$/ButtonProcessor/ButtonProcessor.iml" filepath="$PROJECT_DIR$/ButtonProcessor/ButtonProcessor.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/CorePOM/CorePOM.iml" filepath="$PROJECT_DIR$/CorePOM/CorePOM.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -9,7 +9,7 @@ before_install: | # Wget BuildTools and run if cached folder not found
|
||||||
fi
|
fi
|
||||||
language: java
|
language: java
|
||||||
jdk:
|
jdk:
|
||||||
- oraclejdk8
|
- oraclejdk11
|
||||||
sudo: true
|
sudo: true
|
||||||
deploy:
|
deploy:
|
||||||
# deploy develop to the staging environment
|
# deploy develop to the staging environment
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="MavenAnnotationProcessors">
|
||||||
|
<modules>
|
||||||
|
<module name="ButtonProcessor" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||||
<output url="file://$MODULE_DIR$/target/classes" />
|
<output url="file://$MODULE_DIR$/target/classes" />
|
||||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
|
@ -7,18 +12,20 @@
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/annotations" isTestSource="false" generated="true" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
||||||
|
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
||||||
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.10" level="project" />
|
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.10" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
|
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" />
|
<orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mockito:mockito-core:2.7.20" level="project" />
|
<orderEntry type="library" name="Maven: org.mockito:mockito-core:3.0.0" level="project" />
|
||||||
<orderEntry type="library" scope="RUNTIME" name="Maven: net.bytebuddy:byte-buddy:1.6.11" level="project" />
|
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.9.10" level="project" />
|
||||||
<orderEntry type="library" scope="RUNTIME" name="Maven: net.bytebuddy:byte-buddy-agent:1.6.11" level="project" />
|
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy-agent:1.9.10" level="project" />
|
||||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.objenesis:objenesis:2.5" level="project" />
|
<orderEntry type="library" name="Maven: org.objenesis:objenesis:2.6" level="project" />
|
||||||
<orderEntry type="module" module-name="ButtonProcessor" />
|
<orderEntry type="module" module-name="ButtonProcessor" />
|
||||||
<orderEntry type="library" name="Maven: org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT" level="project" />
|
<orderEntry type="library" name="Maven: org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT" level="project" />
|
||||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||||
|
@ -29,5 +36,6 @@
|
||||||
<orderEntry type="library" name="Maven: net.md-5:bungeecord-chat:1.12-SNAPSHOT" level="project" />
|
<orderEntry type="library" name="Maven: net.md-5:bungeecord-chat:1.12-SNAPSHOT" level="project" />
|
||||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
|
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
|
||||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
|
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.10" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
|
@ -39,5 +39,4 @@
|
||||||
<version>2.6</version>
|
<version>2.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -2,11 +2,11 @@
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.github.TBMCPlugins</groupId>
|
|
||||||
<artifactId>ButtonCore</artifactId>
|
|
||||||
<version>master-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
|
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
|
||||||
|
<artifactId>CorePOM</artifactId>
|
||||||
|
<version>master-SNAPSHOT</version>
|
||||||
|
<relativePath>../CorePOM</relativePath>
|
||||||
|
</parent>
|
||||||
<artifactId>ButtonCore</artifactId>
|
<artifactId>ButtonCore</artifactId>
|
||||||
<name>ButtonCore</name>
|
<name>ButtonCore</name>
|
||||||
<description>ButtonCore</description>
|
<description>ButtonCore</description>
|
||||||
|
@ -26,13 +26,6 @@
|
||||||
</resources>
|
</resources>
|
||||||
<finalName>ButtonCore</finalName>
|
<finalName>ButtonCore</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>1.8</source>
|
|
||||||
<target>1.8</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
@ -68,6 +61,7 @@
|
||||||
<directory>src/main/resources</directory>
|
<directory>src/main/resources</directory>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
@ -111,12 +105,16 @@
|
||||||
</repository> -->
|
</repository> -->
|
||||||
<repository>
|
<repository>
|
||||||
<id>ess-repo</id>
|
<id>ess-repo</id>
|
||||||
<url>http://repo.ess3.net/content/repositories/essrel/</url>
|
<url>https://ci.ender.zone/plugin/repository/everything/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>Votifier</id>
|
<id>Votifier</id>
|
||||||
<url>https://dl.bintray.com/nuvotifier/maven/</url>
|
<url>https://dl.bintray.com/nuvotifier/maven/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>Multiverse-Core</id>
|
||||||
|
<url>http://repo.onarandombox.com/content/repositories/multiverse/</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -131,18 +129,10 @@
|
||||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-io -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-io</groupId>
|
<groupId>com.github.TownyAdvanced</groupId>
|
||||||
<artifactId>commons-io</artifactId>
|
|
||||||
<version>1.3.2</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<!-- Change jitpack.yml to set location of Towny JAR -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
|
|
||||||
<artifactId>Towny</artifactId>
|
<artifactId>Towny</artifactId>
|
||||||
<version>master-SNAPSHOT</version>
|
<version>0.94.0.9</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -160,14 +150,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<version>2.7.20</version>
|
<version>3.0.0</version>
|
||||||
</dependency>
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<version>1.16.16</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
|
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
|
||||||
|
@ -177,8 +160,8 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ess3</groupId>
|
<groupId>net.ess3</groupId>
|
||||||
<artifactId>Essentials</artifactId>
|
<artifactId>EssentialsX</artifactId>
|
||||||
<version>2.13.1</version>
|
<version>2.17.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -187,6 +170,12 @@
|
||||||
<version>2.3.4</version>
|
<version>2.3.4</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.onarandombox.multiversecore</groupId>
|
||||||
|
<artifactId>Multiverse-Core</artifactId>
|
||||||
|
<version>4.0.1</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<organization>
|
<organization>
|
||||||
<name>TBMCPlugins</name>
|
<name>TBMCPlugins</name>
|
||||||
|
|
|
@ -6,11 +6,11 @@ import buttondevteam.lib.chat.ICommand2MC;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@CommandClass
|
@CommandClass
|
||||||
public class ThorpeCommand extends ICommand2MC {
|
public class ChromaCommand extends ICommand2MC {
|
||||||
@Command2.Subcommand //TODO: Main permissions (groups) like 'mod'
|
@Command2.Subcommand //TODO: Main permissions (groups) like 'mod'
|
||||||
public void reload(CommandSender sender) {
|
public void reload(CommandSender sender) {
|
||||||
if (MainPlugin.Instance.tryReloadConfig())
|
if (MainPlugin.Instance.tryReloadConfig())
|
||||||
sender.sendMessage("§bConfig reloaded.");
|
sender.sendMessage("§bCore config reloaded.");
|
||||||
else
|
else
|
||||||
sender.sendMessage("§cFailed to reload config. Check console.");
|
sender.sendMessage("§cFailed to reload config. Check console.");
|
||||||
}
|
}
|
|
@ -24,7 +24,7 @@ public final class ComponentManager {
|
||||||
Component.getComponents().values().stream().filter(c -> c.shouldBeEnabled().get()).forEach(c -> {
|
Component.getComponents().values().stream().filter(c -> c.shouldBeEnabled().get()).forEach(c -> {
|
||||||
try {
|
try {
|
||||||
Component.setComponentEnabled(c, true);
|
Component.setComponentEnabled(c, true);
|
||||||
} catch (Exception e) {
|
} catch (Exception | NoClassDefFoundError e) {
|
||||||
TBMCCoreAPI.SendException("Failed to enable one of the components: " + c.getClass().getSimpleName(), e);
|
TBMCCoreAPI.SendException("Failed to enable one of the components: " + c.getClass().getSimpleName(), e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,6 +6,7 @@ import buttondevteam.core.component.channel.ChatRoom;
|
||||||
import buttondevteam.core.component.members.MemberComponent;
|
import buttondevteam.core.component.members.MemberComponent;
|
||||||
import buttondevteam.core.component.randomtp.RandomTPComponent;
|
import buttondevteam.core.component.randomtp.RandomTPComponent;
|
||||||
import buttondevteam.core.component.restart.RestartComponent;
|
import buttondevteam.core.component.restart.RestartComponent;
|
||||||
|
import buttondevteam.core.component.spawn.SpawnComponent;
|
||||||
import buttondevteam.core.component.towny.TownyComponent;
|
import buttondevteam.core.component.towny.TownyComponent;
|
||||||
import buttondevteam.core.component.updater.PluginUpdater;
|
import buttondevteam.core.component.updater.PluginUpdater;
|
||||||
import buttondevteam.core.component.updater.PluginUpdaterComponent;
|
import buttondevteam.core.component.updater.PluginUpdaterComponent;
|
||||||
|
@ -89,14 +90,16 @@ public class MainPlugin extends ButtonPlugin {
|
||||||
Component.registerComponent(this, new ChannelComponent());
|
Component.registerComponent(this, new ChannelComponent());
|
||||||
Component.registerComponent(this, new RandomTPComponent());
|
Component.registerComponent(this, new RandomTPComponent());
|
||||||
Component.registerComponent(this, new MemberComponent());
|
Component.registerComponent(this, new MemberComponent());
|
||||||
|
Component.registerComponent(this, new SpawnComponent());
|
||||||
if (Bukkit.getPluginManager().isPluginEnabled("Towny")) //It fails to load the component class otherwise
|
if (Bukkit.getPluginManager().isPluginEnabled("Towny")) //It fails to load the component class otherwise
|
||||||
Component.registerComponent(this, new TownyComponent());
|
Component.registerComponent(this, new TownyComponent());
|
||||||
if (Bukkit.getPluginManager().isPluginEnabled("Votifier") && economy != null)
|
if (Bukkit.getPluginManager().isPluginEnabled("Votifier") && economy != null)
|
||||||
Component.registerComponent(this, new VotifierComponent(economy));
|
Component.registerComponent(this, new VotifierComponent(economy));
|
||||||
ComponentManager.enableComponents();
|
ComponentManager.enableComponents();
|
||||||
getCommand2MC().registerCommand(new ComponentCommand());
|
getCommand2MC().registerCommand(new ComponentCommand());
|
||||||
getCommand2MC().registerCommand(new ThorpeCommand());
|
getCommand2MC().registerCommand(new ChromaCommand());
|
||||||
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
|
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
|
||||||
|
TBMCCoreAPI.RegisterEventsForExceptions(getCommand2MC(), this);
|
||||||
ChromaGamerBase.addConverter(commandSender -> Optional.ofNullable(commandSender instanceof ConsoleCommandSender || commandSender instanceof BlockCommandSender
|
ChromaGamerBase.addConverter(commandSender -> Optional.ofNullable(commandSender instanceof ConsoleCommandSender || commandSender instanceof BlockCommandSender
|
||||||
? TBMCPlayer.getPlayer(new UUID(0, 0), TBMCPlayer.class) : null)); //Console & cmdblocks
|
? TBMCPlayer.getPlayer(new UUID(0, 0), TBMCPlayer.class) : null)); //Console & cmdblocks
|
||||||
ChromaGamerBase.addConverter(sender -> Optional.ofNullable(sender instanceof Player
|
ChromaGamerBase.addConverter(sender -> Optional.ofNullable(sender instanceof Player
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class PlayerListener implements Listener {
|
||||||
String msg = MainPlugin.Instance.chatFormat().get()
|
String msg = MainPlugin.Instance.chatFormat().get()
|
||||||
.replace("{channel}", event.getChannel().DisplayName().get())
|
.replace("{channel}", event.getChannel().DisplayName().get())
|
||||||
.replace("{origin}", event.getOrigin().substring(0, 1))
|
.replace("{origin}", event.getOrigin().substring(0, 1))
|
||||||
.replace("{name}", ThorpeUtils.getDisplayName(event.getSender()))
|
.replace("{name}", ChromaUtils.getDisplayName(event.getSender()))
|
||||||
.replace("{message}", event.getMessage());
|
.replace("{message}", event.getMessage());
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
for (Player player : Bukkit.getOnlinePlayers())
|
||||||
if (event.shouldSendTo(player))
|
if (event.shouldSendTo(player))
|
||||||
|
|
|
@ -10,6 +10,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.util.AbstractMap;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import static buttondevteam.core.MainPlugin.permission;
|
import static buttondevteam.core.MainPlugin.permission;
|
||||||
|
@ -39,10 +40,17 @@ public class MemberComponent extends Component<MainPlugin> implements Listener {
|
||||||
return getConfig().getData("registeredForDays", 7);
|
return getConfig().getData("registeredForDays", 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AbstractMap.SimpleEntry<Statistic, Integer> playtime;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void enable() {
|
protected void enable() {
|
||||||
registerListener(this);
|
registerListener(this);
|
||||||
registerCommand(new MemberCommand(this));
|
registerCommand(new MemberCommand(this));
|
||||||
|
try {
|
||||||
|
playtime = new AbstractMap.SimpleEntry<>(Statistic.valueOf("PLAY_ONE_MINUTE"), 60); //1.14
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
playtime = new AbstractMap.SimpleEntry<>(Statistic.valueOf("PLAY_ONE_TICK"), 20 * 3600); //1.12
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -53,7 +61,7 @@ public class MemberComponent extends Component<MainPlugin> implements Listener {
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
if (permission != null && !permission.playerInGroup(event.getPlayer(), memberGroup().get())
|
if (permission != null && !permission.playerInGroup(event.getPlayer(), memberGroup().get())
|
||||||
&& (new Date(event.getPlayer().getFirstPlayed()).toInstant().plus(registeredForDays().get(), ChronoUnit.DAYS).isBefore(Instant.now())
|
&& (new Date(event.getPlayer().getFirstPlayed()).toInstant().plus(registeredForDays().get(), ChronoUnit.DAYS).isBefore(Instant.now())
|
||||||
|| event.getPlayer().getStatistic(Statistic.PLAY_ONE_TICK) > 20 * 3600 * playedHours().get())) {
|
|| event.getPlayer().getStatistic(playtime.getKey()) > playtime.getValue() * playedHours().get())) {
|
||||||
if (permission.playerAddGroup(null, event.getPlayer(), memberGroup().get())) {
|
if (permission.playerAddGroup(null, event.getPlayer(), memberGroup().get())) {
|
||||||
event.getPlayer().sendMessage("§bYou are a member now. YEEHAW");
|
event.getPlayer().sendMessage("§bYou are a member now. YEEHAW");
|
||||||
MainPlugin.Instance.getLogger().info("Added " + event.getPlayer().getName() + " as a member.");
|
MainPlugin.Instance.getLogger().info("Added " + event.getPlayer().getName() + " as a member.");
|
||||||
|
@ -62,4 +70,5 @@ public class MemberComponent extends Component<MainPlugin> implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,11 +53,15 @@ public class RandomTP extends TBMCCommandBase
|
||||||
|
|
||||||
public void onEnable(Component component)
|
public void onEnable(Component component)
|
||||||
{
|
{
|
||||||
|
System.out.println("Adding command");
|
||||||
TBMCChatAPI.AddCommand(component, this);
|
TBMCChatAPI.AddCommand(component, this);
|
||||||
|
|
||||||
|
System.out.println("Getting world");
|
||||||
world = Bukkit.getWorld("World");
|
world = Bukkit.getWorld("World");
|
||||||
|
System.out.println("Getting border");
|
||||||
border = world.getWorldBorder();
|
border = world.getWorldBorder();
|
||||||
newLocation();
|
System.out.println("Getting new location");
|
||||||
|
System.out.println("Success: "+newLocation()); //TODO: It takes 10-30 seconds to find a location (newLocation() was there)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================================================*/
|
/*================================================================================================*/
|
||||||
|
|
|
@ -19,7 +19,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
public class RestartComponent extends Component<MainPlugin> implements Listener {
|
public class RestartComponent extends Component<MainPlugin> implements Listener {
|
||||||
@Override
|
@Override
|
||||||
public void enable() {
|
public void enable() {
|
||||||
//TODO: Permissions for the commands
|
|
||||||
registerCommand(new ScheduledRestartCommand(this));
|
registerCommand(new ScheduledRestartCommand(this));
|
||||||
TBMCChatAPI.AddCommand(this, new PrimeRestartCommand(this));
|
TBMCChatAPI.AddCommand(this, new PrimeRestartCommand(this));
|
||||||
registerListener(this);
|
registerListener(this);
|
||||||
|
|
|
@ -0,0 +1,120 @@
|
||||||
|
package buttondevteam.core.component.spawn;
|
||||||
|
|
||||||
|
import buttondevteam.core.MainPlugin;
|
||||||
|
import buttondevteam.lib.architecture.Component;
|
||||||
|
import buttondevteam.lib.architecture.ConfigData;
|
||||||
|
import buttondevteam.lib.chat.Command2;
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
|
import buttondevteam.lib.chat.ICommand2MC;
|
||||||
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
import com.google.common.io.ByteArrayDataOutput;
|
||||||
|
import com.google.common.io.ByteStreams;
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
public class SpawnComponent extends Component<MainPlugin> implements PluginMessageListener {
|
||||||
|
@Override
|
||||||
|
protected void enable() {
|
||||||
|
registerCommand(new SpawnCommand());
|
||||||
|
if (targetServer().get().length() == 0) {
|
||||||
|
spawnloc = MultiverseCore.getPlugin(MultiverseCore.class).getMVWorldManager().getFirstSpawnWorld()
|
||||||
|
.getSpawnLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
Bukkit.getServer().getMessenger().registerOutgoingPluginChannel(getPlugin(), "BungeeCord");
|
||||||
|
Bukkit.getServer().getMessenger().registerIncomingPluginChannel(getPlugin(), "BungeeCord", this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void disable() {
|
||||||
|
Bukkit.getServer().getMessenger().unregisterIncomingPluginChannel(getPlugin(), "BungeeCord");
|
||||||
|
Bukkit.getServer().getMessenger().unregisterOutgoingPluginChannel(getPlugin(), "BungeeCord");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||||
|
if (!channel.equals("BungeeCord")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (targetServer().get().length() != 0)
|
||||||
|
return;
|
||||||
|
ByteArrayDataInput in = ByteStreams.newDataInput(message);
|
||||||
|
String subchannel = in.readUTF();
|
||||||
|
if ("ChromaCore-Spawn".equals(subchannel)) {
|
||||||
|
// Use the code sample in the 'Response' sections below to read
|
||||||
|
// the data.
|
||||||
|
System.out.println("Heh nice");
|
||||||
|
short len = in.readShort();
|
||||||
|
byte[] msgbytes = new byte[len];
|
||||||
|
in.readFully(msgbytes);
|
||||||
|
|
||||||
|
try {
|
||||||
|
DataInputStream msgin = new DataInputStream(new ByteArrayInputStream(msgbytes));
|
||||||
|
String somedata = msgin.readUTF(); // Read the data in the same way you wrote it
|
||||||
|
if (!"SendToSpawn".equals(somedata)) {
|
||||||
|
System.out.println("somedata: " + somedata);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
player.teleport(spawnloc);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
System.out.println("Subchannel: " + subchannel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to empty if this server is the target.
|
||||||
|
*/
|
||||||
|
private ConfigData<String> targetServer() {
|
||||||
|
return getConfig().getData("targetServer", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
private Location spawnloc;
|
||||||
|
|
||||||
|
@CommandClass(helpText = {
|
||||||
|
"Spawn",
|
||||||
|
"Teleport to spawn."
|
||||||
|
})
|
||||||
|
public class SpawnCommand extends ICommand2MC {
|
||||||
|
@SuppressWarnings("UnstableApiUsage")
|
||||||
|
@Command2.Subcommand
|
||||||
|
public void def(Player player) {
|
||||||
|
if (targetServer().get().length() == 0) {
|
||||||
|
player.sendMessage("§bTeleporting to spawn.");
|
||||||
|
player.teleport(spawnloc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||||
|
out.writeUTF("Connect");
|
||||||
|
out.writeUTF(targetServer().get());
|
||||||
|
|
||||||
|
player.sendPluginMessage(getPlugin(), "BungeeCord", out.toByteArray());
|
||||||
|
|
||||||
|
Bukkit.getScheduler().runTask(getPlugin(), () -> { //Delay it a bit
|
||||||
|
ByteArrayDataOutput outt = ByteStreams.newDataOutput();
|
||||||
|
outt.writeUTF("ForwardToPlayer"); // So BungeeCord knows to forward it
|
||||||
|
outt.writeUTF(player.getName());
|
||||||
|
outt.writeUTF("ChromaCore-Spawn"); // The channel name to check if this your data
|
||||||
|
|
||||||
|
ByteArrayOutputStream msgbytes = new ByteArrayOutputStream();
|
||||||
|
DataOutputStream msgout = new DataOutputStream(msgbytes);
|
||||||
|
try {
|
||||||
|
msgout.writeUTF("SendToSpawn"); // You can do anything you want with msgout
|
||||||
|
} catch (IOException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
outt.writeShort(msgbytes.toByteArray().length);
|
||||||
|
outt.write(msgbytes.toByteArray());
|
||||||
|
|
||||||
|
player.sendPluginMessage(getPlugin(), "BungeeCord", outt.toByteArray());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,10 +5,10 @@ import buttondevteam.core.MainPlugin;
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
import buttondevteam.lib.architecture.Component;
|
import buttondevteam.lib.architecture.Component;
|
||||||
import com.palmergames.bukkit.towny.Towny;
|
import com.palmergames.bukkit.towny.Towny;
|
||||||
|
import com.palmergames.bukkit.towny.TownyUniverse;
|
||||||
import com.palmergames.bukkit.towny.exceptions.AlreadyRegisteredException;
|
import com.palmergames.bukkit.towny.exceptions.AlreadyRegisteredException;
|
||||||
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||||
import com.palmergames.bukkit.towny.object.Resident;
|
import com.palmergames.bukkit.towny.object.Resident;
|
||||||
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,7 +41,7 @@ public class TownyComponent extends Component<MainPlugin> {
|
||||||
TBMCCoreAPI.sendDebugMessage("Target resident name is already in use.");
|
TBMCCoreAPI.sendDebugMessage("Target resident name is already in use.");
|
||||||
} else
|
} else
|
||||||
try {
|
try {
|
||||||
TownyUniverse.getDataSource().renamePlayer(resident, newName); //Fixed in Towny 0.91.1.2
|
tu.getDataSource().renamePlayer(resident, newName); //Fixed in Towny 0.91.1.2
|
||||||
} catch (AlreadyRegisteredException e) {
|
} catch (AlreadyRegisteredException e) {
|
||||||
TBMCCoreAPI.SendException("Failed to rename resident, there's already one with this name.", e);
|
TBMCCoreAPI.SendException("Failed to rename resident, there's already one with this name.", e);
|
||||||
} catch (NotRegisteredException e) {
|
} catch (NotRegisteredException e) {
|
||||||
|
|
|
@ -5,16 +5,13 @@ import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -66,7 +63,7 @@ public class PluginUpdater {
|
||||||
|
|
||||||
private static boolean updatePluginJitPack(CommandSender sender, String correctname,
|
private static boolean updatePluginJitPack(CommandSender sender, String correctname,
|
||||||
String correctbranch) {
|
String correctbranch) {
|
||||||
URL url;
|
/*URL url;
|
||||||
File result = new File(updatedir, correctname + ".jar");
|
File result = new File(updatedir, correctname + ".jar");
|
||||||
try {
|
try {
|
||||||
url = new URL("https://jitpack.io/com/github/TBMCPlugins/"
|
url = new URL("https://jitpack.io/com/github/TBMCPlugins/"
|
||||||
|
@ -93,8 +90,9 @@ public class PluginUpdater {
|
||||||
error(sender, "IO error while updating " + correctname + "\n" + e.getMessage());
|
error(sender, "IO error while updating " + correctname + "\n" + e.getMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
error(sender, "Unknown error while updating " + correctname + ": " + e);
|
error(sender, "Unknown error while updating " + correctname + ": " + e); - TODO: Either add Commons or don't use FileUtils
|
||||||
}
|
}*/
|
||||||
|
info(sender, "Plugin updating is currently not supported");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
package buttondevteam.lib;
|
package buttondevteam.lib;
|
||||||
|
|
||||||
|
import buttondevteam.core.MainPlugin;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
public final class ThorpeUtils {
|
import java.util.function.Supplier;
|
||||||
private ThorpeUtils() {}
|
|
||||||
|
public final class ChromaUtils {
|
||||||
|
private ChromaUtils() {}
|
||||||
|
|
||||||
public static String getDisplayName(CommandSender sender) {
|
public static String getDisplayName(CommandSender sender) {
|
||||||
if (sender instanceof IHaveFancyName)
|
if (sender instanceof IHaveFancyName)
|
||||||
|
@ -51,4 +57,33 @@ public final class ThorpeUtils {
|
||||||
return number.doubleValue();
|
return number.doubleValue();
|
||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls the event always asynchronously. The return value is always false if async.
|
||||||
|
*
|
||||||
|
* @param event The event to call
|
||||||
|
* @return The event cancelled state or false if async.
|
||||||
|
*/
|
||||||
|
public static <T extends Event & Cancellable> boolean callEventAsync(T event) {
|
||||||
|
Supplier<Boolean> task = () -> {
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
return event.isCancelled();
|
||||||
|
};
|
||||||
|
return doItAsync(task, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does something always asynchronously. It will execute in the same thread if it's not the server thread.
|
||||||
|
*
|
||||||
|
* @param what What to do
|
||||||
|
* @param def Default if async
|
||||||
|
* @return The event cancelled state or false if async.
|
||||||
|
*/
|
||||||
|
public static <T> T doItAsync(Supplier<T> what, T def) {
|
||||||
|
if (Bukkit.isPrimaryThread())
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(MainPlugin.Instance, what::get);
|
||||||
|
else
|
||||||
|
return what.get();
|
||||||
|
return def;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,7 +3,6 @@ package buttondevteam.lib;
|
||||||
import buttondevteam.core.component.channel.Channel;
|
import buttondevteam.core.component.channel.Channel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
|
@ -12,7 +11,6 @@ import org.bukkit.event.Event;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@RequiredArgsConstructor
|
|
||||||
public abstract class TBMCChatEventBase extends Event implements Cancellable {
|
public abstract class TBMCChatEventBase extends Event implements Cancellable {
|
||||||
private final Channel channel;
|
private final Channel channel;
|
||||||
private @NonNull String message;
|
private @NonNull String message;
|
||||||
|
@ -26,6 +24,15 @@ public abstract class TBMCChatEventBase extends Event implements Cancellable {
|
||||||
*/
|
*/
|
||||||
private final String groupID;
|
private final String groupID;
|
||||||
|
|
||||||
|
@java.beans.ConstructorProperties({"channel", "message", "score", "groupID"})
|
||||||
|
public TBMCChatEventBase(Channel channel, String message, int score, String groupID) {
|
||||||
|
super(true);
|
||||||
|
this.channel = channel;
|
||||||
|
this.message = message;
|
||||||
|
this.score = score;
|
||||||
|
this.groupID = groupID;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: Errors are sent to the sender automatically
|
* Note: Errors are sent to the sender automatically
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -27,6 +27,7 @@ public class TBMCChatPreprocessEvent extends Event implements Cancellable {
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public TBMCChatPreprocessEvent(CommandSender sender, Channel channel, String message) {
|
public TBMCChatPreprocessEvent(CommandSender sender, Channel channel, String message) {
|
||||||
|
super(true);
|
||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
this.message = message; // TODO: Message object with data?
|
this.message = message; // TODO: Message object with data?
|
||||||
|
|
|
@ -4,7 +4,6 @@ import buttondevteam.core.MainPlugin;
|
||||||
import buttondevteam.core.component.updater.PluginUpdater;
|
import buttondevteam.core.component.updater.PluginUpdater;
|
||||||
import buttondevteam.lib.player.ChromaGamerBase;
|
import buttondevteam.lib.player.ChromaGamerBase;
|
||||||
import buttondevteam.lib.potato.DebugPotato;
|
import buttondevteam.lib.potato.DebugPotato;
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -15,10 +14,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
public class TBMCCoreAPI {
|
public class TBMCCoreAPI {
|
||||||
|
@ -63,7 +59,8 @@ public class TBMCCoreAPI {
|
||||||
InputStream in = con.getInputStream();
|
InputStream in = con.getInputStream();
|
||||||
String encoding = con.getContentEncoding();
|
String encoding = con.getContentEncoding();
|
||||||
encoding = encoding == null ? "UTF-8" : encoding;
|
encoding = encoding == null ? "UTF-8" : encoding;
|
||||||
String body = IOUtils.toString(in, encoding);
|
Scanner s = new Scanner(in).useDelimiter("\\A");
|
||||||
|
String body = s.hasNext() ? s.next() : "";
|
||||||
in.close();
|
in.close();
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
@ -82,6 +79,7 @@ public class TBMCCoreAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SendException(String sourcemsg, Throwable e, boolean debugPotato) {
|
public static void SendException(String sourcemsg, Throwable e, boolean debugPotato) {
|
||||||
|
try {
|
||||||
SendUnsentExceptions();
|
SendUnsentExceptions();
|
||||||
TBMCExceptionEvent event = new TBMCExceptionEvent(sourcemsg, e);
|
TBMCExceptionEvent event = new TBMCExceptionEvent(sourcemsg, e);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
@ -113,6 +111,10 @@ public class TBMCCoreAPI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception ee) {
|
||||||
|
System.err.println("Failed to send exception!");
|
||||||
|
ee.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendDebugMessage(String debugMessage) {
|
public static void sendDebugMessage(String debugMessage) {
|
||||||
|
@ -125,6 +127,7 @@ public class TBMCCoreAPI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static EventExceptionCoreHandler eventExceptionCoreHandler;
|
||||||
/**
|
/**
|
||||||
* Registers Bukkit events, handling the exceptions occurring in those events
|
* Registers Bukkit events, handling the exceptions occurring in those events
|
||||||
*
|
*
|
||||||
|
@ -132,7 +135,8 @@ public class TBMCCoreAPI {
|
||||||
* @param plugin The plugin which the listener belongs to
|
* @param plugin The plugin which the listener belongs to
|
||||||
*/
|
*/
|
||||||
public static void RegisterEventsForExceptions(Listener listener, Plugin plugin) {
|
public static void RegisterEventsForExceptions(Listener listener, Plugin plugin) {
|
||||||
EventExceptionHandler.registerEvents(listener, plugin, new EventExceptionCoreHandler());
|
if (eventExceptionCoreHandler == null) eventExceptionCoreHandler = new EventExceptionCoreHandler();
|
||||||
|
EventExceptionHandler.registerEvents(listener, plugin, eventExceptionCoreHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends ChromaGamerBase> void RegisterUserClass(Class<T> userclass) {
|
public static <T extends ChromaGamerBase> void RegisterUserClass(Class<T> userclass) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package buttondevteam.lib;
|
package buttondevteam.lib;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
@ -9,6 +10,7 @@ public class TBMCDebugMessageEvent extends Event {
|
||||||
private boolean sent;
|
private boolean sent;
|
||||||
|
|
||||||
public TBMCDebugMessageEvent(String message) {
|
public TBMCDebugMessageEvent(String message) {
|
||||||
|
super(!Bukkit.isPrimaryThread());
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package buttondevteam.lib;
|
package buttondevteam.lib;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ import org.bukkit.event.HandlerList;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class TBMCExceptionEvent extends Event {
|
public class TBMCExceptionEvent extends Event {
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
@ -22,6 +21,13 @@ public class TBMCExceptionEvent extends Event {
|
||||||
private final Throwable exception;
|
private final Throwable exception;
|
||||||
private boolean handled;
|
private boolean handled;
|
||||||
|
|
||||||
|
@java.beans.ConstructorProperties({"sourceMessage", "exception"})
|
||||||
|
public TBMCExceptionEvent(String sourceMessage, Throwable exception) {
|
||||||
|
super(!Bukkit.isPrimaryThread());
|
||||||
|
this.sourceMessage = sourceMessage;
|
||||||
|
this.exception = exception;
|
||||||
|
}
|
||||||
|
|
||||||
public void setHandled() {
|
public void setHandled() {
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import buttondevteam.lib.chat.Command2MC;
|
||||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.experimental.var;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
|
|
|
@ -8,7 +8,6 @@ import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.experimental.var;
|
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
@ -131,10 +130,15 @@ public abstract class Component<TP extends JavaPlugin> {
|
||||||
throw new UnregisteredComponentException(component);
|
throw new UnregisteredComponentException(component);
|
||||||
if (component.enabled == enabled) return; //Don't do anything
|
if (component.enabled == enabled) return; //Don't do anything
|
||||||
if (component.enabled = enabled) {
|
if (component.enabled = enabled) {
|
||||||
|
//System.out.println("Updating config for "+component.getClassName());
|
||||||
updateConfig(component.getPlugin(), component);
|
updateConfig(component.getPlugin(), component);
|
||||||
|
//System.out.println("Enabling "+component.getClassName());
|
||||||
component.enable();
|
component.enable();
|
||||||
if (ButtonPlugin.configGenAllowed(component))
|
if (ButtonPlugin.configGenAllowed(component)) {
|
||||||
|
//System.out.println("Pregenning config for "+component.getClassName());
|
||||||
IHaveConfig.pregenConfig(component, null);
|
IHaveConfig.pregenConfig(component, null);
|
||||||
|
}
|
||||||
|
//System.out.println("Done enabling "+component.getClassName());
|
||||||
} else {
|
} else {
|
||||||
component.disable();
|
component.disable();
|
||||||
component.plugin.saveConfig();
|
component.plugin.saveConfig();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package buttondevteam.lib.architecture;
|
package buttondevteam.lib.architecture;
|
||||||
|
|
||||||
import buttondevteam.core.MainPlugin;
|
import buttondevteam.core.MainPlugin;
|
||||||
import buttondevteam.lib.ThorpeUtils;
|
import buttondevteam.lib.ChromaUtils;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
@ -101,7 +101,7 @@ public class ConfigData<T> {
|
||||||
return hmm;
|
return hmm;
|
||||||
}
|
}
|
||||||
if (val instanceof Number && def != null)
|
if (val instanceof Number && def != null)
|
||||||
val = ThorpeUtils.convertNumber((Number) val,
|
val = ChromaUtils.convertNumber((Number) val,
|
||||||
(Class<? extends Number>) def.getClass());
|
(Class<? extends Number>) def.getClass());
|
||||||
if (val instanceof List && def != null && def.getClass().isArray())
|
if (val instanceof List && def != null && def.getClass().isArray())
|
||||||
val = ((List<T>) val).toArray((T[]) Array.newInstance(def.getClass().getComponentType(), 0));
|
val = ((List<T>) val).toArray((T[]) Array.newInstance(def.getClass().getComponentType(), 0));
|
||||||
|
|
|
@ -166,6 +166,7 @@ public final class IHaveConfig {
|
||||||
}
|
}
|
||||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
}).filter(Objects::nonNull).collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
|
if (TBMCCoreAPI.IsTestServer())
|
||||||
MainPlugin.Instance.getLogger().warning("Method " + m.getName() + " returns a config but its parameters are unknown: " + Arrays.toString(m.getParameterTypes()));
|
MainPlugin.Instance.getLogger().warning("Method " + m.getName() + " returns a config but its parameters are unknown: " + Arrays.toString(m.getParameterTypes()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
package buttondevteam.lib.chat;
|
package buttondevteam.lib.chat;
|
||||||
|
|
||||||
import buttondevteam.core.MainPlugin;
|
import buttondevteam.core.MainPlugin;
|
||||||
|
import buttondevteam.lib.ChromaUtils;
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
import buttondevteam.lib.ThorpeUtils;
|
|
||||||
import buttondevteam.lib.player.ChromaGamerBase;
|
import buttondevteam.lib.player.ChromaGamerBase;
|
||||||
import com.google.common.base.Defaults;
|
import com.google.common.base.Defaults;
|
||||||
import com.google.common.primitives.Primitives;
|
import com.google.common.primitives.Primitives;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.experimental.var;
|
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
@ -60,7 +59,7 @@ public abstract class Command2<TC extends ICommand2, TP extends Command2Sender>
|
||||||
String[] helpText() default {};
|
String[] helpText() default {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main permission which allows using this command (individual access can be still granted with "thorpe.command.X").
|
* The main permission which allows using this command (individual access can be still granted with "chroma.command.X").
|
||||||
* Used to be "tbmc.admin". The {@link #MOD_GROUP} is provided to use with this.
|
* Used to be "tbmc.admin". The {@link #MOD_GROUP} is provided to use with this.
|
||||||
*/
|
*/
|
||||||
String permGroup() default ""; //TODO
|
String permGroup() default ""; //TODO
|
||||||
|
@ -109,7 +108,7 @@ public abstract class Command2<TC extends ICommand2, TP extends Command2Sender>
|
||||||
public final String errormsg;
|
public final String errormsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
private HashMap<String, SubcommandData<TC>> subcommands = new HashMap<>();
|
protected HashMap<String, SubcommandData<TC>> subcommands = new HashMap<>();
|
||||||
private HashMap<Class<?>, ParamConverter<?>> paramConverters = new HashMap<>();
|
private HashMap<Class<?>, ParamConverter<?>> paramConverters = new HashMap<>();
|
||||||
|
|
||||||
private ArrayList<String> commandHelp = new ArrayList<>(); //Mainly needed by Discord
|
private ArrayList<String> commandHelp = new ArrayList<>(); //Mainly needed by Discord
|
||||||
|
@ -126,18 +125,33 @@ public abstract class Command2<TC extends ICommand2, TP extends Command2Sender>
|
||||||
paramConverters.put(cl, new ParamConverter<>(converter, errormsg));
|
paramConverters.put(cl, new ParamConverter<>(converter, errormsg));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean handleCommand(TP sender, String commandline) throws Exception {
|
public boolean handleCommand(TP sender, String commandline) {
|
||||||
for (int i = commandline.length(); i != -1; i = commandline.lastIndexOf(' ', i - 1)) {
|
for (int i = commandline.length(); i != -1; i = commandline.lastIndexOf(' ', i - 1)) {
|
||||||
String subcommand = commandline.substring(0, i).toLowerCase();
|
String subcommand = commandline.substring(0, i).toLowerCase();
|
||||||
SubcommandData<TC> sd = subcommands.get(subcommand); //O(1)
|
SubcommandData<TC> sd = subcommands.get(subcommand); //O(1)
|
||||||
if (sd == null) continue;
|
if (sd == null) continue;
|
||||||
|
boolean sync = Bukkit.isPrimaryThread();
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(MainPlugin.Instance, () -> {
|
||||||
|
try {
|
||||||
|
handleCommandAsync(sender, commandline, sd, subcommand, sync);
|
||||||
|
} catch (Exception e) {
|
||||||
|
TBMCCoreAPI.SendException("Command execution failed for sender " + sender + " and message " + commandline, e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true; //We found a method
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Needed because permission checking may load the (perhaps offline) sender's file which is disallowed on the main thread
|
||||||
|
public void handleCommandAsync(TP sender, String commandline, SubcommandData<TC> sd, String subcommand, boolean sync) throws Exception {
|
||||||
if (sd.method == null || sd.command == null) { //Main command not registered, but we have subcommands
|
if (sd.method == null || sd.command == null) { //Main command not registered, but we have subcommands
|
||||||
sender.sendMessage(sd.helpText);
|
sender.sendMessage(sd.helpText);
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
if (!hasPermission(sender, sd.command, sd.method)) {
|
if (!hasPermission(sender, sd.command, sd.method)) {
|
||||||
sender.sendMessage("§cYou don't have permission to use this command");
|
sender.sendMessage("§cYou don't have permission to use this command");
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
val params = new ArrayList<Object>(sd.method.getParameterCount());
|
val params = new ArrayList<Object>(sd.method.getParameterCount());
|
||||||
int j = subcommand.length(), pj;
|
int j = subcommand.length(), pj;
|
||||||
|
@ -158,7 +172,7 @@ public abstract class Command2<TC extends ICommand2, TP extends Command2Sender>
|
||||||
params.add(cg);
|
params.add(cg);
|
||||||
else {
|
else {
|
||||||
sender.sendMessage("§cYou need to be a " + sendertype.getSimpleName() + " to use this command.");
|
sender.sendMessage("§cYou need to be a " + sendertype.getSimpleName() + " to use this command.");
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
val paramArr = sd.method.getParameters();
|
val paramArr = sd.method.getParameters();
|
||||||
for (int i1 = 1; i1 < parameterTypes.length; i1++) {
|
for (int i1 = 1; i1 < parameterTypes.length; i1++) {
|
||||||
|
@ -176,7 +190,7 @@ public abstract class Command2<TC extends ICommand2, TP extends Command2Sender>
|
||||||
continue; //Fill the remaining params with nulls
|
continue; //Fill the remaining params with nulls
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(sd.helpText); //Required param missing
|
sender.sendMessage(sd.helpText); //Required param missing
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (paramArr[i1].isVarArgs()) {
|
if (paramArr[i1].isVarArgs()) {
|
||||||
|
@ -193,11 +207,11 @@ public abstract class Command2<TC extends ICommand2, TP extends Command2Sender>
|
||||||
} else if (Number.class.isAssignableFrom(cl) || cl.isPrimitive()) {
|
} else if (Number.class.isAssignableFrom(cl) || cl.isPrimitive()) {
|
||||||
try {
|
try {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
Number n = ThorpeUtils.convertNumber(NumberFormat.getInstance().parse(param), (Class<? extends Number>) cl);
|
Number n = ChromaUtils.convertNumber(NumberFormat.getInstance().parse(param), (Class<? extends Number>) cl);
|
||||||
params.add(n);
|
params.add(n);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
sender.sendMessage("§c'" + param + "' is not a number.");
|
sender.sendMessage("§c'" + param + "' is not a number.");
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -207,10 +221,11 @@ public abstract class Command2<TC extends ICommand2, TP extends Command2Sender>
|
||||||
val cparam = conv.converter.apply(param);
|
val cparam = conv.converter.apply(param);
|
||||||
if (cparam == null) {
|
if (cparam == null) {
|
||||||
sender.sendMessage(conv.errormsg); //Param conversion failed - ex. plugin not found
|
sender.sendMessage(conv.errormsg); //Param conversion failed - ex. plugin not found
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
params.add(cparam);
|
params.add(cparam);
|
||||||
}
|
}
|
||||||
|
Runnable lol = () -> {
|
||||||
try {
|
try {
|
||||||
val ret = sd.method.invoke(sd.command, params.toArray()); //I FORGOT TO TURN IT INTO AN ARRAY (for a long time)
|
val ret = sd.method.invoke(sd.command, params.toArray()); //I FORGOT TO TURN IT INTO AN ARRAY (for a long time)
|
||||||
if (ret instanceof Boolean) {
|
if (ret instanceof Boolean) {
|
||||||
|
@ -218,12 +233,16 @@ public abstract class Command2<TC extends ICommand2, TP extends Command2Sender>
|
||||||
sender.sendMessage(sd.helpText);
|
sender.sendMessage(sd.helpText);
|
||||||
} else if (ret != null)
|
} else if (ret != null)
|
||||||
throw new Exception("Wrong return type! Must return a boolean or void. Return value: " + ret);
|
throw new Exception("Wrong return type! Must return a boolean or void. Return value: " + ret);
|
||||||
return true; //We found a method
|
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
TBMCCoreAPI.SendException("An error occurred in a command handler!", e.getCause());
|
TBMCCoreAPI.SendException("An error occurred in a command handler!", e.getCause());
|
||||||
|
} catch (Exception e) {
|
||||||
|
TBMCCoreAPI.SendException("Command handling failed for sender " + sender + " and subcommand " + subcommand, e);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
return false; //Didn't handle
|
if (sync)
|
||||||
|
Bukkit.getScheduler().runTask(MainPlugin.Instance, lol);
|
||||||
|
else
|
||||||
|
lol.run();
|
||||||
} //TODO: Add to the help
|
} //TODO: Add to the help
|
||||||
|
|
||||||
public abstract void registerCommand(TC command);
|
public abstract void registerCommand(TC command);
|
||||||
|
@ -321,4 +340,8 @@ public abstract class Command2<TC extends ICommand2, TP extends Command2Sender>
|
||||||
if (scmd == null) return null;
|
if (scmd == null) return null;
|
||||||
return scmd.helpText;
|
return scmd.helpText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*public Set<String> getAllSubcommands() {
|
||||||
|
return Collections.unmodifiableSet(subcommands.keySet());
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,29 @@
|
||||||
package buttondevteam.lib.chat;
|
package buttondevteam.lib.chat;
|
||||||
|
|
||||||
import buttondevteam.core.MainPlugin;
|
import buttondevteam.core.MainPlugin;
|
||||||
import lombok.experimental.var;
|
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.server.TabCompleteEvent;
|
||||||
import org.bukkit.permissions.Permission;
|
import org.bukkit.permissions.Permission;
|
||||||
import org.bukkit.permissions.PermissionDefault;
|
import org.bukkit.permissions.PermissionDefault;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
public class Command2MC extends Command2<ICommand2MC, Command2MCSender> {
|
public class Command2MC extends Command2<ICommand2MC, Command2MCSender> implements Listener {
|
||||||
@Override
|
@Override
|
||||||
public void registerCommand(ICommand2MC command) {
|
public void registerCommand(ICommand2MC command) {
|
||||||
super.registerCommand(command, '/');
|
super.registerCommand(command, '/');
|
||||||
var perm = "thorpe.command." + command.getCommandPath().replace(' ', '.');
|
var perm = "chroma.command." + command.getCommandPath().replace(' ', '.');
|
||||||
if (Bukkit.getPluginManager().getPermission(perm) == null) //Check needed for plugin reset
|
if (Bukkit.getPluginManager().getPermission(perm) == null) //Check needed for plugin reset
|
||||||
Bukkit.getPluginManager().addPermission(new Permission(perm,
|
Bukkit.getPluginManager().addPermission(new Permission(perm,
|
||||||
modOnly(command) ? PermissionDefault.OP : PermissionDefault.TRUE)); //Allow commands by default, unless it's mod only - TODO: Test
|
modOnly(command) ? PermissionDefault.OP : PermissionDefault.TRUE)); //Allow commands by default, unless it's mod only - TODO: Test
|
||||||
|
@ -26,7 +31,7 @@ public class Command2MC extends Command2<ICommand2MC, Command2MCSender> {
|
||||||
if (!method.isAnnotationPresent(Subcommand.class)) continue;
|
if (!method.isAnnotationPresent(Subcommand.class)) continue;
|
||||||
String pg = permGroup(command, method);
|
String pg = permGroup(command, method);
|
||||||
if (pg.length() == 0) continue;
|
if (pg.length() == 0) continue;
|
||||||
perm = "thorpe." + pg;
|
perm = "chroma." + pg;
|
||||||
if (Bukkit.getPluginManager().getPermission(perm) == null) //It may occur multiple times
|
if (Bukkit.getPluginManager().getPermission(perm) == null) //It may occur multiple times
|
||||||
Bukkit.getPluginManager().addPermission(new Permission(perm,
|
Bukkit.getPluginManager().addPermission(new Permission(perm,
|
||||||
//pg.equals(Subcommand.MOD_GROUP) ? PermissionDefault.OP : PermissionDefault.TRUE)); //Allow commands by default, unless it's mod only
|
//pg.equals(Subcommand.MOD_GROUP) ? PermissionDefault.OP : PermissionDefault.TRUE)); //Allow commands by default, unless it's mod only
|
||||||
|
@ -36,19 +41,23 @@ public class Command2MC extends Command2<ICommand2MC, Command2MCSender> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(Command2MCSender sender, ICommand2MC command, Method method) {
|
public boolean hasPermission(Command2MCSender sender, ICommand2MC command, Method method) {
|
||||||
if (sender.getSender() instanceof ConsoleCommandSender) return true; //Always allow the console
|
return hasPermission(sender.getSender(), command, method);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasPermission(CommandSender sender, ICommand2MC command, Method method) {
|
||||||
|
if (sender instanceof ConsoleCommandSender) return true; //Always allow the console
|
||||||
String pg;
|
String pg;
|
||||||
boolean p = true;
|
boolean p = true;
|
||||||
String[] perms = {
|
String[] perms = {
|
||||||
"thorpe.command." + command.getCommandPath().replace(' ', '.'),
|
"chroma.command." + command.getCommandPath().replace(' ', '.'),
|
||||||
(pg = permGroup(command, method)).length() > 0 ? "thorpe." + pg : null,
|
(pg = permGroup(command, method)).length() > 0 ? "chroma." + pg : null,
|
||||||
modOnly(command) ? "tbmc.admin" : null
|
modOnly(command) ? "tbmc.admin" : null
|
||||||
};
|
};
|
||||||
for (String perm : perms) {
|
for (String perm : perms) {
|
||||||
if (perm != null) {
|
if (perm != null) {
|
||||||
if (p) { //Use OfflinePlayer to avoid fetching player data
|
if (p) { //Use OfflinePlayer to avoid fetching player data
|
||||||
if (sender.getSender() instanceof OfflinePlayer)
|
if (sender instanceof OfflinePlayer)
|
||||||
p = MainPlugin.permission.playerHas(null, (OfflinePlayer) sender.getSender(), perm);
|
p = MainPlugin.permission.playerHas(null, (OfflinePlayer) sender, perm);
|
||||||
else
|
else
|
||||||
p = MainPlugin.permission.playerHas(null, Bukkit.getOfflinePlayer(new UUID(0, 0)), perm);
|
p = MainPlugin.permission.playerHas(null, Bukkit.getOfflinePlayer(new UUID(0, 0)), perm);
|
||||||
} else break; //If any of the permissions aren't granted then don't allow
|
} else break; //If any of the permissions aren't granted then don't allow
|
||||||
|
@ -109,4 +118,112 @@ public class Command2MC extends Command2<ICommand2MC, Command2MCSender> {
|
||||||
public <T> void addParamConverter(Class<T> cl, Function<String, T> converter, String errormsg) {
|
public <T> void addParamConverter(Class<T> cl, Function<String, T> converter, String errormsg) {
|
||||||
super.addParamConverter(cl, converter, "§c" + errormsg);
|
super.addParamConverter(cl, converter, "§c" + errormsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
private void handleTabComplete(TabCompleteEvent event) {
|
||||||
|
String commandline = event.getBuffer();
|
||||||
|
CommandSender sender = event.getSender();
|
||||||
|
//System.out.println("tab");
|
||||||
|
for (int i = commandline.length(); i != -1; i = commandline.lastIndexOf(' ', i - 1)) {
|
||||||
|
String subcommand = commandline.substring(0, i).toLowerCase();
|
||||||
|
if (subcommand.length() == 0 || subcommand.charAt(0) != '/') subcommand = '/' + subcommand; //Console
|
||||||
|
//System.out.println("Subcommand: " + subcommand);
|
||||||
|
SubcommandData<ICommand2MC> sd = subcommands.get(subcommand); //O(1)
|
||||||
|
if (sd == null) continue;
|
||||||
|
//System.out.println("ht: " + Arrays.toString(sd.helpText));
|
||||||
|
Arrays.stream(sd.helpText).skip(1).map(ht -> new HashMap.SimpleEntry<>(ht, subcommands.get(ht))).filter(e -> e.getValue() != null)
|
||||||
|
.filter(kv -> kv.getKey().startsWith(commandline))
|
||||||
|
.filter(kv -> hasPermission(sender, kv.getValue().command, kv.getValue().method))
|
||||||
|
.forEach(kv -> event.getCompletions().add((kv.getKey()).substring(kv.getKey().lastIndexOf(' ', commandline.length()) + 1)));
|
||||||
|
if (sd.method == null || sd.command == null)
|
||||||
|
return;
|
||||||
|
/*if (!hasPermission(sender, sd.command, sd.method)) { - TODO: Arguments
|
||||||
|
sender.sendMessage("§cYou don't have permission to use this command");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
val params = new ArrayList<Object>(sd.method.getParameterCount());
|
||||||
|
int j = subcommand.length(), pj;
|
||||||
|
Class<?>[] parameterTypes = sd.method.getParameterTypes();
|
||||||
|
if (parameterTypes.length == 0)
|
||||||
|
throw new Exception("No sender parameter for method '" + sd.method + "'");
|
||||||
|
val sendertype = parameterTypes[0];
|
||||||
|
final ChromaGamerBase cg;
|
||||||
|
if (sendertype.isAssignableFrom(sender.getClass()))
|
||||||
|
params.add(sender); //The command either expects a CommandSender or it is a Player, or some other expected type
|
||||||
|
else if (sender instanceof Command2MCSender
|
||||||
|
&& sendertype.isAssignableFrom(((Command2MCSender) sender).getSender().getClass()))
|
||||||
|
params.add(((Command2MCSender) sender).getSender());
|
||||||
|
else if (ChromaGamerBase.class.isAssignableFrom(sendertype)
|
||||||
|
&& sender instanceof Command2MCSender
|
||||||
|
&& (cg = ChromaGamerBase.getFromSender(((Command2MCSender) sender).getSender())) != null
|
||||||
|
&& cg.getClass() == sendertype) //The command expects a user of our system
|
||||||
|
params.add(cg);
|
||||||
|
else {
|
||||||
|
sender.sendMessage("§cYou need to be a " + sendertype.getSimpleName() + " to use this command.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
val paramArr = sd.method.getParameters();
|
||||||
|
for (int i1 = 1; i1 < parameterTypes.length; i1++) {
|
||||||
|
Class<?> cl = parameterTypes[i1];
|
||||||
|
pj = j + 1; //Start index
|
||||||
|
if (pj == commandline.length() + 1) { //No param given
|
||||||
|
if (paramArr[i1].isAnnotationPresent(OptionalArg.class)) {
|
||||||
|
if (cl.isPrimitive())
|
||||||
|
params.add(Defaults.defaultValue(cl));
|
||||||
|
else if (Number.class.isAssignableFrom(cl)
|
||||||
|
|| Number.class.isAssignableFrom(cl))
|
||||||
|
params.add(Defaults.defaultValue(Primitives.unwrap(cl)));
|
||||||
|
else
|
||||||
|
params.add(null);
|
||||||
|
continue; //Fill the remaining params with nulls
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(sd.helpText); //Required param missing
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (paramArr[i1].isVarArgs()) {
|
||||||
|
par0ams.add(commandline.substring(j + 1).split(" +"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
j = commandline.indexOf(' ', j + 1); //End index
|
||||||
|
if (j == -1 || paramArr[i1].isAnnotationPresent(TextArg.class)) //Last parameter
|
||||||
|
j = commandline.length();
|
||||||
|
String param = commandline.substring(pj, j);
|
||||||
|
if (cl == String.class) {
|
||||||
|
params.add(param);
|
||||||
|
continue;
|
||||||
|
} else if (Number.class.isAssignableFrom(cl) || cl.isPrimitive()) {
|
||||||
|
try {
|
||||||
|
//noinspection unchecked
|
||||||
|
Number n = ThorpeUtils.convertNumber(NumberFormat.getInstance().parse(param), (Class<? extends Number>) cl);
|
||||||
|
params.add(n);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
sender.sendMessage("§c'" + param + "' is not a number.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
val conv = paramConverters.get(cl);
|
||||||
|
if (conv == null)
|
||||||
|
throw new Exception("No suitable converter found for parameter type '" + cl.getCanonicalName() + "' for command '" + sd.method.toString() + "'");
|
||||||
|
val cparam = conv.converter.apply(param);
|
||||||
|
if (cparam == null) {
|
||||||
|
sender.sendMessage(conv.errormsg); //Param conversion failed - ex. plugin not found
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
params.add(cparam);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
val ret = sd.method.invoke(sd.command, params.toArray()); //I FORGOT TO TURN IT INTO AN ARRAY (for a long time)
|
||||||
|
if (ret instanceof Boolean) {
|
||||||
|
if (!(boolean) ret) //Show usage
|
||||||
|
sender.sendMessage(sd.helpText);
|
||||||
|
} else if (ret != null)
|
||||||
|
throw new Exception("Wrong return type! Must return a boolean or void. Return value: " + ret);
|
||||||
|
return true; //We found a method
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
TBMCCoreAPI.SendException("An error occurred in a command handler!", e.getCause());
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public @interface CommandClass {
|
||||||
String[] helpText() default {};
|
String[] helpText() default {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main permission which allows using this command (individual access can be still granted with "thorpe.command.X").
|
* The main permission which allows using this command (individual access can be still granted with "chroma.command.X").
|
||||||
* Used to be "tbmc.admin"
|
* Used to be "tbmc.admin"
|
||||||
*/
|
*/
|
||||||
String permGroup() default ""; //TODO: A single annotation instead of these two
|
String permGroup() default ""; //TODO: A single annotation instead of these two
|
||||||
|
|
|
@ -4,10 +4,7 @@ import buttondevteam.core.CommandCaller;
|
||||||
import buttondevteam.core.MainPlugin;
|
import buttondevteam.core.MainPlugin;
|
||||||
import buttondevteam.core.component.channel.Channel;
|
import buttondevteam.core.component.channel.Channel;
|
||||||
import buttondevteam.core.component.channel.Channel.RecipientTestResult;
|
import buttondevteam.core.component.channel.Channel.RecipientTestResult;
|
||||||
import buttondevteam.lib.TBMCChatEvent;
|
import buttondevteam.lib.*;
|
||||||
import buttondevteam.lib.TBMCChatPreprocessEvent;
|
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
|
||||||
import buttondevteam.lib.TBMCSystemChatEvent;
|
|
||||||
import buttondevteam.lib.architecture.Component;
|
import buttondevteam.lib.architecture.Component;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -26,6 +23,7 @@ import java.util.HashMap;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class TBMCChatAPI {
|
public class TBMCChatAPI {
|
||||||
|
|
||||||
|
@ -38,10 +36,8 @@ public class TBMCChatAPI {
|
||||||
/**
|
/**
|
||||||
* Returns messages formatted for Minecraft chat listing the subcommands of the command.
|
* Returns messages formatted for Minecraft chat listing the subcommands of the command.
|
||||||
*
|
*
|
||||||
* @param command
|
* @param command The command which we want the subcommands of
|
||||||
* The command which we want the subcommands of
|
* @param sender The sender for permissions
|
||||||
* @param sender
|
|
||||||
* The sender for permissions
|
|
||||||
* @return The subcommands
|
* @return The subcommands
|
||||||
*/
|
*/
|
||||||
public static String[] GetSubCommands(TBMCCommandBase command, CommandSender sender) {
|
public static String[] GetSubCommands(TBMCCommandBase command, CommandSender sender) {
|
||||||
|
@ -52,10 +48,8 @@ public class TBMCChatAPI {
|
||||||
* Returns messages formatted for Minecraft chat listing the subcommands of the command.<br>
|
* Returns messages formatted for Minecraft chat listing the subcommands of the command.<br>
|
||||||
* Returns a header if subcommands were found, otherwise returns an empty array.
|
* Returns a header if subcommands were found, otherwise returns an empty array.
|
||||||
*
|
*
|
||||||
* @param command
|
* @param command The command which we want the subcommands of
|
||||||
* The command which we want the subcommands of
|
* @param sender The sender for permissions
|
||||||
* @param sender
|
|
||||||
* The sender for permissions
|
|
||||||
* @return The subcommands
|
* @return The subcommands
|
||||||
*/
|
*/
|
||||||
public static String[] GetSubCommands(String command, CommandSender sender) {
|
public static String[] GetSubCommands(String command, CommandSender sender) {
|
||||||
|
@ -97,10 +91,8 @@ public class TBMCChatAPI {
|
||||||
* <i>Using this method after the server is done loading will have no effect.</i>
|
* <i>Using this method after the server is done loading will have no effect.</i>
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param plugin
|
* @param plugin The caller plugin
|
||||||
* The caller plugin
|
* @param acmdclass A command's class to get the package name for commands. The provided class's package and subpackages are scanned for commands.
|
||||||
* @param acmdclass
|
|
||||||
* A command's class to get the package name for commands. The provided class's package and subpackages are scanned for commands.
|
|
||||||
*/
|
*/
|
||||||
public static synchronized void AddCommands(JavaPlugin plugin, Class<? extends TBMCCommandBase> acmdclass) {
|
public static synchronized void AddCommands(JavaPlugin plugin, Class<? extends TBMCCommandBase> acmdclass) {
|
||||||
plugin.getLogger().info("Registering commands from " + acmdclass.getPackage().getName());
|
plugin.getLogger().info("Registering commands from " + acmdclass.getPackage().getName());
|
||||||
|
@ -140,10 +132,8 @@ public class TBMCChatAPI {
|
||||||
* <i>Using this method after the server is done loading will have no effect.</i>
|
* <i>Using this method after the server is done loading will have no effect.</i>
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param plugin
|
* @param plugin The caller plugin
|
||||||
* The caller plugin
|
* @param thecmdclass The command's class to create it (because why let you create the command class)
|
||||||
* @param thecmdclass
|
|
||||||
* The command's class to create it (because why let you create the command class)
|
|
||||||
*/
|
*/
|
||||||
public static void AddCommand(JavaPlugin plugin, Class<? extends TBMCCommandBase> thecmdclass, Object... params) {
|
public static void AddCommand(JavaPlugin plugin, Class<? extends TBMCCommandBase> thecmdclass, Object... params) {
|
||||||
// plugin.getLogger().info("Registering command " + thecmdclass.getSimpleName() + " for " + plugin.getName());
|
// plugin.getLogger().info("Registering command " + thecmdclass.getSimpleName() + " for " + plugin.getName());
|
||||||
|
@ -173,10 +163,8 @@ public class TBMCChatAPI {
|
||||||
* <i>Using this method after the server is done loading will have no effect.</i>
|
* <i>Using this method after the server is done loading will have no effect.</i>
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param plugin
|
* @param plugin The caller plugin
|
||||||
* The caller plugin
|
* @param cmd The command to add
|
||||||
* @param cmd
|
|
||||||
* The command to add
|
|
||||||
*/
|
*/
|
||||||
public static void AddCommand(JavaPlugin plugin, TBMCCommandBase cmd) {
|
public static void AddCommand(JavaPlugin plugin, TBMCCommandBase cmd) {
|
||||||
try {
|
try {
|
||||||
|
@ -283,6 +271,7 @@ public class TBMCChatAPI {
|
||||||
cm.getSender().sendMessage("§cThe channel '" + channel.DisplayName().get() + "' is disabled!");
|
cm.getSender().sendMessage("§cThe channel '" + channel.DisplayName().get() + "' is disabled!");
|
||||||
return true; //Cancel sending if channel is disabled
|
return true; //Cancel sending if channel is disabled
|
||||||
}
|
}
|
||||||
|
Supplier<Boolean> task = () -> {
|
||||||
val permcheck = cm.getPermCheck();
|
val permcheck = cm.getPermCheck();
|
||||||
RecipientTestResult rtr = getScoreOrSendError(channel, permcheck);
|
RecipientTestResult rtr = getScoreOrSendError(channel, permcheck);
|
||||||
int score = rtr.score;
|
int score = rtr.score;
|
||||||
|
@ -297,17 +286,16 @@ public class TBMCChatAPI {
|
||||||
event = new TBMCChatEvent(channel, cm, rtr);
|
event = new TBMCChatEvent(channel, cm, rtr);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
return event.isCancelled();
|
return event.isCancelled();
|
||||||
|
};
|
||||||
|
return ChromaUtils.doItAsync(task, false); //Not cancelled if async
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a regular message to Minecraft. Make sure that the channel is registered with {@link #RegisterChatChannel(Channel)}.
|
* Sends a regular message to Minecraft. Make sure that the channel is registered with {@link #RegisterChatChannel(Channel)}.
|
||||||
*
|
*
|
||||||
* @param channel
|
* @param channel The channel to send to
|
||||||
* The channel to send to
|
* @param rtr The score&group to use to find the group - use {@link RecipientTestResult#ALL} if the channel doesn't have scores
|
||||||
* @param rtr
|
* @param message The message to send
|
||||||
* The score&group to use to find the group - use {@link RecipientTestResult#ALL} if the channel doesn't have scores
|
|
||||||
* @param message
|
|
||||||
* The message to send
|
|
||||||
* @param exceptions Platforms where this message shouldn't be sent (same as {@link ChatMessage#getOrigin()}
|
* @param exceptions Platforms where this message shouldn't be sent (same as {@link ChatMessage#getOrigin()}
|
||||||
* @return The event cancelled state
|
* @return The event cancelled state
|
||||||
*/
|
*/
|
||||||
|
@ -319,8 +307,7 @@ public class TBMCChatAPI {
|
||||||
if (!Arrays.asList(exceptions).contains("Minecraft"))
|
if (!Arrays.asList(exceptions).contains("Minecraft"))
|
||||||
Bukkit.getConsoleSender().sendMessage("[" + channel.DisplayName().get() + "] " + message);
|
Bukkit.getConsoleSender().sendMessage("[" + channel.DisplayName().get() + "] " + message);
|
||||||
TBMCSystemChatEvent event = new TBMCSystemChatEvent(channel, message, rtr.score, rtr.groupID, exceptions, target);
|
TBMCSystemChatEvent event = new TBMCSystemChatEvent(channel, message, rtr.score, rtr.groupID, exceptions, target);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
return ChromaUtils.callEventAsync(event);
|
||||||
return event.isCancelled();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RecipientTestResult getScoreOrSendError(Channel channel, CommandSender sender) {
|
private static RecipientTestResult getScoreOrSendError(Channel channel, CommandSender sender) {
|
||||||
|
@ -333,8 +320,7 @@ public class TBMCChatAPI {
|
||||||
/**
|
/**
|
||||||
* Register a chat channel. See {@link Channel#Channel(String, Color, String, java.util.function.Function)} for details.
|
* Register a chat channel. See {@link Channel#Channel(String, Color, String, java.util.function.Function)} for details.
|
||||||
*
|
*
|
||||||
* @param channel
|
* @param channel A new {@link Channel} to register
|
||||||
* A new {@link Channel} to register
|
|
||||||
*/
|
*/
|
||||||
public static void RegisterChatChannel(Channel channel) {
|
public static void RegisterChatChannel(Channel channel) {
|
||||||
Channel.RegisterChannel(channel);
|
Channel.RegisterChannel(channel);
|
||||||
|
|
|
@ -24,6 +24,7 @@ public class TBMCPlayerGetInfoEvent extends Event {
|
||||||
private final InfoTarget target;
|
private final InfoTarget target;
|
||||||
|
|
||||||
TBMCPlayerGetInfoEvent(ChromaGamerBase player, InfoTarget target) {
|
TBMCPlayerGetInfoEvent(ChromaGamerBase player, InfoTarget target) {
|
||||||
|
super(true);
|
||||||
this.player = player;
|
this.player = player;
|
||||||
infolines = new ArrayList<>();
|
infolines = new ArrayList<>();
|
||||||
this.target = target;
|
this.target = target;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
name: ThorpeCore
|
name: ChromaCore
|
||||||
main: buttondevteam.core.MainPlugin
|
main: buttondevteam.core.MainPlugin
|
||||||
version: 1.0
|
version: 1.0
|
||||||
author: TBMCPlugins
|
author: TBMCPlugins
|
||||||
|
@ -21,3 +21,4 @@ depend:
|
||||||
softdepend:
|
softdepend:
|
||||||
- Towny
|
- Towny
|
||||||
- Votifier
|
- Votifier
|
||||||
|
- Multiverse-Core
|
|
@ -6,9 +6,14 @@ import buttondevteam.lib.player.TBMCPlayerBase;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.FileVisitResult;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.SimpleFileVisitor;
|
||||||
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PlayerDataTest extends TestCase {
|
public class PlayerDataTest extends TestCase {
|
||||||
|
@ -25,7 +30,30 @@ public class PlayerDataTest extends TestCase {
|
||||||
|
|
||||||
public void testConfig() throws Exception {
|
public void testConfig() throws Exception {
|
||||||
TestPrepare.PrepareServer();
|
TestPrepare.PrepareServer();
|
||||||
FileUtils.deleteDirectory(new File(ChromaGamerBase.TBMC_PLAYERS_DIR));
|
//FileUtils.deleteDirectory(new File(ChromaGamerBase.TBMC_PLAYERS_DIR));
|
||||||
|
File file = new File(ChromaGamerBase.TBMC_PLAYERS_DIR);
|
||||||
|
if (file.exists()) {
|
||||||
|
Files.walkFileTree(file.toPath(), new SimpleFileVisitor<Path>() {
|
||||||
|
@Override
|
||||||
|
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
|
||||||
|
throws IOException {
|
||||||
|
Files.delete(file);
|
||||||
|
return FileVisitResult.CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FileVisitResult postVisitDirectory(Path dir, IOException e)
|
||||||
|
throws IOException {
|
||||||
|
if (e == null) {
|
||||||
|
Files.delete(dir);
|
||||||
|
return FileVisitResult.CONTINUE;
|
||||||
|
} else {
|
||||||
|
// directory iteration failed
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
UUID uuid = new UUID(0L, 0L);
|
UUID uuid = new UUID(0L, 0L);
|
||||||
try (TestPlayerClass p = TBMCPlayerBase.getPlayer(uuid, TestPlayerClass.class)) {
|
try (TestPlayerClass p = TBMCPlayerBase.getPlayer(uuid, TestPlayerClass.class)) {
|
||||||
p.PlayerName().set("Test");
|
p.PlayerName().set("Test");
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||||
<component name="ExternalSystem" externalSystem="Maven" />
|
<component name="ExternalSystem" externalSystem="Maven" />
|
||||||
|
<component name="MavenAnnotationProcessors">
|
||||||
|
<modules>
|
||||||
|
<module name="ButtonProcessor" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||||
<output url="file://$MODULE_DIR$/target/classes" />
|
<output url="file://$MODULE_DIR$/target/classes" />
|
||||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
|
@ -8,6 +13,7 @@
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/annotations" isTestSource="false" generated="true" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
|
@ -20,5 +26,6 @@
|
||||||
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
|
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: net.md-5:bungeecord-chat:1.12-SNAPSHOT" level="project" />
|
<orderEntry type="library" name="Maven: net.md-5:bungeecord-chat:1.12-SNAPSHOT" level="project" />
|
||||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
|
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.10" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
|
@ -38,8 +38,6 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
|
||||||
<target>1.8</target>
|
|
||||||
<compilerArgument>-proc:none</compilerArgument>
|
<compilerArgument>-proc:none</compilerArgument>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
20
CorePOM/CorePOM.iml
Normal file
20
CorePOM/CorePOM.iml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="MavenAnnotationProcessors">
|
||||||
|
<modules>
|
||||||
|
<module name="ButtonProcessor" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_13_PREVIEW">
|
||||||
|
<output url="file://$MODULE_DIR$/target/classes" />
|
||||||
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/annotations" isTestSource="false" generated="true" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.10" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
108
CorePOM/pom.xml
Executable file
108
CorePOM/pom.xml
Executable file
|
@ -0,0 +1,108 @@
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||||
|
http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
|
||||||
|
<artifactId>CorePOM</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<version>master-SNAPSHOT</version>
|
||||||
|
<properties>
|
||||||
|
<lombok.version>1.18.10</lombok.version>
|
||||||
|
</properties>
|
||||||
|
<name>Core POM for Chroma</name>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<release>8</release>
|
||||||
|
<annotationProcessorPaths>
|
||||||
|
<annotationProcessorPath>
|
||||||
|
<groupId>com.github.bsideup.jabel</groupId>
|
||||||
|
<artifactId>jabel-javac-plugin</artifactId>
|
||||||
|
<version>0.2.0</version>
|
||||||
|
</annotationProcessorPath>
|
||||||
|
<annotationProcessorPath>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>${lombok.version}</version>
|
||||||
|
</annotationProcessorPath>
|
||||||
|
<annotationProcessorPath>
|
||||||
|
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
|
||||||
|
<artifactId>ButtonProcessor</artifactId>
|
||||||
|
<version>master-SNAPSHOT</version>
|
||||||
|
</annotationProcessorPath>
|
||||||
|
</annotationProcessorPaths>
|
||||||
|
<annotationProcessors> <!-- Order is important, so these lines are needed -->
|
||||||
|
<annotationProcessor>com.github.bsideup.jabel.JabelJavacProcessor</annotationProcessor>
|
||||||
|
<annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor
|
||||||
|
</annotationProcessor>
|
||||||
|
<annotationProcessor>buttondevteam.buttonproc.ButtonProcessor</annotationProcessor>
|
||||||
|
</annotationProcessors>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<useSystemClassLoader>false
|
||||||
|
</useSystemClassLoader> <!-- https://stackoverflow.com/a/53012553/2703239 -->
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>jitpack.io</id>
|
||||||
|
<url>https://jitpack.io/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>${lombok.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>intellij-idea-only</id>
|
||||||
|
<activation>
|
||||||
|
<property>
|
||||||
|
<name>idea.maven.embedder.version</name>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<release>13</release>
|
||||||
|
<compilerArgs>
|
||||||
|
<arg>--enable-preview</arg>
|
||||||
|
</compilerArgs>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
</project>
|
10
jitpack.yml
10
jitpack.yml
|
@ -1,10 +0,0 @@
|
||||||
jdk:
|
|
||||||
- oraclejdk8
|
|
||||||
#before_install:
|
|
||||||
# - ./prepareEnvironment.sh
|
|
||||||
install:
|
|
||||||
- echo "Downloading Towny JAR..."
|
|
||||||
- 'wget -O "Towny.jar" --header="Accept-Language: en-us,en;q=0.5" http://palmergames.com/file-repo/Towny%20Advanced/Development/0.94.0.3/Towny.jar'
|
|
||||||
- mvn install:install-file -Dfile=Towny.jar -DgroupId=com.github.TBMCPlugins.ButtonCore -DartifactId=Towny -Dversion=master-SNAPSHOT -Dpackaging=jar
|
|
||||||
- mvn clean install -DskipTests
|
|
||||||
# - rm -r ~/.m2/repository/com/palmergames/Towny/
|
|
16
pom.xml
16
pom.xml
|
@ -8,9 +8,13 @@
|
||||||
<artifactId>ButtonCore</artifactId>
|
<artifactId>ButtonCore</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>master-SNAPSHOT</version>
|
<version>master-SNAPSHOT</version>
|
||||||
|
<properties>
|
||||||
|
<lombok.version>1.18.10</lombok.version>
|
||||||
|
</properties>
|
||||||
<name>ButtonCore Parent</name>
|
<name>ButtonCore Parent</name>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
<module>CorePOM</module>
|
||||||
<module>ButtonCore</module>
|
<module>ButtonCore</module>
|
||||||
<module>ButtonProcessor</module>
|
<module>ButtonProcessor</module>
|
||||||
<module>BuildConfigUpdater</module>
|
<module>BuildConfigUpdater</module>
|
||||||
|
@ -22,10 +26,9 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.3</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<release>8</release>
|
||||||
<target>1.8</target>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -45,5 +48,12 @@
|
||||||
<version>3.8.1</version>
|
<version>3.8.1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>${lombok.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
Loading…
Reference in a new issue