Compare commits
180 Commits
10.8
...
developmen
Author | SHA1 | Date | |
---|---|---|---|
b5bd600bdb | |||
7f8a0c35cb | |||
5f2c2cacbe | |||
6ea2335bc2 | |||
7b574ffa02 | |||
2f7f8e3bee | |||
987af06fb4 | |||
311ae66d18 | |||
8ae50fcbbf | |||
90df1fa5fb | |||
56080e1eb8 | |||
c7e392a0f0 | |||
a350f9fb00 | |||
83f4a3ef71 | |||
8678eee675 | |||
a74710ed9a | |||
d0c683b73c | |||
a533d2211b | |||
44c35bd185 | |||
5a49cc625a | |||
e9a43889cb | |||
2f168197fe | |||
3c85c440c9 | |||
f3bc2e3d4f | |||
d8f0752ea7 | |||
90f899cb16 | |||
7c3ffc80c3 | |||
d5a82e6005 | |||
eb237aaa89 | |||
1397656bf2 | |||
bbe8fbce49 | |||
9413f0f7c8 | |||
a05223333c | |||
2ac9c890f6 | |||
b8c65cb537 | |||
32b57de55c | |||
cb4a81a3c1 | |||
76862db7c9 | |||
e5cba7fe6d | |||
770b7daa94 | |||
0f645300f4 | |||
65e0082322 | |||
150d9f4933 | |||
f40c47e6ab | |||
de6ecdf7a8 | |||
cdd375a673 | |||
1cfaf32ee1 | |||
c72edafd0a | |||
610cb74868 | |||
3a3c9b3208 | |||
a834adc8c9 | |||
290b9264f3 | |||
eb991d01e3 | |||
ec7714c9fe | |||
260dae2aa0 | |||
addc485ca8 | |||
f8619e4802 | |||
e97fadfbec | |||
567b0a2442 | |||
7b04697895 | |||
59133a36f9 | |||
c2adf6957d | |||
2e1ef9c46d | |||
a7c7877ac6 | |||
71c746b752 | |||
6f054a8993 | |||
a3ec7117dd | |||
034bf241e5 | |||
b2ebce50ed | |||
1b8bedc4e6 | |||
4b7d8539ea | |||
bb230fb3ea | |||
b01bf2d84f | |||
32fe2ab579 | |||
c4282817b0 | |||
e9ee3e690c | |||
|
c9ee80dd38 | ||
b00b201bce | |||
709bd16317 | |||
66dc27483b | |||
623d6f8c12 | |||
b3adbe61e8 | |||
167b81f0df | |||
8bbdd7a818 | |||
3aee76ddb8 | |||
65ff4ee24a | |||
ede7908721 | |||
dd4a5de2ab | |||
7243e403e1 | |||
63d80b9e5e | |||
74e05ff7c5 | |||
1708c4bf70 | |||
415e8dc24b | |||
c4b5996256 | |||
37db515726 | |||
6c412f5360 | |||
0fcf436dbf | |||
1762afce07 | |||
9916040c63 | |||
1b589759fb | |||
6ee14b4782 | |||
2d916c7e0c | |||
8567e6b3b2 | |||
b64c1e7c59 | |||
1b12c2728b | |||
eb7fd03650 | |||
deeedcd408 | |||
e4c4aee0f7 | |||
1b7918f011 | |||
9986f477b2 | |||
d27ef185e6 | |||
8114035cd9 | |||
f0b5b2e65b | |||
f9b0b512b9 | |||
f5460be3a1 | |||
f65d277817 | |||
c1b9de8b5a | |||
03af0646a6 | |||
|
f70767b361 | ||
5857e02695 | |||
ee07755493 | |||
|
9d233ba5a6 | ||
f1065ad5a1 | |||
a0e590a2c1 | |||
1a914a9410 | |||
564288c9ab | |||
ed16dc160b | |||
a2e8a672fa | |||
55d7a4496c | |||
c049b8a032 | |||
|
8147a5a2b4 | ||
|
a15d667244 | ||
|
73d574adef | ||
|
855b0ee3cd | ||
|
eb466f0df1 | ||
|
0163eae97b | ||
|
9368fdd48f | ||
|
1012c8c008 | ||
76d71dace8 | |||
489d6369f7 | |||
3bdbaacd64 | |||
027df297f9 | |||
8cf5a11e76 | |||
|
8034d8852a | ||
|
14c520722a | ||
27bdaf8c43 | |||
|
43295ff2bb | ||
561715af46 | |||
a7b9c06b42 | |||
02432a8e5c | |||
2d6b6fa277 | |||
176e9724e7 | |||
667ff81357 | |||
|
82905c0d66 | ||
868d36e1b5 | |||
|
f35b4efe4f | ||
14741afb8d | |||
8f05d5c677 | |||
c89afa3c68 | |||
df22ddd9d2 | |||
c92e36163e | |||
d4f311493f | |||
fb289bd66e | |||
72d33dca90 | |||
3ce11b3d12 | |||
f14aeb6078 | |||
066496dea0 | |||
d7cad5524c | |||
df01efdfbd | |||
f27ec3c985 | |||
abf95ecf0c | |||
7e627f5033 | |||
efb66696eb | |||
|
4bdbe98f8a | ||
e3c1217f86 | |||
dab150407c | |||
|
cd9cd478b5 | ||
810e61f0e2 | |||
15f2a5d422 | |||
8482f7f787 |
37
.gitea/ISSUE_TEMPLATE/bug_report.md
Normal file
37
.gitea/ISSUE_TEMPLATE/bug_report.md
Normal file
@ -0,0 +1,37 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels:
|
||||
- "bug report"
|
||||
|
||||
---
|
||||
|
||||
**Description of issue:**
|
||||
|
||||
|
||||
---
|
||||
|
||||
**Plugin Version (using`/t2c info`):**
|
||||
|
||||
**Server Type (Spigot/Paperspigot/etc):**
|
||||
|
||||
**Server Version (using `/ver`):**
|
||||
|
||||
**Relevant plugins (Delete if this isn't needed):**
|
||||
|
||||
---
|
||||
|
||||
**ERROR (DELETE IF YOU HAVE NO ERROR):**
|
||||
```
|
||||
######################
|
||||
## REPLACE WITH ERROR ##
|
||||
######################
|
||||
```
|
||||
|
||||
**CONFIG SECTION (DELETE IF NOT RELEVANT):**
|
||||
```
|
||||
#######################################
|
||||
## REPLACE WITH RELEVANT CONFIG SECTION ##
|
||||
#######################################
|
||||
```
|
21
.gitea/ISSUE_TEMPLATE/feature_request.md
Normal file
21
.gitea/ISSUE_TEMPLATE/feature_request.md
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea/improvement
|
||||
title: ''
|
||||
labels:
|
||||
- "feature request"
|
||||
|
||||
---
|
||||
|
||||
**Description of feature request:**
|
||||
|
||||
|
||||
---
|
||||
|
||||
**Plugin Version (using`/t2c info`):**
|
||||
|
||||
**Server Type (Spigot/Paperspigot/etc):**
|
||||
|
||||
**Server Version (using `/ver`):**
|
||||
|
||||
**Relevant plugins (Delete if this isn't needed):**
|
22
.gitea/ISSUE_TEMPLATE/question.md
Normal file
22
.gitea/ISSUE_TEMPLATE/question.md
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
name: Question
|
||||
about: Ask a question or get advice
|
||||
title: ''
|
||||
labels:
|
||||
- question
|
||||
|
||||
---
|
||||
|
||||
**Share your question here:**
|
||||
|
||||
---
|
||||
|
||||
**Plugin Version (using`/t2c info`):**
|
||||
|
||||
**Server Type (Spigot/Paperspigot/etc):**
|
||||
|
||||
**Server Version (using `/ver`):**
|
||||
|
||||
**Relevant plugins (Delete if this isn't needed):**
|
||||
|
||||
---
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,6 +1,4 @@
|
||||
# User-specific stuff
|
||||
.idea/
|
||||
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
@ -96,7 +94,6 @@ $RECYCLE.BIN/
|
||||
*.lnk
|
||||
|
||||
target/
|
||||
target\
|
||||
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
|
@ -1,8 +0,0 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="T2CodeLib">
|
||||
<output-path>$PROJECT_DIR$/../../Libarys</output-path>
|
||||
<root id="archive" name="T2CodeLib.jar">
|
||||
<element id="module-output" name="T2CodeLib" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
@ -1,8 +0,0 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="T2CodeLib_1.0.0.32">
|
||||
<output-path>$PROJECT_DIR$/../../Testserver/1.17.1/Server/plugins</output-path>
|
||||
<root id="archive" name="T2CodeLib_1.0.0.3.jar">
|
||||
<element id="module-output" name="T2CodeLib" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
@ -2,6 +2,7 @@
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="true" />
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
@ -9,8 +10,5 @@
|
||||
<module name="T2CodeLib" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="T2CodeLib" target="1.8" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DiscordProjectSettings">
|
||||
<option name="show" value="ASK" />
|
||||
<option name="show" value="PROJECT_FILES" />
|
||||
<option name="description" value="" />
|
||||
</component>
|
||||
</project>
|
3
.idea/icon.svg
Normal file
3
.idea/icon.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 295 KiB |
49
.idea/inspectionProfiles/Project_Default.xml
Normal file
49
.idea/inspectionProfiles/Project_Default.xml
Normal file
@ -0,0 +1,49 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ADDITIONAL_TAGS" value="Deprecated" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="VulnerableLibrariesLocal" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="isIgnoringEnabled" value="true" />
|
||||
<option name="ignoredModules">
|
||||
<list>
|
||||
<option value="T2CodeLib" />
|
||||
<option value="T2CodeLib" />
|
||||
<option value="T2CodeLib" />
|
||||
<option value="T2CodeLib" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="ignoredPackages">
|
||||
<list>
|
||||
<option value="junit:junit:4.10" />
|
||||
<option value="commons-codec:commons-codec:1.9" />
|
||||
<option value="commons-io:commons-io:2.4" />
|
||||
<option value="org.apache.logging.log4j:log4j-core:2.0-beta9" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="ignoredReasons">
|
||||
<list>
|
||||
<option value="Not exploitable" />
|
||||
<option value="Not exploitable" />
|
||||
<option value="Not exploitable" />
|
||||
<option value="Not exploitable" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="unused" enabled="false" level="WARNING" enabled_by_default="false" checkParameterExcludingHierarchy="false">
|
||||
<option name="LOCAL_VARIABLE" value="true" />
|
||||
<option name="FIELD" value="true" />
|
||||
<option name="METHOD" value="true" />
|
||||
<option name="CLASS" value="true" />
|
||||
<option name="PARAMETER" value="true" />
|
||||
<option name="REPORT_PARAMETER_FOR_PUBLIC_METHODS" value="true" />
|
||||
<option name="ADD_MAINS_TO_ENTRIES" value="true" />
|
||||
<option name="ADD_APPLET_TO_ENTRIES" value="true" />
|
||||
<option name="ADD_SERVLET_TO_ENTRIES" value="true" />
|
||||
<option name="ADD_NONJAVA_TO_ENTRIES" value="true" />
|
||||
<option name="selected" value="true" />
|
||||
<option name="mixinEntryPoint" value="true" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
@ -6,41 +6,11 @@
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="Builders-Paradise" />
|
||||
<option name="name" value="Builders-Paradise" />
|
||||
<option name="url" value="https://dojagames.net:8081/repository/Builders-Paradise/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jitpack.io" />
|
||||
<option name="name" value="jitpack.io" />
|
||||
<option name="url" value="https://jitpack.io" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="sonatype" />
|
||||
<option name="name" value="sonatype" />
|
||||
<option name="url" value="https://oss.sonatype.org/content/groups/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="placeholderapi" />
|
||||
<option name="name" value="placeholderapi" />
|
||||
<option name="url" value="http://repo.extendedclip.com/content/repositories/placeholderapi/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="Builders-Paradise" />
|
||||
<option name="name" value="Builders-Paradise" />
|
||||
<option name="url" value="https://repo.t2code.net/repository/Builders-Paradise/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="T2CodePrivat" />
|
||||
<option name="name" value="T2CodePrivat" />
|
||||
<option name="url" value="https://repo.t2code.net/repository/T2CodePrivat/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="T2Code" />
|
||||
<option name="name" value="T2Code" />
|
||||
@ -52,19 +22,44 @@
|
||||
<option name="url" value="https://hub.spigotmc.org/nexus/content/repositories/snapshots/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="spigotmc-repo" />
|
||||
<option name="name" value="spigotmc-repo" />
|
||||
<option name="url" value="https://hub.spigotmc.org/nexus/content/repositories/snapshots/" />
|
||||
<option name="id" value="sonatype-oss-snapshots1" />
|
||||
<option name="name" value="sonatype-oss-snapshots1" />
|
||||
<option name="url" value="https://s01.oss.sonatype.org/content/repositories/snapshots/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="papermc-repo" />
|
||||
<option name="name" value="papermc-repo" />
|
||||
<option name="url" value="https://repo.papermc.io/repository/maven-public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="placeholderapi" />
|
||||
<option name="name" value="placeholderapi" />
|
||||
<option name="url" value="https://repo.extendedclip.com/content/repositories/placeholderapi/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="minecraft-repo" />
|
||||
<option name="name" value="minecraft-repo" />
|
||||
<option name="url" value="https://libraries.minecraft.net/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="bungeecord-repo" />
|
||||
<option name="name" value="bungeecord-repo" />
|
||||
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="BenCodez Repo" />
|
||||
<option name="name" value="BenCodez Repo" />
|
||||
<option name="url" value="https://nexus.bencodez.com/repository/maven-public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.github.MilkBowl:VaultAPI:1.7">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/github/MilkBowl/VaultAPI/1.7/VaultAPI-1.7.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/github/MilkBowl/VaultAPI/1.7/VaultAPI-1.7-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/github/MilkBowl/VaultAPI/1.7/VaultAPI-1.7-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.google.code.findbugs:jsr305:3.0.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.google.code.gson:gson:2.8.8">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.8/gson-2.8.8.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.8/gson-2.8.8-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.8/gson-2.8.8-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.google.errorprone:error_prone_annotations:2.7.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/errorprone/error_prone_annotations/2.7.1/error_prone_annotations-2.7.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/errorprone/error_prone_annotations/2.7.1/error_prone_annotations-2.7.1-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/errorprone/error_prone_annotations/2.7.1/error_prone_annotations-2.7.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.google.guava:failureaccess:1.0.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.google.guava:guava:31.0.1-jre">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/31.0.1-jre/guava-31.0.1-jre.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/31.0.1-jre/guava-31.0.1-jre-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/31.0.1-jre/guava-31.0.1-jre-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.google.j2objc:j2objc-annotations:1.3">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3-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-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:4.10">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.10/junit-4.10.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.10/junit-4.10-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.10/junit-4.10-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: me.clip:placeholderapi:2.9.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/me/clip/placeholderapi/2.9.2/placeholderapi-2.9.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/me/clip/placeholderapi/2.9.2/placeholderapi-2.9.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/me/clip/placeholderapi/2.9.2/placeholderapi-2.9.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: net.md-5:bungeecord-chat:1.16-R0.4">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/md-5/bungeecord-chat/1.16-R0.4/bungeecord-chat-1.16-R0.4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/md-5/bungeecord-chat/1.16-R0.4/bungeecord-chat-1.16-R0.4-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/md-5/bungeecord-chat/1.16-R0.4/bungeecord-chat-1.16-R0.4-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.checkerframework:checker-qual:3.12.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/checkerframework/checker-qual/3.12.0/checker-qual-3.12.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/checkerframework/checker-qual/3.12.0/checker-qual-3.12.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/checkerframework/checker-qual/3.12.0/checker-qual-3.12.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.hamcrest:hamcrest-core:1.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.18-R0.1-SNAPSHOT/spigot-api-1.18-R0.1-20211210.131639-28.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.18-R0.1-SNAPSHOT/spigot-api-1.18-R0.1-20211210.131639-28-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.18-R0.1-SNAPSHOT/spigot-api-1.18-R0.1-20211210.131639-28-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.yaml:snakeyaml:1.28">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.28/snakeyaml-1.28.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.28/snakeyaml-1.28-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.28/snakeyaml-1.28-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -2,10 +2,14 @@
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<list size="2">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
|
||||
<item index="1" class="java.lang.String" itemvalue="net.md_5.bungee.event.EventHandler" />
|
||||
<item index="0" class="java.lang.String" itemvalue="net.md_5.bungee.event.EventHandler" />
|
||||
<item index="1" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
|
||||
</list>
|
||||
<writeAnnotations>
|
||||
<writeAnnotation name="lombok.Getter" />
|
||||
</writeAnnotations>
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
@ -13,7 +17,5 @@
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" default="true" project-jdk-name="16" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-17" project-jdk-type="JavaSDK" />
|
||||
</project>
|
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
@ -2,121 +2,121 @@
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
35
README.md
Normal file
35
README.md
Normal file
@ -0,0 +1,35 @@
|
||||
<p align="center">
|
||||
<img src="https://i.imgur.com/0pSf6jl.png" width="300">
|
||||
</p>
|
||||
|
||||
---
|
||||
# Links
|
||||
* [Spigot](https://www.spigotmc.org/resources/t2codelib.96388/)
|
||||
* [Discord](http://dc.T2Code.net)
|
||||
---
|
||||
|
||||
T2CodeLib is a library for the plugins of T2Code.
|
||||
|
||||
Main library file to centralize the main functions for multiple plugins, allowing better maintenance capabilities and reducing the overall size of the plugins.
|
||||
|
||||
Maven:
|
||||
```
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>T2Code</id>
|
||||
<url>https://repo.t2code.net/repository/T2Code/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>VERSION</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
---
|
||||
<img src="https://i.imgur.com/HoZSt7c.png" width="600">
|
||||
<img src="https://bstats.org/signatures/bukkit/T2CodeLib.svg" width="600">
|
@ -1,48 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="minecraft" name="Minecraft">
|
||||
<configuration>
|
||||
<autoDetectTypes>
|
||||
<platformType>SPIGOT</platformType>
|
||||
</autoDetectTypes>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="McpModuleSettings">
|
||||
<option name="srgType" value="SRG" />
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<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$/src/main/java" isTestSource="false" />
|
||||
<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/resources" type="java-test-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:31.0.1-jre" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.checkerframework:checker-qual:3.12.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.errorprone:error_prone_annotations:2.7.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.8" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.28" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.t2code:bungee:1615" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.t2code:LuckyBox-API:4.2.7" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.MilkBowl:VaultAPI:1.7" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: me.clip:placeholderapi:2.9.2" level="project" />
|
||||
</component>
|
||||
</module>
|
161
pom.xml
161
pom.xml
@ -6,27 +6,30 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>10.8</version>
|
||||
<version>17.0_beta-1</version>
|
||||
<!--version>VERSION_snapshot-0</version-->
|
||||
<!--version>VERSION_beta-0</version-->
|
||||
<!--version>VERSION_dev-0</version-->
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>T2CodeLib</name>
|
||||
|
||||
<description>Libarie from T2Code Plugins</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<url>T2Code.net</url>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}_${project.version}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<source>11</source>
|
||||
<target>11</target>
|
||||
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@ -41,6 +44,12 @@
|
||||
</goals>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>net.kyori</pattern>
|
||||
<shadedPattern>net.t2code.t2codelib.shaded.adventure</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
@ -55,56 +64,182 @@
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<!-- Spigot -->
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
|
||||
<!-- Mojang authlib -->
|
||||
<repository>
|
||||
<id>Builders-Paradise</id>
|
||||
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
|
||||
<id>minecraft-repo</id>
|
||||
<url>https://libraries.minecraft.net/</url>
|
||||
</repository>
|
||||
|
||||
<!-- Bungee -->
|
||||
<repository>
|
||||
<id>bungeecord-repo</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
|
||||
<!-- Velocity / Paper-->
|
||||
<repository>
|
||||
<id>papermc-repo</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
<!-- repo.t2code / T2Code -->
|
||||
<repository>
|
||||
<id>T2Code</id>
|
||||
<url>https://repo.t2code.net/repository/T2Code/</url>
|
||||
</repository>
|
||||
|
||||
<!-- Vault-->
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
|
||||
<!-- placeholderapi -->
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
|
||||
<!-- votingplugin -->
|
||||
<repository>
|
||||
<id>BenCodez Repo</id>
|
||||
<url>https://nexus.bencodez.com/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
<!--Kyori MiniMessage-->
|
||||
<repository>
|
||||
<id>sonatype-oss-snapshots1</id>
|
||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<!-- Spigot-->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.18-R0.1-SNAPSHOT</version>
|
||||
<version>1.21-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Mojang authlib -->
|
||||
<dependency>
|
||||
<groupId>com.mojang</groupId>
|
||||
<artifactId>authlib</artifactId>
|
||||
<version>1.5.21</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Bungee -->
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.21-R0.1-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>bungee</artifactId>
|
||||
<version>1615</version>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.21-R0.1-SNAPSHOT</version>
|
||||
<type>javadoc</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Velocity -->
|
||||
<dependency>
|
||||
<groupId>com.velocitypowered</groupId>
|
||||
<artifactId>velocity-api</artifactId>
|
||||
<version>3.3.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- repo.t2code / T2Code -->
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>LuckyBox-API</artifactId>
|
||||
<version>4.2.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Vault-->
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- placeholderapi -->
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.9.2</version>
|
||||
<version>2.11.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- votingplugin -->
|
||||
<dependency>
|
||||
<groupId>com.bencodez</groupId>
|
||||
<artifactId>votingplugin</artifactId>
|
||||
<version>6.12.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!--Kyori MiniMessage-->
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-minimessage</artifactId>
|
||||
<version>4.18.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-bukkit</artifactId>
|
||||
<version>4.3.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-bungeecord</artifactId>
|
||||
<version>4.3.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.24</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpmime</artifactId>
|
||||
<version>4.5.14</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20231013</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<version>2.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -1,42 +0,0 @@
|
||||
package net.t2code.lib.Bungee;
|
||||
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.t2code.lib.Bungee.Lib.messages.Bsend;
|
||||
import net.t2code.lib.Bungee.system.BLoad;
|
||||
import net.t2code.lib.Util;
|
||||
|
||||
public final class BMain extends Plugin {
|
||||
|
||||
|
||||
public static Plugin plugin;
|
||||
public static String Version;
|
||||
public static String Autor;
|
||||
|
||||
public static String Prefix = Util.getPrefix();
|
||||
public static Integer SpigotID = Util.getSpigotID();
|
||||
public static Integer BstatsID = Util.getBstatsID();
|
||||
public static String Spigot = Util.getSpigot();
|
||||
public static String Discord = Util.getDiscord();
|
||||
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Plugin startup logic
|
||||
plugin = this;
|
||||
Version = plugin.getDescription().getVersion();
|
||||
Autor = plugin.getDescription().getAuthor();
|
||||
BLoad.onLoad(plugin, Prefix, Autor, Version, Spigot, Discord, SpigotID,BstatsID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// Plugin shutdown logic
|
||||
Bsend.console(Prefix + "§4============================= " + Prefix + " §4=============================");
|
||||
Bsend.console(Prefix + " §2Autor: §6" + String.valueOf(Autor).replace("[", "").replace("]", ""));
|
||||
Bsend.console(Prefix + " §2Version: §6" + Version);
|
||||
Bsend.console(Prefix + " §2Spigot: §6" + Spigot);
|
||||
Bsend.console(Prefix + " §2Discord: §6" + Discord);
|
||||
Bsend.console(Prefix + " §4Plugin successfully disabled.");
|
||||
Bsend.console(Prefix + "§4============================= " + Prefix + " §4=============================");
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package net.t2code.lib.Bungee.Lib.commands;
|
||||
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class BTab {
|
||||
public static Iterable<String> tab(CommandSender sender, String[] args, String perm,Boolean onlinePlayer){
|
||||
List<String> matches = new ArrayList<>();
|
||||
Iterator var6 = ProxyServer.getInstance().getPlayers().iterator();
|
||||
while (var6.hasNext()) {
|
||||
ProxiedPlayer player1 = (ProxiedPlayer) var6.next();
|
||||
if (passend(player1.getName(), args[0]) && hasPermission(sender, perm)){
|
||||
matches.add(player1.getName());
|
||||
}
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
public static Iterable<String> tab(CommandSender sender, String[] args, HashMap<String, String> permMap) {
|
||||
List<String> matches = new ArrayList<>();
|
||||
for (String command : permMap.keySet()) {
|
||||
if (hasPermission(sender, permMap.get(command)) && passend(command, args[0])) {
|
||||
matches.add(command);
|
||||
}
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
public static Iterable<String> tab(CommandSender sender, String[] args, String perm, String command) {
|
||||
List<String> matches = new ArrayList<>();
|
||||
if (hasPermission(sender, perm) && passend(command, args[0])) {
|
||||
matches.add(command);
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
public static Boolean passend(String command, String arg) {
|
||||
for (int i = 0; i < arg.toUpperCase().length(); i++) {
|
||||
if (arg.toUpperCase().length() >= command.toUpperCase().length()) {
|
||||
return false;
|
||||
} else {
|
||||
if (arg.toUpperCase().charAt(i) != command.toUpperCase().charAt(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean hasPermission(CommandSender sender, String permission) {
|
||||
String[] Permissions = permission.split(";");
|
||||
for (String perm : Permissions) {
|
||||
if (sender.hasPermission(perm)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package net.t2code.lib.Bungee.Lib.messages;
|
||||
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.t2code.lib.Bungee.Lib.update.BUpdateAPI;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BT2CodeTemplate {
|
||||
|
||||
|
||||
public static Long onLoadHeader(String prefix, String autor, String version, String spigot, String discord) {
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
Bsend.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
Bsend.console(prefix + " §2Autor: §6" + autor.replace("[", "").replace("]", ""));
|
||||
Bsend.console(prefix + " §2Version: §6" + version);
|
||||
Bsend.console(prefix + " §2Spigot: §6" + spigot);
|
||||
Bsend.console(prefix + " §2Discord: §6" + discord);
|
||||
Bsend.console(prefix + " §8-------------------------------");
|
||||
return long_;
|
||||
}
|
||||
|
||||
public static void onLoadSeparateStroke(String prefix) {
|
||||
Bsend.console(prefix + " §8-------------------------------");
|
||||
}
|
||||
|
||||
public static void onLoadFooter(String prefix, Long long_) {
|
||||
Bsend.console(prefix + " §8-------------------------------");
|
||||
Bsend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
Bsend.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
}
|
||||
|
||||
public static void onDisable(String prefix, String autor, String version, String spigot, String discord) {
|
||||
Bsend.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
Bsend.console(prefix + " §2Autor: §6" + autor.replace("[", "").replace("]", ""));
|
||||
Bsend.console(prefix + " §2Version: §6" + version);
|
||||
Bsend.console(prefix + " §2Spigot: §6" + spigot);
|
||||
Bsend.console(prefix + " §2Discord: §6" + discord);
|
||||
Bsend.console(prefix + " §4Plugin successfully disabled.");
|
||||
Bsend.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
}
|
||||
|
||||
public static void sendInfo(CommandSender sender, String prefix, String spigot, String discord, String autor, String pluginVersion, String publicVersion) {
|
||||
Bsend.sender(sender, prefix + "§4======= " + prefix + " §4=======");
|
||||
Bsend.sender(sender, prefix + " §2Autor: §6" + autor);
|
||||
if (publicVersion.equalsIgnoreCase(pluginVersion)) {
|
||||
Bsend.sender(sender, prefix + " §2Version: §6" + pluginVersion);
|
||||
} else {
|
||||
BUpdateAPI.sendUpdateMsg(prefix, spigot, discord, pluginVersion, publicVersion, sender);
|
||||
}
|
||||
Bsend.sender(sender, prefix + " §2Spigot: §6" + spigot);
|
||||
Bsend.sender(sender, prefix + " §2Discord: §6" + discord);
|
||||
Bsend.sender(sender, prefix + "§4======= " + prefix + " §4=======");
|
||||
}
|
||||
}
|
@ -1,115 +0,0 @@
|
||||
package net.t2code.lib.Bungee.Lib.update;
|
||||
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.t2code.lib.Bungee.Lib.messages.Bsend;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateObject;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Scanner;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class BUpdateAPI {
|
||||
public static HashMap<String, UpdateObject> bungeePluginVersionen = new HashMap<String, UpdateObject>();
|
||||
|
||||
public static void sendUpdateMsg(String Prefix, String Spigot, String Discord, String foundVersion, String update_version) {
|
||||
Bsend.console("§4=========== " + Prefix + " §4===========");
|
||||
Bsend.console("§6A new version was found!");
|
||||
Bsend.console("§6Your version: §c" + foundVersion + " §7- §6Current version: §a" + update_version);
|
||||
Bsend.console("§6You can download it here: §e" + Spigot);
|
||||
Bsend.console("§6You can find more information on Discord: §e" + Discord);
|
||||
Bsend.console("§4=========== " + Prefix + " §4===========");
|
||||
}
|
||||
public static void sendUpdateMsg(String Prefix, String Spigot, String Discord, String foundVersion, String update_version, CommandSender sender) {
|
||||
Bsend.sender(sender,"§4=========== " + Prefix + " §4===========");
|
||||
Bsend.sender(sender,"§6A new version was found!");
|
||||
Bsend.sender(sender,"§6Your version: §c" + foundVersion + " §7- §6Current version: §a" + update_version);
|
||||
Bsend.sender(sender,"§6You can download it here: §e" + Spigot);
|
||||
Bsend.sender(sender,"§6You can find more information on Discord: §e" + Discord);
|
||||
Bsend.sender(sender,"§4=========== " + Prefix + " §4===========");
|
||||
}
|
||||
private static Boolean noUpdate = true;
|
||||
private static String pluginVersion;
|
||||
public static void onUpdateCheckTimer(Plugin plugin, String Prefix, String Spigot, String Discord, Integer SpigotID) {
|
||||
ProxyServer.getInstance().getScheduler().schedule(plugin, new Runnable() {
|
||||
public void run() {
|
||||
(new BUpdateAPI(plugin, SpigotID)).getVersion((update_version) -> {
|
||||
pluginVersion = plugin.getDescription().getVersion();
|
||||
UpdateObject update = new UpdateObject(
|
||||
plugin.getDescription().getName(),
|
||||
pluginVersion,
|
||||
update_version
|
||||
);
|
||||
bungeePluginVersionen.put(plugin.getDescription().getName(), update);
|
||||
if (!pluginVersion.replace("_Bungee", "").equalsIgnoreCase(update_version)) {
|
||||
sendUpdateMsg(Prefix, Spigot, Discord, pluginVersion, update_version);
|
||||
noUpdate = true;
|
||||
} else {
|
||||
if (noUpdate) {
|
||||
Bsend.console(Prefix + " §2No update found.");
|
||||
noUpdate = false;
|
||||
}
|
||||
}
|
||||
},Prefix, pluginVersion);
|
||||
}
|
||||
}, 0, 20 * 60 * 60L, TimeUnit.SECONDS);
|
||||
}
|
||||
private Plugin plugin;
|
||||
private int resourceId;
|
||||
|
||||
public BUpdateAPI(Plugin plugin, int resourceId) {
|
||||
this.plugin = plugin;
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
public void getVersion(Consumer<String> consumer, String Prefix, String pluginVersion) {
|
||||
ProxyServer.getInstance().getScheduler().runAsync(this.plugin, () -> {
|
||||
try {
|
||||
InputStream inputStream = (new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId)).openStream();
|
||||
try {
|
||||
Scanner scanner = new Scanner(inputStream);
|
||||
|
||||
try {
|
||||
if (scanner.hasNext()) {
|
||||
consumer.accept(scanner.next());
|
||||
}
|
||||
} catch (Throwable var8) {
|
||||
try {
|
||||
scanner.close();
|
||||
} catch (Throwable var7) {
|
||||
var8.addSuppressed(var7);
|
||||
}
|
||||
throw var8;
|
||||
}
|
||||
scanner.close();
|
||||
} catch (Throwable var9) {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (Throwable var6) {
|
||||
var9.addSuppressed(var6);
|
||||
}
|
||||
}
|
||||
throw var9;
|
||||
}
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
} catch (IOException var10) {
|
||||
UpdateObject update = new UpdateObject(
|
||||
plugin.getDescription().getName(),
|
||||
pluginVersion,
|
||||
"§4No public version found!"
|
||||
);
|
||||
bungeePluginVersionen.put(plugin.getDescription().getName(), update);
|
||||
this.plugin.getLogger().severe(Prefix + "§4 Cannot look for updates: " + var10.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package net.t2code.lib.Bungee.Lib.update;
|
||||
|
||||
public class BUpdateObject {
|
||||
public String pluginName;
|
||||
public String pluginVersion;
|
||||
public String publicVersion;
|
||||
public BUpdateObject(String pluginName, String pluginVersion, String publicVersion){
|
||||
this.pluginName = pluginName;
|
||||
this.pluginVersion = pluginVersion;
|
||||
this.publicVersion = publicVersion;
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package net.t2code.lib.Bungee.system;
|
||||
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.t2code.lib.Bungee.Lib.messages.Bsend;
|
||||
import net.t2code.lib.Bungee.Lib.update.BUpdateAPI;
|
||||
|
||||
public class BLoad {
|
||||
public static void onLoad(Plugin plugin, String prefix, String autor, String version, String spigot, String discord, Integer spigotID,Integer bstatsID){
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
Bsend.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
Bsend.console(prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
Bsend.console(prefix + " §2Version: §6" + version);
|
||||
Bsend.console(prefix + " §2Spigot: §6" + spigot);
|
||||
Bsend.console(prefix + " §2Discord: §6" + discord);
|
||||
|
||||
|
||||
|
||||
|
||||
BMetrics.Bstats(plugin, bstatsID);
|
||||
|
||||
BUpdateAPI.onUpdateCheckTimer(plugin, prefix, spigot, discord, spigotID);
|
||||
|
||||
Bsend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
Bsend.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package net.t2code.lib.Spigot.Lib.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Cmd {
|
||||
public static void console(String cmd) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd);
|
||||
}
|
||||
|
||||
public static void player(Player player, String cmd) {
|
||||
player.chat("/" + cmd);
|
||||
}
|
||||
}
|
@ -1,104 +0,0 @@
|
||||
package net.t2code.lib.Spigot.Lib.commands;
|
||||
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class Tab {
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, String perm, Boolean onlinePlayer) {
|
||||
if (args.length == arg + 1) {
|
||||
Iterator var6 = Bukkit.getOnlinePlayers().iterator();
|
||||
while (var6.hasNext()) {
|
||||
Player player1 = (Player) var6.next();
|
||||
if (passend(player1.getName(), args[arg]) && hasPermission(sender, perm)) {
|
||||
matches.add(player1.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int argEquals, String equalsValue, int arg, String[] args, String perm, Boolean onlinePlayer) {
|
||||
if (args.length == arg + 1) {
|
||||
if (args[argEquals].toLowerCase().equals(equalsValue)) {
|
||||
Iterator var6 = Bukkit.getOnlinePlayers().iterator();
|
||||
while (var6.hasNext()) {
|
||||
Player player1 = (Player) var6.next();
|
||||
if (passend(player1.getName(), args[arg]) && hasPermission(sender, perm)) {
|
||||
matches.add(player1.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//public static void tab(List<String> matches,CommandSender sender, int arg, String[] args, HashMap<String, String> permMap) {
|
||||
//
|
||||
// for (String command : permMap.keySet()) {
|
||||
// if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||
// matches.add(command);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, HashMap<String, String> permMap) {
|
||||
if (args.length == arg + 1) {
|
||||
for (String command : permMap.keySet()) {
|
||||
if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||
matches.add(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int argEquals, String equalsValue, int arg, String[] args, HashMap<String, String> permMap) {
|
||||
if (args.length == arg + 1) {
|
||||
if (args[argEquals].toLowerCase().equals(equalsValue)) {
|
||||
for (String command : permMap.keySet()) {
|
||||
if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||
matches.add(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> tab(CommandSender sender, int arg, String[] args, String perm, String command) {
|
||||
List<String> matches = new ArrayList<>();
|
||||
if (hasPermission(sender, perm) && passend(command, args[arg])) {
|
||||
matches.add(command);
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
|
||||
private static Boolean passend(String command, String arg) {
|
||||
for (int i = 0; i < arg.toUpperCase().length(); i++) {
|
||||
if (arg.toUpperCase().length() >= command.toUpperCase().length()) {
|
||||
return false;
|
||||
} else {
|
||||
if (arg.toUpperCase().charAt(i) != command.toUpperCase().charAt(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean hasPermission(CommandSender sender, String permission) {
|
||||
String[] Permissions = permission.split(";");
|
||||
for (String perm : Permissions) {
|
||||
if (sender.hasPermission(perm)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package net.t2code.lib.Spigot.Lib.items;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ItemVersion {
|
||||
private static Material Head;
|
||||
private static ItemStack HeadIS;
|
||||
public static void scan(){
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
Head = Material.valueOf("SKULL");
|
||||
} else Head = Material.valueOf("PLAYER_HEAD");
|
||||
HeadIS = new ItemStack(Head);
|
||||
}
|
||||
|
||||
public static Material getHead() {
|
||||
return Head;
|
||||
}
|
||||
|
||||
public static ItemStack getHeadIS() {
|
||||
return HeadIS;
|
||||
}
|
||||
}
|
@ -1,131 +0,0 @@
|
||||
package net.t2code.lib.Spigot.Lib.messages;
|
||||
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class T2CodeTemplate {
|
||||
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord) {
|
||||
return onLoadHeader(prefix, autor, version, spigot, discord, null, null);
|
||||
}
|
||||
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord, Boolean isPremium) {
|
||||
return onLoadHeader(prefix, autor, version, spigot, discord, isPremium, null);
|
||||
}
|
||||
|
||||
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord, Boolean isPremium, Boolean isVerify) {
|
||||
Long long_ = System.currentTimeMillis();
|
||||
// send.console(prefix +" §4===================== " + prefix + " §4=====================");
|
||||
send.console(prefix + " §4 _______ §7___ §4_____ ");
|
||||
send.console(prefix + " §4 |__ __|§7__ \\ §4/ ____|");
|
||||
send.console(prefix + " §4 | | §7 ) §4| | ");
|
||||
send.console(prefix + " §4 | | §7 / /§4| | ");
|
||||
send.console(prefix + " §4 | | §7/ /_§4| |____ ");
|
||||
send.console(prefix + " §4 |_| §7|____|§4\\_____|");
|
||||
send.console(prefix + " §4 §e------------------");
|
||||
send.console(prefix + " §4 §e| §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
send.console(prefix + " §4 §e| §2Version: §6" + version);
|
||||
send.console(prefix + " §4 §e| §2Spigot: §6" + spigot);
|
||||
send.console(prefix + " §4 §e| §2Discord: §6" + discord);
|
||||
if (isPremium != null) {
|
||||
if (isPremium) {
|
||||
send.console(prefix + " §4 §e| §6Premium: §2true");
|
||||
} else send.console(prefix + " §4 §e| §6Premium: §4false");
|
||||
if (isVerify != null) {
|
||||
if (isVerify) {
|
||||
send.console(prefix + " §4 §e| §6Verify: §2true");
|
||||
} else send.console(prefix + " §4 §e| §6Verify: §4false");
|
||||
} else send.console(prefix + " §4 §e| §6Verify: §4false");
|
||||
}
|
||||
|
||||
send.console(prefix + " §4 §e-------------------");
|
||||
if (version.toLowerCase().contains("dev") || version.toLowerCase().contains("snapshot") || version.toLowerCase().contains("beta")) {
|
||||
send.console(prefix + " §eYou are running §4" + version + " §eof " + prefix + "§e! Some features may not be working as expected. Please report all bugs here: http://dc.t2code.net §4UpdateChecker & bStats may be disabled!");
|
||||
send.console(prefix + " §4 §e-------------------");
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
//onLoadSeparateStroke(prefix);
|
||||
return long_;
|
||||
}
|
||||
|
||||
public static Long onLoadHeader(String prefix) {
|
||||
Long long_ = System.currentTimeMillis();
|
||||
send.console(prefix + "§4===================== " + prefix + " §4=====================");
|
||||
return long_;
|
||||
}
|
||||
|
||||
public static void onLoadSeparateStroke(String prefix) {
|
||||
send.console(prefix + " §8-------------------------------");
|
||||
}
|
||||
|
||||
public static void onLoadFooter(String prefix, Long long_, String version) {
|
||||
onLoadSeparateStroke(prefix);
|
||||
send.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
// send.console(prefix +" §4===================== " + prefix + "§4=====================");
|
||||
}
|
||||
|
||||
public static void onLoadFooter(String prefix, Long long_) {
|
||||
onLoadSeparateStroke(prefix);
|
||||
send.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
// send.console(prefix +" §4===================== " + prefix + "§4=====================");
|
||||
}
|
||||
|
||||
public static void onDisable(String prefix, List<String> autor, String version, String spigot, String discord) {
|
||||
//send.console(prefix + "§4===================== " + prefix + " §7- §6" + version + " §4=====================");
|
||||
//send.console(prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
//send.console(prefix + " §2Version: §6" + version);
|
||||
//send.console(prefix + " §2Spigot: §6" + spigot);
|
||||
//send.console(prefix + " §2Discord: §6" + discord);
|
||||
//send.console(prefix + " §4Plugin successfully disabled.");
|
||||
//send.console(prefix + "§4===================== " + prefix + " §7- §6" + version + " §4=====================");
|
||||
send.console(prefix + " §2Version: §6" + version);
|
||||
send.console(prefix + " §4Plugin successfully disabled.");
|
||||
}
|
||||
|
||||
public static void sendInfo(CommandSender sender, String prefix, String spigot, String discord, List<String> autor, String pluginVersion, String publicVersion, Boolean isPremium) {
|
||||
send.sender(sender, prefix + "§4======= " + prefix + " §4=======");
|
||||
send.sender(sender, prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
if (sender instanceof Player) {
|
||||
|
||||
TextComponent comp2 = new TextBuilder(prefix + " §2Version: §6" + pluginVersion)
|
||||
.addHover("§8Click to copy").addClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, Replace.removeColorCode(prefix) + " - " + pluginVersion).build();
|
||||
sender.spigot().sendMessage(comp2);
|
||||
if (!publicVersion.equalsIgnoreCase(pluginVersion)) {
|
||||
UpdateAPI.sendUpdateMsg(prefix, spigot, discord, pluginVersion, publicVersion, (Player) sender);
|
||||
}
|
||||
TextComponent comp3 = new TextBuilder(prefix + " §2Spigot: §6" + spigot)
|
||||
.addHover("§8Open Spigot").addClickEvent(ClickEvent.Action.OPEN_URL, spigot).build();
|
||||
sender.spigot().sendMessage(comp3);
|
||||
TextComponent comp4 = new TextBuilder(prefix + " §2Discord: §6" + discord)
|
||||
.addHover("§8Open Discord").addClickEvent(ClickEvent.Action.OPEN_URL, discord).build();
|
||||
sender.spigot().sendMessage(comp4);
|
||||
} else {
|
||||
if (publicVersion.equalsIgnoreCase(pluginVersion)) {
|
||||
send.sender(sender, prefix + " §2Version: §6" + pluginVersion);
|
||||
} else {
|
||||
UpdateAPI.sendUpdateMsg(prefix, spigot, discord, pluginVersion, publicVersion);
|
||||
}
|
||||
send.sender(sender, prefix + " §2Spigot: §6" + spigot);
|
||||
send.sender(sender, prefix + " §2Discord: §6" + discord);
|
||||
|
||||
}
|
||||
if (isPremium != null) {
|
||||
if (isPremium) {
|
||||
send.sender(sender, prefix + " §6Premium: §2true");
|
||||
} else send.sender(sender, prefix + " §6Premium: §4false");
|
||||
}
|
||||
send.sender(sender, prefix + "§4======= " + prefix + " §4=======");
|
||||
}
|
||||
|
||||
public static void sendInfo(CommandSender sender, String prefix, String spigot, String discord, List<String> autor, String pluginVersion, String publicVersion) {
|
||||
sendInfo(sender, prefix, spigot, discord, autor, pluginVersion, publicVersion, null);
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
package net.t2code.lib.Spigot.Lib.messages;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class send {
|
||||
|
||||
/**
|
||||
* Spigot
|
||||
*/
|
||||
|
||||
public static void console(String msg) {
|
||||
Bukkit.getConsoleSender().sendMessage(msg);
|
||||
}
|
||||
|
||||
public static void player(Player player, String msg) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
|
||||
public static void title(Player player, String msg, String msg2) {
|
||||
player.sendTitle(msg, msg2);
|
||||
}
|
||||
|
||||
public static void title(Player player, String msg, String msg2, int i, int i1, int i2) {
|
||||
player.sendTitle(msg, msg2, i, i1, i2);
|
||||
}
|
||||
|
||||
public static void sender(CommandSender sender, String msg) {
|
||||
sender.sendMessage(msg);
|
||||
}
|
||||
|
||||
public static void debug(Plugin plugin, String msg) {
|
||||
debug(plugin, msg, null);
|
||||
}
|
||||
|
||||
public static void debug(Plugin plugin, String msg, Integer stage) {
|
||||
// if (!new File(Main.getPath(), "config.yml").exists()) return;
|
||||
if (stage == null) {
|
||||
if (plugin.getConfig().getBoolean("Plugin.Debug")) Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
||||
return;
|
||||
}
|
||||
if (plugin.getConfig().getInt("Plugin.Debug") >= stage) Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
||||
}
|
||||
|
||||
public static void debugmsg(Plugin plugin, String msg) {
|
||||
Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG-MSG: §6" + msg);
|
||||
}
|
||||
|
||||
public static void info(Plugin plugin, String msg) {
|
||||
plugin.getLogger().log(Level.INFO, msg);
|
||||
}
|
||||
|
||||
public static void warning(Plugin plugin, String msg) {
|
||||
plugin.getLogger().log(Level.WARNING, msg);
|
||||
}
|
||||
|
||||
public static void error(Plugin plugin, String msg) {
|
||||
plugin.getLogger().log(Level.SEVERE, msg);
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package net.t2code.lib.Spigot.Lib.minecraftVersion;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class MCVersion {
|
||||
public static String isVersion;
|
||||
public static String isBuckitVersion;
|
||||
public static boolean minecraft1_8;
|
||||
public static boolean minecraft1_9;
|
||||
public static boolean minecraft1_10;
|
||||
public static boolean minecraft1_11;
|
||||
public static boolean minecraft1_12;
|
||||
public static boolean minecraft1_13;
|
||||
public static boolean minecraft1_14;
|
||||
public static boolean minecraft1_15;
|
||||
public static boolean minecraft1_16;
|
||||
public static boolean minecraft1_17;
|
||||
public static boolean minecraft1_18;
|
||||
public static boolean minecraft1_19;
|
||||
public static void onCheck(){
|
||||
isVersion = Bukkit.getServer().getVersion();
|
||||
isBuckitVersion = Bukkit.getServer().getBukkitVersion();
|
||||
minecraft1_8 = Bukkit.getServer().getClass().getPackage().getName().contains("1_8");
|
||||
minecraft1_9 = Bukkit.getServer().getClass().getPackage().getName().contains("1_9");
|
||||
minecraft1_10 = Bukkit.getServer().getClass().getPackage().getName().contains("1_10");
|
||||
minecraft1_11 = Bukkit.getServer().getClass().getPackage().getName().contains("1_11");
|
||||
minecraft1_12 = Bukkit.getServer().getClass().getPackage().getName().contains("1_12");
|
||||
minecraft1_13 = Bukkit.getServer().getClass().getPackage().getName().contains("1_13");
|
||||
minecraft1_14 = Bukkit.getServer().getClass().getPackage().getName().contains("1_14");
|
||||
minecraft1_15 = Bukkit.getServer().getClass().getPackage().getName().contains("1_15");
|
||||
minecraft1_16 = Bukkit.getServer().getClass().getPackage().getName().contains("1_16");
|
||||
minecraft1_17 = Bukkit.getServer().getClass().getPackage().getName().contains("1_17");
|
||||
minecraft1_18 = Bukkit.getServer().getClass().getPackage().getName().contains("1_18");
|
||||
minecraft1_19 = Bukkit.getServer().getClass().getPackage().getName().contains("1_19");
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package net.t2code.lib.Spigot.Lib.minecraftVersion;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class NMSVersion {
|
||||
public static String isNMS;
|
||||
public static boolean v1_8_R1;
|
||||
public static boolean v1_8_R2;
|
||||
public static boolean v1_8_R3;
|
||||
public static boolean v1_9_R1;
|
||||
public static boolean v1_9_R2;
|
||||
public static boolean v1_10_R1;
|
||||
public static boolean v1_11_R1;
|
||||
public static boolean v1_12_R1;
|
||||
public static boolean v1_13_R1;
|
||||
public static boolean v1_13_R2;
|
||||
public static boolean v1_14_R1;
|
||||
public static boolean v1_15_R1;
|
||||
public static boolean v1_16_R1;
|
||||
public static boolean v1_16_R2;
|
||||
public static boolean v1_16_R3;
|
||||
public static boolean v1_17_R1;
|
||||
public static boolean v1_18_R1;
|
||||
public static boolean v1_18_R2;
|
||||
|
||||
public static void onCheck() {
|
||||
isNMS = Bukkit.getServer().getClass().getPackage().getName();
|
||||
v1_8_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_8_R1");
|
||||
v1_8_R2 = Bukkit.getServer().getClass().getPackage().getName().contains("1_8_R2");
|
||||
v1_8_R3 = Bukkit.getServer().getClass().getPackage().getName().contains("1_8_R3");
|
||||
v1_9_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_9_R1");
|
||||
v1_9_R2 = Bukkit.getServer().getClass().getPackage().getName().contains("1_9_R2");
|
||||
v1_10_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_10_R1");
|
||||
v1_11_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_11_R1");
|
||||
v1_12_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_12_R1");
|
||||
v1_13_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_13_R1");
|
||||
v1_13_R2 = Bukkit.getServer().getClass().getPackage().getName().contains("1_13_R2");
|
||||
v1_14_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_14_R1");
|
||||
v1_15_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_15_R1");
|
||||
v1_16_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_16_R1");
|
||||
v1_16_R2 = Bukkit.getServer().getClass().getPackage().getName().contains("1_16_R2");
|
||||
v1_16_R3 = Bukkit.getServer().getClass().getPackage().getName().contains("1_16_R3");
|
||||
v1_17_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_17_R1");
|
||||
v1_18_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_18_R1");
|
||||
v1_18_R2 = Bukkit.getServer().getClass().getPackage().getName().contains("1_18_R2");
|
||||
}
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
package net.t2code.lib.Spigot.Lib.replace;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Replace {
|
||||
|
||||
public static String replace(String prefix, String Text) {
|
||||
return Text.replace("[prefix]", prefix).replace("&", "§").replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä");
|
||||
}
|
||||
|
||||
|
||||
public static String replace(String prefix,Player player, String Text) {
|
||||
return PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä"));
|
||||
}
|
||||
|
||||
|
||||
public static List<String> replace(String prefix, List<String> Text) {
|
||||
List<String> output = new ArrayList<>();
|
||||
for (String input : Text) {
|
||||
output.add(input.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä"));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
public static List<String> replace(String prefix,Player player, List<String> Text) {
|
||||
List<String> output = new ArrayList();
|
||||
if (player == null) {
|
||||
return Collections.singletonList("player is null");
|
||||
}
|
||||
if (Text == null) {
|
||||
return Collections.singletonList("Text is null");
|
||||
}
|
||||
for (String input : Text) {
|
||||
output.add(PlaceholderAPI.setPlaceholders(player, input.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
public static List<String> replacePrice(String prefix,List<String> Text, String price) {
|
||||
List<String> rp = new ArrayList();
|
||||
for (String s : Text) {
|
||||
rp.add(s.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[price]", String.valueOf(price)));
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public static String removeColorCode(String value){
|
||||
String text = value.replace("&", "§");
|
||||
while(text.contains("§")){
|
||||
int stelle = text.indexOf("§");
|
||||
if(text.length() >= stelle+2) {
|
||||
text = text.substring(0, stelle) + text.substring(stelle + 2);
|
||||
}else{
|
||||
text = text.substring(0, stelle) + text.substring(stelle + 1);
|
||||
}
|
||||
}
|
||||
return (text);
|
||||
}
|
||||
|
||||
|
||||
public static List<String> replacePrice(String prefix,Player player, List<String> Text, String price) {
|
||||
List<String> rp = new ArrayList();
|
||||
for (String s : Text) {
|
||||
rp.add(PlaceholderAPI.setPlaceholders(player, s.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[price]", String.valueOf(price))));
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
public static String replacePrice(String prefix, String Text, String price) {
|
||||
return Text.replace("[prefix]", prefix).replace("&", "§").replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[price]", String.valueOf(price));
|
||||
}
|
||||
|
||||
|
||||
public static String replacePrice(String prefix,Player player, String Text, String price) {
|
||||
return PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[price]", String.valueOf(price)));
|
||||
}
|
||||
|
||||
}
|
@ -1,198 +0,0 @@
|
||||
package net.t2code.lib.Spigot.Lib.update;
|
||||
|
||||
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.messages.TextBuilder;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import net.t2code.lib.Spigot.system.config.SelectLibConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Scanner;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class UpdateAPI {
|
||||
public static HashMap<String, UpdateObject> PluginVersionen = new HashMap<>();
|
||||
|
||||
public static void join(Plugin plugin, String prefix, String perm, Player player, String spigot, String discord) {
|
||||
String pluginVersion = plugin.getDescription().getVersion();
|
||||
if (!player.hasPermission(perm) || !player.isOp()) {
|
||||
return;
|
||||
}
|
||||
if (UpdateAPI.PluginVersionen.get(plugin.getName()) == null) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
join(plugin, prefix, perm, player, spigot, discord);
|
||||
}
|
||||
}.runTaskLater(plugin, 20L);
|
||||
} else use(plugin, prefix, player, pluginVersion, UpdateAPI.PluginVersionen.get(plugin.getName()).publicVersion, spigot, discord);
|
||||
}
|
||||
|
||||
private static void use(Plugin plugin, String prefix, Player player, String pluginVersion, String publicVersion, String spigot, String discord) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!pluginVersion.equals(publicVersion)) {
|
||||
if (SelectLibConfig.UpdateCheckOnJoin) {
|
||||
UpdateAPI.sendUpdateMsg(prefix, spigot, discord, pluginVersion, publicVersion, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskLater(plugin, 200L);
|
||||
}
|
||||
|
||||
public static void sendUpdateMsg(String Prefix, String Spigot, String Discord, String pluginVersion, String publicVersion) {
|
||||
send.console("§4=========== " + Prefix + " §4===========");
|
||||
if (publicVersion.toLowerCase().contains("dev") || publicVersion.toLowerCase().contains("beta") || publicVersion.toLowerCase().contains("snapshot")){
|
||||
if (publicVersion.toLowerCase().contains("dev")){
|
||||
send.console("§6A new §4DEV§6 version was found!");
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("beta")){
|
||||
send.console("§6A new §2BETA§6 version was found!");
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("snapshot")){
|
||||
send.console("§6A new §eSNAPSHOT§6 version was found!");
|
||||
}
|
||||
} else {
|
||||
send.console("§6A new version was found!");
|
||||
}
|
||||
send.console("§6Your version: §c" + pluginVersion + " §7- §6Current version: §a" + publicVersion);
|
||||
send.console("§6You can download it here: §e" + Spigot);
|
||||
send.console("§6You can find more information on Discord: §e" + Discord);
|
||||
send.console("§4=========== " + Prefix + " §4===========");
|
||||
}
|
||||
|
||||
public static void sendUpdateMsg(String Prefix, String Spigot, String Discord, String pluginVersion, String publicVersion, Player player) {
|
||||
if (publicVersion.equals("§4No public version found!")) {
|
||||
return;
|
||||
}
|
||||
send.player(player, Prefix);
|
||||
if (publicVersion.toLowerCase().contains("dev") || publicVersion.toLowerCase().contains("beta") || publicVersion.toLowerCase().contains("snapshot")){
|
||||
if (publicVersion.toLowerCase().contains("dev")){
|
||||
TextComponent comp = new TextBuilder(Prefix + " §6A new §4DEV§6 version was found!")
|
||||
.addHover("§6You can download it here: §e" + Spigot).addClickEvent(ClickEvent.Action.OPEN_URL, Spigot).build();
|
||||
player.spigot().sendMessage(comp);
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("beta")){
|
||||
TextComponent comp = new TextBuilder(Prefix + " §6A new §2BETA§6 version was found!")
|
||||
.addHover("§6You can download it here: §e" + Spigot).addClickEvent(ClickEvent.Action.OPEN_URL, Spigot).build();
|
||||
player.spigot().sendMessage(comp);
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("snapshot")){
|
||||
TextComponent comp = new TextBuilder(Prefix + " §6A new §eSNAPSHOT§6 version was found!")
|
||||
.addHover("§6You can download it here: §e" + Spigot).addClickEvent(ClickEvent.Action.OPEN_URL, Spigot).build();
|
||||
player.spigot().sendMessage(comp);
|
||||
}
|
||||
} else {
|
||||
TextComponent comp = new TextBuilder(Prefix + " §6A new version was found!")
|
||||
.addHover("§6You can download it here: §e" + Spigot).addClickEvent(ClickEvent.Action.OPEN_URL, Spigot).build();
|
||||
player.spigot().sendMessage(comp);
|
||||
}
|
||||
TextComponent comp1 = new TextBuilder(Prefix + " §c" + pluginVersion + " §7-> §a" + publicVersion)
|
||||
.addHover("§6You can download it here: §e" + Spigot).addClickEvent(ClickEvent.Action.OPEN_URL, Spigot).build();
|
||||
player.spigot().sendMessage(comp1);
|
||||
TextComponent comp2 = new TextBuilder(Prefix + " §6You can find more information on Discord.")
|
||||
.addHover("§e" + Discord).addClickEvent(ClickEvent.Action.OPEN_URL, Discord).build();
|
||||
player.spigot().sendMessage(comp2);
|
||||
send.player(player, Prefix);
|
||||
}
|
||||
|
||||
private static Boolean noUpdate = true;
|
||||
|
||||
public static void onUpdateCheck(Plugin plugin, String Prefix, String Spigot, int SpigotID, String Discord) {
|
||||
onUpdateCheck(plugin, Prefix, Spigot, SpigotID, Discord, 60);
|
||||
}
|
||||
|
||||
public static void onUpdateCheck(Plugin plugin, String Prefix, String Spigot, int SpigotID, String Discord, Integer timeInMin) {
|
||||
int taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
||||
public void run() {
|
||||
(new UpdateAPI((JavaPlugin) plugin, SpigotID)).getVersion((update_version) -> {
|
||||
UpdateObject update = new UpdateObject(
|
||||
plugin.getName(),
|
||||
plugin.getDescription().getVersion(),
|
||||
update_version
|
||||
);
|
||||
UpdateAPI.PluginVersionen.put(plugin.getName(), update);
|
||||
if (!plugin.getDescription().getVersion().equalsIgnoreCase(update_version)) {
|
||||
noUpdate = true;
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sendUpdateMsg(Prefix, Spigot, Discord, plugin.getDescription().getVersion(), update_version);
|
||||
}
|
||||
}.runTaskLater(plugin, 600L);
|
||||
} else {
|
||||
if (noUpdate) {
|
||||
send.console(Prefix + " §2No update found.");
|
||||
noUpdate = false;
|
||||
}
|
||||
}
|
||||
}, Prefix, plugin.getDescription().getVersion());
|
||||
}
|
||||
}, 0L, timeInMin * 60 * 20L);
|
||||
}
|
||||
|
||||
private JavaPlugin plugin;
|
||||
private int resourceId;
|
||||
|
||||
public UpdateAPI(JavaPlugin plugin, int resourceId) {
|
||||
this.plugin = plugin;
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
public void getVersion(Consumer<String> consumer, String Prefix, String pluginVersion) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
|
||||
try {
|
||||
InputStream inputStream = (new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId)).openStream();
|
||||
try {
|
||||
Scanner scanner = new Scanner(inputStream);
|
||||
|
||||
try {
|
||||
if (scanner.hasNext()) {
|
||||
consumer.accept(scanner.next());
|
||||
}
|
||||
} catch (Throwable var8) {
|
||||
try {
|
||||
scanner.close();
|
||||
} catch (Throwable var7) {
|
||||
var8.addSuppressed(var7);
|
||||
}
|
||||
throw var8;
|
||||
}
|
||||
scanner.close();
|
||||
} catch (Throwable var9) {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (Throwable var6) {
|
||||
var9.addSuppressed(var6);
|
||||
}
|
||||
}
|
||||
throw var9;
|
||||
}
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
} catch (IOException var10) {
|
||||
UpdateObject update = new UpdateObject(
|
||||
plugin.getName(),
|
||||
pluginVersion,
|
||||
"§4No public version found!"
|
||||
);
|
||||
UpdateAPI.PluginVersionen.put(plugin.getName(), update);
|
||||
this.plugin.getLogger().severe(Prefix + "§4 Cannot look for updates: " + var10.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package net.t2code.lib.Spigot.Lib.update;
|
||||
|
||||
public class UpdateObject {
|
||||
|
||||
public String pluginName;
|
||||
public String pluginVersion;
|
||||
public String publicVersion;
|
||||
|
||||
public UpdateObject(String pluginName, String pluginVersion, String publicVersion) {
|
||||
this.pluginName = pluginName;
|
||||
this.pluginVersion = pluginVersion;
|
||||
this.publicVersion = publicVersion;
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
package net.t2code.lib.Spigot.Lib.vault;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import net.t2code.lib.Spigot.system.languages.SelectLibMsg;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
public class Vault {
|
||||
|
||||
public static Boolean vaultEnable;
|
||||
public static Boolean connected;
|
||||
|
||||
public static boolean buy(String prefix, Player p, Double price) {
|
||||
if (Main.eco == null) {
|
||||
if (Bukkit.getPluginManager().getPlugin("Vault") == null) {
|
||||
send.console(prefix + " §4\n" + prefix + " §4Vault could not be found! §9Please download it here: " +
|
||||
"§6https://www.spigotmc.org/resources/vault.34315/§4\n" + prefix);
|
||||
}
|
||||
p.sendMessage(prefix + "\n" + SelectLibMsg.VaultNotSetUp + "\n" + prefix);
|
||||
} else {
|
||||
if (Main.eco.getBalance(p) < price) {
|
||||
return false;
|
||||
} else {
|
||||
Main.eco.withdrawPlayer(p, price);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void loadVault() throws InterruptedException {
|
||||
long long_ = System.currentTimeMillis();
|
||||
if (Main.plugin.getServer().getPluginManager().getPlugin("Vault") != null) {
|
||||
vaultEnable = true;
|
||||
RegisteredServiceProvider<Economy> eco = Main.plugin.getServer().getServicesManager().getRegistration(Economy.class);
|
||||
if (eco != null) {
|
||||
Main.eco = eco.getProvider();
|
||||
if (Main.eco != null) {
|
||||
connected = true;
|
||||
send.console(Main.prefix + " §2Vault / Economy successfully connected!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
} else {
|
||||
connected = false;
|
||||
send.console(Main.prefix + " §4Economy could not be connected / found! 1" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
} else {
|
||||
connected = false;
|
||||
send.console(Main.prefix + " §4Economy could not be connected / found! 2" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
RegisteredServiceProvider<Permission> perm = Main.plugin.getServer().getServicesManager().getRegistration(Permission.class);
|
||||
if (perm != null) {
|
||||
Main.perm = perm.getProvider();
|
||||
}
|
||||
} else {
|
||||
vaultEnable = false;
|
||||
connected = false;
|
||||
send.console(Main.prefix + " §4Vault could not be connected! 3" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
}
|
||||
|
||||
public static void vaultDisable() {
|
||||
connected = false;
|
||||
send.console(Main.prefix + " §4Vault / Economy successfully deactivated.");
|
||||
}
|
||||
}
|
@ -1,161 +0,0 @@
|
||||
package net.t2code.lib.Spigot.Lib.yamlConfiguration;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||
import net.t2code.lib.Spigot.system.languages.SelectLibMsg;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Config {
|
||||
public static void set(String path, String value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(String path, YamlConfiguration YamlConfiguration) {
|
||||
YamlConfiguration.set(path, null);
|
||||
}
|
||||
|
||||
public static void set(String path, Integer value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(String path, Double value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(String path, Boolean value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(String path, List<String> value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(String path, ItemStack value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setSound(String soundName, String sound1_8, String sound1_9, String sound1_13, YamlConfiguration yamlConfiguration) {
|
||||
Config.set("Sound." + soundName + ".Enable", true, yamlConfiguration);
|
||||
String sound;
|
||||
if (MCVersion.minecraft1_8) {
|
||||
sound = sound1_8.toString();
|
||||
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
sound = sound1_9.toString();
|
||||
} else sound = sound1_13.toString();
|
||||
Config.set("Sound." + soundName + ".Sound", sound, yamlConfiguration);
|
||||
}
|
||||
|
||||
public static void setSound(String soundName, String sound1_8, String sound1_13, YamlConfiguration yamlConfiguration) {
|
||||
Config.set("Sound." + soundName + ".Enable", true, yamlConfiguration);
|
||||
String sound;
|
||||
if (MCVersion.minecraft1_8) {
|
||||
sound = sound1_8.toString();
|
||||
} else sound = sound1_13.toString();
|
||||
Config.set("Sound." + soundName + ".Sound", sound, yamlConfiguration);
|
||||
}
|
||||
|
||||
public static void setSound(String soundName, String sound, YamlConfiguration yamlConfiguration) {
|
||||
Config.set("Sound." + soundName + ".Enable", true, yamlConfiguration);
|
||||
Config.set("Sound." + soundName + ".Sound", sound.toString(), yamlConfiguration);
|
||||
}
|
||||
|
||||
public static boolean selectSoundEnable(String soundName, YamlConfiguration yamlConfiguration) {
|
||||
return selectBoolean("Sound." + soundName + ".Enable", yamlConfiguration);
|
||||
}
|
||||
|
||||
public static String selectSound(String prefix, String soundName, YamlConfiguration yamlConfiguration) {
|
||||
return select(prefix, "Sound." + soundName + ".Sound", yamlConfiguration);
|
||||
}
|
||||
|
||||
public static Sound checkSound(String sound1_8, String sound1_9, String sound1_13, String selectSoundFromConfig, String prefix) {
|
||||
String SOUND;
|
||||
if (MCVersion.minecraft1_8) {
|
||||
SOUND = sound1_8;
|
||||
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
SOUND = sound1_9;
|
||||
} else SOUND = sound1_13;
|
||||
|
||||
return checkSound(SOUND, selectSoundFromConfig, prefix);
|
||||
}
|
||||
|
||||
public static Sound checkSound(String sound1_8, String sound1_13, String selectSoundFromConfig, String prefix) {
|
||||
String SOUND;
|
||||
if (MCVersion.minecraft1_8) {
|
||||
SOUND = sound1_8;
|
||||
} else SOUND = sound1_13;
|
||||
|
||||
return checkSound(SOUND, selectSoundFromConfig, prefix);
|
||||
}
|
||||
|
||||
public static Sound checkSound(String sound, String selectSoundFromConfig, String prefix) {
|
||||
try {
|
||||
return Sound.valueOf(selectSoundFromConfig);
|
||||
} catch (Exception e) {
|
||||
send.console("§4\n§4\n§4\n" + SelectLibMsg.SoundNotFound.replace("[prefix]", prefix)
|
||||
.replace("[sound]", "§8Buy: §6" + selectSoundFromConfig) + "§4\n§4\n§4\n");
|
||||
return Sound.valueOf(sound);
|
||||
}
|
||||
}
|
||||
|
||||
public static String select(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
||||
return Replace.replace(prefix, yamlConfiguration.getString(path));
|
||||
}
|
||||
|
||||
|
||||
public static Integer selectInt(String path, YamlConfiguration yamlConfiguration) {
|
||||
return (yamlConfiguration.getInt(path));
|
||||
}
|
||||
|
||||
public static Boolean selectBoolean(String path, YamlConfiguration yamlConfiguration) {
|
||||
return (yamlConfiguration.getBoolean(path));
|
||||
}
|
||||
|
||||
public static Double selectDouble(String path, YamlConfiguration yamlConfiguration) {
|
||||
return (yamlConfiguration.getDouble(path));
|
||||
}
|
||||
|
||||
public static List<String> selectList(String path, YamlConfiguration yamlConfiguration) {
|
||||
return (yamlConfiguration.getStringList(path));
|
||||
}
|
||||
|
||||
public static ItemStack selectItemStack(String path, YamlConfiguration yamlConfiguration) {
|
||||
return (yamlConfiguration.getItemStack(path));
|
||||
}
|
||||
|
||||
|
||||
public static List<String> selectList(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
||||
List<String> output = new ArrayList<>();
|
||||
List<String> input = yamlConfiguration.getStringList(path);
|
||||
for (String st : input) {
|
||||
output.add(Replace.replace(prefix, st));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public static void select(String prefix, List<String> value, String path, YamlConfiguration yamlConfiguration) {
|
||||
List<String> output = new ArrayList<>();
|
||||
List<String> input = yamlConfiguration.getStringList(path);
|
||||
for (String st : input) {
|
||||
output.add(Replace.replace(prefix, st));
|
||||
}
|
||||
value = output;
|
||||
}
|
||||
}
|
@ -1,119 +0,0 @@
|
||||
package net.t2code.lib.Spigot.system;
|
||||
|
||||
import net.md_5.bungee.protocol.packet.Commands;
|
||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import net.t2code.lib.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.nio.file.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!sender.hasPermission("t2code.admin")){
|
||||
send.sender(sender,"§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
if (args.length == 0) {
|
||||
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
|
||||
} else {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "info":
|
||||
case "plugin":
|
||||
case "pl":
|
||||
case "version":
|
||||
case "ver":
|
||||
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
|
||||
return false;
|
||||
}
|
||||
if ("debug".equals(args[0].toLowerCase())) {
|
||||
if (args.length != 2) {
|
||||
send.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
||||
return false;
|
||||
}
|
||||
if ("createreportlog".equals(args[1].toLowerCase())) {
|
||||
|
||||
CreateReportLog.create(sender);
|
||||
|
||||
} else send.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
||||
} else send.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//TabCompleter
|
||||
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
||||
put("debug", "t2code.admin");
|
||||
put("info", "t2code.admin");
|
||||
}};
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
|
||||
List<String> list = new ArrayList<>();
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
if (args.length == 1) {
|
||||
for (String command : arg1.keySet()) {
|
||||
if (hasPermission(p, arg1.get(command)) && passend(command, args[0])) {
|
||||
list.add(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length == 2 && args[0].equalsIgnoreCase("debug")) {
|
||||
if (sender.hasPermission("t2code.admin")) {
|
||||
if (hasPermission(p, arg1.get("debug")) && passend("debug", args[1])) {
|
||||
list.add("createReportLog");
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static Boolean passend(String command, String arg) {
|
||||
for (int i = 0; i < arg.toUpperCase().length(); i++) {
|
||||
if (arg.toUpperCase().length() >= command.toUpperCase().length()) {
|
||||
return false;
|
||||
} else {
|
||||
if (arg.toUpperCase().charAt(i) != command.toUpperCase().charAt(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean hasPermission(Player player, String permission) {
|
||||
if (player.isOp()) {
|
||||
return true;
|
||||
}
|
||||
String[] Permissions = permission.split(";");
|
||||
for (String perm : Permissions) {
|
||||
if (player.hasPermission(perm)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,190 +0,0 @@
|
||||
package net.t2code.lib.Spigot.system;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
|
||||
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
|
||||
import net.t2code.lib.Spigot.Lib.vault.Vault;
|
||||
import net.t2code.luckyBox.api.LuckyBoxAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
|
||||
public class CreateReportLog {
|
||||
protected static void create(CommandSender sender) {
|
||||
send.sender(sender, Main.prefix + " §6A DebugLog is created...");
|
||||
String timeStampFile = new SimpleDateFormat("HH_mm_ss-dd_MM_yyyy").format(Calendar.getInstance().getTime());
|
||||
|
||||
File directory = new File(Main.getPath() + "/DebugLogs");
|
||||
if (!directory.exists()) {
|
||||
directory.mkdir();
|
||||
}
|
||||
|
||||
File file = new File(Main.getPath(), "/DebugLogs/T2CodeLog.txt");
|
||||
PrintWriter pWriter = null;
|
||||
try {
|
||||
pWriter = new PrintWriter(new FileWriter(file.getPath()));
|
||||
String timeStamp = new SimpleDateFormat("HH:mm:ss dd.MM.yyyy").format(Calendar.getInstance().getTime());
|
||||
pWriter.println("Created on: " + timeStamp);
|
||||
pWriter.println();
|
||||
pWriter.println("Server Bukkit version: " + MCVersion.isBuckitVersion);
|
||||
pWriter.println("Server run on: " + MCVersion.isVersion);
|
||||
pWriter.println("Server NMS: " + NMSVersion.isNMS);
|
||||
pWriter.println();
|
||||
pWriter.println("Online Mode: " + Bukkit.getOnlineMode());
|
||||
pWriter.println("Worlds: " + Bukkit.getWorlds());
|
||||
pWriter.println();
|
||||
if (Vault.vaultEnable) {
|
||||
pWriter.println("Vault: " + Bukkit.getPluginManager().getPlugin("Vault").getName() + " - " + Bukkit.getPluginManager().getPlugin("Vault").getDescription().getVersion());
|
||||
} else pWriter.println("Vault: not connected");
|
||||
if (Main.eco != null) {
|
||||
String st;
|
||||
st = Main.eco.getName();
|
||||
if (Main.eco.getName().equals("CMIEconomy")) st = "CMI";
|
||||
pWriter.println("Economy: " + Main.eco.isEnabled() + " - " + Main.eco.getName() + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion());
|
||||
} else pWriter.println("Economy: not connected via vault");
|
||||
if (Main.perm != null) {
|
||||
pWriter.println("Permission: " + Main.perm.isEnabled() + " - " + Main.perm.getName() + " - " + Bukkit.getPluginManager().getPlugin(Main.perm.getName()).getDescription().getVersion());
|
||||
} else pWriter.println("Permission: not connected via vault");
|
||||
pWriter.println();
|
||||
pWriter.println("Java: " + System.getProperty("java.version"));
|
||||
pWriter.println("System: " + System.getProperty("os.name"));
|
||||
pWriter.println("System: " + System.getProperty("os.version"));
|
||||
pWriter.println("User Home: " + System.getProperty("user.home"));
|
||||
pWriter.println();
|
||||
pWriter.println("T2CodeLib: " + Main.plugin.getDescription().getVersion());
|
||||
pWriter.println();
|
||||
if (PluginCheck.luckyBox()){
|
||||
pWriter.println("T2C-PremiumPlugins: ");
|
||||
pWriter.println("T2C-LuckyBox UID: " + LuckyBoxAPI.getUID());
|
||||
pWriter.println("T2C-LuckyBox RID: " + LuckyBoxAPI.getRID());
|
||||
pWriter.println("T2C-LuckyBox DID: " + LuckyBoxAPI.getDID());
|
||||
pWriter.println("T2C-LuckyBox isP: " + LuckyBoxAPI.isP());
|
||||
pWriter.println("T2C-LuckyBox isV: " + LuckyBoxAPI.isV());
|
||||
pWriter.println();
|
||||
}
|
||||
pWriter.println("Plugins: ");
|
||||
for (Plugin pl : Bukkit.getPluginManager().getPlugins()) {
|
||||
pWriter.println(" - " + pl.getName() + " - " + pl.getDescription().getVersion() + " - Enabled: " + pl.isEnabled() + " - Autors: " + pl.getDescription().getAuthors() + " - Website: " + pl.getDescription().getWebsite());
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
} finally {
|
||||
if (pWriter != null) {
|
||||
pWriter.flush();
|
||||
pWriter.close();
|
||||
}
|
||||
}
|
||||
|
||||
String filePath = Main.getPath() + "/DebugLogs/T2CodeLog.txt";
|
||||
String log = "logs/latest.log";
|
||||
String zipPath = "plugins/T2CodeLib/DebugLogs/T2CLog-" + timeStampFile + ".zip";
|
||||
try (ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(zipPath))) {
|
||||
File fileToZip = new File(filePath);
|
||||
zip.putNextEntry(new ZipEntry(fileToZip.getName()));
|
||||
Files.copy(fileToZip.toPath(), zip);
|
||||
|
||||
//File logToZip = new File(log);
|
||||
//zipOut.putNextEntry(new ZipEntry(logToZip.getName()));
|
||||
//Files.copy(logToZip.toPath(), zipOut);
|
||||
|
||||
addFileToZip("", "logs/latest.log", zip, false);
|
||||
|
||||
//pluginToDebug("T2CodeLib", "T2CodeLib", zip); todo bugfix (servercrash)
|
||||
pluginToDebug("T2C-LuckyBox", "T2C-LuckyBox", zip);
|
||||
pluginToDebug("WonderBagShop", "WonderBagShop", zip);
|
||||
pluginToDebug("CommandGUI", "CommandGUI", zip);
|
||||
pluginToDebug("OPSecurity", "OPSecurity", zip);
|
||||
pluginToDebug("PaPiTest", "PaPiTest", zip);
|
||||
pluginToDebug("PlotSquaredGUI", "PlotSquaredGUI", zip);
|
||||
pluginToDebug("T2C-Alias", "T2Code-Alias", zip);
|
||||
|
||||
pluginToDebug("LoreEditor", "LoreEditor", zip);
|
||||
pluginToDebug("Booster", "Booster", zip);
|
||||
pluginToDebug("AntiMapCopy", "AntiCopy", zip);
|
||||
zip.closeEntry();
|
||||
zip.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
file.delete();
|
||||
if (sender instanceof Player) {
|
||||
send.sender(sender, Main.prefix + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath);
|
||||
send.console(Main.prefix + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath);
|
||||
} else send.sender(sender, Main.prefix + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + zipPath);
|
||||
|
||||
}
|
||||
|
||||
private static void pluginToDebug(String pluginName, String jar, ZipOutputStream zip) throws IOException {
|
||||
if (PluginCheck.pluginCheck(pluginName)) {
|
||||
Plugin plugin = Bukkit.getPluginManager().getPlugin(pluginName);
|
||||
File plConfigs = new File(plugin.getDataFolder().getPath());
|
||||
if (plConfigs.exists()) {
|
||||
addFolderToZip("T2Code-Plugins", plugin.getDataFolder().getPath(), zip);
|
||||
}
|
||||
File f = new File("plugins/");
|
||||
File[] fileArray = f.listFiles();
|
||||
|
||||
for (File config : fileArray) {
|
||||
if (config.getName().contains(jar) && config.getName().contains(".jar")) {
|
||||
addFileToZip("T2Code-Plugins", config.getPath(), zip, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addFolderToZip(String path, String srcFolder, ZipOutputStream zip) throws IOException {
|
||||
File folder = new File(srcFolder);
|
||||
if (folder.list() == null) {
|
||||
addFileToZip(path + "/" + folder.getName(), srcFolder, zip, false);
|
||||
} else if (folder.list().length == 0) {
|
||||
addFileToZip(path, srcFolder, zip, true);
|
||||
} else {
|
||||
for (String fileName : folder.list()) {
|
||||
if (path.equals("")) {
|
||||
addFileToZip(folder.getName(), srcFolder + "/" + fileName, zip, false);
|
||||
} else {
|
||||
addFileToZip(path + "/" + folder.getName(), srcFolder + "/" + fileName, zip, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addFileToZip(String path, String srcFile, ZipOutputStream zip, boolean flag) throws IOException {
|
||||
File folder = new File(srcFile);
|
||||
if (flag) {
|
||||
zip.putNextEntry(new ZipEntry(path + "/" + folder.getName() + "/"));
|
||||
} else {
|
||||
if (folder.isDirectory()) {
|
||||
addFolderToZip(path, srcFile, zip);
|
||||
} else {
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
FileInputStream in = new FileInputStream(srcFile);
|
||||
|
||||
if (path.equals("")) {
|
||||
zip.putNextEntry(new ZipEntry((folder.getName())));
|
||||
} else {
|
||||
zip.putNextEntry(new ZipEntry((path + "/" + folder.getName())));
|
||||
}
|
||||
|
||||
while ((len = in.read(buf)) > 0) {
|
||||
try {
|
||||
zip.write(buf, 0, len);
|
||||
} catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
// This claas was created by JaTiTV
|
||||
|
||||
package net.t2code.lib.Spigot.system;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import net.t2code.lib.Util;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
|
||||
public class JoinEvent implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onJoinEvent(PlayerLoginEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
UpdateAPI.join(Main.plugin, Util.getPrefix(), "t2code.lib.updatemsg", event.getPlayer(), Main.spigot, Main.discord);
|
||||
}
|
||||
}
|
@ -1,130 +0,0 @@
|
||||
package net.t2code.lib.Spigot.system;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
|
||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
||||
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import net.t2code.lib.Spigot.Lib.vault.Vault;
|
||||
import net.t2code.lib.Spigot.system.config.ConfigCreate;
|
||||
import net.t2code.lib.Spigot.system.languages.LanguagesCreate;
|
||||
import net.t2code.lib.Util;
|
||||
import net.t2code.lib.Spigot.system.config.SelectLibConfig;
|
||||
import net.t2code.lib.Spigot.system.languages.SelectLibMsg;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public final class Main extends JavaPlugin {
|
||||
|
||||
public static File getPath() {
|
||||
return plugin.getDataFolder();
|
||||
}
|
||||
|
||||
public static Main plugin;
|
||||
public static Economy eco = null;
|
||||
public static Permission perm = null;
|
||||
|
||||
public static List<String> autor;
|
||||
public static String version;
|
||||
|
||||
public static String prefix = Util.getPrefix();
|
||||
public static Integer spigotID = Util.getSpigotID();
|
||||
public static Integer bstatsID = Util.getBstatsID();
|
||||
public static String spigot = Util.getSpigot();
|
||||
public static String discord = Util.getDiscord();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Plugin startup logic
|
||||
plugin = this;
|
||||
autor = plugin.getDescription().getAuthors();
|
||||
version = plugin.getDescription().getVersion();
|
||||
Long long_;
|
||||
long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord);
|
||||
if (Util.getSnapshot()){
|
||||
send.console(prefix + " §eYou are running §4" + version + " §eof " + prefix + "§e! §4This is a trial version! §eSome features may not be working as expected. Please report all bugs here: http://dc.t2code.net §4UpdateChecker & bStats may be disabled!");
|
||||
send.console(prefix + " §4 §e-------------------");
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//send.console("§4 _|_|_|_|_| _|_| _|_|_| _| ");
|
||||
//send.console("§4 _| _| _| _| _|_| _|_|_| _|_| ");
|
||||
//send.console("§4 _| _| _| _| _| _| _| _|_|_|_| ");
|
||||
//send.console("§4 _| _| _| _| _| _| _| _| ");
|
||||
//send.console("§4 _| _|_|_|_| _|_|_| _|_| _|_|_| _|_|_| ");
|
||||
//T2CodeTemplate.onLoadSeparateStroke(prefix);
|
||||
try {
|
||||
Vault.loadVault();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
NMSVersion.onCheck();
|
||||
MCVersion.onCheck();
|
||||
if (MCVersion.minecraft1_19){
|
||||
send.warning(this, "The 1.19 is a very fresh / new version. If there are any bugs in our plugins, please report them to us via our Discord: http://dc.t2code.net");
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
ItemVersion.scan();
|
||||
send.console(Main.prefix + " §3Server run on: §6" + MCVersion.isVersion + " / " + NMSVersion.isNMS);
|
||||
if (eco != null) {
|
||||
String st;
|
||||
st = eco.getName();
|
||||
if (eco.getName().equals("CMIEconomy")) st = "CMI";
|
||||
if (Bukkit.getPluginManager().getPlugin(st) != null){
|
||||
send.console(Main.prefix + " §3Economy: §6" + eco.getName() + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion() + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
} else send.console(Main.prefix + " §3Economy: §6" + eco.getName() + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
} else send.console(Main.prefix + " §3Economy: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
|
||||
if (perm != null) {
|
||||
if (Bukkit.getPluginManager().getPlugin(perm.getName()) != null){
|
||||
send.console(Main.prefix + " §3Permission plugin: §6" + perm.getName() + " - " + Bukkit.getPluginManager().getPlugin(perm.getName()).getDescription().getVersion() + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
} else send.console(Main.prefix + " §3Permission plugin: §6" + perm.getName() + " - §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
} else send.console(Main.prefix + " §3Permission plugin: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
if (PluginCheck.pluginCheck("PlaceholderAPI")) {
|
||||
send.console(Main.prefix + " §3PlaceholderAPI: §6connected" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
|
||||
}
|
||||
|
||||
|
||||
Main.plugin.getCommand("t2code").setExecutor(new CmdExecuter());
|
||||
ConfigCreate.configCreate();
|
||||
LanguagesCreate.langCreate();
|
||||
SelectLibConfig.onSelect();
|
||||
SelectLibMsg.onSelect(prefix);
|
||||
if (!Util.getSnapshot()){
|
||||
UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
|
||||
Metrics.Bstats(plugin, bstatsID);
|
||||
}
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
|
||||
T2CodeTemplate.onLoadFooter(prefix, long_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// Plugin shutdown logic
|
||||
if (SelectLibConfig.InventoriesCloseByServerStop){
|
||||
for (Player player : Bukkit.getOnlinePlayers()){
|
||||
player.closeInventory();
|
||||
}
|
||||
}
|
||||
Vault.vaultDisable();
|
||||
T2CodeTemplate.onDisable(prefix, autor, version, spigot, discord);
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package net.t2code.lib.Spigot.system;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Scanner;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class UpdateChecker {
|
||||
private final JavaPlugin plugin;
|
||||
private final int resourceId;
|
||||
|
||||
public UpdateChecker(JavaPlugin plugin, int resourceId) {
|
||||
this.plugin = plugin;
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
public void getVersion(final Consumer<String> consumer) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
|
||||
try (InputStream inputStream = new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId).openStream(); Scanner scanner = new Scanner(inputStream)) {
|
||||
if (scanner.hasNext()) {
|
||||
consumer.accept(scanner.next());
|
||||
}
|
||||
} catch (IOException exception) {
|
||||
plugin.getLogger().info("Unable to check for updates: " + exception.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
package net.t2code.lib.Spigot.system.config;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class ConfigCreate {
|
||||
|
||||
private static Boolean UpdateCheckOnJoin = true;
|
||||
private static Integer UpdateCheckTimeInterval = 60;
|
||||
private static Boolean Debug = false;
|
||||
private static String language = "english";
|
||||
|
||||
|
||||
private static Boolean mySQL = false;
|
||||
private static String Storage = "YML";
|
||||
private static String ip = "localhost";
|
||||
private static Integer port = 3306;
|
||||
private static String database = "database";
|
||||
private static String user = "root";
|
||||
private static String password = "password";
|
||||
private static Boolean SSL = false;
|
||||
|
||||
private static Boolean Bungee = false;
|
||||
private static String thisServer = "server";
|
||||
|
||||
public static void configCreate() {
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
if (new File(Main.getPath(), "config.yml").exists()){
|
||||
if (Main.plugin.getConfig().getBoolean("Plugin.Debug")) send.console(Main.prefix + " §5DEBUG: §6" + " §4config.yml are created / updated...");
|
||||
} else send.console(Main.prefix + " §4config.yml are created...");
|
||||
|
||||
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
Config.set("Plugin.UpdateCheck.OnJoin", UpdateCheckOnJoin, yamlConfiguration);
|
||||
Config.set("Plugin.UpdateCheck.TimeInterval", UpdateCheckTimeInterval, yamlConfiguration);
|
||||
Config.set("Plugin.language", language, yamlConfiguration);
|
||||
|
||||
Config.set("BungeeCord.Enable", Bungee, yamlConfiguration);
|
||||
Config.set("BungeeCord.ThisServer", thisServer, yamlConfiguration);
|
||||
Config.set("Player.Inventories.CloseByServerStop", true, yamlConfiguration);
|
||||
|
||||
// Config.set("Storage.MySQL.Enable", mySQL, yamlConfiguration);
|
||||
// Config.set("Storage.Type", Storage, yamlConfiguration);
|
||||
// Config.set("Storage.MySQL.IP", ip, yamlConfiguration);
|
||||
// Config.set("Storage.MySQL.Port", port, yamlConfiguration);
|
||||
// Config.set("Storage.MySQL.Database", database, yamlConfiguration);
|
||||
// Config.set("Storage.MySQL.User", user, yamlConfiguration);
|
||||
// Config.set("Storage.MySQL.Password", password, yamlConfiguration);
|
||||
// Config.set("Storage.MySQL.SSL", SSL, yamlConfiguration);
|
||||
|
||||
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
send.console(Main.prefix + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package net.t2code.lib.Spigot.system.config;
|
||||
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class SelectLibConfig {
|
||||
|
||||
|
||||
public static Boolean UpdateCheckOnJoin;
|
||||
public static Integer UpdateCheckTimeInterval;
|
||||
public static Boolean Debug;
|
||||
public static String language;
|
||||
public static Boolean InventoriesCloseByServerStop;
|
||||
|
||||
public static void onSelect() {
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheck.OnJoin");
|
||||
UpdateCheckTimeInterval = yamlConfiguration.getInt("Plugin.UpdateCheck.TimeInterval");
|
||||
Debug = yamlConfiguration.getBoolean("Plugin.Debug");
|
||||
language = yamlConfiguration.getString("Plugin.language");
|
||||
InventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop");
|
||||
|
||||
}
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
package net.t2code.lib.Spigot.system.languages;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class LanguagesCreate {
|
||||
static Plugin plugin = Main.plugin;
|
||||
|
||||
public static void langCreate() {
|
||||
send.debug(plugin,"§4Language files are created / updated...");
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
|
||||
/**
|
||||
*
|
||||
* ENGLISH
|
||||
*
|
||||
*/
|
||||
|
||||
File messagesEN = new File(Main.getPath(), "languages/english_messages.yml");
|
||||
YamlConfiguration yamlConfigurationEN = YamlConfiguration.loadConfiguration(messagesEN);
|
||||
|
||||
Config.set("Plugin.VaultNotSetUp", MSG.EN_VaultNotSetUp, yamlConfigurationEN);
|
||||
Config.set("Plugin.SoundNotFound", MSG.EN_SoundNotFound, yamlConfigurationEN);
|
||||
|
||||
try {
|
||||
yamlConfigurationEN.save(messagesEN);
|
||||
} catch (IOException e) {
|
||||
send.warning(Main.plugin,e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* GERMAN
|
||||
*
|
||||
*/
|
||||
|
||||
File messagesDE = new File(Main.getPath(), "languages/german_messages.yml");
|
||||
YamlConfiguration yamlConfigurationDE = YamlConfiguration.loadConfiguration(messagesDE);
|
||||
|
||||
Config.set("Plugin.VaultNotSetUp", MSG.DE_VaultNotSetUp, yamlConfigurationDE);
|
||||
Config.set("Plugin.SoundNotFound", MSG.DE_SoundNotFound, yamlConfigurationDE);
|
||||
|
||||
try {
|
||||
yamlConfigurationDE.save(messagesDE);
|
||||
} catch (IOException e) {
|
||||
send.warning(Main.plugin,e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* norwegian
|
||||
*
|
||||
*/
|
||||
|
||||
File messagesNO = new File(Main.getPath(), "languages/norwegian_messages.yml");
|
||||
YamlConfiguration yamlConfigurationNO = YamlConfiguration.loadConfiguration(messagesNO);
|
||||
|
||||
Config.set("Plugin.VaultNotSetUp", MSG.NO_VaultNotSetUp, yamlConfigurationNO);
|
||||
Config.set("Plugin.SoundNotFound", MSG.NO_SoundNotFound, yamlConfigurationNO);
|
||||
|
||||
try {
|
||||
yamlConfigurationNO.save(messagesNO);
|
||||
} catch (IOException e) {
|
||||
send.warning(Main.plugin,e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
send.console(Main.prefix + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
// This claas was created by JaTiTV
|
||||
|
||||
package net.t2code.lib.Spigot.system.languages;
|
||||
|
||||
public class MSG {
|
||||
|
||||
// EN
|
||||
public static String EN_VaultNotSetUp = "[prefix] &4Vault / Economy not set up!";
|
||||
public static String EN_SoundNotFound = "[prefix] &4The sound &6[sound] &4was not found! Please check the settings.";
|
||||
|
||||
|
||||
// DE
|
||||
public static String DE_VaultNotSetUp = "[prefix] &4Vault / Economy nicht eingerichtet!";
|
||||
public static String DE_SoundNotFound = "[prefix] &4Der Sound &6[sound] &4wurde nicht gefunden! Bitte [ue]berpr[ue]fe die Einstellungen.";
|
||||
|
||||
|
||||
|
||||
// NO
|
||||
public static String NO_VaultNotSetUp = "[prefix] &4Vault / Økonomi har ikke blitt satt opp!";
|
||||
public static String NO_SoundNotFound = "[prefix] &4Lyden &6[sound] &4ble ikke bli funnet! Vennligst sjekk innstillingene.";
|
||||
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package net.t2code.lib.Spigot.system.languages;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import net.t2code.lib.Spigot.system.config.SelectLibConfig;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class SelectLibMsg {
|
||||
private static Plugin plugin = Main.plugin;
|
||||
private static String prefix = Main.prefix;
|
||||
|
||||
public static String selectMSG;
|
||||
|
||||
public static String VaultNotSetUp;
|
||||
public static String SoundNotFound;
|
||||
|
||||
public static void onSelect(String Prefix) {
|
||||
|
||||
send.debug(plugin, "§4Select language...");
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
|
||||
File msg;
|
||||
|
||||
msg = new File(Main.getPath(), "languages/" + SelectLibConfig.language + "_messages.yml");
|
||||
if (!msg.isFile()) {
|
||||
send.console(Prefix);
|
||||
send.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
send.console(Prefix + " §4The selected §c" + SelectLibConfig.language + " §4language file was not found.");
|
||||
send.console(Prefix + " §6The default language §eEnglish §6is used!");
|
||||
send.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
send.console(Prefix);
|
||||
msg = new File(Main.getPath(), "languages/" + "english_messages.yml");
|
||||
selectMSG = "english";
|
||||
} else selectMSG = SelectLibConfig.language;
|
||||
YamlConfiguration yamlConfiguration_msg = YamlConfiguration.loadConfiguration(msg);
|
||||
|
||||
VaultNotSetUp = Replace.replace(prefix, yamlConfiguration_msg.getString("Plugin.VaultNotSetUp"));
|
||||
SoundNotFound = Replace.replace(prefix, yamlConfiguration_msg.getString("Plugin.SoundNotFound"));
|
||||
|
||||
|
||||
|
||||
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package net.t2code.lib;
|
||||
|
||||
public class Util {
|
||||
private static Boolean Snapshot = false;
|
||||
|
||||
private static String Prefix = "§8[§4T2Code§5Lib§8]";
|
||||
private static Integer SpigotID = 96388;
|
||||
private static Integer BstatsID = 12518;
|
||||
private static String Spigot = "https://www.spigotmc.org/resources/" + SpigotID;
|
||||
private static String Discord = "http://dc.t2code.net";
|
||||
|
||||
public static String getPrefix() {
|
||||
return Prefix;
|
||||
}
|
||||
|
||||
public static Integer getSpigotID() {
|
||||
return SpigotID;
|
||||
}
|
||||
|
||||
public static Integer getBstatsID() {
|
||||
return BstatsID;
|
||||
}
|
||||
|
||||
public static String getSpigot() {
|
||||
return Spigot;
|
||||
}
|
||||
|
||||
public static String getDiscord() {
|
||||
return Discord;
|
||||
}
|
||||
|
||||
public static Boolean getSnapshot(){
|
||||
return Snapshot;
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
package net.t2code.t2codelib.BUNGEE.api.bungeePlayers;
|
||||
|
||||
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import net.t2code.t2codelib.BUNGEE.api.messages.T2CB_Send;
|
||||
import net.t2code.t2codelib.BUNGEE.system.T2CB_Main;
|
||||
import net.t2code.t2codelib.SPIGOT.api.bungeePlayers.T2C_BngeePlayersEnum;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class T2CB_BungeePlayers implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PostLoginEvent e) {
|
||||
sendToSpigotPlayer(e.getPlayer().getName(), T2C_BngeePlayersEnum.JOIN, "");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDisconnect(PlayerDisconnectEvent e) {
|
||||
sendToSpigotPlayer(e.getPlayer().getName(), T2C_BngeePlayersEnum.QUIT, "");
|
||||
}
|
||||
|
||||
public static void sendToSpigotPlayer(String name, T2C_BngeePlayersEnum value, String uuid) {
|
||||
switch (value) {
|
||||
case JOIN:
|
||||
case QUIT:
|
||||
sendToSpigotPlayerExecute(name, value, uuid);
|
||||
break;
|
||||
case GIVEALL:
|
||||
StringBuilder input = new StringBuilder();
|
||||
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
|
||||
input.append(player.getName()).append(";");
|
||||
}
|
||||
sendToSpigotPlayerExecute(input.toString(), T2C_BngeePlayersEnum.GIVEALL, uuid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void sendToSpigotPlayerExecute(String name, T2C_BngeePlayersEnum value, String uuid) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream output = new DataOutputStream(stream);
|
||||
try {
|
||||
output.writeUTF(value.name());
|
||||
output.writeUTF(name);
|
||||
output.writeUTF(uuid);
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger(e.getMessage());
|
||||
}
|
||||
T2CB_Send.debug(T2CB_Main.getPlugin(), "PluginMessage received channel: "+ T2C_Util.getPluginChannel_ProxyOnlinePlayers());
|
||||
T2CB_Send.debug(T2CB_Main.getPlugin(), "PluginMessage received subChannel: " + value.name());
|
||||
T2CB_Send.debug(T2CB_Main.getPlugin(), "PluginMessage received input: " + name);
|
||||
T2CB_Send.debug(T2CB_Main.getPlugin(), "PluginMessage received input2/uuid: " + uuid);
|
||||
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
||||
server.sendData(T2C_Util.getPluginChannel_ProxyOnlinePlayers(), stream.toByteArray());
|
||||
});
|
||||
}
|
||||
|
||||
public static void sendToSpigotDeleteAll() {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream output = new DataOutputStream(stream);
|
||||
try {
|
||||
output.writeUTF(T2C_BngeePlayersEnum.CLEAR.name());
|
||||
output.writeUTF("");
|
||||
output.writeUTF("");
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger(e.getMessage());
|
||||
}
|
||||
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
||||
server.sendData(T2C_Util.getPluginChannel_ProxyOnlinePlayers(), stream.toByteArray());
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPluginMessage(PluginMessageEvent event) {
|
||||
if (event.getTag().equalsIgnoreCase(T2C_Util.getPluginChannel_ProxyOnlinePlayers())) {
|
||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
||||
event.setCancelled(true);
|
||||
try {
|
||||
T2C_BngeePlayersEnum subChannel = T2C_BngeePlayersEnum.valueOf(stream.readUTF());
|
||||
String input = stream.readUTF();
|
||||
|
||||
T2CB_Send.debug(T2CB_Main.getPlugin(), "PluginMessage received channel: " + event.getTag());
|
||||
T2CB_Send.debug(T2CB_Main.getPlugin(), "PluginMessage received subChannel: " + subChannel.name());
|
||||
T2CB_Send.debug(T2CB_Main.getPlugin(), "PluginMessage received input/uuid: " + input);
|
||||
|
||||
sendToSpigotPlayer("", subChannel, input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package net.t2code.lib.Bungee.Lib.commands;
|
||||
package net.t2code.t2codelib.BUNGEE.api.commands;
|
||||
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
public class Bcmd {
|
||||
public class T2CB_Cmd {
|
||||
public static void Console(String cmd){
|
||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), cmd);
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package net.t2code.t2codelib.BUNGEE.api.commands;
|
||||
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class T2CB_Tab {
|
||||
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, String perm, Boolean onlinePlayer) {
|
||||
if (args.length != arg + 1) return;
|
||||
for (ProxiedPlayer player1 : ProxyServer.getInstance().getPlayers()) {
|
||||
if (passend(player1.getName(), args[arg]) && hasPermission(sender, perm)) {
|
||||
matches.add(player1.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int argEquals, String equalsValue, int arg, String[] args, String perm, Boolean onlinePlayer) {
|
||||
if (args.length != arg + 1) return;
|
||||
if (!args[argEquals].toLowerCase().equals(equalsValue)) return;
|
||||
for (ProxiedPlayer player1 : ProxyServer.getInstance().getPlayers()) {
|
||||
if (passend(player1.getName(), args[arg]) && hasPermission(sender, perm)) {
|
||||
matches.add(player1.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, HashMap<String, String> permMap, Boolean onlinePlayer, String permForPlayer) {
|
||||
if (args.length != arg + 1) return;
|
||||
for (String command : permMap.keySet()) {
|
||||
if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||
matches.add(command);
|
||||
} else if (onlinePlayer != null && permForPlayer != null) {
|
||||
tab(matches, sender, arg, args, permForPlayer, onlinePlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, HashMap<String, String> permMap) {
|
||||
tab(matches, sender, arg, args, permMap, null, null);
|
||||
}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int argEquals, String equalsValue, int arg, String[] args, HashMap<String, String> permMap) {
|
||||
if (args.length != arg + 1) return;
|
||||
if (!args[argEquals].toLowerCase().equals(equalsValue)) return;
|
||||
for (String command : permMap.keySet()) {
|
||||
if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||
matches.add(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> tab(CommandSender sender, int arg, String[] args, String perm, String command) {
|
||||
List<String> matches = new ArrayList<>();
|
||||
if (hasPermission(sender, perm) && passend(command, args[arg])) {
|
||||
matches.add(command);
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
public static Boolean passend(String command, String arg) {
|
||||
for (int i = 0; i < arg.toUpperCase().length(); i++) {
|
||||
if (arg.toUpperCase().length() >= command.toUpperCase().length()) {
|
||||
return false;
|
||||
} else {
|
||||
if (arg.toUpperCase().charAt(i) != command.toUpperCase().charAt(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean hasPermission(CommandSender sender, String permission) {
|
||||
String[] Permissions = permission.split(";");
|
||||
for (String perm : Permissions) {
|
||||
if (sender.hasPermission(perm)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package net.t2code.t2codelib.BUNGEE.api.messages;
|
||||
|
||||
|
||||
import net.kyori.adventure.platform.bungeecord.BungeeAudiences;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.t2code.t2codelib.BUNGEE.system.T2CB_Main;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Replace;
|
||||
|
||||
public class T2CB_MiniMessage {
|
||||
private static final BungeeAudiences bungeeAudiences = T2CB_Main.getAdventure();
|
||||
|
||||
public static void sendSenderMiniMessage(String msg, CommandSender sender) {
|
||||
bungeeAudiences.sender(sender).sendMessage(replace(msg));
|
||||
}
|
||||
|
||||
public static void sendConsoleMiniMessage(String msg) {
|
||||
bungeeAudiences.console().sendMessage(replace(msg));
|
||||
}
|
||||
|
||||
public static void sendPlayerMiniMessage(String msg, ProxiedPlayer player) {
|
||||
bungeeAudiences.player(player).sendMessage(replace(msg));
|
||||
}
|
||||
|
||||
protected static Component replace(String text) {
|
||||
return MiniMessage.miniMessage().deserialize(T2C_Replace.convertColorCode(text));
|
||||
}
|
||||
|
||||
public static String removeMiniMessageCodes(String text){
|
||||
return MiniMessage.miniMessage().stripTags(text);
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package net.t2code.lib.Bungee.Lib.replace;
|
||||
package net.t2code.t2codelib.BUNGEE.api.messages;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BReplace {
|
||||
public class T2CB_Replace {
|
||||
|
||||
public static String replace(String prefix, String Text) {
|
||||
return Text.replace("[prefix]", prefix).replace("&", "§").replace("[ue]", "ü")
|
||||
@ -11,8 +11,6 @@ public class BReplace {
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä");
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static List<String> replace(String prefix, List<String> Text) {
|
||||
List<String> output = new ArrayList<>();
|
||||
for (String input : Text) {
|
@ -1,21 +1,25 @@
|
||||
package net.t2code.lib.Bungee.Lib.messages;
|
||||
package net.t2code.t2codelib.BUNGEE.api.messages;
|
||||
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.Title;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
import net.t2code.t2codelib.BUNGEE.system.T2CB_Main;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class Bsend {
|
||||
public class T2CB_Send {
|
||||
public static void console(String msg) {
|
||||
ProxyServer.getInstance().getConsole().sendMessage(msg);
|
||||
if (T2CB_Main.getMmIsLoad() && T2CB_Main.getMmIsLoad()) {
|
||||
T2CB_MiniMessage.sendConsoleMiniMessage(msg);
|
||||
} else ProxyServer.getInstance().getConsole().sendMessage(msg);
|
||||
}
|
||||
|
||||
public static void player(ProxiedPlayer player, String msg) {
|
||||
player.sendMessage(msg);
|
||||
if (T2CB_Main.getMmIsLoad()&& T2CB_Main.getMmIsLoad()) {
|
||||
T2CB_MiniMessage.sendPlayerMiniMessage(msg, player);
|
||||
} else player.sendMessage(msg);
|
||||
}
|
||||
|
||||
public static void title(ProxiedPlayer player, Title msg) {
|
||||
@ -23,7 +27,9 @@ public class Bsend {
|
||||
}
|
||||
|
||||
public static void sender(CommandSender sender, String msg) {
|
||||
sender.sendMessage(msg);
|
||||
if (T2CB_Main.getMmIsLoad()&& T2CB_Main.getMmIsLoad()) {
|
||||
T2CB_MiniMessage.sendSenderMiniMessage(msg, sender);
|
||||
} else sender.sendMessage(msg);
|
||||
}
|
||||
|
||||
public static void debug(Plugin plugin, String msg) {
|
||||
@ -32,15 +38,15 @@ public class Bsend {
|
||||
|
||||
public static void debug(Plugin plugin, String msg, Integer stage) {
|
||||
// if (!new File(Main.getPath(), "config.yml").exists()) return;
|
||||
if (stage == null) {
|
||||
//todo if (plugin.getConfig().getBoolean("Plugin.Debug")){
|
||||
// ProxyServer.getInstance().getConsole().sendMessage(plugin.getDescription().getName() + " §5DEBUG: §6" + msg);
|
||||
// }
|
||||
return;
|
||||
}
|
||||
// todo if (plugin.getConfig().getInt("Plugin.Debug") >= stage) {
|
||||
// ProxyServer.getInstance().getConsole().sendMessage(plugin.getDescription().getName() + " §5DEBUG: §6" + msg);
|
||||
// }
|
||||
// if (stage == null) {
|
||||
// if (plugin.getConfig().getBoolean("Plugin.Debug")) {
|
||||
// ProxyServer.getInstance().getConsole().sendMessage(plugin.getDescription().getName() + " §5DEBUG: §6" + msg);
|
||||
// }
|
||||
// return;
|
||||
//}
|
||||
//if (plugin.getConfig().getInt("Plugin.Debug") >= stage) {
|
||||
// ProxyServer.getInstance().getConsole().sendMessage(plugin.getDescription().getName() + " §5DEBUG: §6" + msg);
|
||||
//}
|
||||
}
|
||||
|
||||
public static void debugmsg(Plugin plugin, String msg) {
|
@ -0,0 +1,56 @@
|
||||
package net.t2code.t2codelib.BUNGEE.api.messages;
|
||||
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.t2code.t2codelib.BUNGEE.api.update.T2CB_UpdateAPI;
|
||||
import net.t2code.t2codelib.util.T2C_UpdateWebData;
|
||||
|
||||
public class T2CB_Template {
|
||||
|
||||
|
||||
public static Long onLoadHeader(String prefix, String autor, String version, String spigot, String discord) {
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
T2CB_Send.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
T2CB_Send.console(prefix + " §2Autor: §6" + autor.replace("[", "").replace("]", ""));
|
||||
T2CB_Send.console(prefix + " §2Version: §6" + version);
|
||||
T2CB_Send.console(prefix + " §2Spigot: §6" + spigot);
|
||||
T2CB_Send.console(prefix + " §2Discord: §6" + discord);
|
||||
T2CB_Send.console(prefix + " §8-------------------------------");
|
||||
return long_;
|
||||
}
|
||||
|
||||
public static void onLoadSeparateStroke(String prefix) {
|
||||
T2CB_Send.console(prefix + " §8-------------------------------");
|
||||
}
|
||||
|
||||
public static void onLoadFooter(String prefix, Long long_) {
|
||||
T2CB_Send.console(prefix + " §8-------------------------------");
|
||||
T2CB_Send.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
T2CB_Send.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
}
|
||||
|
||||
public static void onDisable(String prefix, String autor, String version, String spigot, String discord) {
|
||||
T2CB_Send.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
T2CB_Send.console(prefix + " §2Autor: §6" + autor.replace("[", "").replace("]", ""));
|
||||
T2CB_Send.console(prefix + " §2Version: §6" + version);
|
||||
T2CB_Send.console(prefix + " §2Spigot: §6" + spigot);
|
||||
T2CB_Send.console(prefix + " §2Discord: §6" + discord);
|
||||
T2CB_Send.console(prefix + " §4Plugin successfully disabled.");
|
||||
T2CB_Send.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
}
|
||||
|
||||
public static void sendInfo(CommandSender sender, Plugin plugin, String prefix, String spigot, String discord, String autor) {
|
||||
T2C_UpdateWebData webData = T2CB_UpdateAPI.bungeePluginVersins.get(plugin.getDescription().getName()).webData;
|
||||
String pluginVersion = plugin.getDescription().getVersion();
|
||||
T2CB_Send.sender(sender, prefix + "§4======= " + prefix + " §4=======");
|
||||
T2CB_Send.sender(sender, prefix + " §2Autor: §6" + autor);
|
||||
if (webData.getVersion().equalsIgnoreCase(pluginVersion)) {
|
||||
T2CB_Send.sender(sender, prefix + " §2Version: §6" + pluginVersion);
|
||||
} else {
|
||||
T2CB_UpdateAPI.sendUpdateMsg(prefix, discord, webData, plugin, sender);
|
||||
}
|
||||
T2CB_Send.sender(sender, prefix + " §2Spigot: §6" + spigot);
|
||||
T2CB_Send.sender(sender, prefix + " §2Discord: §6" + discord);
|
||||
T2CB_Send.sender(sender, prefix + "§4======= " + prefix + " §4=======");
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package net.t2code.t2codelib.BUNGEE.api.pluginMessaging;
|
||||
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class T2CB_PluginMessageProxyCommand implements Listener {
|
||||
@EventHandler
|
||||
public void onPluginmessage(PluginMessageEvent event) {
|
||||
if (event.getTag().equalsIgnoreCase(T2C_Util.getPluginChannel_ProxyCommand())) {
|
||||
event.setCancelled(true);
|
||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
||||
try {
|
||||
String channel = stream.readUTF();
|
||||
String input = stream.readUTF();
|
||||
String serverID;
|
||||
try {
|
||||
serverID = stream.readUTF();
|
||||
} catch (Exception i){
|
||||
serverID = "not Found";
|
||||
}
|
||||
|
||||
if (channel.equals("T2Code-Console")) {
|
||||
ProxyServer.getInstance().getConsole().sendMessage(T2C_Util.getPrefix()+" [§6"+serverID+"§r] §cT2C BCMD Command Console: §r"+ input);
|
||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);
|
||||
} else {
|
||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(channel);
|
||||
if (player != null) {
|
||||
ProxyServer.getInstance().getConsole().sendMessage(T2C_Util.getPrefix()+" [§6"+serverID+"§r] §cT2C BCMD Command §r" + player +": "+ input);
|
||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(player, input);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package net.t2code.t2codelib.BUNGEE.api.pluginMessaging.autoResponse;
|
||||
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import net.t2code.t2codelib.BUNGEE.api.messages.T2CB_Send;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class T2CB_API_AutoResponse implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPluginmessage(PluginMessageEvent event) {
|
||||
if (event.getTag().equalsIgnoreCase(T2C_Util.getPluginChannel_AutoResponse())) {
|
||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
||||
event.setCancelled(true);
|
||||
try {
|
||||
String channel = stream.readUTF();
|
||||
String input = stream.readUTF();
|
||||
|
||||
switch (channel) {
|
||||
case "ConC":
|
||||
ProxyServer.getInstance().getConsole().sendMessage("Command Console: " + input);
|
||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);
|
||||
break;
|
||||
case "ALLPMSG":
|
||||
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
|
||||
T2CB_Send.player(player, input);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(channel);
|
||||
if (player != null) {
|
||||
ProxyServer.getInstance().getConsole().sendMessage("Command " + player + ": " + input);
|
||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(player, input);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package net.t2code.t2codelib.BUNGEE.api.pluginMessaging.commandgui;
|
||||
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class T2CB_API_CGUI implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PostLoginEvent e) {
|
||||
ProxiedPlayer player = e.getPlayer();
|
||||
sendToSpigotPlayer(player.getName(), true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDisconnect(PlayerDisconnectEvent e) {
|
||||
ProxiedPlayer player = e.getPlayer();
|
||||
sendToSpigotPlayer(e.getPlayer().getName(), false);
|
||||
}
|
||||
|
||||
public static void sendToSpigotPlayer(String name, Boolean join) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream output = new DataOutputStream(stream);
|
||||
try {
|
||||
if (join) {
|
||||
output.writeUTF("join");
|
||||
} else {
|
||||
output.writeUTF("left");
|
||||
}
|
||||
output.writeUTF(name);
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger(e.getMessage());
|
||||
}
|
||||
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
||||
server.sendData(T2C_Util.getPluginChannel_CGUIOnlinePlayers(), stream.toByteArray());
|
||||
});
|
||||
}
|
||||
|
||||
public static void sendToSpigotDeleteAll() {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream output = new DataOutputStream(stream);
|
||||
try {
|
||||
output.writeUTF("clear");
|
||||
output.writeUTF("");
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger(e.getMessage());
|
||||
}
|
||||
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
||||
server.sendData(T2C_Util.getPluginChannel_CGUIOnlinePlayers(), stream.toByteArray());
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package net.t2code.t2codelib.BUNGEE.api.pluginMessaging.opSecurity;
|
||||
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class T2CB_API_OpSecurity implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPluginmessage(PluginMessageEvent event) {
|
||||
if (event.getTag().equalsIgnoreCase(T2C_Util.getPluginChannel_OPSecurity())) {
|
||||
event.setCancelled(true);
|
||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
||||
try {
|
||||
String channel = stream.readUTF();
|
||||
String mode = stream.readUTF();
|
||||
String information = stream.readUTF();
|
||||
if (channel.equals("T2Cconsole")) {
|
||||
sendToSpigotPlayer(channel,mode,information);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void sendToSpigotPlayer(String channel,String mode,String information) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream output = new DataOutputStream(stream);
|
||||
try {
|
||||
output.writeUTF(channel);
|
||||
output.writeUTF(mode);
|
||||
output.writeUTF(information);
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger(e.getMessage());
|
||||
}
|
||||
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
||||
server.sendData(T2C_Util.getPluginChannel_OPSecurity(), stream.toByteArray());
|
||||
});
|
||||
}
|
||||
}
|
@ -1,13 +1,12 @@
|
||||
package net.t2code.lib.Bungee.Lib.plugins;
|
||||
package net.t2code.t2codelib.BUNGEE.api.plugins;
|
||||
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.t2code.lib.Bungee.BMain;
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import net.t2code.t2codelib.BUNGEE.system.T2CB_Main;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class BPluginCheck {
|
||||
public class T2CB_PluginCheck {
|
||||
public static Boolean pluginCheck(String pluginName){
|
||||
return (ProxyServer.getInstance().getPluginManager().getPlugin(pluginName) != null);
|
||||
}
|
||||
@ -71,7 +70,7 @@ public class BPluginCheck {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
ProxyServer.getInstance().getConsole().sendMessage(prefix + " §e" + pl + " §4could not be found. Please download it here: " +
|
||||
"§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
||||
BMain.plugin.getProxy().getPluginManager().getPlugin(plugin.getDescription().getName()).onDisable();
|
||||
T2CB_Main.getPlugin().getProxy().getPluginManager().getPlugin(plugin.getDescription().getName()).onDisable();
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package net.t2code.t2codelib.BUNGEE.api.update;
|
||||
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.t2code.t2codelib.BUNGEE.api.messages.T2CB_Send;
|
||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CB_LibConfig;
|
||||
import net.t2code.t2codelib.util.T2C_UpdateObject;
|
||||
import net.t2code.t2codelib.util.T2C_UpdateWebData;
|
||||
import net.t2code.t2codelib.util.T2C_UpdateType;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class T2CB_UpdateAPI {
|
||||
public static HashMap<String, T2C_UpdateObject> bungeePluginVersins = new HashMap<>();
|
||||
|
||||
public static void sendUpdateMsg(String prefix, String discord, T2C_UpdateWebData webData, Plugin plugin, CommandSender sender) {
|
||||
String publicVersion = webData.getVersion();
|
||||
String pluginVersion = plugin.getDescription().getVersion();
|
||||
String value;
|
||||
if (webData.isPreRelease()) {
|
||||
value = T2C_UpdateType.PRERELEASE.text;
|
||||
if (publicVersion.toLowerCase().contains("dev")) {
|
||||
value = T2C_UpdateType.DEVELOPMENT.text;
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("beta")) {
|
||||
value = T2C_UpdateType.BETA.text;
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("snapshot")) {
|
||||
value = T2C_UpdateType.SNAPSHOT.text;
|
||||
}
|
||||
} else value = T2C_UpdateType.STABLE.text;
|
||||
String h = "<br><dark_red>╔══════════════</dark_red>" + prefix + "<dark_red>══════════════</dark_red>";
|
||||
String s1 = "<br><dark_red>║</dark_red> <gold>A new [value] version was found!</gold>".replace("[value]", value);
|
||||
String s2 = "<br><dark_red>║</dark_red> <gold>Your version: <red>" + pluginVersion + "</red> <gray>-</gray> Current version:</gold> <green>" + webData.getVersion() + "</green>";
|
||||
String s3 = "<br><dark_red>║</dark_red> <gold>You can download it here:</gold> <yellow>" + webData.getUpdateUrl() + "</yellow>";
|
||||
String s4 = "<br><dark_red>║</dark_red> <gold>You can find more information on Discord:</gold> <yellow>" + discord + "</yellow>";
|
||||
String f = "<br><dark_red>╚══════════════</dark_red>" + prefix + "<dark_red>══════════════</dark_red>";
|
||||
String text = h + s1 + s2 + s3 + s4 + f;
|
||||
if (sender == null) {
|
||||
T2CB_Send.console(text);
|
||||
} else T2CB_Send.sender(sender, text);
|
||||
|
||||
}
|
||||
|
||||
private static Boolean noUpdate = true;
|
||||
private static String pluginVersion;
|
||||
|
||||
public static void onUpdateCheckTimer(Plugin plugin, String prefix, String discord, Integer spigotID, String url) {
|
||||
if ((int) T2CB_LibConfig.VALUES.updateTimer.getValue() < 1) {
|
||||
T2CB_LibConfig.VALUES.updateTimer.setValue(1);
|
||||
}
|
||||
ProxyServer.getInstance().getScheduler().schedule(plugin, new Runnable() {
|
||||
public void run() {
|
||||
(new T2CB_UpdateCheckerGit(plugin)).getVersion((webData) -> {
|
||||
pluginVersion = plugin.getDescription().getVersion();
|
||||
T2C_UpdateObject update = new T2C_UpdateObject(
|
||||
plugin.getDescription().getName(),
|
||||
plugin.getDescription().getVersion(),
|
||||
webData,
|
||||
false,
|
||||
!plugin.getDescription().getVersion().equals(webData.getVersion()),
|
||||
true
|
||||
);
|
||||
bungeePluginVersins.put(plugin.getDescription().getName(), update);
|
||||
if (!pluginVersion.replace("_Bungee", "").equalsIgnoreCase(webData.getVersion())) {
|
||||
sendUpdateMsg(prefix, discord, webData, plugin, null);
|
||||
noUpdate = true;
|
||||
} else {
|
||||
if (noUpdate) {
|
||||
T2CB_Send.console(prefix + " §2No update found.");
|
||||
noUpdate = false;
|
||||
}
|
||||
}
|
||||
}, pluginVersion, spigotID, url);
|
||||
}
|
||||
}, 0, (int) T2CB_LibConfig.VALUES.updateTimer.getValue() * 60 * 20L, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package net.t2code.t2codelib.BUNGEE.api.update;
|
||||
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CB_LibConfig;
|
||||
import net.t2code.t2codelib.util.T2C_UpdateObject;
|
||||
import net.t2code.t2codelib.util.T2C_UpdateWebData;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class T2CB_UpdateCheckerGit {
|
||||
private Plugin plugin;
|
||||
|
||||
|
||||
public T2CB_UpdateCheckerGit(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
}
|
||||
|
||||
public void getVersion(Consumer<T2C_UpdateWebData> consumer, String pluginVersion, Integer spigotID, String gitKey) {
|
||||
String RepoURL = "https://git.t2code.net/api/v1/repos/" + gitKey + "/releases?limit=1";
|
||||
if (!(boolean) T2CB_LibConfig.VALUES.seePreReleaseUpdates.getValue() ) {
|
||||
RepoURL = RepoURL + "&pre-release=false";
|
||||
}
|
||||
String finalRepoURL = RepoURL;
|
||||
ProxyServer.getInstance().getScheduler().runAsync(this.plugin, () -> {
|
||||
try {
|
||||
URL url = new URL(finalRepoURL);
|
||||
URLConnection yc = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(
|
||||
new InputStreamReader(
|
||||
yc.getInputStream()));
|
||||
String inputLine;
|
||||
String data = "";
|
||||
while ((inputLine = in.readLine()) != null)
|
||||
data = inputLine;
|
||||
in.close();
|
||||
data = data.substring(1, data.length() - 1);
|
||||
if (data.isEmpty()) {
|
||||
consumer.accept(null);
|
||||
return;
|
||||
}
|
||||
JSONObject obj = new JSONObject(data);
|
||||
String updateTitle = obj.getString("name");
|
||||
String version = obj.getString("tag_name");
|
||||
String updateDescription = obj.getString("body").replace("\n", "<br>").replace("\r", "").replace("'", "''");
|
||||
String updateUrl = obj.getString("html_url");
|
||||
boolean preRelease = obj.getBoolean("prerelease");
|
||||
|
||||
String date = obj.getString("published_at");
|
||||
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss a");
|
||||
Date parsedDate = inputFormat.parse(date);
|
||||
String publishedAt = outputFormat.format(parsedDate);
|
||||
|
||||
JSONArray downloadArray = obj.getJSONArray("assets");
|
||||
String gitURL = updateUrl;
|
||||
String downloadURL;
|
||||
if (downloadArray.isEmpty()) {
|
||||
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
||||
} else {
|
||||
downloadURL = downloadArray.getJSONObject(0).getString("browser_download_url");
|
||||
}
|
||||
|
||||
if (!preRelease) {
|
||||
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
||||
updateUrl = "https://www.spigotmc.org/resources/" + spigotID;
|
||||
}
|
||||
|
||||
T2C_UpdateWebData webData = new T2C_UpdateWebData(updateTitle, version, updateDescription, updateUrl, publishedAt, downloadURL, gitURL, preRelease);
|
||||
consumer.accept(webData);
|
||||
} catch (Exception var10) {
|
||||
Boolean load = false;
|
||||
if (T2CB_UpdateAPI.bungeePluginVersins.containsKey(plugin.getDescription().getName())) {
|
||||
load = T2CB_UpdateAPI.bungeePluginVersins.get(plugin.getDescription().getName()).load;
|
||||
}
|
||||
T2C_UpdateObject update = new T2C_UpdateObject(
|
||||
plugin.getDescription().getName(),
|
||||
pluginVersion,
|
||||
null,
|
||||
load,
|
||||
false,
|
||||
true
|
||||
);
|
||||
T2CB_UpdateAPI.bungeePluginVersins.put(plugin.getDescription().getName(), update);
|
||||
this.plugin.getLogger().severe("§4 Cannot look for updates: " + var10.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
package net.t2code.lib.Bungee.Lib.yamlConfiguration;
|
||||
package net.t2code.t2codelib.BUNGEE.api.yaml;
|
||||
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||
import net.t2code.t2codelib.BUNGEE.api.messages.T2CB_Replace;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BConfig {
|
||||
public class T2CB_Config {
|
||||
public static void set(String path, String value, Configuration configuration) {
|
||||
if (!configuration.contains(path)) {
|
||||
configuration.set(path, value);
|
||||
@ -43,7 +43,7 @@ public class BConfig {
|
||||
|
||||
|
||||
public static String select(String prefix, String path, Configuration configuration) {
|
||||
return Replace.replace(prefix, configuration.getString(path));
|
||||
return T2CB_Replace.replace(prefix, configuration.getString(path));
|
||||
}
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ public class BConfig {
|
||||
List<String> output = new ArrayList<>();
|
||||
List<String> input = configuration.getStringList(path);
|
||||
for (String st : input) {
|
||||
output.add(Replace.replace(prefix, st));
|
||||
output.add(T2CB_Replace.replace(prefix, st));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
@ -78,7 +78,7 @@ public class BConfig {
|
||||
List<String> output = new ArrayList<>();
|
||||
List<String> input = configuration.getStringList(path);
|
||||
for (String st : input) {
|
||||
output.add(Replace.replace(prefix, st));
|
||||
output.add(T2CB_Replace.replace(prefix, st));
|
||||
}
|
||||
value = output;
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
// This class was created by JaTiTV.
|
||||
|
||||
package net.t2code.t2codelib.BUNGEE.api.yaml;
|
||||
|
||||
import net.md_5.bungee.config.ConfigurationProvider;
|
||||
import net.md_5.bungee.config.YamlConfiguration;
|
||||
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class T2CB_ConfigWriter {
|
||||
|
||||
private static Configuration config;
|
||||
|
||||
|
||||
public static void createConfig(File configFile, T2C_ConfigItem[] values, String... header) {
|
||||
boolean exist = configFile.exists();
|
||||
if (!exist) {
|
||||
configFile.getParentFile().mkdirs();
|
||||
try {
|
||||
configFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Map<String, List<String>> comments = new LinkedHashMap<>();
|
||||
|
||||
T2C_LanguageEnum lang = T2C_LanguageEnum.english;
|
||||
|
||||
for (T2C_ConfigItem item : values) {
|
||||
if (item.getForceSet() || !exist) {
|
||||
if (!config.contains(item.getPath())) {
|
||||
config.set(item.getPath(), item.getValue());
|
||||
}
|
||||
List<String> commandList = item.getComments().get(lang);
|
||||
if (commandList != null) {
|
||||
comments.put(item.getPath(), commandList);
|
||||
}
|
||||
}
|
||||
}
|
||||
saveConfigWithComments(configFile, comments, header);
|
||||
readConfig(config, values);
|
||||
}
|
||||
|
||||
private static void readConfig(Configuration config, T2C_ConfigItem[] values) {
|
||||
for (T2C_ConfigItem item : values) {
|
||||
item.setValue(config.get(item.getPath()));
|
||||
}
|
||||
}
|
||||
|
||||
private static void saveConfigWithComments(File file, Map<String, List<String>> comments, String... headers) {
|
||||
try {
|
||||
StringBuilder configContent = new StringBuilder();
|
||||
for (String h : headers) {
|
||||
configContent.append("# ").append(h).append("\n");
|
||||
}
|
||||
configContent.append("\n");
|
||||
addSection(config, comments, configContent, "", 0);
|
||||
|
||||
// Write the content to the file
|
||||
Files.write(file.toPath(), configContent.toString().getBytes());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void addSection(Configuration section, Map<String, List<String>> comments, StringBuilder builder, String prefix, int indentLevel) {
|
||||
String indent = " ".repeat(indentLevel);
|
||||
|
||||
for (String key : section.getKeys()) {
|
||||
String fullKey = prefix.isEmpty() ? key : prefix + "." + key;
|
||||
Object value = section.get(key);
|
||||
|
||||
// Add comment if it exists for this key
|
||||
List<String> commentList = comments.get(fullKey);
|
||||
if (commentList != null) {
|
||||
for (String c : commentList) {
|
||||
if (c.isEmpty()) {
|
||||
builder.append(indent).append(c).append("\n");
|
||||
} else builder.append(indent).append("# ").append(c).append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the value is a section (nested map)
|
||||
|
||||
if (value instanceof Configuration) {
|
||||
// Correctly add the section
|
||||
builder.append(indent).append(key).append(":\n");
|
||||
addSection((Configuration) value, comments, builder, fullKey, indentLevel + 1);
|
||||
} else {
|
||||
// Add value with proper indentation
|
||||
// builder.append(indent).append(key).append(": ").append(value).append("\n");
|
||||
if (value instanceof List) {
|
||||
List<?> list = (List<?>) value;
|
||||
if (list.size() == 1){
|
||||
for (Object s : list) {
|
||||
if (s instanceof String) {
|
||||
builder.append(indent).append(key).append(": \"").append(value).append("\"\n");
|
||||
} else builder.append(indent).append(key).append(": ").append(value).append("\n");
|
||||
}
|
||||
} else {
|
||||
builder.append(indent).append(key).append(": ").append("\n");
|
||||
for (Object s : list) {
|
||||
if (s instanceof String) {
|
||||
builder.append(indent).append("- \"").append(s).append("\"\n");
|
||||
} else builder.append(indent).append("- ").append(s).append("\n");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (value instanceof String) {
|
||||
builder.append(indent).append(key).append(": \"").append(value).append("\"\n");
|
||||
} else builder.append(indent).append(key).append(": ").append(value).append("\n");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
117
src/main/java/net/t2code/t2codelib/BUNGEE/system/T2CB_Main.java
Normal file
117
src/main/java/net/t2code/t2codelib/BUNGEE/system/T2CB_Main.java
Normal file
@ -0,0 +1,117 @@
|
||||
package net.t2code.t2codelib.BUNGEE.system;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.kyori.adventure.platform.bungeecord.BungeeAudiences;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.t2code.t2codelib.BUNGEE.api.messages.T2CB_Send;
|
||||
import net.t2code.t2codelib.BUNGEE.api.bungeePlayers.T2CB_BungeePlayers;
|
||||
import net.t2code.t2codelib.BUNGEE.api.pluginMessaging.T2CB_PluginMessageProxyCommand;
|
||||
import net.t2code.t2codelib.BUNGEE.api.pluginMessaging.autoResponse.T2CB_API_AutoResponse;
|
||||
import net.t2code.t2codelib.BUNGEE.api.pluginMessaging.commandgui.T2CB_API_CGUI;
|
||||
import net.t2code.t2codelib.BUNGEE.api.pluginMessaging.opSecurity.T2CB_API_OpSecurity;
|
||||
import net.t2code.t2codelib.BUNGEE.api.update.T2CB_UpdateAPI;
|
||||
import net.t2code.t2codelib.BUNGEE.system.bstats.T2CB_Metrics;
|
||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CB_LibConfig;
|
||||
import net.t2code.t2codelib.util.T2C_PlatformDetector;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
|
||||
public class T2CB_Main extends Plugin {
|
||||
|
||||
@Getter
|
||||
private static Plugin plugin;
|
||||
|
||||
private static String version;
|
||||
private static String orgVersion;
|
||||
private static String autor;
|
||||
|
||||
private static Boolean mmIsLoad = true;
|
||||
private static BungeeAudiences adventure;
|
||||
|
||||
public static BungeeAudiences getAdventure() {
|
||||
T2C_PlatformDetector.scan();
|
||||
if (adventure == null) {
|
||||
throw new IllegalStateException("Cannot retrieve audience provider while plugin is not enabled");
|
||||
}
|
||||
return adventure;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Plugin startup logic
|
||||
plugin = this;
|
||||
orgVersion = plugin.getDescription().getVersion();
|
||||
autor = plugin.getDescription().getAuthor();
|
||||
try {
|
||||
adventure = BungeeAudiences.create(this);
|
||||
T2CB_Send.info(this, "Adventure load!");
|
||||
} catch (Exception e) {
|
||||
T2CB_Send.error(this, "Adventure can not be load!");
|
||||
mmIsLoad = false;
|
||||
}
|
||||
onLoad(T2C_Util.getPrefix(), autor, orgVersion, T2C_Util.getSpigot(), T2C_Util.getDiscord(), T2C_Util.getSpigotID(), T2C_Util.getBstatsID(), T2C_Util.getGit());
|
||||
version = plugin.getDescription().getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// Plugin shutdown logic
|
||||
T2CB_BungeePlayers.sendToSpigotDeleteAll();
|
||||
if (mmIsLoad) {
|
||||
if (adventure != null) {
|
||||
adventure.close();
|
||||
adventure = null;
|
||||
}
|
||||
}
|
||||
T2CB_Send.console(T2C_Util.getPrefix() + "§4============================= " + T2C_Util.getPrefix() + " §4=============================");
|
||||
T2CB_Send.console(T2C_Util.getPrefix() + " §2Autor: §6" + String.valueOf(plugin.getDescription().getAuthor()).replace("[", "").replace("]", ""));
|
||||
T2CB_Send.console(T2C_Util.getPrefix() + " §2Version: §6" + version);
|
||||
T2CB_Send.console(T2C_Util.getPrefix() + " §2Spigot: §6" + T2C_Util.getSpigot());
|
||||
T2CB_Send.console(T2C_Util.getPrefix() + " §2Discord: §6" + T2C_Util.getDiscord());
|
||||
T2CB_Send.console(T2C_Util.getPrefix() + " §4Plugin successfully disabled.");
|
||||
T2CB_Send.console(T2C_Util.getPrefix() + "§4============================= " + T2C_Util.getPrefix() + " §4=============================");
|
||||
}
|
||||
|
||||
public static Boolean getMmIsLoad() {
|
||||
return mmIsLoad;
|
||||
}
|
||||
|
||||
public static void onLoad(String prefix, String autor, String version, String spigot, String discord, Integer spigotID, Integer bstatsID, String url) {
|
||||
long long_ = System.currentTimeMillis();
|
||||
T2CB_Send.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
T2CB_Send.console(prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
T2CB_Send.console(prefix + " §2Version: §6" + version);
|
||||
T2CB_Send.console(prefix + " §2Spigot: §6" + spigot);
|
||||
T2CB_Send.console(prefix + " §2Discord: §6" + discord);
|
||||
|
||||
T2CB_Metrics.bStats(plugin, bstatsID);
|
||||
T2CB_LibConfig.set();
|
||||
|
||||
T2CB_UpdateAPI.onUpdateCheckTimer(plugin, prefix, discord, spigotID, url);
|
||||
|
||||
//API
|
||||
plugin.getProxy().registerChannel(T2C_Util.getPluginChannel_ProxyCommand());
|
||||
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CB_PluginMessageProxyCommand());
|
||||
|
||||
plugin.getProxy().registerChannel(T2C_Util.getPluginChannel_ProxyOnlinePlayers());
|
||||
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CB_BungeePlayers());
|
||||
T2CB_BungeePlayers.sendToSpigotDeleteAll();
|
||||
|
||||
if ((boolean) T2CB_LibConfig.VALUES.apiCommandGUIEnable.getValue()) {
|
||||
plugin.getProxy().registerChannel(T2C_Util.getPluginChannel_CGUIOnlinePlayers());
|
||||
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CB_API_CGUI());
|
||||
T2CB_API_CGUI.sendToSpigotDeleteAll();
|
||||
}
|
||||
if ((boolean) T2CB_LibConfig.VALUES.apiAutoResponse.getValue()) {
|
||||
plugin.getProxy().registerChannel(T2C_Util.getPluginChannel_AutoResponse());
|
||||
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CB_API_AutoResponse());
|
||||
}
|
||||
if ((boolean) T2CB_LibConfig.VALUES.apiOpSecurity.getValue()) {
|
||||
plugin.getProxy().registerChannel(T2C_Util.getPluginChannel_OPSecurity());
|
||||
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CB_API_OpSecurity());
|
||||
}
|
||||
|
||||
T2CB_Send.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
T2CB_Send.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package net.t2code.lib.Bungee.system;
|
||||
package net.t2code.t2codelib.BUNGEE.system.bstats;
|
||||
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
@ -21,11 +21,11 @@ import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
public class BMetrics {
|
||||
public class T2CB_Metrics {
|
||||
|
||||
public static void Bstats(Plugin plugin, int bstatsID) {
|
||||
public static void bStats(Plugin plugin, int bstatsID) {
|
||||
int pluginId = bstatsID; // <-- Replace with the id of your plugin!
|
||||
BMetrics metrics = new BMetrics(plugin, pluginId);
|
||||
T2CB_Metrics metrics = new T2CB_Metrics(plugin, pluginId);
|
||||
}
|
||||
|
||||
private final Plugin plugin;
|
||||
@ -49,7 +49,7 @@ public class BMetrics {
|
||||
* @param serviceId The id of the service. It can be found at <a
|
||||
* href="https://bstats.org/what-is-my-plugin-id">What is my plugin id?</a>
|
||||
*/
|
||||
public BMetrics(Plugin plugin, int serviceId) {
|
||||
public T2CB_Metrics(Plugin plugin, int serviceId) {
|
||||
this.plugin = plugin;
|
||||
try {
|
||||
loadConfig();
|
@ -0,0 +1,37 @@
|
||||
package net.t2code.t2codelib.BUNGEE.system.config;
|
||||
|
||||
import net.md_5.bungee.config.ConfigurationProvider;
|
||||
import net.t2code.t2codelib.BUNGEE.system.T2CB_Main;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.md_5.bungee.config.YamlConfiguration;
|
||||
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ConvertT2CBlibConfig {
|
||||
|
||||
public static Configuration configuration;
|
||||
|
||||
public static void convert() throws IOException {
|
||||
File config = new File(T2CB_Main.getPlugin().getDataFolder(), "config.yml");
|
||||
configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(config);
|
||||
|
||||
if (!config.exists()) return;
|
||||
if (configuration.contains("plugin.updateCheck.onJoin")) return;
|
||||
|
||||
set("UpdateCheck.TimerInMin", T2CB_LibConfig.VALUES.updateTimer);
|
||||
set("UpdateCheck.SeePreReleaseUpdates", T2CB_LibConfig.VALUES.seePreReleaseUpdates);
|
||||
set("API.CommandGUI.Enable", T2CB_LibConfig.VALUES.apiCommandGUIEnable);
|
||||
set("API.AutoResponse.Enable", T2CB_LibConfig.VALUES.apiAutoResponse);
|
||||
set("API.OPSecurity.Enable", T2CB_LibConfig.VALUES.apiOpSecurity);
|
||||
|
||||
config.delete();
|
||||
}
|
||||
|
||||
private static void set(String path, T2C_ConfigItem item){
|
||||
if (configuration.contains(path)){
|
||||
item.setValue(configuration.get(path));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package net.t2code.t2codelib.BUNGEE.system.config;
|
||||
|
||||
import net.t2code.t2codelib.BUNGEE.api.yaml.T2CB_ConfigWriter;
|
||||
import net.t2code.t2codelib.BUNGEE.system.T2CB_Main;
|
||||
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class T2CB_LibConfig {
|
||||
|
||||
public enum VALUES implements T2C_ConfigItem {
|
||||
updateTimer("updateCheck.timerInMin", 60, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.english, List.of("In this option you can set the time interval in minutes in which updates should be checked."));
|
||||
}}),
|
||||
seePreReleaseUpdates("updateCheck.seePreReleaseUpdates", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.english, List.of("In this option you can set whether you want to receive and display beta and snapshot versions in the update check."));
|
||||
}}),
|
||||
|
||||
apiCommandGUIEnable("api.commandGUI.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.english, List.of("With this option you activate the api interface for the T2C-CommandGUI plugin."));
|
||||
}}),
|
||||
apiAutoResponse("api.autoResponse.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.english, List.of("With this option you activate the api interface for the T2C-AutoResponse plugin."));
|
||||
}}),
|
||||
apiOpSecurity("api.opSecurity.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.english, List.of("With this option you activate the api interface for the T2C-OPSecurity plugin."));
|
||||
}}),
|
||||
;
|
||||
|
||||
private final String path;
|
||||
private Object value;
|
||||
private final boolean forceSet;
|
||||
private final HashMap<T2C_LanguageEnum, List<String>> comments;
|
||||
|
||||
VALUES(String path, Object value, boolean forceSet, HashMap<T2C_LanguageEnum, List<String>> comments) {
|
||||
this.path = path;
|
||||
this.value = value;
|
||||
this.forceSet = forceSet;
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getForceSet() {
|
||||
return forceSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLanguagePath() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Object newValue) {
|
||||
value = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
public static void set() {
|
||||
try {
|
||||
ConvertT2CBlibConfig.convert();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
T2CB_ConfigWriter.createConfig(new File(T2CB_Main.getPlugin().getDataFolder(), "config.yml"), VALUES.values(), T2C_Util.getConfigLogo());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.bungeePlayers;
|
||||
|
||||
public enum T2C_BngeePlayersEnum {
|
||||
JOIN,
|
||||
QUIT,
|
||||
GIVEALL,
|
||||
CLEAR
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.bungeePlayers;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class T2C_BungeePlayers implements PluginMessageListener {
|
||||
@Getter
|
||||
private static List<String> bungeePlayers = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void onPluginMessageReceived(@NotNull String channel, @NotNull Player player, byte[] message) {
|
||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "stream: " + stream.toString());
|
||||
try {
|
||||
T2C_BngeePlayersEnum subChannel = T2C_BngeePlayersEnum.valueOf(stream.readUTF());
|
||||
String input = stream.readUTF();
|
||||
String uuid = stream.readUTF();
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received channel: " + channel);
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received subChannel: " + subChannel.name());
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received input: " + input);
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received input2/uuid: " + uuid);
|
||||
switch (subChannel) {
|
||||
case JOIN:
|
||||
bungeePlayers.add(input);
|
||||
break;
|
||||
case QUIT:
|
||||
bungeePlayers.remove(input);
|
||||
break;
|
||||
case GIVEALL:
|
||||
if (!T2C_LibConfig.VALUES.serverUUID.getValue().equals(uuid)) {
|
||||
return;
|
||||
}
|
||||
bungeePlayers.clear();
|
||||
String[] in = input.split(";");
|
||||
bungeePlayers.addAll(Arrays.asList(in));
|
||||
break;
|
||||
case CLEAR:
|
||||
bungeePlayers.clear();
|
||||
break;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||
}
|
||||
}
|
||||
|
||||
public static void callAllBungeePlayers() {
|
||||
if (Bukkit.getOnlinePlayers().isEmpty()) {
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(T2C_Main.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
callAllBungeePlayers();
|
||||
}
|
||||
}, 20L);
|
||||
return;
|
||||
}
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream output = new DataOutputStream(stream);
|
||||
try {
|
||||
output.writeUTF(T2C_BngeePlayersEnum.GIVEALL.name());
|
||||
output.writeUTF(T2C_LibConfig.VALUES.serverUUID.getValue().toString());
|
||||
} catch (IOException e) {
|
||||
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||
}
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
player.sendPluginMessage(T2C_Main.getPlugin(), T2C_Util.getPluginChannel_ProxyOnlinePlayers(), stream.toByteArray());
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received channel: " + T2C_Util.getPluginChannel_ProxyOnlinePlayers());
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage send subChannel: " + T2C_BngeePlayersEnum.GIVEALL.name());
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage send output/uuid: " + T2C_LibConfig.VALUES.serverUUID.getValue().toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.commands;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_ProxyCommandSenderReceiver;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class T2C_Cmd {
|
||||
public static void console(String cmdInput) {
|
||||
Map.Entry<String,Integer> map = delay(cmdInput);
|
||||
int delay = map.getValue();
|
||||
String cmd = map.getKey();
|
||||
Bukkit.getScheduler().runTaskLater(T2C_Main.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (cmd.contains("!onBungee")) {
|
||||
T2C_ProxyCommandSenderReceiver.sendToBungee(null, cmd.replace("!onBungee", ""), true);
|
||||
} else Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd);
|
||||
}
|
||||
}, delay);
|
||||
}
|
||||
|
||||
public static void player(Player player, String cmdInput) {
|
||||
Map.Entry<String,Integer> map = delay(PlaceholderAPI.setPlaceholders(player, cmdInput));
|
||||
int delay = map.getValue();
|
||||
String cmd = map.getKey();
|
||||
Bukkit.getScheduler().runTaskLater(T2C_Main.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (cmd.contains("!asConsole")) {
|
||||
if (cmd.contains("!onBungee")) {
|
||||
T2C_ProxyCommandSenderReceiver.sendToBungee(player, cmd.replace("!asConsole", "").replace("!onBungee", ""), true);
|
||||
} else console(cmd.replace("!asConsole", ""));
|
||||
} else {
|
||||
if (cmd.contains("!onBungee")) {
|
||||
T2C_ProxyCommandSenderReceiver.sendToBungee(player, cmd.replace("!onBungee", ""), false);
|
||||
} else player.chat("/" + cmd);
|
||||
}
|
||||
}
|
||||
}, delay);
|
||||
}
|
||||
|
||||
private static Map.Entry<String, Integer> delay(@NotNull String cmdInput) {
|
||||
int delay = 0;
|
||||
String cmd;
|
||||
if (cmdInput.contains("!delay:")) {
|
||||
int i = cmdInput.indexOf("!delay:") + 7;
|
||||
String s2 = cmdInput.substring(i);
|
||||
int i2 = 1;
|
||||
if(s2.contains(" ")) {
|
||||
i2 = s2.indexOf(" ");
|
||||
}else{
|
||||
i2 = s2.length();
|
||||
}
|
||||
delay = Integer.parseInt(cmdInput.substring(i, i + i2));
|
||||
cmd = cmdInput.replace("!delay:" + delay, "");
|
||||
|
||||
} else cmd = cmdInput;
|
||||
|
||||
return Map.entry(cmd, delay);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class T2C_Tab {
|
||||
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, String perm, Boolean onlinePlayer) {
|
||||
if (args.length != arg + 1) return;
|
||||
for (Player player1 : Bukkit.getOnlinePlayers()) {
|
||||
if (passend(player1.getName(), args[arg]) && hasPermission(sender, perm)) {
|
||||
matches.add(player1.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int argEquals, String equalsValue, int arg, String[] args, String perm, Boolean onlinePlayer) {
|
||||
if (args.length != arg + 1) return;
|
||||
if (!args[argEquals].toLowerCase().equals(equalsValue)) return;
|
||||
for (Player player1 : Bukkit.getOnlinePlayers()) {
|
||||
if (passend(player1.getName(), args[arg]) && hasPermission(sender, perm)) {
|
||||
matches.add(player1.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, HashMap<String, String> permMap, Boolean onlinePlayer, String permForPlayer) {
|
||||
if (args.length != arg + 1) return;
|
||||
for (String command : permMap.keySet()) {
|
||||
if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||
matches.add(command);
|
||||
} else if (onlinePlayer != null && permForPlayer != null) {
|
||||
tab(matches, sender, arg, args, permForPlayer, onlinePlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, HashMap<String, String> permMap) {
|
||||
tab(matches, sender, arg, args, permMap, null, null);
|
||||
}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int argEquals, String equalsValue, int arg, String[] args, HashMap<String, String> permMap) {
|
||||
if (args.length != arg + 1) return;
|
||||
if (!args[argEquals].toLowerCase().equals(equalsValue)) return;
|
||||
for (String command : permMap.keySet()) {
|
||||
if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||
matches.add(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> tab(CommandSender sender, int arg, String[] args, String perm, String command) {
|
||||
List<String> matches = new ArrayList<>();
|
||||
if (hasPermission(sender, perm) && passend(command, args[arg])) {
|
||||
matches.add(command);
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
public static Boolean passend(String command, String arg) {
|
||||
for (int i = 0; i < arg.toUpperCase().length(); i++) {
|
||||
if (arg.toUpperCase().length() >= command.toUpperCase().length()) {
|
||||
return false;
|
||||
} else {
|
||||
if (arg.toUpperCase().charAt(i) != command.toUpperCase().charAt(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean hasPermission(CommandSender sender, String permission) {
|
||||
String[] Permissions = permission.split(";");
|
||||
for (String perm : Permissions) {
|
||||
if (sender.hasPermission(perm)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.debug;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class T2C_Debug {
|
||||
public static void debug(Plugin plugin, String msg) {
|
||||
debug(plugin, msg, null);
|
||||
}
|
||||
|
||||
public static void debug(Plugin plugin, String msg, Integer stage) {
|
||||
// if (!new File(Main.getPath(), "config.yml").exists()) return;
|
||||
if (stage == null) {
|
||||
if (plugin.getConfig().getBoolean("Plugin.Debug") || plugin.getConfig().getBoolean("plugin.debug") || plugin.getConfig().getBoolean("Debug") || plugin.getConfig().getBoolean("debug")){
|
||||
T2C_Send.info(plugin, "");
|
||||
Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (plugin.getConfig().getInt("Plugin.Debug") >= stage || plugin.getConfig().getInt("plugin.debug") >= stage || plugin.getConfig().getInt("Debug") >= stage || plugin.getConfig().getInt("debug") >= stage) {
|
||||
T2C_Send.info(plugin, "");
|
||||
Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void debugmsg(Plugin plugin, String msg) {
|
||||
T2C_Send.warning(plugin, "");
|
||||
Bukkit.getConsoleSender().sendMessage("§e[" + plugin.getDescription().getPrefix() + "] §5DEBUG-MSG: §6" + msg);
|
||||
}
|
||||
|
||||
public static String debugCode(){
|
||||
return UUID.randomUUID().toString().substring(0, 7);
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.dev;
|
||||
|
||||
public class T2C_DevelopmentTool {
|
||||
public static String removeLastChar(String s, int amount) {
|
||||
return (s == null || s.length() == 0)
|
||||
? null
|
||||
: (s.substring(0, s.length() - amount));
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.eco;
|
||||
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2C_PluginCheck;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class T2C_Eco {
|
||||
public static boolean moneyRemove(String prefix, Player player, Double price) {
|
||||
if (vault(prefix, player)) {
|
||||
return T2C_Main.getEco().withdrawPlayer(player, price).transactionSuccess();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean moneyAdd(String prefix, Player player, Double price) {
|
||||
if (vault(prefix, player)) {
|
||||
return T2C_Main.getEco().depositPlayer(player, price).transactionSuccess();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean vault(String prefix, Player player) {
|
||||
if (T2C_Main.getEco() == null) {
|
||||
if (Bukkit.getPluginManager().getPlugin("Vault") == null) {
|
||||
T2C_Send.console(prefix + " §e║ "+ "§4\n" + prefix + " §e║ " + "§4Vault could not be found! §9Please download it here: " +
|
||||
"§6https://www.spigotmc.org/resources/vault.34315/§4\n" + prefix + " §e║ ");
|
||||
}
|
||||
player.sendMessage(prefix + "\n" + T2CLibLanguages.VALUES.vaultNotSetUp.getValue().toString() + "\n" + prefix);
|
||||
return false;
|
||||
} else return true;
|
||||
}
|
||||
|
||||
public static boolean itemRemove(Player player, String item, int amount) {
|
||||
ItemStack itemStack = new ItemStack(Material.valueOf(item.toUpperCase()));
|
||||
boolean have = false;
|
||||
int anz = 0;
|
||||
for (int iam = 0; iam < player.getInventory().getSize(); iam++) {
|
||||
ItemStack itm = player.getInventory().getItem(iam);
|
||||
if (itm == null) continue;
|
||||
if (itm.getType() == itemStack.getType()) {
|
||||
anz = anz + itm.getAmount();
|
||||
}
|
||||
}
|
||||
if (anz >= amount) {
|
||||
player.getInventory().removeItem(new ItemStack(Material.valueOf(item), amount));
|
||||
have = true;
|
||||
}
|
||||
return have;
|
||||
}
|
||||
|
||||
public static boolean itemAdd(Player player, ItemStack itemStack, int amount) {
|
||||
for (int i = 0; i < amount; i++) {
|
||||
if (player.getInventory().firstEmpty() != -1) {
|
||||
player.getInventory().addItem(itemStack);
|
||||
} else {
|
||||
player.getLocation().getWorld().dropItem(player.getLocation(), itemStack);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean votePointsRemove(String prefix, Player player, Integer amount) {
|
||||
if (votePlugin(prefix, player)) {
|
||||
return VotingPluginMain.getPlugin().getVotingPluginUserManager().getVotingPluginUser(player).removePoints(amount);
|
||||
} else return false;
|
||||
}
|
||||
|
||||
public static boolean votePointsAdd(String prefix, Player player, Integer amount) {
|
||||
if (votePlugin(prefix, player)) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(T2C_Main.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
VotingPluginMain.getPlugin().getVotingPluginUserManager().getVotingPluginUser(player).addPoints(amount);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
private static boolean votePlugin(String prefix, Player player) {
|
||||
if (T2C_PluginCheck.votingPlugin()) return true;
|
||||
T2C_Send.console(prefix + " §e║ " + "§4\n" + prefix + " §e║ " + "§4VotingPlugin could not be found! §9Please download it here: " +
|
||||
"§6https://www.spigotmc.org/resources/votingplugin.15358/§4\n" + prefix + " §e║ ");
|
||||
player.sendMessage(prefix + "\n" + T2CLibLanguages.VALUES.votingPluginNotSetUp.getValue().toString() + "\n" + prefix);
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,130 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.items;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.profile.PlayerProfile;
|
||||
import org.bukkit.profile.PlayerTextures;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Base64;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class T2C_ItemBuilder {
|
||||
public static final boolean getLegacy = T2C_McVersion.isMc1_8() || T2C_McVersion.isMc1_9() || T2C_McVersion.isMc1_10() || T2C_McVersion.isMc1_11() || T2C_McVersion.isMc1_12();
|
||||
|
||||
public static void fillItem(boolean enable, String item, Integer lines, Inventory inventory) {
|
||||
if (!enable) return;
|
||||
fillItem(item, lines, inventory);
|
||||
}
|
||||
|
||||
public static void fillItem(String item, Integer lines, Inventory inventory) {
|
||||
try {
|
||||
ItemStack glass;
|
||||
if (getLegacy) {
|
||||
glass = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, Short.parseShort(item));
|
||||
} else glass = new ItemStack(Material.valueOf(item.toUpperCase().replace(".", "_")));
|
||||
ItemMeta itemMetaglass = glass.getItemMeta();
|
||||
assert itemMetaglass != null;
|
||||
itemMetaglass.setDisplayName(" ");
|
||||
glass.setItemMeta(itemMetaglass);
|
||||
glass.setAmount(1);
|
||||
for (int i = 0; i < 9 * lines; i++) {
|
||||
inventory.setItem(i, glass);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack itemStack(Material material, Integer amount, String displayName, List<String> lore) {
|
||||
ItemStack itemStack = new ItemStack(material);
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
|
||||
itemMeta.setDisplayName(displayName);
|
||||
itemMeta.setLore(lore);
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
|
||||
itemStack.setAmount(amount);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public static void setItem(Integer slot, Integer amount, String material, String displayName, List<String> lore, Inventory inventory) {
|
||||
ItemStack item;
|
||||
if (getLegacy && material.contains(",")) {
|
||||
String[] split = material.split(",");
|
||||
item = new ItemStack(Material.valueOf(split[0]), 1, Short.parseShort(split[1]));
|
||||
} else item = new ItemStack(Material.valueOf(material));
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
itemMeta.setDisplayName(displayName);
|
||||
itemMeta.setLore(lore);
|
||||
item.setItemMeta(itemMeta);
|
||||
item.setAmount(amount);
|
||||
inventory.setItem(slot, item);
|
||||
}
|
||||
|
||||
public static ItemStack base64(String base64Value) {
|
||||
if (!T2C_McVersion.minMc1_20() || T2C_McVersion.isNms1_20_R1()|| T2C_McVersion.isNms1_20_R2()|| T2C_McVersion.isNms1_20_R3()) {
|
||||
return base64Old(base64Value);
|
||||
} else return base64New(base64Value);
|
||||
}
|
||||
|
||||
private static ItemStack base64Old(String base64Value) {
|
||||
ItemStack itemStack = new ItemStack(T2C_ItemVersion.getHead());
|
||||
SkullMeta itemMeta = (SkullMeta) itemStack.getItemMeta();
|
||||
|
||||
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
|
||||
profile.getProperties().put("textures", new Property("textures", base64Value));
|
||||
Field profileField;
|
||||
try {
|
||||
profileField = itemMeta.getClass().getDeclaredField("profile");
|
||||
profileField.setAccessible(true);
|
||||
profileField.set(itemMeta, profile);
|
||||
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
|
||||
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||
}
|
||||
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
private static ItemStack base64New(String base64Value) {
|
||||
ItemStack itemStack = new ItemStack(T2C_ItemVersion.getHead());
|
||||
SkullMeta itemMeta = (SkullMeta) itemStack.getItemMeta();
|
||||
|
||||
PlayerProfile profile = Bukkit.createPlayerProfile(UUID.randomUUID());
|
||||
PlayerTextures textures = profile.getTextures();
|
||||
try {
|
||||
textures.setSkin(new URL(base64Convert(base64Value)));
|
||||
} catch (MalformedURLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
profile.setTextures(textures);
|
||||
itemMeta.setOwnerProfile(profile);
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
private static String base64Convert(String base64Value) {
|
||||
String jsonString = new String(Base64.getDecoder().decode(base64Value));
|
||||
JSONObject obj = new JSONObject(jsonString);
|
||||
String output = obj.getJSONObject("textures").getJSONObject("SKIN").getString("url");
|
||||
if (output.startsWith("http://textures.minecraft.net/texture/")){
|
||||
return output;
|
||||
} else return "http://textures.minecraft.net/texture/d5d20330da59c207d78352838e91a48ea1e42b45a9893226144b251fe9b9d535";
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.items;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class T2C_ItemVersion {
|
||||
@Getter
|
||||
private static Material Head;
|
||||
@Getter
|
||||
private static ItemStack HeadIS;
|
||||
@Getter
|
||||
private static ItemStack CraftingTable;
|
||||
@Getter
|
||||
private static ItemStack YellowWool;
|
||||
@Getter
|
||||
private static ItemStack OrangeWool;
|
||||
@Getter
|
||||
private static ItemStack GreenWool;
|
||||
@Getter
|
||||
private static ItemStack GrayWool;
|
||||
@Getter
|
||||
private static ItemStack RedWool;
|
||||
@Getter
|
||||
private static ItemStack RedStainedGlassPane;
|
||||
@Getter
|
||||
private static ItemStack BlackStainedGlassPane;
|
||||
|
||||
public static void scan() {
|
||||
if (T2C_McVersion.isMc1_8() || T2C_McVersion.isMc1_9() || T2C_McVersion.isMc1_10() || T2C_McVersion.isMc1_11() || T2C_McVersion.isMc1_12()) {
|
||||
Head = Material.valueOf("SKULL_ITEM");
|
||||
YellowWool = new ItemStack(Material.valueOf("WOOL"), 1, (short) 4);
|
||||
OrangeWool = new ItemStack(Material.valueOf("WOOL"), 1, (short) 1);
|
||||
GreenWool = new ItemStack(Material.valueOf("WOOL"), 1, (short) 5);
|
||||
GrayWool = new ItemStack(Material.valueOf("WOOL"), 1, (short) 8);
|
||||
RedWool = new ItemStack(Material.valueOf("WOOL"), 1, (short) 14);
|
||||
RedStainedGlassPane = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, (short) 14);
|
||||
BlackStainedGlassPane = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, (short) 15);
|
||||
CraftingTable = new ItemStack(Material.valueOf("WORKBENCH"));
|
||||
} else {
|
||||
Head = Material.valueOf("PLAYER_HEAD");
|
||||
CraftingTable = new ItemStack(Material.CRAFTING_TABLE);
|
||||
YellowWool = new ItemStack(Material.YELLOW_WOOL);
|
||||
OrangeWool = new ItemStack(Material.ORANGE_WOOL);
|
||||
GreenWool = new ItemStack(Material.GREEN_WOOL);
|
||||
GrayWool = new ItemStack(Material.GRAY_WOOL);
|
||||
RedWool = new ItemStack(Material.RED_WOOL);
|
||||
RedStainedGlassPane = new ItemStack(Material.RED_STAINED_GLASS_PANE);
|
||||
BlackStainedGlassPane = new ItemStack(Material.BLACK_STAINED_GLASS_PANE);
|
||||
}
|
||||
HeadIS = new ItemStack(Head, 1, (byte) 3);
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class T2C_MiniMessage {
|
||||
private static final BukkitAudiences bukkitAudiences = T2C_Main.getPlugin().getAdventure();
|
||||
|
||||
public static void sendSenderMiniMessage(String msg, CommandSender sender) {
|
||||
String string = "";
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
string = T2C_Replace.replace("",player,msg);
|
||||
} else string = msg;
|
||||
bukkitAudiences.sender(sender).sendMessage(replace(string));
|
||||
}
|
||||
|
||||
public static void sendConsoleMiniMessage(String msg) {
|
||||
bukkitAudiences.console().sendMessage(replace(msg));
|
||||
}
|
||||
|
||||
public static void sendPlayerMiniMessage(String msg, Player player) {
|
||||
bukkitAudiences.player(player).sendMessage(replace(T2C_Replace.replace("", player, msg)));
|
||||
}
|
||||
|
||||
protected static Component replace(String text) {
|
||||
return MiniMessage.miniMessage().deserialize(T2C_Replace.convertColorCode(text));
|
||||
}
|
||||
|
||||
|
||||
public static String removeMiniMessageCodes(String text){
|
||||
return MiniMessage.miniMessage().stripTags(text);
|
||||
}
|
||||
}
|
@ -0,0 +1,230 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2C_PluginCheck;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class T2C_Replace {
|
||||
|
||||
public static String replace(String prefix, String Text) {
|
||||
|
||||
return replaceLegacyColor(Text).replace("[prefix]", prefix).replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n");
|
||||
}
|
||||
|
||||
public static String replace(String prefix, Player player, String Text) {
|
||||
String input = Text.replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n");
|
||||
if (T2C_PluginCheck.papi()) {
|
||||
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, input));
|
||||
} else {
|
||||
return replaceLegacyColor(input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Object replaceObject(String prefix, Object object) {
|
||||
if (object instanceof String) {
|
||||
object = replaceLegacyColor((String) object).replace("[prefix]", prefix).replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n");
|
||||
}
|
||||
|
||||
if ((object instanceof List) || (object instanceof ArrayList)) {
|
||||
List<String> in = (List<String>) object;
|
||||
List<String> output = new ArrayList<>();
|
||||
for (String input : in) {
|
||||
output.add(replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n"));
|
||||
}
|
||||
object = output;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
public static Object replaceObject(String prefix, Player player, Object object) {
|
||||
if (object instanceof String) {
|
||||
|
||||
if (T2C_PluginCheck.papi()) {
|
||||
object = PlaceholderAPI.setPlaceholders(player, replaceLegacyColor((String) object).replace("[prefix]", prefix).replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n"));
|
||||
} else {
|
||||
object = replaceLegacyColor((String) object).replace("[prefix]", prefix).replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n");
|
||||
}
|
||||
|
||||
}
|
||||
if (object instanceof List) {
|
||||
List<String> in = (List<String>) object;
|
||||
List<String> output = new ArrayList<>();
|
||||
for (String input : in) {
|
||||
if (T2C_PluginCheck.papi()) {
|
||||
output.add(PlaceholderAPI.setPlaceholders(player, replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n")));
|
||||
} else {
|
||||
output.add(replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n"));
|
||||
}
|
||||
}
|
||||
object = output;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
public static List<String> replace(String prefix, List<String> Text) {
|
||||
List<String> output = new ArrayList<>();
|
||||
for (String input : Text) {
|
||||
output.add(replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n"));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public static List<String> replace(String prefix, Player player, List<String> Text) {
|
||||
List<String> output = new ArrayList<>();
|
||||
if (player == null) {
|
||||
return Collections.singletonList("player is null");
|
||||
}
|
||||
if (Text == null) {
|
||||
return Collections.singletonList("Text is null");
|
||||
}
|
||||
for (String input : Text) {
|
||||
if (T2C_PluginCheck.papi()) {
|
||||
output.add(PlaceholderAPI.setPlaceholders(player, replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n")));
|
||||
} else {
|
||||
output.add(replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n"));
|
||||
}
|
||||
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public static List<String> replacePrice(String prefix, List<String> Text, String price) {
|
||||
List<String> rp = new ArrayList<>();
|
||||
for (String s : Text) {
|
||||
rp.add(replaceLegacyColor(s).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n").replace("[price]", String.valueOf(price)));
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public static String removeColorCode(String value) {
|
||||
return value.replace("&0", "").replace("&1", "").replace("&2", "").replace("&3", "")
|
||||
.replace("&4", "").replace("&5", "").replace("&6", "").replace("&7", "")
|
||||
.replace("&8", "").replace("&9", "").replace("&a", "").replace("&b", "")
|
||||
.replace("&c", "").replace("&d", "").replace("&e", "").replace("&f", "")
|
||||
.replace("&k", "").replace("&l", "").replace("&m", "").replace("&n", "")
|
||||
.replace("&o", "").replace("&r", "");
|
||||
}
|
||||
|
||||
public static List<String> replacePrice(String prefix, Player player, List<String> Text, String price) {
|
||||
List<String> rp = new ArrayList<>();
|
||||
for (String s : Text) {
|
||||
String input = s.replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n")
|
||||
.replace("[price]", String.valueOf(price));
|
||||
if (T2C_PluginCheck.papi()) {
|
||||
rp.add(replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, input)));
|
||||
} else {
|
||||
rp.add(replaceLegacyColor(input));
|
||||
}
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public static String replacePrice(String prefix, String Text, String price) {
|
||||
return replaceLegacyColor(Text).replace("[prefix]", prefix)
|
||||
.replace("&o", "§o").replace("&r", "§r").replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[price]", String.valueOf(price))
|
||||
.replace("[nl]", "\n");
|
||||
}
|
||||
|
||||
public static String replacePrice(String prefix, Player player, String Text, String price) {
|
||||
String input = Text.replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[price]", String.valueOf(price)).replace("[nl]", "\n");
|
||||
if (T2C_PluginCheck.papi()) {
|
||||
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, input));
|
||||
} else {
|
||||
return replaceLegacyColor(input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String replaceLegacyColor(String text) {
|
||||
return text.replace("&0", "§0").replace("&1", "§1").replace("&2", "§2").replace("&3", "§3")
|
||||
.replace("&4", "§4").replace("&5", "§5").replace("&6", "§6").replace("&7", "§7")
|
||||
.replace("&8", "§8").replace("&9", "§9").replace("&a", "§a").replace("&b", "§b")
|
||||
.replace("&c", "§c").replace("&d", "§d").replace("&e", "§e").replace("&f", "§f")
|
||||
.replace("&k", "§k").replace("&l", "§l").replace("&m", "§m").replace("&n", "§n")
|
||||
.replace("&o", "§o").replace("&r", "§r");
|
||||
}
|
||||
|
||||
public static String convertColorCode(String text) {
|
||||
return text.replace("&0", "<black>").replace("§0", "<black>")
|
||||
.replace("&1", "<dark_blue>").replace("§1", "<dark_blue>")
|
||||
.replace("&2", "<dark_green>").replace("§2", "<dark_green>")
|
||||
.replace("&3", "<dark_aqua>").replace("§3", "<dark_aqua>")
|
||||
.replace("&4", "<dark_red>").replace("§4", "<dark_red>")
|
||||
.replace("&5", "<dark_purple>").replace("§5", "<dark_purple>")
|
||||
.replace("&6", "<gold>").replace("§6", "<gold>")
|
||||
.replace("&7", "<gray>").replace("§7", "<gray>")
|
||||
.replace("&8", "<dark_gray>").replace("§8", "<dark_gray>")
|
||||
.replace("&9", "<blue>").replace("§9", "<blue>")
|
||||
.replace("&a", "<green>").replace("§a", "<green>")
|
||||
.replace("&b", "<aqua>").replace("§b", "<aqua>")
|
||||
.replace("&c", "<red>").replace("§c", "<red>")
|
||||
.replace("&d", "<light_purple>").replace("§d", "<light_purple>")
|
||||
.replace("&e", "<yellow>").replace("§e", "<yellow>")
|
||||
.replace("&f", "<white>").replace("§f", "<white>")
|
||||
.replace("&k", "<obfuscated>").replace("§k", "<obfuscated>")
|
||||
.replace("&l", "<bold>").replace("§l", "<bold>")
|
||||
.replace("&m", "<strikethrough>").replace("§m", "<strikethrough>")
|
||||
.replace("&n", "<underlined>").replace("§n", "<underlined>")
|
||||
.replace("&o", "<italic>").replace("§o", "<italic>")
|
||||
.replace("&r", "<reset>").replace("§r", "<reset>");
|
||||
}
|
||||
|
||||
public static Object replace(Object object, String placeholder, String replacement) {
|
||||
if (object instanceof String) {
|
||||
object = ((String) object).replace(placeholder, replacement);
|
||||
}
|
||||
if ((object instanceof List) || (object instanceof ArrayList)) {
|
||||
List<String> in = (List<String>) object;
|
||||
List<String> output = new ArrayList<>();
|
||||
for (String input : in) {
|
||||
output.add(input.replace(placeholder, replacement));
|
||||
}
|
||||
object = output;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
}
|
@ -0,0 +1,141 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
||||
import net.t2code.t2codelib.util.T2C_GenerateFrame;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class T2C_Send {
|
||||
|
||||
public static void sendStartTextCenter(String prefix, String text, boolean isReload) {
|
||||
if (isReload) {
|
||||
console(prefix + " " + text);
|
||||
return;
|
||||
}
|
||||
console(T2C_GenerateFrame.setCenterAligned(prefix, text));
|
||||
}
|
||||
|
||||
public static void sendStartTextLeft(String prefix, String text, boolean isReload) {
|
||||
if (isReload) {
|
||||
console(prefix + " " + text);
|
||||
return;
|
||||
}
|
||||
console(T2C_GenerateFrame.setLeftAligned(prefix, text));
|
||||
}
|
||||
|
||||
public static String getFrameCenter(String prefix, boolean console, String... lines) {
|
||||
return T2C_GenerateFrame.getFrameCenter(prefix, console, lines);
|
||||
}
|
||||
|
||||
public static String getFrameLeft(String prefix, boolean console, String... lines) {
|
||||
return T2C_GenerateFrame.getFrameLeft(prefix, console, lines);
|
||||
}
|
||||
|
||||
public static void sendException(Exception e, Logger logger) {
|
||||
logger.log(Level.SEVERE, "Interrupted exception occurred", e);
|
||||
}
|
||||
|
||||
public static void console(String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2C_MiniMessage.sendConsoleMiniMessage(msg);
|
||||
}
|
||||
|
||||
public static void player(Player player, String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2C_MiniMessage.sendPlayerMiniMessage(msg, player);
|
||||
}
|
||||
|
||||
public static void sender(CommandSender sender, String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2C_MiniMessage.sendSenderMiniMessage(msg, sender);
|
||||
}
|
||||
|
||||
public static void console(Object object) {
|
||||
for (String msg : list(object)) {
|
||||
if (msg == null || msg.contains("[empty]")) continue;
|
||||
T2C_MiniMessage.sendConsoleMiniMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void player(Player player, Object object) {
|
||||
for (String msg : list(object)) {
|
||||
if (msg == null || msg.contains("[empty]")) continue;
|
||||
T2C_MiniMessage.sendPlayerMiniMessage(msg, player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void sender(CommandSender sender, Object object) {
|
||||
for (String msg : list(object)) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2C_MiniMessage.sendSenderMiniMessage(msg, sender);
|
||||
}
|
||||
}
|
||||
|
||||
public static void title(Player player, @Nullable String title, @Nullable String subtitle) {
|
||||
player.sendTitle(title, subtitle);
|
||||
}
|
||||
|
||||
public static void title(Player player, @Nullable String title, @Nullable String subtitle, int fadeIn, int stay, int fadeOut) {
|
||||
player.sendTitle(title, subtitle, fadeIn, stay, fadeOut);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated This method will be removed soon, as the debug messages have been moved to a separate class.
|
||||
* Please use the new method {@link T2C_Debug#debug(Plugin, String)} or {@link T2C_Debug#debug(Plugin, String, Integer)}
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void debug(Plugin plugin, String msg) {
|
||||
debug(plugin, msg, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated This method will be removed soon, as the debug messages have been moved to a separate class.
|
||||
* Please use the new method {@link T2C_Debug#debug(Plugin, String)} or {@link T2C_Debug#debug(Plugin, String, Integer)}
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void debug(Plugin plugin, String msg, Integer stage) {
|
||||
// if (!new File(Main.getPath(), "config.yml").exists()) return;
|
||||
T2C_Debug.debug(plugin, msg, stage);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated This method will be removed soon, as the debug messages have been moved to a separate class.
|
||||
* Please use the new method {@link T2C_Debug#debugmsg(Plugin, String)}
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void debugmsg(Plugin plugin, String msg) {
|
||||
T2C_Debug.debugmsg(plugin, msg);
|
||||
}
|
||||
|
||||
public static void info(Plugin plugin, String msg) {
|
||||
plugin.getLogger().log(Level.INFO, msg);
|
||||
}
|
||||
|
||||
public static void warning(Plugin plugin, String msg) {
|
||||
plugin.getLogger().log(Level.WARNING, msg);
|
||||
}
|
||||
|
||||
public static void error(Plugin plugin, String msg) {
|
||||
plugin.getLogger().log(Level.SEVERE, msg);
|
||||
}
|
||||
|
||||
private static ArrayList<String> list(Object object) {
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
|
||||
if (object instanceof List) {
|
||||
list = (ArrayList<String>) object;
|
||||
}
|
||||
if (object instanceof String) {
|
||||
list.add((String) object);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
|
||||
import net.t2code.t2codelib.util.T2C_GenerateFrame;
|
||||
import net.t2code.t2codelib.util.T2C_UpdateWebData;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class T2C_Template {
|
||||
|
||||
|
||||
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord) {
|
||||
return onLoadHeader(prefix, autor, version, spigot, discord, null, null);
|
||||
}
|
||||
|
||||
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord, Boolean isPremium, Boolean isVerify) {
|
||||
Long long_ = System.currentTimeMillis();
|
||||
|
||||
for (String s : T2C_Util.getLoadLogo()) {
|
||||
T2C_Send.console(prefix + " "+ T2C_GenerateFrame.getCOLOR_CODE() + s);
|
||||
}
|
||||
T2C_Send.sendStartTextCenter(prefix, "§2Author §6" + String.valueOf(autor).replace("[", "").replace("]", ""), false);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§2Version: §6" + version, false);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§2Spigot: §6" + spigot, false);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§2Discord: §6" + discord, false);
|
||||
if (isPremium != null) {
|
||||
if (isPremium) {
|
||||
T2C_Send.sendStartTextCenter(prefix, "§6Premium: §2true", false);
|
||||
} else T2C_Send.sendStartTextCenter(prefix, "§6Premium: §4false", false);
|
||||
if (isVerify != null) {
|
||||
if (isVerify) {
|
||||
T2C_Send.sendStartTextCenter(prefix, "§6Verify: §2true", false);
|
||||
} else T2C_Send.sendStartTextCenter(prefix, "§6Verify: §4false", false);
|
||||
} else T2C_Send.sendStartTextCenter(prefix, "§6Verify: §4false", false);
|
||||
}
|
||||
|
||||
onLoadSeparateStroke(prefix);
|
||||
if (version.toLowerCase().contains("dev") || version.toLowerCase().contains("snapshot") || version.toLowerCase().contains("beta")) {
|
||||
T2C_Send.sendStartTextCenter(prefix, "", false);
|
||||
T2C_Send.sendStartTextCenter(prefix, "", false);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§eYou are running §4" + version + " §eof §4" + prefix + "§e!", false);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§eSome features may not be working as expected.", false);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§ePlease report all bugs here: http://dc.t2code.net", false);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§4UpdateChecker & bStats may be disabled!", false);
|
||||
T2C_Send.sendStartTextCenter(prefix, "", false);
|
||||
T2C_Send.sendStartTextCenter(prefix, "", false);
|
||||
onLoadSeparateStroke(prefix);
|
||||
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return long_;
|
||||
}
|
||||
|
||||
public static void onLoadSeparateStroke(String prefix) {
|
||||
T2C_Send.console(prefix + " " + T2C_GenerateFrame.getCOLOR_CODE() + T2C_GenerateFrame.getSTROKE());
|
||||
}
|
||||
|
||||
public static void onLoadFooter(String prefix, Long long_) {
|
||||
onLoadSeparateStroke(prefix);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||
T2C_Send.console(prefix + " " + T2C_GenerateFrame.getCOLOR_CODE() + T2C_GenerateFrame.getBOTTOM_BORDER());
|
||||
}
|
||||
|
||||
public static void onDisable(String prefix, Plugin plugin) {
|
||||
T2C_Send.console(T2C_Send.getFrameCenter(prefix, true, " §2Version: §6" + plugin.getDescription().getVersion(), "§2Autors: §6" + String.valueOf(plugin.getDescription().getAuthors())
|
||||
.replace("[", "").replace("]", ""), " §4Plugin successfully disabled. "));
|
||||
}
|
||||
|
||||
public static void sendInfo(CommandSender sender, Plugin plugin, int spigotID, String discord, Boolean premiumVerified, String text) {
|
||||
String pluginVersion = plugin.getDescription().getVersion();
|
||||
String publicVersion = "";
|
||||
boolean update;
|
||||
String stNVersion;
|
||||
T2C_UpdateWebData webData;
|
||||
try {
|
||||
webData = T2C_UpdateAPI.pluginVersions.get(plugin.getName()).webData;
|
||||
} catch (Exception ex) {
|
||||
webData = null;
|
||||
}
|
||||
|
||||
if (webData != null) {
|
||||
publicVersion = T2C_UpdateAPI.pluginVersions.get(plugin.getName()).webData.getVersion();
|
||||
update = !publicVersion.equalsIgnoreCase(pluginVersion);
|
||||
|
||||
} else {
|
||||
update = false;
|
||||
}
|
||||
|
||||
boolean player = sender instanceof Player;
|
||||
String stPlugin = "<dark_red>║</dark_red> <yellow>Plugin:</yellow> <gold>[pl]</gold>".replace("[pl]", plugin.getName());
|
||||
String stVersion = "<dark_red>║</dark_red> <yellow>Version:</yellow> <gold>[ver]</gold>".replace("[ver]", pluginVersion);
|
||||
String stAutor = "<dark_red>║</dark_red> <yellow>Autor(s):</yellow> <gold>[autor]</gold>".replace("[autor]", plugin.getDescription().getAuthors().toString());
|
||||
|
||||
String stUpdate = "<dark_red>║</dark_red> <yellow>New version available:</yellow> [up]".replace("[up]", webData != null ? update ?
|
||||
"<dark_green>YES</dark_green>" : "<red>no</red>" : "<b><dark_red>It could not be checked for updates!</dark_red></b>");
|
||||
stNVersion = update ? "<br><dark_red>║</dark_red> <yellow>Newest Version:</yellow> <gold>[newVersion]</gold>".replace("[newVersion]", player ? "<hover:show_text:'<yellow>Click for the update information</yellow>'><click:run_command:'/t2code updateinfo " + plugin.getName() + "'>" + publicVersion + "</click></hover>" : publicVersion) : "";
|
||||
String stLink = getString(spigotID, discord, player);
|
||||
String pr = premiumVerified != null ? "<br><dark_red>║</dark_red> <yellow>Premium verified:</yellow> [pr]".replace("[pr]",
|
||||
premiumVerified ? "<dark_green>YES</dark_green>" : "<red>NO</red>") : "";
|
||||
|
||||
String stMSG = text == null || text.isEmpty() ? "" : "<br><dark_red>║</dark_red> " + text;
|
||||
T2C_Send.sender(sender, "<br><dark_red>╔════════════════════════════════</dark_red>"
|
||||
+ "<br>" + stPlugin
|
||||
+ "<br>" + stVersion
|
||||
+ stMSG
|
||||
+ "<br>" + stAutor
|
||||
+ "<br>" + stUpdate
|
||||
+ stNVersion
|
||||
+ "<br>" + stLink
|
||||
+ pr
|
||||
+ "<br><dark_red>╚════════════════════════════════</dark_red>");
|
||||
}
|
||||
|
||||
private static @NotNull String getString(int spigotID, String discord, boolean player) {
|
||||
String stLinkPlayer = "<dark_red>║</dark_red> <yellow><hover:show_text:'<green>Go to the Spigot page</green>'><click:open_url:'[slink]'>Spigot</click></hover></yellow> "
|
||||
.replace("[slink]", "https://www.spigotmc.org/resources/" + spigotID)
|
||||
+ "<dark_red>-</dark_red> <dark_purple><hover:show_text:'<green>Go to the T2Code Support Discord</green>'><click:open_url:'[dlink]'>Discord</click></hover></dark_purple>"
|
||||
.replace("[dlink]", discord);
|
||||
String stLinkConsole = "<dark_red>║</dark_red> <yellow>Spigot:</yellow> <gold>https://www.spigotmc.org/resources/" + spigotID + "</gold>"
|
||||
+ "<br><dark_red>║</dark_red> <yellow>Discord:</yellow> <gold>" + discord + "</gold>";
|
||||
return player ? stLinkPlayer : stLinkConsole;
|
||||
}
|
||||
|
||||
public static void sendInfo(CommandSender sender, Plugin plugin, int spigotID, String discord, String text) {
|
||||
sendInfo(sender, plugin, spigotID, discord, null, text);
|
||||
}
|
||||
}
|
@ -1,33 +1,34 @@
|
||||
package net.t2code.lib.Spigot.Lib.messages;
|
||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
||||
public class TextBuilder {
|
||||
public class T2C_TextBuilder {
|
||||
|
||||
private final String text;
|
||||
private String hover;
|
||||
private String click;
|
||||
private ClickEvent.Action action;
|
||||
|
||||
public TextBuilder(String text) {
|
||||
public T2C_TextBuilder(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public TextBuilder addHover(String hover) {
|
||||
public T2C_TextBuilder addHover(String hover) {
|
||||
this.hover = hover;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TextBuilder addClickEvent(ClickEvent.Action clickEventAction, String value) {
|
||||
public T2C_TextBuilder addClickEvent(ClickEvent.Action clickEventAction, String value) {
|
||||
this.action = clickEventAction;
|
||||
this.click = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TextComponent build() {
|
||||
if (this.text.contains("[empty]")) return null;
|
||||
TextComponent textComponent = new TextComponent();
|
||||
textComponent.setText(this.text);
|
||||
if (this.hover != null) {
|
@ -0,0 +1,345 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.minecraftVersion;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
|
||||
public class T2C_McVersion {
|
||||
|
||||
|
||||
public static void onCheck() {
|
||||
mcVersion = Bukkit.getServer().getVersion();
|
||||
bukkitVersion = Bukkit.getServer().getBukkitVersion();
|
||||
T2C_NmsVersions.init();
|
||||
nms = String.valueOf(T2C_NmsVersions.getT2CnmsEnum());
|
||||
// T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), "mcVersion: " + mcVersion);
|
||||
// T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), "bukkitVersion: " + bukkitVersion);
|
||||
// T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), "nms: " + nms);
|
||||
|
||||
mc1_8 = mcVersion.contains("MC: 1.8");
|
||||
mc1_9 = mcVersion.contains("MC: 1.9");
|
||||
mc1_10 = mcVersion.contains("MC: 1.10");
|
||||
mc1_11 = mcVersion.contains("MC: 1.11");
|
||||
mc1_12 = mcVersion.contains("MC: 1.12");
|
||||
mc1_13 = mcVersion.contains("MC: 1.13");
|
||||
mc1_14 = mcVersion.contains("MC: 1.14");
|
||||
mc1_15 = mcVersion.contains("MC: 1.15");
|
||||
mc1_16 = mcVersion.contains("MC: 1.16");
|
||||
mc1_17 = mcVersion.contains("MC: 1.17");
|
||||
mc1_18 = mcVersion.contains("MC: 1.18");
|
||||
mc1_19 = mcVersion.contains("MC: 1.19");
|
||||
mc1_20 = mcVersion.contains("MC: 1.20");
|
||||
mc1_21 = mcVersion.contains("MC: 1.21");
|
||||
mc1_22 = mcVersion.contains("MC: 1.22");
|
||||
|
||||
nms1_8_R1 = nms.contains("1_8_R1");
|
||||
nms1_8_R2 = nms.contains("1_8_R2");
|
||||
nms1_8_R3 = nms.contains("1_8_R3");
|
||||
nms1_9_R1 = nms.contains("1_9_R1");
|
||||
nms1_9_R2 = nms.contains("1_9_R2");
|
||||
nms1_10_R1 = nms.contains("1_10_R1");
|
||||
nms1_11_R1 = nms.contains("1_11_R1");
|
||||
nms1_12_R1 = nms.contains("1_12_R1");
|
||||
nms1_13_R1 = nms.contains("1_13_R1");
|
||||
nms1_13_R2 = nms.contains("1_13_R2");
|
||||
nms1_14_R1 = nms.contains("1_14_R1");
|
||||
nms1_15_R1 = nms.contains("1_15_R1");
|
||||
nms1_16_R1 = nms.contains("1_16_R1");
|
||||
nms1_16_R2 = nms.contains("1_16_R2");
|
||||
nms1_16_R3 = nms.contains("1_16_R3");
|
||||
nms1_17_R1 = nms.contains("1_17_R1");
|
||||
nms1_18_R1 = nms.contains("1_18_R1");
|
||||
nms1_18_R2 = nms.contains("1_18_R2");
|
||||
nms1_19_R1 = nms.contains("1_19_R1");
|
||||
nms1_19_R2 = nms.contains("1_19_R2");
|
||||
nms1_20_R1 = nms.contains("1_20_R1");
|
||||
nms1_20_R2 = nms.contains("1_20_R2");
|
||||
nms1_20_R3 = nms.contains("1_20_R3");
|
||||
nms1_20_R4 = nms.contains("1_20_R4");
|
||||
nms1_21_R1 = nms.contains("1_21_R1");
|
||||
nms1_21_R2 = nms.contains("1_21_R2");
|
||||
nms1_22_R1 = nms.contains("1_22_R1");
|
||||
}
|
||||
|
||||
private static String mcVersion;
|
||||
private static String bukkitVersion;
|
||||
private static boolean mc1_8;
|
||||
private static boolean mc1_9;
|
||||
private static boolean mc1_10;
|
||||
private static boolean mc1_11;
|
||||
private static boolean mc1_12;
|
||||
private static boolean mc1_13;
|
||||
private static boolean mc1_14;
|
||||
private static boolean mc1_15;
|
||||
private static boolean mc1_16;
|
||||
private static boolean mc1_17;
|
||||
private static boolean mc1_18;
|
||||
private static boolean mc1_19;
|
||||
private static boolean mc1_20;
|
||||
private static boolean mc1_21;
|
||||
private static boolean mc1_22;
|
||||
|
||||
private static String nms;
|
||||
private static boolean nms1_8_R1;
|
||||
private static boolean nms1_8_R2;
|
||||
private static boolean nms1_8_R3;
|
||||
private static boolean nms1_9_R1;
|
||||
private static boolean nms1_9_R2;
|
||||
private static boolean nms1_10_R1;
|
||||
private static boolean nms1_11_R1;
|
||||
private static boolean nms1_12_R1;
|
||||
private static boolean nms1_13_R1;
|
||||
private static boolean nms1_13_R2;
|
||||
private static boolean nms1_14_R1;
|
||||
private static boolean nms1_15_R1;
|
||||
private static boolean nms1_16_R1;
|
||||
private static boolean nms1_16_R2;
|
||||
private static boolean nms1_16_R3;
|
||||
private static boolean nms1_17_R1;
|
||||
private static boolean nms1_18_R1;
|
||||
private static boolean nms1_18_R2;
|
||||
private static boolean nms1_19_R1;
|
||||
private static boolean nms1_19_R2;
|
||||
private static boolean nms1_20_R1;
|
||||
private static boolean nms1_20_R2;
|
||||
private static boolean nms1_20_R3;
|
||||
private static boolean nms1_20_R4;
|
||||
private static boolean nms1_21_R1;
|
||||
private static boolean nms1_21_R2;
|
||||
private static boolean nms1_22_R1;
|
||||
|
||||
public static String getMcVersion() {
|
||||
return mcVersion;
|
||||
}
|
||||
|
||||
public static String getBukkitVersion() {
|
||||
return bukkitVersion;
|
||||
}
|
||||
|
||||
public static boolean isMc1_8() {
|
||||
return mc1_8;
|
||||
}
|
||||
|
||||
public static boolean isMc1_9() {
|
||||
return mc1_9;
|
||||
}
|
||||
|
||||
public static boolean isMc1_10() {
|
||||
return mc1_10;
|
||||
}
|
||||
|
||||
public static boolean isMc1_11() {
|
||||
return mc1_11;
|
||||
}
|
||||
|
||||
public static boolean isMc1_12() {
|
||||
return mc1_12;
|
||||
}
|
||||
|
||||
public static boolean isMc1_13() {
|
||||
return mc1_13;
|
||||
}
|
||||
|
||||
public static boolean isMc1_14() {
|
||||
return mc1_14;
|
||||
}
|
||||
|
||||
public static boolean isMc1_15() {
|
||||
return mc1_15;
|
||||
}
|
||||
|
||||
public static boolean isMc1_16() {
|
||||
return mc1_16;
|
||||
}
|
||||
|
||||
public static boolean isMc1_17() {
|
||||
return mc1_17;
|
||||
}
|
||||
|
||||
public static boolean isMc1_18() {
|
||||
return mc1_18;
|
||||
}
|
||||
|
||||
public static boolean isMc1_19() {
|
||||
return mc1_19;
|
||||
}
|
||||
|
||||
public static boolean isMc1_20() {
|
||||
return mc1_20;
|
||||
}
|
||||
|
||||
public static boolean isMc1_21() {
|
||||
return mc1_21;
|
||||
}
|
||||
|
||||
public static boolean isMc1_22() {
|
||||
return mc1_22;
|
||||
}
|
||||
|
||||
public static String getNms() {
|
||||
return nms;
|
||||
}
|
||||
|
||||
public static boolean isNms1_8_R1() {
|
||||
return nms1_8_R1;
|
||||
}
|
||||
|
||||
public static boolean isNms1_8_R2() {
|
||||
return nms1_8_R2;
|
||||
}
|
||||
|
||||
public static boolean isNms1_8_R3() {
|
||||
return nms1_8_R3;
|
||||
}
|
||||
|
||||
public static boolean isNms1_9_R1() {
|
||||
return nms1_9_R1;
|
||||
}
|
||||
|
||||
public static boolean isNms1_9_R2() {
|
||||
return nms1_9_R2;
|
||||
}
|
||||
|
||||
public static boolean isNms1_10_R1() {
|
||||
return nms1_10_R1;
|
||||
}
|
||||
|
||||
public static boolean isNms1_11_R1() {
|
||||
return nms1_11_R1;
|
||||
}
|
||||
|
||||
public static boolean isNms1_12_R1() {
|
||||
return nms1_12_R1;
|
||||
}
|
||||
|
||||
public static boolean isNms1_13_R1() {
|
||||
return nms1_13_R1;
|
||||
}
|
||||
|
||||
public static boolean isNms1_13_R2() {
|
||||
return nms1_13_R2;
|
||||
}
|
||||
|
||||
public static boolean isNms1_14_R1() {
|
||||
return nms1_14_R1;
|
||||
}
|
||||
|
||||
public static boolean isNms1_15_R1() {
|
||||
return nms1_15_R1;
|
||||
}
|
||||
|
||||
public static boolean isNms1_16_R1() {
|
||||
return nms1_16_R1;
|
||||
}
|
||||
|
||||
public static boolean isNms1_16_R2() {
|
||||
return nms1_16_R2;
|
||||
}
|
||||
|
||||
public static boolean isNms1_16_R3() {
|
||||
return nms1_16_R3;
|
||||
}
|
||||
|
||||
public static boolean isNms1_17_R1() {
|
||||
return nms1_17_R1;
|
||||
}
|
||||
|
||||
public static boolean isNms1_18_R1() {
|
||||
return nms1_18_R1;
|
||||
}
|
||||
|
||||
public static boolean isNms1_18_R2() {
|
||||
return nms1_18_R2;
|
||||
}
|
||||
|
||||
public static boolean isNms1_19_R1() {
|
||||
return nms1_19_R1;
|
||||
}
|
||||
|
||||
public static boolean isNms1_19_R2() {
|
||||
return nms1_19_R2;
|
||||
}
|
||||
|
||||
public static boolean isNms1_20_R1() {
|
||||
return nms1_20_R1;
|
||||
}
|
||||
|
||||
public static boolean isNms1_20_R2() {
|
||||
return nms1_20_R2;
|
||||
}
|
||||
|
||||
public static boolean isNms1_20_R3() {
|
||||
return nms1_20_R3;
|
||||
}
|
||||
|
||||
public static boolean isNms1_20_R4() {
|
||||
return nms1_20_R4;
|
||||
}
|
||||
|
||||
public static boolean isNms1_21_R1() {
|
||||
return nms1_21_R1;
|
||||
}
|
||||
public static boolean isNms1_21_R2() {
|
||||
return nms1_21_R2;
|
||||
}
|
||||
public static boolean isNms1_22_R1() {
|
||||
return nms1_22_R1;
|
||||
}
|
||||
|
||||
|
||||
public static boolean minMc1_8() {
|
||||
return isMc1_8();
|
||||
}
|
||||
|
||||
public static boolean minMc1_9() {
|
||||
return !isMc1_8();
|
||||
}
|
||||
|
||||
public static boolean minMc1_10() {
|
||||
return !isMc1_8() && !isMc1_9();
|
||||
}
|
||||
|
||||
public static boolean minMc1_11() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10();
|
||||
}
|
||||
|
||||
public static boolean minMc1_12() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11();
|
||||
}
|
||||
|
||||
public static boolean minMc1_13() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12();
|
||||
}
|
||||
|
||||
public static boolean minMc1_14() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13();
|
||||
}
|
||||
|
||||
public static boolean minMc1_15() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14();
|
||||
}
|
||||
|
||||
public static boolean minMc1_16() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15();
|
||||
}
|
||||
|
||||
public static boolean minMc1_17() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16();
|
||||
}
|
||||
|
||||
public static boolean minMc1_18() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16() && !isMc1_17();
|
||||
}
|
||||
|
||||
public static boolean minMc1_19() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16() && !isMc1_17() && !isMc1_18();
|
||||
}
|
||||
|
||||
public static boolean minMc1_20() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16() && !isMc1_17()
|
||||
&& !isMc1_18() && !isMc1_19();
|
||||
}
|
||||
public static boolean minMc1_21() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16() && !isMc1_17()
|
||||
&& !isMc1_18() && !isMc1_19() && !isMc1_20();
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user