Compare commits
53 Commits
15.1
...
a74710ed9a
Author | SHA1 | Date | |
---|---|---|---|
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 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,6 +1,4 @@
|
||||
# User-specific stuff
|
||||
.idea/
|
||||
.idea
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
|
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
13
.idea/compiler.xml
generated
Normal file
13
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="T2CodeLib" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
7
.idea/discord.xml
generated
Normal file
7
.idea/discord.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DiscordProjectSettings">
|
||||
<option name="show" value="PROJECT_FILES" />
|
||||
<option name="description" value="" />
|
||||
</component>
|
||||
</project>
|
7
.idea/encodings.xml
generated
Normal file
7
.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
3
.idea/icon.svg
generated
Normal file
3
.idea/icon.svg
generated
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 295 KiB |
35
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
35
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,35 @@
|
||||
<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>
|
||||
</profile>
|
||||
</component>
|
65
.idea/jarRepositories.xml
generated
Normal file
65
.idea/jarRepositories.xml
generated
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</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="T2Code" />
|
||||
<option name="name" value="T2Code" />
|
||||
<option name="url" value="https://repo.t2code.net/repository/T2Code/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="spigot-repo" />
|
||||
<option name="name" value="spigot-repo" />
|
||||
<option name="url" value="https://hub.spigotmc.org/nexus/content/repositories/snapshots/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<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>
|
21
.idea/misc.xml
generated
Normal file
21
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<list size="2">
|
||||
<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>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-17" project-jdk-type="JavaSDK" />
|
||||
</project>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/T2CodeLib.iml" filepath="$PROJECT_DIR$/T2CodeLib.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
76
pom.xml
76
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>15.1</version>
|
||||
<version>16.7_dev-11</version>
|
||||
<!--version>VERSION_snapshot-0</version-->
|
||||
<!--version>VERSION_beta-0</version-->
|
||||
<!--version>VERSION_dev-0</version-->
|
||||
@@ -27,8 +27,8 @@
|
||||
<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>
|
||||
@@ -45,8 +45,32 @@
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>net.kyori.adventure</pattern>
|
||||
<shadedPattern>net.t2code.t2codelib.shaded.adventure</shadedPattern>
|
||||
<pattern>net.kyori</pattern>
|
||||
<shadedPattern>net.t2code.libraries.kyori.adventure</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.google.gson</pattern>
|
||||
<shadedPattern>net.t2code.libraries.google</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>mozilla</pattern>
|
||||
<shadedPattern>net.t2code.libraries.mozilla</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.apache</pattern>
|
||||
<shadedPattern>net.t2code.libraries.apache</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.intellij</pattern>
|
||||
<shadedPattern>net.t2code.libraries.intellij</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.jetbrains</pattern>
|
||||
<shadedPattern>net.t2code.libraries.jetbrains</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.json</pattern>
|
||||
<shadedPattern>net.t2code.libraries.json</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
@@ -81,6 +105,12 @@
|
||||
<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>
|
||||
@@ -105,11 +135,11 @@
|
||||
<url>https://nexus.bencodez.com/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
<!--Kyori MiniMessage
|
||||
<!--Kyori MiniMessage-->
|
||||
<repository>
|
||||
<id>sonatype-oss-snapshots1</id>
|
||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</repository>-->
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
||||
@@ -118,7 +148,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.20-R0.1-SNAPSHOT</version>
|
||||
<version>1.21-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -134,18 +164,26 @@
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.20-R0.1-SNAPSHOT</version>
|
||||
<version>1.21-R0.1-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.19-R0.1-SNAPSHOT</version>
|
||||
<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>
|
||||
@@ -182,19 +220,19 @@
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-minimessage</artifactId>
|
||||
<version>4.14.0</version>
|
||||
<version>4.18.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-bukkit</artifactId>
|
||||
<version>4.3.0</version>
|
||||
<version>4.3.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-bungeecord</artifactId>
|
||||
<version>4.3.0</version>
|
||||
<version>4.3.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -221,6 +259,18 @@
|
||||
<version>4.5.14</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20230227</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<version>2.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@@ -10,31 +10,55 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class T2CBtab {
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
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());
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
}
|
||||
|
||||
public static Iterable<String> tab(CommandSender sender, String[] args, HashMap<String, String> permMap) {
|
||||
List<String> matches = new ArrayList<>();
|
||||
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[0])) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
public static Iterable<String> tab(CommandSender sender, String[] args, String perm, String 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[0])) {
|
||||
if (hasPermission(sender, perm) && passend(command, args[arg])) {
|
||||
matches.add(command);
|
||||
}
|
||||
return matches;
|
||||
|
@@ -5,7 +5,6 @@ import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
|
||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import net.t2code.t2codelib.T2CupdateObject;
|
||||
import net.t2code.t2codelib.T2CupdateWebData;
|
||||
import net.t2code.t2codelib.UpdateType;
|
||||
@@ -49,14 +48,12 @@ public class T2CBupdateAPI {
|
||||
private static String pluginVersion;
|
||||
|
||||
public static void onUpdateCheckTimer(Plugin plugin, String prefix, String discord, Integer spigotID, String url) {
|
||||
Integer finalInterval;
|
||||
if (T2CBlibConfig.getUpdateTimer() < 1){
|
||||
finalInterval = 1;
|
||||
} else finalInterval = T2CBlibConfig.getUpdateTimer();
|
||||
if ((int) T2CBlibConfig.VALUES.updateTimer.getValue() < 1) {
|
||||
T2CBlibConfig.VALUES.updateTimer.setValue(1);
|
||||
}
|
||||
ProxyServer.getInstance().getScheduler().schedule(plugin, new Runnable() {
|
||||
public void run() {
|
||||
if (T2CBlibConfig.getUpdateCheckFullDisable()) return;
|
||||
(new T2CBupdateCheckerGit(plugin, spigotID)).getVersion((webData) -> {
|
||||
(new T2CBupdateCheckerGit(plugin)).getVersion((webData) -> {
|
||||
pluginVersion = plugin.getDescription().getVersion();
|
||||
T2CupdateObject update = new T2CupdateObject(
|
||||
plugin.getDescription().getName(),
|
||||
@@ -78,6 +75,6 @@ public class T2CBupdateAPI {
|
||||
}
|
||||
}, pluginVersion, spigotID, url);
|
||||
}
|
||||
}, 0, finalInterval * 60 * 20L, TimeUnit.SECONDS);
|
||||
}, 0, (int) T2CBlibConfig.VALUES.updateTimer.getValue() * 60 * 20L, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
@@ -18,17 +18,16 @@ import java.util.function.Consumer;
|
||||
|
||||
public class T2CBupdateCheckerGit {
|
||||
private Plugin plugin;
|
||||
private int resourceId;
|
||||
|
||||
public T2CBupdateCheckerGit(Plugin plugin, int resourceId) {
|
||||
|
||||
public T2CBupdateCheckerGit(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.resourceId = resourceId;
|
||||
|
||||
}
|
||||
|
||||
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String gitKey) {
|
||||
if (T2CBlibConfig.getUpdateCheckFullDisable()) return;
|
||||
String RepoURL = "https://git.t2code.net/api/v1/repos/" + gitKey + "/releases?limit=1";
|
||||
if (!T2CBlibConfig.getSeePreReleaseUpdates()) {
|
||||
if (!(boolean)T2CBlibConfig.VALUES.seePreReleaseUpdates.getValue() ) {
|
||||
RepoURL = RepoURL + "&pre-release=false";
|
||||
}
|
||||
String finalRepoURL = RepoURL;
|
||||
@@ -50,20 +49,20 @@ public class T2CBupdateCheckerGit {
|
||||
return;
|
||||
}
|
||||
JSONObject obj = new JSONObject(data);
|
||||
String UpdateName = obj.getString("name");
|
||||
String tag_name = obj.getString("tag_name");
|
||||
String body = obj.getString("body").replace("\n", "<br>").replace("\r", "").replace("'", "''");
|
||||
String updateurl = obj.getString("html_url");
|
||||
boolean prerelease = obj.getBoolean("prerelease");
|
||||
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 formattedDate = outputFormat.format(parsedDate);
|
||||
String publishedAt = outputFormat.format(parsedDate);
|
||||
|
||||
JSONArray downloadArray = obj.getJSONArray("assets");
|
||||
String gitURL = updateurl;
|
||||
String gitURL = updateUrl;
|
||||
String downloadURL;
|
||||
if (downloadArray.isEmpty()) {
|
||||
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
||||
@@ -71,12 +70,12 @@ public class T2CBupdateCheckerGit {
|
||||
downloadURL = downloadArray.getJSONObject(0).getString("browser_download_url");
|
||||
}
|
||||
|
||||
if (!prerelease) {
|
||||
if (!preRelease) {
|
||||
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
||||
updateurl = "https://www.spigotmc.org/resources/" + spigotID;
|
||||
updateUrl = "https://www.spigotmc.org/resources/" + spigotID;
|
||||
}
|
||||
|
||||
T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, formattedDate, downloadURL, gitURL, prerelease);
|
||||
T2CupdateWebData webData = new T2CupdateWebData(updateTitle, version, updateDescription, updateUrl, publishedAt, downloadURL, gitURL, preRelease);
|
||||
consumer.accept(webData);
|
||||
} catch (Exception var10) {
|
||||
Boolean load = false;
|
||||
|
@@ -0,0 +1,124 @@
|
||||
// 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.T2CconfigItem;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.t2code.t2codelib.T2CLanguageEnum;
|
||||
|
||||
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 T2CBconfigWriter {
|
||||
|
||||
private static Configuration config;
|
||||
|
||||
|
||||
public static void createConfig(File configFile, T2CconfigItem[] 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<>();
|
||||
|
||||
T2CLanguageEnum lang = T2CLanguageEnum.english;
|
||||
|
||||
for (T2CconfigItem 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, T2CconfigItem[] values) {
|
||||
for (T2CconfigItem 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) {
|
||||
builder.append(indent).append(key).append(": ").append("\n");
|
||||
List<Object> zw = (List<Object>) value;
|
||||
for (Object s : zw) {
|
||||
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");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,15 +4,13 @@ import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
|
||||
import net.t2code.t2codelib.BUNGEE.api.update.T2CBupdateAPI;
|
||||
import net.t2code.t2codelib.BUNGEE.system.bstats.T2CBmetrics;
|
||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
|
||||
import net.t2code.t2codelib.BUNGEE.api.bungeePlayers.T2CBbungeePlayers;
|
||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
|
||||
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.T2CplmsgBcmd;
|
||||
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.autoResponse.T2CapiAutoResponse;
|
||||
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.commandgui.T2CapiCGUI;
|
||||
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.opSecurity.T2CapiOpSecurity;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class T2CBload {
|
||||
public static void onLoad(Plugin plugin, String prefix, String autor, String version, String spigot, String discord, Integer spigotID, Integer bstatsID, String url) {
|
||||
long long_ = System.currentTimeMillis();
|
||||
@@ -22,19 +20,10 @@ public class T2CBload {
|
||||
T2CBsend.console(prefix + " §2Spigot: §6" + spigot);
|
||||
T2CBsend.console(prefix + " §2Discord: §6" + discord);
|
||||
|
||||
T2CBmetrics.Bstats(plugin, bstatsID);
|
||||
try {
|
||||
T2CBlibConfig.create();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
T2CBlibConfig.select();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
T2CBmetrics.bStats(plugin, bstatsID);
|
||||
T2CBlibConfig.set();
|
||||
|
||||
T2CBupdateAPI.onUpdateCheckTimer(plugin, prefix, discord, spigotID,url);
|
||||
T2CBupdateAPI.onUpdateCheckTimer(plugin, prefix, discord, spigotID, url);
|
||||
|
||||
//API
|
||||
plugin.getProxy().registerChannel("t2c:bcmd");
|
||||
@@ -44,16 +33,16 @@ public class T2CBload {
|
||||
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CBbungeePlayers());
|
||||
T2CBbungeePlayers.sendToSpigotDeleteAll();
|
||||
|
||||
if (T2CBlibConfig.getApiCommandGUIEnable()) {
|
||||
if ((boolean) T2CBlibConfig.VALUES.apiCommandGUIEnable.getValue()) {
|
||||
plugin.getProxy().registerChannel("t2c:cguiopl");
|
||||
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CapiCGUI());
|
||||
T2CapiCGUI.sendToSpigotDeleteAll();
|
||||
}
|
||||
if (T2CBlibConfig.getApiAutoResponse()) {
|
||||
if ( (boolean)T2CBlibConfig.VALUES.apiAutoResponse.getValue() ) {
|
||||
plugin.getProxy().registerChannel("t2c:aresp");
|
||||
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CapiAutoResponse());
|
||||
}
|
||||
if (T2CBlibConfig.getApiOpSecurity()) {
|
||||
if ((boolean)T2CBlibConfig.VALUES.apiOpSecurity.getValue()) {
|
||||
plugin.getProxy().registerChannel("t2c:t2c:opsec");
|
||||
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CapiOpSecurity());
|
||||
}
|
||||
|
@@ -43,8 +43,6 @@ public class T2CodeBMain extends Plugin {
|
||||
mmIsLoad = false;
|
||||
}
|
||||
T2CBload.onLoad(plugin, Util.getPrefix(), autor, orgVersion, Util.getSpigot(), Util.getDiscord(), Util.getSpigotID(), Util.getBstatsID(),Util.getGit());
|
||||
String[] fv = orgVersion.split("_");
|
||||
plugin.getDescription().setVersion(fv[0]);
|
||||
version = plugin.getDescription().getVersion();
|
||||
}
|
||||
|
||||
|
@@ -23,7 +23,7 @@ import java.util.zip.GZIPOutputStream;
|
||||
|
||||
public class T2CBmetrics {
|
||||
|
||||
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!
|
||||
T2CBmetrics metrics = new T2CBmetrics(plugin, pluginId);
|
||||
}
|
||||
|
@@ -0,0 +1,37 @@
|
||||
package net.t2code.t2codelib.BUNGEE.system.config;
|
||||
|
||||
import net.md_5.bungee.config.ConfigurationProvider;
|
||||
import net.t2code.t2codelib.BUNGEE.system.T2CodeBMain;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.md_5.bungee.config.YamlConfiguration;
|
||||
import net.t2code.t2codelib.T2CconfigItem;
|
||||
|
||||
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(T2CodeBMain.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",T2CBlibConfig.VALUES.updateTimer);
|
||||
set("UpdateCheck.SeePreReleaseUpdates",T2CBlibConfig.VALUES.seePreReleaseUpdates);
|
||||
set("API.CommandGUI.Enable",T2CBlibConfig.VALUES.apiCommandGUIEnable);
|
||||
set("API.AutoResponse.Enable",T2CBlibConfig.VALUES.apiAutoResponse);
|
||||
set("API.OPSecurity.Enable",T2CBlibConfig.VALUES.apiOpSecurity);
|
||||
|
||||
config.delete();
|
||||
}
|
||||
|
||||
private static void set(String path, T2CconfigItem item){
|
||||
if (configuration.contains(path)){
|
||||
item.setValue(configuration.get(path));
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,63 +1,92 @@
|
||||
package net.t2code.t2codelib.BUNGEE.system.config;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.md_5.bungee.config.ConfigurationProvider;
|
||||
import net.md_5.bungee.config.YamlConfiguration;
|
||||
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
|
||||
import net.t2code.t2codelib.BUNGEE.api.yaml.T2CBconfig;
|
||||
import net.t2code.t2codelib.BUNGEE.api.yaml.T2CBconfigWriter;
|
||||
import net.t2code.t2codelib.BUNGEE.system.T2CodeBMain;
|
||||
import net.t2code.t2codelib.T2CconfigItem;
|
||||
import net.t2code.t2codelib.T2CLanguageEnum;
|
||||
import net.t2code.t2codelib.Util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class T2CBlibConfig {
|
||||
|
||||
public static void create() throws IOException {
|
||||
long long_ = System.currentTimeMillis();
|
||||
File config = new File(T2CodeBMain.getPlugin().getDataFolder(), "config.yml");
|
||||
if (!T2CodeBMain.getPlugin().getDataFolder().exists()) T2CodeBMain.getPlugin().getDataFolder().mkdir();
|
||||
if (!config.exists()) {
|
||||
config.createNewFile();
|
||||
public enum VALUES implements T2CconfigItem {
|
||||
updateTimer("updateCheck.timerInMin", 60, true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.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(T2CLanguageEnum.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(T2CLanguageEnum.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(T2CLanguageEnum.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(T2CLanguageEnum.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<T2CLanguageEnum, List<String>> comments;
|
||||
|
||||
VALUES(String path, Object value, boolean forceSet, HashMap<T2CLanguageEnum, List<String>> comments) {
|
||||
this.path = path;
|
||||
this.value = value;
|
||||
this.forceSet = forceSet;
|
||||
this.comments = comments;
|
||||
}
|
||||
Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(config);
|
||||
T2CBconfig.set("UpdateCheck.TimerInMin", 60, configuration);
|
||||
T2CBconfig.set("UpdateCheck.SeePreReleaseUpdates", true, configuration);
|
||||
T2CBconfig.set("Plugin.UpdateCheck.AllPlugins.FullDisable", false, configuration);
|
||||
|
||||
T2CBconfig.set("API.CommandGUI.Enable", false, configuration);
|
||||
T2CBconfig.set("API.AutoResponse.Enable", false, configuration);
|
||||
T2CBconfig.set("API.OPSecurity.Enable", false, configuration);
|
||||
@Override
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
ConfigurationProvider.getProvider(YamlConfiguration.class).save(configuration, config);
|
||||
T2CBsend.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getForceSet() {
|
||||
return forceSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<T2CLanguageEnum, List<String>> getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLanguagePath() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Object newValue) {
|
||||
value = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
public static void select() throws IOException {
|
||||
File config = new File(T2CodeBMain.getPlugin().getDataFolder(), "config.yml");
|
||||
Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(config);
|
||||
|
||||
updateTimer = configuration.getInt("UpdateCheck.TimerInMin");
|
||||
seePreReleaseUpdates = configuration.getBoolean("UpdateCheck.SeePreReleaseUpdates");
|
||||
updateCheckFullDisable = configuration.getBoolean("Plugin.UpdateCheck.AllPlugins.FullDisable");
|
||||
|
||||
apiCommandGUIEnable = configuration.getBoolean("API.CommandGUI.Enable");
|
||||
apiAutoResponse = configuration.getBoolean("API.AutoResponse.Enable");
|
||||
apiOpSecurity = configuration.getBoolean("API.OPSecurity.Enable");
|
||||
public static void set() {
|
||||
try {
|
||||
ConvertT2CBlibConfig.convert();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
T2CBconfigWriter.createConfig(new File(T2CodeBMain.getPlugin().getDataFolder(), "config.yml"), VALUES.values(), Util.getConfigLogo());
|
||||
}
|
||||
|
||||
@Getter
|
||||
private static Integer updateTimer;
|
||||
@Getter
|
||||
private static Boolean seePreReleaseUpdates;
|
||||
@Getter
|
||||
private static Boolean updateCheckFullDisable;
|
||||
@Getter
|
||||
private static Boolean apiCommandGUIEnable;
|
||||
@Getter
|
||||
private static Boolean apiAutoResponse;
|
||||
@Getter
|
||||
private static Boolean apiOpSecurity;
|
||||
|
||||
}
|
||||
|
@@ -5,6 +5,8 @@ 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;
|
||||
import org.junit.Ignore;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
@@ -19,13 +21,20 @@ public class T2CplmsgBcmd implements Listener {
|
||||
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("Command Console: "+ input);
|
||||
ProxyServer.getInstance().getConsole().sendMessage(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("Command " + player +": "+ input);
|
||||
ProxyServer.getInstance().getConsole().sendMessage(Util.getPrefix()+" [§6"+serverID+"§r] §cT2C BCMD Command §r" + player +": "+ input);
|
||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(player, input);
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,10 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.bungeePlayers;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -20,15 +22,15 @@ public class T2CbungeePlayers implements PluginMessageListener {
|
||||
@Override
|
||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
|
||||
T2Csend.debug(T2CodeLibMain.getPlugin(), "stream: " + stream.toString());
|
||||
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "stream: " + stream.toString());
|
||||
try {
|
||||
T2CbungeePlayersEnum subChannel = T2CbungeePlayersEnum.valueOf(stream.readUTF());
|
||||
String input = stream.readUTF();
|
||||
String uuid = stream.readUTF();
|
||||
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage received channel: " + channel);
|
||||
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage received subChannel: " + subChannel.name());
|
||||
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage received input: " + input);
|
||||
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage received input2/uuid: " + uuid);
|
||||
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received channel: " + channel);
|
||||
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received subChannel: " + subChannel.name());
|
||||
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received input: " + input);
|
||||
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received input2/uuid: " + uuid);
|
||||
switch (subChannel) {
|
||||
case JOIN:
|
||||
bungeePlayers.add(input);
|
||||
@@ -37,7 +39,7 @@ public class T2CbungeePlayers implements PluginMessageListener {
|
||||
bungeePlayers.remove(input);
|
||||
break;
|
||||
case GIVEALL:
|
||||
if (!Util.getServerUUID().toString().equals(uuid)) {
|
||||
if (!T2CLibConfig.VALUES.serverUUID.getValue().equals(uuid)) {
|
||||
return;
|
||||
}
|
||||
bungeePlayers.clear();
|
||||
@@ -67,16 +69,16 @@ public class T2CbungeePlayers implements PluginMessageListener {
|
||||
DataOutputStream output = new DataOutputStream(stream);
|
||||
try {
|
||||
output.writeUTF(T2CbungeePlayersEnum.GIVEALL.name());
|
||||
output.writeUTF(Util.getServerUUID().toString());
|
||||
output.writeUTF(T2CLibConfig.VALUES.serverUUID.getValue().toString());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
player.sendPluginMessage(T2CodeLibMain.getPlugin(), "t2c:bonlp", stream.toByteArray());
|
||||
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage received channel: t2c:bonlp");
|
||||
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage send subChannel: " + T2CbungeePlayersEnum.GIVEALL.name());
|
||||
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage send output/uuid: " + Util.getServerUUID().toString());
|
||||
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received channel: t2c:bonlp");
|
||||
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage send subChannel: " + T2CbungeePlayersEnum.GIVEALL.name());
|
||||
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage send output/uuid: " + T2CLibConfig.VALUES.serverUUID.getValue().toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@@ -1,25 +1,70 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.commands;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CbungeeCommandSenderReciver;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.rmi.MarshalledObject;
|
||||
import java.util.Map;
|
||||
|
||||
public class T2Ccmd {
|
||||
public static void console(String cmd) {
|
||||
if (cmd.contains("!onBungee")){
|
||||
T2CbungeeCommandSenderReciver.sendToBungee(null, cmd.replace("!onBungee", ""), true);
|
||||
}else Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), 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(T2CodeLibMain.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (cmd.contains("!onBungee")) {
|
||||
T2CbungeeCommandSenderReciver.sendToBungee(null, cmd.replace("!onBungee", ""), true);
|
||||
} else Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd);
|
||||
}
|
||||
}, delay);
|
||||
}
|
||||
|
||||
public static void player(Player player, String cmd) {
|
||||
if (cmd.contains("!asConsole")) {
|
||||
if (cmd.contains("!onBungee")) {
|
||||
T2CbungeeCommandSenderReciver.sendToBungee(player, cmd.replace("!asConsole", "").replace("!onBungee", ""), true);
|
||||
} else console(cmd.replace("!asConsole", ""));
|
||||
} else {
|
||||
if (cmd.contains("!onBungee")) {
|
||||
T2CbungeeCommandSenderReciver.sendToBungee(player, cmd.replace("!onBungee", ""), false);
|
||||
} else player.chat("/" + cmd);
|
||||
}
|
||||
public static void player(Player player, String cmdInput) {
|
||||
Map.Entry<String,Integer> map = delay(cmdInput);
|
||||
int delay = map.getValue();
|
||||
String cmd = map.getKey();
|
||||
Bukkit.getScheduler().runTaskLater(T2CodeLibMain.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (cmd.contains("!asConsole")) {
|
||||
if (cmd.contains("!onBungee")) {
|
||||
T2CbungeeCommandSenderReciver.sendToBungee(player, cmd.replace("!asConsole", "").replace("!onBungee", ""), true);
|
||||
} else console(cmd.replace("!asConsole", ""));
|
||||
} else {
|
||||
if (cmd.contains("!onBungee")) {
|
||||
T2CbungeeCommandSenderReciver.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,9 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.dev;
|
||||
|
||||
public class T2CdevelopmentTool {
|
||||
public static String removeLastChar(String s, int amount) {
|
||||
return (s == null || s.length() == 0)
|
||||
? null
|
||||
: (s.substring(0, s.length() - amount));
|
||||
}
|
||||
}
|
@@ -4,7 +4,8 @@ import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.languages.SelectLibMsg;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -28,10 +29,10 @@ public class T2Ceco {
|
||||
private static boolean vault(String prefix, Player player) {
|
||||
if (T2CodeLibMain.getEco() == null) {
|
||||
if (Bukkit.getPluginManager().getPlugin("Vault") == null) {
|
||||
T2Csend.console(prefix + " §4\n" + prefix + " §4Vault could not be found! §9Please download it here: " +
|
||||
"§6https://www.spigotmc.org/resources/vault.34315/§4\n" + prefix);
|
||||
T2Csend.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" + SelectLibMsg.vaultNotSetUp + "\n" + prefix);
|
||||
player.sendMessage(prefix + "\n" + T2CLibLanguages.VALUES.vaultNotSetUp.getValue().toString() + "\n" + prefix);
|
||||
return false;
|
||||
} else return true;
|
||||
}
|
||||
@@ -85,9 +86,9 @@ public class T2Ceco {
|
||||
|
||||
private static boolean votePlugin(String prefix, Player player) {
|
||||
if (T2CpluginCheck.votingPlugin()) return true;
|
||||
T2Csend.console(prefix + " §4\n" + prefix + " §4VotingPlugin could not be found! §9Please download it here: " +
|
||||
"§6https://www.spigotmc.org/resources/votingplugin.15358/§4\n" + prefix);
|
||||
player.sendMessage(prefix + "\n" + SelectLibMsg.votingPluginNotSetUp + "\n" + prefix);
|
||||
T2Csend.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;
|
||||
}
|
||||
}
|
||||
|
@@ -3,13 +3,22 @@ package net.t2code.t2codelib.SPIGOT.api.items;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
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;
|
||||
|
||||
@@ -52,7 +61,27 @@ public class T2CitemBuilder {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public static ItemStack base64(String base64Value, Integer amount, String displayName, List<String> lore) {
|
||||
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 (!T2CmcVersion.minMc1_20() || T2CmcVersion.isNms1_20_R1()|| T2CmcVersion.isNms1_20_R2()|| T2CmcVersion.isNms1_20_R3()) {
|
||||
return base64Old(base64Value);
|
||||
} else return base64New(base64Value);
|
||||
}
|
||||
|
||||
private static ItemStack base64Old(String base64Value) {
|
||||
ItemStack itemStack = new ItemStack(T2CitemVersion.getHead());
|
||||
SkullMeta itemMeta = (SkullMeta) itemStack.getItemMeta();
|
||||
|
||||
@@ -67,11 +96,33 @@ public class T2CitemBuilder {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
itemMeta.setDisplayName(displayName);
|
||||
itemMeta.setLore(lore);
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
|
||||
itemStack.setAmount(amount);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
private static ItemStack base64New(String base64Value) {
|
||||
ItemStack itemStack = new ItemStack(T2CitemVersion.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";
|
||||
}
|
||||
}
|
||||
|
@@ -1,76 +1,54 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.items;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class T2CitemVersion {
|
||||
@Getter
|
||||
private static Material Head;
|
||||
@Getter
|
||||
private static ItemStack HeadIS;
|
||||
private static ItemStack CRAFTING_TABLE;
|
||||
private static ItemStack YELLOW_WOOL;
|
||||
private static ItemStack ORANGE_WOOL;
|
||||
private static ItemStack GREEN_WOOL;
|
||||
private static ItemStack GRAY_WOOL;
|
||||
private static ItemStack RED_WOOL;
|
||||
private static ItemStack RED_STAINED_GLASS_PANE;
|
||||
@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 (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
Head = Material.valueOf("SKULL_ITEM");
|
||||
YELLOW_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 4);
|
||||
ORANGE_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 1);
|
||||
GREEN_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 5);
|
||||
GRAY_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 8);
|
||||
RED_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 14);
|
||||
RED_STAINED_GLASS_PANE = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, (short) 14);
|
||||
CRAFTING_TABLE = new ItemStack(Material.valueOf("WORKBENCH"));
|
||||
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");
|
||||
CRAFTING_TABLE = new ItemStack(Material.CRAFTING_TABLE);
|
||||
YELLOW_WOOL = new ItemStack(Material.YELLOW_WOOL);
|
||||
ORANGE_WOOL = new ItemStack(Material.ORANGE_WOOL);
|
||||
GREEN_WOOL = new ItemStack(Material.GREEN_WOOL);
|
||||
GRAY_WOOL = new ItemStack(Material.GRAY_WOOL);
|
||||
RED_WOOL = new ItemStack(Material.RED_WOOL);
|
||||
RED_STAINED_GLASS_PANE = new ItemStack(Material.RED_STAINED_GLASS_PANE);
|
||||
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);
|
||||
}
|
||||
|
||||
public static Material getHead() {
|
||||
return Head;
|
||||
}
|
||||
|
||||
public static ItemStack getHeadIS() {
|
||||
return HeadIS;
|
||||
}
|
||||
|
||||
public static ItemStack getCraftingTable() {
|
||||
return CRAFTING_TABLE;
|
||||
}
|
||||
|
||||
public static ItemStack getYellowWool() {
|
||||
return YELLOW_WOOL;
|
||||
}
|
||||
|
||||
public static ItemStack getOrangeWool() {
|
||||
return ORANGE_WOOL;
|
||||
}
|
||||
|
||||
public static ItemStack getGreenWool() {
|
||||
return GREEN_WOOL;
|
||||
}
|
||||
|
||||
public static ItemStack getGrayWool() {
|
||||
return GRAY_WOOL;
|
||||
}
|
||||
|
||||
public static ItemStack getRedWool() {
|
||||
return RED_WOOL;
|
||||
}
|
||||
|
||||
public static ItemStack getRedStainedGlassPane() {
|
||||
return RED_STAINED_GLASS_PANE;
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,12 @@ public class T2CminiMessage {
|
||||
private static final BukkitAudiences bukkitAudiences = T2CodeLibMain.getPlugin().getAdventure();
|
||||
|
||||
public static void sendSenderMiniMessage(String msg, CommandSender sender) {
|
||||
bukkitAudiences.sender(sender).sendMessage(replace(msg));
|
||||
String string = "";
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
string =T2Creplace.replace("",player,msg);
|
||||
} else string = msg;
|
||||
bukkitAudiences.sender(sender).sendMessage(replace(string));
|
||||
}
|
||||
|
||||
public static void sendConsoleMiniMessage(String msg) {
|
||||
@@ -19,7 +24,7 @@ public class T2CminiMessage {
|
||||
}
|
||||
|
||||
public static void sendPlayerMiniMessage(String msg, Player player) {
|
||||
bukkitAudiences.player(player).sendMessage(replace(msg));
|
||||
bukkitAudiences.player(player).sendMessage(replace(T2Creplace.replace("", player, msg)));
|
||||
}
|
||||
|
||||
protected static Component replace(String text) {
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -17,10 +18,16 @@ public class T2Creplace {
|
||||
}
|
||||
|
||||
public static String replace(String prefix, Player player, String Text) {
|
||||
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix)
|
||||
String input = Text.replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n")));
|
||||
.replace("[nl]", "\n");
|
||||
if (T2CpluginCheck.papi()) {
|
||||
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, input));
|
||||
} else {
|
||||
return replaceLegacyColor(input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Object replaceObject(String prefix, Object object) {
|
||||
@@ -46,18 +53,33 @@ public class T2Creplace {
|
||||
|
||||
public static Object replaceObject(String prefix, Player player, Object object) {
|
||||
if (object instanceof String) {
|
||||
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"));
|
||||
|
||||
if (T2CpluginCheck.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) {
|
||||
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")));
|
||||
if (T2CpluginCheck.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;
|
||||
}
|
||||
@@ -84,10 +106,18 @@ public class T2Creplace {
|
||||
return Collections.singletonList("Text is null");
|
||||
}
|
||||
for (String input : Text) {
|
||||
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")));
|
||||
if (T2CpluginCheck.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;
|
||||
}
|
||||
@@ -110,25 +140,20 @@ public class T2Creplace {
|
||||
.replace("&c", "").replace("&d", "").replace("&e", "").replace("&f", "")
|
||||
.replace("&k", "").replace("&l", "").replace("&m", "").replace("&n", "")
|
||||
.replace("&o", "").replace("&r", "");
|
||||
// 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(replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, s.replace("[prefix]", prefix)
|
||||
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)))));
|
||||
.replace("[price]", String.valueOf(price));
|
||||
if (T2CpluginCheck.papi()) {
|
||||
rp.add(replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, input)));
|
||||
} else {
|
||||
rp.add(replaceLegacyColor(input));
|
||||
}
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
@@ -142,10 +167,16 @@ public class T2Creplace {
|
||||
}
|
||||
|
||||
public static String replacePrice(String prefix, Player player, String Text, String price) {
|
||||
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix)
|
||||
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")));
|
||||
.replace("[price]", String.valueOf(price)).replace("[nl]", "\n");
|
||||
if (T2CpluginCheck.papi()) {
|
||||
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, input));
|
||||
} else {
|
||||
return replaceLegacyColor(input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String replaceLegacyColor(String text) {
|
||||
@@ -181,4 +212,19 @@ public class T2Creplace {
|
||||
.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;
|
||||
}
|
||||
}
|
||||
|
@@ -7,14 +7,12 @@ 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;
|
||||
|
||||
public class T2Csend {
|
||||
|
||||
/**
|
||||
* Spigot
|
||||
*/
|
||||
|
||||
public static void console(String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleConsole(msg);
|
||||
@@ -31,21 +29,25 @@ public class T2Csend {
|
||||
}
|
||||
|
||||
public static void console(Object object) {
|
||||
String msg = String.valueOf(object);
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleConsole(msg);
|
||||
for (String msg : list(object)){
|
||||
if (msg == null || msg.contains("[empty]")) continue;
|
||||
T2ChoverModule.moduleConsole(msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void player(Player player, Object object) {
|
||||
String msg = String.valueOf(object);
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.modulePlayer(msg, player);
|
||||
for (String msg : list(object)){
|
||||
if (msg == null || msg.contains("[empty]")) continue;
|
||||
T2ChoverModule.modulePlayer(msg, player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void sender(CommandSender sender, Object object) {
|
||||
String msg = String.valueOf(object);
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleSender(msg, sender);
|
||||
for (String msg : list(object)){
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleSender(msg, sender);
|
||||
}
|
||||
}
|
||||
|
||||
public static void title(Player player, @Nullable String title, @Nullable String subtitle) {
|
||||
@@ -56,15 +58,28 @@ public class T2Csend {
|
||||
player.sendTitle(title, subtitle, fadeIn, stay, fadeOut);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Deprecated Use: T2Cdebug.debug(Plugin plugin, String msg) or T2Cdebug.debug(Plugin plugin, String msg, Integer stage)
|
||||
*/
|
||||
@Deprecated
|
||||
public static void debug(Plugin plugin, String msg) {
|
||||
debug(plugin, msg, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Deprecated Use: T2Cdebug.debug(Plugin plugin, String msg) or T2Cdebug.debug(Plugin plugin, String msg, Integer stage)
|
||||
*/
|
||||
@Deprecated
|
||||
public static void debug(Plugin plugin, String msg, Integer stage) {
|
||||
// if (!new File(Main.getPath(), "config.yml").exists()) return;
|
||||
T2Cdebug.debug(plugin, msg, stage);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Use: T2Cdebug.debugmsg(plugin, msg)
|
||||
*/
|
||||
@Deprecated
|
||||
public static void debugmsg(Plugin plugin, String msg) {
|
||||
T2Cdebug.debugmsg(plugin, msg);
|
||||
}
|
||||
@@ -80,4 +95,16 @@ public class T2Csend {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,10 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.T2CupdateWebData;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -9,50 +12,61 @@ import org.bukkit.plugin.Plugin;
|
||||
import java.util.List;
|
||||
|
||||
public class T2Ctemplate {
|
||||
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) {
|
||||
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();
|
||||
T2Csend.console(prefix + " <dark_red> _______ </dark_red><gray>___ </gray><dark_red>_____ </dark_red>");
|
||||
T2Csend.console(prefix + " <dark_red> |__ __|</dark_red><gray>__ \\ </gray><dark_red>/ ____|</dark_red>");
|
||||
T2Csend.console(prefix + " <dark_red> | | </dark_red><gray> ) </gray><dark_red>| | </dark_red>");
|
||||
T2Csend.console(prefix + " <dark_red> | | </dark_red><gray> / /</gray><dark_red>| | </dark_red>");
|
||||
T2Csend.console(prefix + " <dark_red> | | </dark_red><gray>/ /_</gray><dark_red>| |____ </dark_red>");
|
||||
T2Csend.console(prefix + " <dark_red> |_| </dark_red><gray>|____|</gray><dark_red>\\_____|</dark_red>");
|
||||
T2Csend.console(prefix + " §4 §e╔══════════════════════════");
|
||||
T2Csend.console(prefix + " §4 §e║ §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
T2Csend.console(prefix + " §4 §e║ §2Version: §6" + version);
|
||||
T2Csend.console(prefix + " §4 §e║ §2Spigot: §6" + spigot);
|
||||
T2Csend.console(prefix + " §4 §e║ §2Discord: §6" + discord);
|
||||
|
||||
/**
|
||||
T2Csend.console(prefix + " <dark_red> _______ </dark_red><gray>___ </gray><dark_red>_____ </dark_red>");
|
||||
T2Csend.console(prefix + " <dark_red> |__ __|</dark_red><gray>__ \\ </gray><dark_red>/ ____|</dark_red>");
|
||||
T2Csend.console(prefix + " <dark_red> | | </dark_red><gray> ) </gray><dark_red>| | </dark_red>");
|
||||
T2Csend.console(prefix + " <dark_red> | | </dark_red><gray> / /</gray><dark_red>| | </dark_red>");
|
||||
T2Csend.console(prefix + " <dark_red> | | </dark_red><gray>/ /_</gray><dark_red>| |____ </dark_red>");
|
||||
T2Csend.console(prefix + " <dark_red> |_| </dark_red><gray>|____|</gray><dark_red>\\_____|</dark_red>");
|
||||
*/
|
||||
|
||||
|
||||
for (String s : Util.getLoadLogo()) {
|
||||
T2Csend.console(prefix + " §e" + s);
|
||||
}
|
||||
setCenterAligned(prefix, "§2Author §6" + String.valueOf(autor).replace("[", "").replace("]", ""), true);
|
||||
setCenterAligned(prefix, "§2Version: §6" + version, true);
|
||||
setCenterAligned(prefix, "§2Spigot: §6" + spigot, true);
|
||||
setCenterAligned(prefix, "§2Discord: §6" + discord, true);
|
||||
if (isPremium != null) {
|
||||
if (isPremium) {
|
||||
T2Csend.console(prefix + " §4 §e║ §6Premium: §2true");
|
||||
} else T2Csend.console(prefix + " §4 §e║ §6Premium: §4false");
|
||||
setCenterAligned(prefix, "§6Premium: §2true", true);
|
||||
} else setCenterAligned(prefix, "§6Premium: §4false", true);
|
||||
if (isVerify != null) {
|
||||
if (isVerify) {
|
||||
T2Csend.console(prefix + " §4 §e║ §6Verify: §2true");
|
||||
} else T2Csend.console(prefix + " §4 §e║ §6Verify: §4false");
|
||||
} else T2Csend.console(prefix + " §4 §e║ §6Verify: §4false");
|
||||
setCenterAligned(prefix, "§6Verify: §2true", true);
|
||||
} else setCenterAligned(prefix, "§6Verify: §4false", true);
|
||||
} else setCenterAligned(prefix, "§6Verify: §4false", true);
|
||||
}
|
||||
|
||||
T2Csend.console(prefix + " §4 §e╚══════════════════════════");
|
||||
onLoadSeparateStroke(prefix);
|
||||
if (version.toLowerCase().contains("dev") || version.toLowerCase().contains("snapshot") || version.toLowerCase().contains("beta")) {
|
||||
T2Csend.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!");
|
||||
setCenterAligned(prefix, "", true);
|
||||
setCenterAligned(prefix, "", true);
|
||||
setCenterAligned(prefix, "§eYou are running §4" + version + " §eof §4" + prefix + "§e!", true);
|
||||
setCenterAligned(prefix, "§eSome features may not be working as expected.", true);
|
||||
setCenterAligned(prefix, "§ePlease report all bugs here: http://dc.t2code.net", true);
|
||||
setCenterAligned(prefix, "§4UpdateChecker & bStats may be disabled!", true);
|
||||
setCenterAligned(prefix, "", true);
|
||||
setCenterAligned(prefix, "", true);
|
||||
onLoadSeparateStroke(prefix);
|
||||
if (!SelectLibConfig.getT2cTestDevelopment()){
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return long_;
|
||||
@@ -65,35 +79,54 @@ public class T2Ctemplate {
|
||||
}
|
||||
|
||||
public static void onLoadSeparateStroke(String prefix) {
|
||||
T2Csend.console(prefix + " §8-------------------------------");
|
||||
T2Csend.console(prefix + " §e╠═══════════════════════════════════════════════════════════════════════════╣");
|
||||
}
|
||||
|
||||
public static void onLoadFooter(String prefix, Long long_, String version) {
|
||||
onLoadSeparateStroke(prefix);
|
||||
T2Csend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
|
||||
public static void onLoadFooter(String prefix, Long long_, String v) {
|
||||
onLoadFooter(prefix, long_);
|
||||
}
|
||||
|
||||
|
||||
public static void onLoadFooter(String prefix, Long long_) {
|
||||
onLoadSeparateStroke(prefix);
|
||||
T2Csend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
setCenterAligned(prefix, "§2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
T2Csend.console(prefix + " §e" + BOTTOM_BORDER);
|
||||
}
|
||||
|
||||
public static void onDisable(String prefix, List<String> autor, String version, String spigot, String discord) {
|
||||
T2Csend.console(prefix + " §2Version: §6" + version);
|
||||
T2Csend.console(prefix + " §4Plugin successfully disabled.");
|
||||
public static void onDisable(String prefix, Plugin plugin) {
|
||||
sendFrameCenter(prefix, " §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 = T2CupdateAPI.pluginVersions.get(plugin.getName()).webData.getVersion();
|
||||
boolean update = !publicVersion.equalsIgnoreCase(pluginVersion);
|
||||
boolean player = sender instanceof Player;
|
||||
String publicVersion = "";
|
||||
boolean update;
|
||||
String stNVersion;
|
||||
T2CupdateWebData webData;
|
||||
try {
|
||||
webData = T2CupdateAPI.pluginVersions.get(plugin.getName()).webData;
|
||||
} catch (Exception ex) {
|
||||
webData = null;
|
||||
}
|
||||
|
||||
if (webData != null) {
|
||||
publicVersion = T2CupdateAPI.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 stNVersion = "<dark_red>║</dark_red> <yellow>Newest Version:</yellow> <gold>[nver]</gold>".replace("[nver]", publicVersion);
|
||||
String stStable = "<dark_red>║</dark_red> <yellow>Stable version available:</yellow> [up]".replace("[up]", update ? "<dark_green>YES</dark_green>" : "<red>no</red>");
|
||||
|
||||
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>[nver]</gold>".replace("[nver]", player ? "<hover:show_text:'<yellow>Click for the update information</yellow>'><click:run_command:'/t2code updateinfo " + plugin.getName() + "'>" + publicVersion + "</click></hover>" : publicVersion) : "";
|
||||
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>"
|
||||
@@ -101,16 +134,17 @@ public class T2Ctemplate {
|
||||
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>";
|
||||
String stLink = player ? stLinkPlayer : stLinkConsole;
|
||||
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 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.equals("") ? "" : "<br><dark_red>║</dark_red> " + text + "<br>";
|
||||
T2Csend.sender(sender, "<dark_red>╔════════════════════════════════</dark_red>"
|
||||
String stMSG = text == null || text.equals("") ? "" : "<br><dark_red>║</dark_red> " + text;
|
||||
T2Csend.sender(sender, "<br><dark_red>╔════════════════════════════════</dark_red>"
|
||||
+ "<br>" + stPlugin
|
||||
+ "<br>" + stVersion
|
||||
+ stMSG
|
||||
+ stVersion
|
||||
+ "<br>" + stAutor
|
||||
+ "<br>" + stNVersion
|
||||
+ "<br>" + stStable
|
||||
+ "<br>" + stUpdate
|
||||
+ stNVersion
|
||||
+ "<br>" + stLink
|
||||
+ pr
|
||||
+ "<br><dark_red>╚════════════════════════════════</dark_red>");
|
||||
@@ -119,4 +153,173 @@ public class T2Ctemplate {
|
||||
public static void sendInfo(CommandSender sender, Plugin plugin, int spigotID, String discord, String text) {
|
||||
sendInfo(sender, plugin, spigotID, discord, null, text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Frame in Console
|
||||
|
||||
|
||||
//todo Frame Builder als replace String Builder um es überall nutzen zu können
|
||||
|
||||
protected static final String BOTTOM_BORDER = "╚═══════════════════════════════════════════════════════════════════════════╝";
|
||||
protected static final int FIXED_WIDTH = BOTTOM_BORDER.length() - 2; // Länge ohne die Randzeichen
|
||||
|
||||
|
||||
public static void setCenterAligned(String prefix, String text, boolean setStartFrame) {
|
||||
if (!setStartFrame) {
|
||||
T2Csend.console(prefix + " " + text);
|
||||
return;
|
||||
}
|
||||
// Entfernen von Farbcodes aus der Berechnungslänge
|
||||
String textWithoutColor = removeColorCodes(text);
|
||||
int textLengthWithoutColor = textWithoutColor.length();
|
||||
int totalPaddingSize = FIXED_WIDTH - textLengthWithoutColor;
|
||||
|
||||
// Sicherstellen, dass das Padding nicht negativ wird
|
||||
if (totalPaddingSize < 0) totalPaddingSize = 0;
|
||||
|
||||
// Berechnung des Abstands vor und nach dem Text
|
||||
int paddingLeft = totalPaddingSize / 2;
|
||||
int paddingRight = totalPaddingSize - paddingLeft;
|
||||
// Formatierung der Zeile: Text zentrieren
|
||||
String formattedValue = "§e║" + " ".repeat(paddingLeft) + text + " ".repeat(paddingRight) + "§e║";
|
||||
T2Csend.console(prefix + " " + formattedValue);
|
||||
}
|
||||
|
||||
|
||||
public static void setLeftAligned(String prefix, String text, boolean setStartFrame) {
|
||||
T2Csend.error(T2CodeLibMain.getPlugin(), text);
|
||||
if (!setStartFrame) {
|
||||
T2Csend.console(prefix + " " + text);
|
||||
return;
|
||||
}
|
||||
// Entfernen von Farbcodes aus der Berechnungslänge
|
||||
String textWithoutColor = removeColorCodes(text);
|
||||
int textLengthWithoutColor = textWithoutColor.length();
|
||||
int totalPaddingSize = FIXED_WIDTH - textLengthWithoutColor;
|
||||
|
||||
// Sicherstellen, dass das Padding nicht negativ wird
|
||||
if (totalPaddingSize < 0) totalPaddingSize = 0;
|
||||
|
||||
// Berechnung des Abstands nach dem Text und vor dem Rand
|
||||
int paddingLeft = 0; // Kein zusätzlicher Abstand vor dem Text
|
||||
int paddingRight = totalPaddingSize; // Alles Padding geht nach rechts
|
||||
|
||||
// Formatierung der Zeile: Text am Anfang und dynamischer Abstand zum Ende
|
||||
String formattedValue = "§e║" + text + " ".repeat(paddingRight) + "║";
|
||||
T2Csend.console(prefix + " " + formattedValue);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Methode für mehrere Zeilen Text mit dynamischem Rahmen
|
||||
public static void sendFrameLeft(String prefix, String... lines) {
|
||||
|
||||
String COLOR_CODE = "§e";
|
||||
String BORDER_CHAR = "═";
|
||||
String TOP_LEFT = "╔";
|
||||
String TOP_RIGHT = "╗";
|
||||
String BOTTOM_LEFT = "╚";
|
||||
String BOTTOM_RIGHT = "╝";
|
||||
String SIDE_BORDER = "║";
|
||||
|
||||
// Entfernen von Farbcodes und Berechnung der maximalen Länge
|
||||
int maxLength = 0;
|
||||
for (String line : lines) {
|
||||
String lineWithoutColor = removeColorCodes(line);
|
||||
maxLength = Math.max(maxLength, lineWithoutColor.length());
|
||||
}
|
||||
|
||||
// Berechnung der Rahmenbreite
|
||||
int frameWidth = maxLength + 2; // +2 für die Ränder '║'
|
||||
String topBorder = COLOR_CODE + TOP_LEFT + BORDER_CHAR.repeat(frameWidth) + COLOR_CODE + TOP_RIGHT;
|
||||
String bottomBorder = COLOR_CODE + BOTTOM_LEFT + BORDER_CHAR.repeat(frameWidth) + COLOR_CODE + BOTTOM_RIGHT;
|
||||
|
||||
|
||||
|
||||
// Gehe durch jede Zeile und formatiere sie
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
// Ausgabe der oberen Linie
|
||||
builder.append("<br>").append(prefix).append(" ").append(topBorder).append("<br>");
|
||||
for (String line : lines) {
|
||||
// Entfernen von Farbcodes aus der Berechnungslänge
|
||||
String lineWithoutColor = removeColorCodes(line);
|
||||
int lineLengthWithoutColor = lineWithoutColor.length();
|
||||
int totalPaddingSize = frameWidth - lineLengthWithoutColor; // -2 für die Ränder '║'
|
||||
|
||||
// Sicherstellen, dass das Padding nicht negativ wird
|
||||
if (totalPaddingSize < 0) totalPaddingSize = 0;
|
||||
|
||||
// Berechnung des Abstands nach dem Text und vor dem Rand
|
||||
int paddingLeft = 0; // Kein zusätzlicher Abstand vor dem Text
|
||||
int paddingRight = totalPaddingSize; // Alles Padding geht nach rechts
|
||||
|
||||
// Formatierung der Zeile: Text am Anfang und dynamischer Abstand zum Ende
|
||||
String formattedValue = COLOR_CODE + SIDE_BORDER + line + " ".repeat(paddingRight) + COLOR_CODE + SIDE_BORDER;
|
||||
builder.append(prefix).append(" ").append(formattedValue).append("<br>");
|
||||
}
|
||||
// Ausgabe der unteren Linie
|
||||
builder.append(prefix).append(" ").append(bottomBorder);
|
||||
T2Csend.console(builder.toString());
|
||||
}
|
||||
|
||||
public static void sendFrameCenter(String prefix, String... lines) {
|
||||
|
||||
String COLOR_CODE = "§e";
|
||||
String BORDER_CHAR = "═";
|
||||
String TOP_LEFT = "╔";
|
||||
String TOP_RIGHT = "╗";
|
||||
String BOTTOM_LEFT = "╚";
|
||||
String BOTTOM_RIGHT = "╝";
|
||||
String SIDE_BORDER = "║";
|
||||
// Entfernen von Farbcodes und Berechnung der maximalen Länge
|
||||
int maxLength = 0;
|
||||
for (String line : lines) {
|
||||
String lineWithoutColor = removeColorCodes(line);
|
||||
maxLength = Math.max(maxLength, lineWithoutColor.length());
|
||||
}
|
||||
|
||||
// Berechnung der Rahmenbreite
|
||||
int frameWidth = maxLength + 2; // +2 für die Ränder '║'
|
||||
String topBorder = COLOR_CODE + TOP_LEFT + BORDER_CHAR.repeat(frameWidth) + COLOR_CODE + TOP_RIGHT;
|
||||
String bottomBorder = COLOR_CODE + BOTTOM_LEFT + BORDER_CHAR.repeat(frameWidth) + COLOR_CODE + BOTTOM_RIGHT;
|
||||
|
||||
|
||||
// Gehe durch jede Zeile und formatiere sie
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
// Ausgabe der oberen Linie
|
||||
|
||||
builder.append("<br>").append(prefix).append(" ").append(topBorder).append("<br>");
|
||||
for (String line : lines) {
|
||||
// Entfernen von Farbcodes aus der Berechnungslänge
|
||||
String lineWithoutColor = removeColorCodes(line);
|
||||
int lineLengthWithoutColor = lineWithoutColor.length();
|
||||
int totalPaddingSize = frameWidth - lineLengthWithoutColor; // -2 für die Ränder '║'
|
||||
|
||||
// Sicherstellen, dass das Padding nicht negativ wird
|
||||
if (totalPaddingSize < 0) totalPaddingSize = 0;
|
||||
|
||||
// Berechnung des Abstands vor und nach dem Text
|
||||
int paddingLeft = totalPaddingSize / 2;
|
||||
int paddingRight = totalPaddingSize - paddingLeft;
|
||||
|
||||
// Formatierung der Zeile: Text zentrieren
|
||||
String formattedValue = COLOR_CODE + SIDE_BORDER + " ".repeat(paddingLeft) + line + " ".repeat(paddingRight) + COLOR_CODE + SIDE_BORDER;
|
||||
builder.append(prefix).append(" ").append(formattedValue).append("<br>");
|
||||
|
||||
}
|
||||
// Ausgabe der unteren Linie
|
||||
builder.append(prefix).append(" ").append(bottomBorder);
|
||||
T2Csend.console(builder.toString());
|
||||
|
||||
}
|
||||
|
||||
// Methode zum Entfernen von Farbcodes und MiniMessage-Farbcodes aus dem Text, außer <br>
|
||||
private static String removeColorCodes(String text) {
|
||||
// Regex für alle Farbcodes und MiniMessage-Codes außer <br>
|
||||
String miniMessageRegex = "<(?!br)(color:#([A-Fa-f0-9]{6})|[a-zA-Z_]+)(:[a-zA-Z0-9_]+)?>|</[a-zA-Z_]+>";
|
||||
return text.replaceAll("§[a-f0-9k-oK-O]", "").replaceAll(miniMessageRegex, "");
|
||||
}
|
||||
|
||||
}
|
@@ -1,27 +1,38 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.minecraftVersion;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
|
||||
public class T2CmcVersion {
|
||||
|
||||
|
||||
public static void onCheck() {
|
||||
mcVersion = Bukkit.getServer().getVersion();
|
||||
bukkitVersion = Bukkit.getServer().getBukkitVersion();
|
||||
nms = Bukkit.getServer().getClass().getPackage().getName();
|
||||
mc1_8 = nms.contains("1_8");
|
||||
mc1_9 = nms.contains("1_9");
|
||||
mc1_10 = nms.contains("1_10");
|
||||
mc1_11 = nms.contains("1_11");
|
||||
mc1_12 = nms.contains("1_12");
|
||||
mc1_13 = nms.contains("1_13");
|
||||
mc1_14 = nms.contains("1_14");
|
||||
mc1_15 = nms.contains("1_15");
|
||||
mc1_16 = nms.contains("1_16");
|
||||
mc1_17 = nms.contains("1_17");
|
||||
mc1_18 = nms.contains("1_18");
|
||||
mc1_19 = nms.contains("1_19");
|
||||
mc1_20 = nms.contains("1_20");
|
||||
|
||||
T2CnmsVersions.init();
|
||||
nms = String.valueOf(T2CnmsVersions.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");
|
||||
@@ -44,6 +55,10 @@ public class T2CmcVersion {
|
||||
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");
|
||||
}
|
||||
|
||||
private static String mcVersion;
|
||||
@@ -61,6 +76,8 @@ public class T2CmcVersion {
|
||||
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;
|
||||
@@ -85,6 +102,10 @@ public class T2CmcVersion {
|
||||
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;
|
||||
|
||||
public static String getMcVersion() {
|
||||
return mcVersion;
|
||||
@@ -146,6 +167,14 @@ public class T2CmcVersion {
|
||||
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;
|
||||
}
|
||||
@@ -233,7 +262,74 @@ public class T2CmcVersion {
|
||||
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 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();
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,32 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.minecraftVersion;
|
||||
|
||||
public enum T2CnmsEnum {
|
||||
not_support,
|
||||
v1_8_R1,
|
||||
v1_8_R2,
|
||||
v1_8_R3,
|
||||
v1_9_R1,
|
||||
v1_9_R2,
|
||||
v1_10_R1,
|
||||
v1_11_R1,
|
||||
v1_12_R1,
|
||||
v1_13_R1,
|
||||
v1_13_R2,
|
||||
v1_14_R1,
|
||||
v1_15_R1,
|
||||
v1_16_R1,
|
||||
v1_16_R2,
|
||||
v1_16_R3,
|
||||
v1_17_R1,
|
||||
v1_18_R1,
|
||||
v1_18_R2,
|
||||
v1_19_R1,
|
||||
v1_19_R2,
|
||||
v1_19_R3,
|
||||
v1_20_R1,
|
||||
v1_20_R2,
|
||||
v1_20_R3,
|
||||
v1_20_R4,
|
||||
v1_21_R1,
|
||||
v1_21_R2,
|
||||
}
|
@@ -0,0 +1,102 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.minecraftVersion;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
|
||||
|
||||
public class T2CnmsVersions {
|
||||
|
||||
public static Class minecraftServerClass;
|
||||
|
||||
@Getter
|
||||
private static T2CnmsEnum t2CnmsEnum;
|
||||
|
||||
public static void init() {
|
||||
String mc = T2CmcVersion.getMcVersion();
|
||||
|
||||
if (mc.contains("(MC: 1.8)") || mc.contains("(MC: 1.8.1)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_8_R1;
|
||||
} else if (mc.contains("(MC: 1.8.3)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_8_R2;
|
||||
} else if (mc.contains("(MC: 1.8.4)") || mc.contains("(MC: 1.8.5)") || mc.contains("(MC: 1.8.6)") || mc.contains("(MC: 1.8.7)") || mc.contains("(MC: 1.8.8)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_8_R3;
|
||||
} else if (mc.contains("(MC: 1.9)") || mc.contains("(MC: 1.9.2)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_9_R1;
|
||||
} else if (mc.contains("(MC: 1.9.3)") || mc.contains("(MC: 1.9.4)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_9_R2;
|
||||
} else if (mc.contains("(MC: 1.10")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_10_R1;
|
||||
} else if (mc.contains("(MC: 1.11")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_11_R1;
|
||||
} else if (mc.contains("(MC: 1.12")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_12_R1;
|
||||
} else if (mc.contains("(MC: 1.13)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_13_R1;
|
||||
} else if (mc.contains("(MC: 1.13.1)") || mc.contains("(MC: 1.13.2)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_13_R2;
|
||||
} else if (mc.contains("(MC: 1.14")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_14_R1;
|
||||
} else if (mc.contains("(MC: 1.15")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_15_R1;
|
||||
} else if (mc.contains("(MC: 1.16)") || mc.contains("(MC: 1.16.1)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_16_R1;
|
||||
} else if (mc.contains("(MC: 1.16.2)") || mc.contains("(MC: 1.16.3)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_16_R2;
|
||||
} else if (mc.contains("(MC: 1.16.4)") || mc.contains("(MC: 1.16.5)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_16_R3;
|
||||
} else if (mc.contains("(MC: 1.17")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_17_R1;
|
||||
} else if (mc.contains("(MC: 1.18)") || mc.contains("(MC: 1.18.1)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_18_R1;
|
||||
} else if (mc.contains("(MC: 1.18.2)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_18_R2;
|
||||
} else if (mc.contains("(MC: 1.19)") || mc.contains("(MC: 1.19.1)") || mc.contains("(MC: 1.19.2)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_19_R1;
|
||||
} else if (mc.contains("(MC: 1.19.3)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_19_R2;
|
||||
} else if (mc.contains("(MC: 1.19.4)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_19_R3;
|
||||
} else if (mc.contains("(MC: 1.20)") || mc.contains("(MC: 1.20.1)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_20_R1;
|
||||
} else if (mc.contains("(MC: 1.20.2)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_20_R2;
|
||||
} else if (mc.contains("(MC: 1.20.3)") || mc.contains("(MC: 1.20.4)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_20_R3;
|
||||
} else if (mc.contains("(MC: 1.20.6)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_20_R4;
|
||||
} else if (mc.contains("(MC: 1.21)")) {
|
||||
t2CnmsEnum = T2CnmsEnum.v1_21_R1;
|
||||
} else t2CnmsEnum = T2CnmsEnum.not_support;
|
||||
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// public static void init() {
|
||||
//
|
||||
//
|
||||
// // List<String> list= Arrays.stream(Class .getPackages()).map(Package::getName).filter(n -> n.startsWith("net.minecraft.server")).collect(Collectors.toList());
|
||||
//
|
||||
// // for (String s : list){
|
||||
// // T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(),s);
|
||||
// //}
|
||||
//
|
||||
//
|
||||
// for (T2CnmsEnum nmsEnum : T2CnmsEnum.values()) {
|
||||
// try {
|
||||
// minecraftServerClass = Class.forName("net.minecraft.server." + nmsEnum + ".MinecraftServer");
|
||||
// } catch (ClassNotFoundException ignored) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// if (minecraftServerClass != null) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// // todo nicht kompatiebel
|
||||
// T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), "nicht kompa");
|
||||
//
|
||||
// }
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
// This class was created by JaTiTV.
|
||||
|
||||
package net.t2code.t2codelib.SPIGOT.api.sound;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class T2Csound {
|
||||
public static void playSound(Player player, String sound, int v, int v1) {
|
||||
playSound(player, Sound.valueOf(sound), v, v1);
|
||||
}
|
||||
|
||||
public static void playSound(Player player, Sound sound, int v, int v1) {
|
||||
player.playSound(player.getLocation(), sound, v, v1);
|
||||
}
|
||||
|
||||
|
||||
public static Sound checkSound(String sound1_8, String sound1_9, String sound1_13, String selectSoundFromConfig, String prefix) {
|
||||
String SOUND;
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
SOUND = sound1_8;
|
||||
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_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 (T2CmcVersion.isMc1_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) {
|
||||
T2Csend.console("§4\n§4\n§4\n" + T2CLibLanguages.VALUES.soundNotFound.getValue().toString().replace("[prefix]", prefix)
|
||||
.replace("[sound]", "§8Buy: §6" + selectSoundFromConfig) + "§4\n§4\n§4\n");
|
||||
return Sound.valueOf(sound);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,11 +1,13 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.update;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
|
||||
import net.t2code.t2codelib.UpdateType;
|
||||
import net.t2code.t2codelib.T2CupdateObject;
|
||||
import net.t2code.t2codelib.T2CupdateWebData;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -68,50 +70,48 @@ public class T2CupdateAPI {
|
||||
"[prefix] <color:#ff9499><hover:show_text:'<red>Click for more information</red>'><click:run_command:'/t2c updateinfo " + plugin.getName() + "'>Update information</click></hover></color><br>" +
|
||||
"[prefix]";
|
||||
|
||||
String value;
|
||||
String updateStatusVersion;
|
||||
|
||||
if (webData.isPreRelease()) {
|
||||
//todo if (!SelectLibConfig.getSeePreReleaseUpdates()) return;
|
||||
value = UpdateType.PRERELEASE.text;
|
||||
updateStatusVersion = UpdateType.PRERELEASE.text;
|
||||
if (publicVersion.toLowerCase().contains("dev")) {
|
||||
value = UpdateType.DEVELOPMENT.text;
|
||||
updateStatusVersion = UpdateType.DEVELOPMENT.text;
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("beta")) {
|
||||
value = UpdateType.BETA.text;
|
||||
updateStatusVersion = UpdateType.BETA.text;
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("snapshot")) {
|
||||
value = UpdateType.SNAPSHOT.text;
|
||||
updateStatusVersion = UpdateType.SNAPSHOT.text;
|
||||
}
|
||||
} else value = UpdateType.STABLE.text;
|
||||
} else updateStatusVersion = UpdateType.STABLE.text;
|
||||
|
||||
T2Csend.player(player, st.replace("[prefix]", prefix).replace("[value]", value).replace("[link]", webData.getUpdateUrl())
|
||||
T2Csend.player(player, st.replace("[prefix]", prefix).replace("[value]", updateStatusVersion).replace("[link]", webData.getUpdateUrl())
|
||||
.replace("[plv]", pluginVersion).replace("[puv]", publicVersion).replace("[dc]", discord));
|
||||
}
|
||||
|
||||
public static void sendUpdateMsg(String prefix, String discord, T2CupdateWebData webData, Plugin plugin) {
|
||||
String publicVersion = webData.getVersion();
|
||||
String pluginVersion = plugin.getDescription().getVersion();
|
||||
String value;
|
||||
String updateStatusVersion;
|
||||
if (webData.isPreRelease()) {
|
||||
value = UpdateType.PRERELEASE.text;
|
||||
updateStatusVersion = UpdateType.PRERELEASE.text;
|
||||
if (publicVersion.toLowerCase().contains("dev")) {
|
||||
value = UpdateType.DEVELOPMENT.text;
|
||||
updateStatusVersion = UpdateType.DEVELOPMENT.text;
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("beta")) {
|
||||
value = UpdateType.BETA.text;
|
||||
updateStatusVersion = UpdateType.BETA.text;
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("snapshot")) {
|
||||
value = UpdateType.SNAPSHOT.text;
|
||||
updateStatusVersion = UpdateType.SNAPSHOT.text;
|
||||
}
|
||||
} else value = UpdateType.STABLE.text;
|
||||
String h = "<br><dark_red>╔══════════════</dark_red>" + prefix + "<dark_red>══════════════</dark_red>";
|
||||
String s1 = "<br><dark_red>║</dark_red> <color:#6e90ff>A new [value] version was found!</color>".replace("[value]", value);
|
||||
String s2 = "<br><dark_red>║</dark_red> <color:#6e90ff>Your version: <red>" + pluginVersion + "</red> <gray>-</gray> Current version:</color> <green>" + webData.getVersion() + "</green>";
|
||||
String s3 = "<br><dark_red>║</dark_red> <color:#6e90ff>You can download it here:</color> <yellow>" + webData.getUpdateUrl() + "</yellow>";
|
||||
String s4 = "<br><dark_red>║</dark_red> <color:#6e90ff>You can find more information on Discord:</color> <yellow>" + discord + "</yellow>";
|
||||
String f = "<br><dark_red>╚══════════════</dark_red>" + prefix + "<dark_red>══════════════</dark_red>";
|
||||
String text = h + s1 + s2 + s3 + s4 + f;
|
||||
T2Csend.console(text);
|
||||
} else updateStatusVersion = UpdateType.STABLE.text;
|
||||
String s1 = " <color:#6e90ff>A new [value] version was found!</color>".replace("[value]", updateStatusVersion);
|
||||
String s2 = " <color:#6e90ff>Your version: <red>" + pluginVersion + "</red> <gray>-</gray> Current version:</color> <green>" + webData.getVersion() + "</green>";
|
||||
String s3 = " <color:#6e90ff>You can download it here:</color> <yellow>" + webData.getUpdateUrl() + "</yellow>";
|
||||
String s4 = " <color:#6e90ff>You can find more information on Discord:</color> <yellow>" + discord + "</yellow>";
|
||||
|
||||
T2Ctemplate.sendFrameCenter(prefix,s1,s2,s3,s4);
|
||||
}
|
||||
|
||||
public static String updateInfo(String[] args, Boolean player) {
|
||||
@@ -119,9 +119,13 @@ public class T2CupdateAPI {
|
||||
try {
|
||||
object = T2CupdateAPI.pluginVersions.get(args[1]);
|
||||
} catch (Exception e) {
|
||||
return "Das Plugin " + args[1] + " gibts net"; // todo
|
||||
return Util.getPrefix() + " <red>The plugin <yellow>" + args[1] + "</yellow> is not registered in the update checker of T2Code!</red>";
|
||||
}
|
||||
if (object == null) return Util.getPrefix() + " <red>The plugin <yellow>" + args[1] + "</yellow> is not registered in the update checker of T2Code!</red>";
|
||||
T2CupdateWebData webData = object.webData;
|
||||
if (webData == null) {
|
||||
return Util.getPrefix() + " <b><dark_red>It could not be checked for updates with the plugin <yellow>" + args[1] + "</yellow>!</dark_red></b>";
|
||||
}
|
||||
String pluginName = T2CupdateAPI.pluginVersions.get(args[1]).pluginName;
|
||||
String pluginVersion = T2CupdateAPI.pluginVersions.get(args[1]).pluginVersion;
|
||||
|
||||
@@ -162,7 +166,7 @@ public class T2CupdateAPI {
|
||||
|
||||
String text;
|
||||
|
||||
text = "<dark_red>╔══════════════════════</dark_red>";
|
||||
text = "<br><dark_red>╔══════════════════════</dark_red>";
|
||||
text = text + pluginNameString;
|
||||
text = text + pluginVersionString;
|
||||
text = text + updateInfoString.replace("[value]", object.updateAvailable ? "Update available" : "Info about your version");
|
||||
@@ -181,7 +185,7 @@ public class T2CupdateAPI {
|
||||
}
|
||||
|
||||
public static void onUpdateCheck(Plugin plugin, String prefix, String gitKey, Integer spigotID, String discord, Boolean updateCheckOnJoin, Boolean seePreReleaseUpdates, Integer timeInterval) {
|
||||
if (SelectLibConfig.getUpdateCheckFullDisable()) return;
|
||||
if ((boolean) T2CLibConfig.VALUES.updateCheckFullDisable.getValue()) return;
|
||||
new T2CupdateCheckerGit((JavaPlugin) plugin, prefix, gitKey, spigotID, discord, updateCheckOnJoin, seePreReleaseUpdates, timeInterval);
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ package net.t2code.t2codelib.SPIGOT.api.update;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
|
||||
import net.t2code.t2codelib.T2CupdateObject;
|
||||
import net.t2code.t2codelib.T2CupdateWebData;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -33,14 +33,14 @@ public class T2CupdateCheckerGit {
|
||||
String finalRepoURL = RepoURL;
|
||||
|
||||
Integer finalInterval;
|
||||
if (timeInterval < 1){
|
||||
if (timeInterval < 1) {
|
||||
finalInterval = 1;
|
||||
} else finalInterval = timeInterval;
|
||||
|
||||
Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (SelectLibConfig.getUpdateCheckFullDisable()) return;
|
||||
if ((boolean) T2CLibConfig.VALUES.updateCheckFullDisable.getValue()) return;
|
||||
getVersion((webData) -> {
|
||||
T2CupdateObject update = new T2CupdateObject(
|
||||
plugin.getName(),
|
||||
@@ -52,6 +52,10 @@ public class T2CupdateCheckerGit {
|
||||
);
|
||||
|
||||
T2CupdateAPI.pluginVersions.put(plugin.getName(), update);
|
||||
if (T2CupdateAPI.pluginVersions.get(plugin.getName()) == null) {
|
||||
T2Csend.debugmsg(T2CodeLibMain.getPlugin(), "'" + plugin.getName() + "' UpdateAPI T2CupdateAPI.pluginVersions.get(plugin.getName()) == null");
|
||||
return;
|
||||
}
|
||||
if (T2CupdateAPI.pluginVersions.get(plugin.getName()).updateAvailable) {
|
||||
if (!update.load) {
|
||||
new BukkitRunnable() {
|
||||
@@ -64,7 +68,7 @@ public class T2CupdateCheckerGit {
|
||||
} else T2CupdateAPI.sendUpdateMsg(prefix, discord, webData, plugin);
|
||||
} else {
|
||||
if (!update.load) {
|
||||
T2Csend.console(prefix + " §2No update found.");
|
||||
T2Csend.console(prefix + " §e║ " + "§2No update found.");
|
||||
update.load = true;
|
||||
}
|
||||
}
|
||||
@@ -73,7 +77,7 @@ public class T2CupdateCheckerGit {
|
||||
|
||||
}, plugin.getDescription().getVersion(), spigotID, finalRepoURL, updateCheckOnJoin, seePreReleaseUpdates, timeInterval);
|
||||
}
|
||||
}, 0L, finalInterval * 60 * 20L);
|
||||
}, 10L, finalInterval * 60 * 20L);
|
||||
}
|
||||
|
||||
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String URL, Boolean updateCheckOnJoin, Boolean seePreReleaseUpdates, Integer timeInterval) {
|
||||
@@ -98,19 +102,19 @@ public class T2CupdateCheckerGit {
|
||||
return;
|
||||
}
|
||||
JSONObject obj = new JSONObject(data);
|
||||
String UpdateName = obj.getString("name");
|
||||
String tag_name = obj.getString("tag_name");
|
||||
String body = obj.getString("body").replace("\n", "<br>").replace("\r", "").replace("'", "''").replace("**", "");
|
||||
String updateurl = obj.getString("html_url");
|
||||
boolean prerelease = obj.getBoolean("prerelease");
|
||||
String updateTitle = obj.getString("name");
|
||||
String version = obj.getString("tag_name");
|
||||
String updateDescription = obj.getString("body").replace("\n", "<br>").replace("\r", "").replace("'", "''").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 formattedDate = outputFormat.format(parsedDate);
|
||||
String publishedAt = outputFormat.format(parsedDate);
|
||||
|
||||
String gitURL = updateurl;
|
||||
String gitURL = updateUrl;
|
||||
JSONArray downloadArray = obj.getJSONArray("assets");
|
||||
String downloadURL;
|
||||
if (downloadArray.isEmpty()) {
|
||||
@@ -119,14 +123,14 @@ public class T2CupdateCheckerGit {
|
||||
downloadURL = downloadArray.getJSONObject(0).getString("browser_download_url");
|
||||
}
|
||||
|
||||
if (!prerelease) {
|
||||
if (!preRelease) {
|
||||
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
||||
updateurl = "https://www.spigotmc.org/resources/" + spigotID;
|
||||
updateUrl = "https://www.spigotmc.org/resources/" + spigotID;
|
||||
}
|
||||
|
||||
T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, formattedDate, downloadURL, gitURL, prerelease);
|
||||
T2CupdateWebData webData = new T2CupdateWebData(updateTitle, version, updateDescription, updateUrl, publishedAt, downloadURL, gitURL, preRelease);
|
||||
consumer.accept(webData);
|
||||
} catch (Exception var10) {
|
||||
} catch (Exception exception) {
|
||||
Boolean load = false;
|
||||
if (T2CupdateAPI.pluginVersions.containsKey(plugin.getName())) {
|
||||
load = T2CupdateAPI.pluginVersions.get(plugin.getName()).load;
|
||||
@@ -140,7 +144,9 @@ public class T2CupdateCheckerGit {
|
||||
updateCheckOnJoin
|
||||
);
|
||||
T2CupdateAPI.pluginVersions.put(plugin.getName(), update);
|
||||
this.plugin.getLogger().severe("§4 Cannot look for updates: " + var10.getMessage());
|
||||
|
||||
T2Csend.error(this.plugin, "§4 Cannot look for updates: " + exception.getMessage());
|
||||
exception.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -1,37 +1,60 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.yaml;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
|
||||
public class T2CLibConfig {
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, use the method from the return!
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static Boolean getUpdateCheckOnJoin() {
|
||||
return SelectLibConfig.getUpdateCheckOnJoin();
|
||||
}
|
||||
|
||||
public static Boolean getT2cTestDevelopment() {
|
||||
return SelectLibConfig.getT2cTestDevelopment();
|
||||
return (boolean) net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig.VALUES.updateCheckOnJoin.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, use the method from the return!
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static Integer getUpdateCheckTimeInterval() {
|
||||
return SelectLibConfig.getUpdateCheckTimeInterval();
|
||||
return (Integer) net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig.VALUES.updateCheckTimeInterval.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, use the method from the return!
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static Boolean getSeePreReleaseUpdates() {
|
||||
return SelectLibConfig.getSeePreReleaseUpdates();
|
||||
return (boolean) net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig.VALUES.seePreReleaseUpdates.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, use the method from the return!
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static Boolean getDebug() {
|
||||
return SelectLibConfig.getDebug();
|
||||
return (boolean) net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig.VALUES.debug.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, use the method from the return!
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static String getLanguage() {
|
||||
return SelectLibConfig.getLanguage();
|
||||
return (String) net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig.VALUES.language.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, use the method from the return!
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static Boolean getBungee() {
|
||||
return SelectLibConfig.getBungee();
|
||||
return (boolean) net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig.VALUES.proxy.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, use the method from the return!
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static Boolean getInventoriesCloseByServerStop() {
|
||||
return SelectLibConfig.getInventoriesCloseByServerStop();
|
||||
return (boolean) net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig.VALUES.inventoriesCloseByServerStop.getValue();
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.yaml;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.languages.SelectLibMsg;
|
||||
import net.t2code.t2codelib.SPIGOT.api.sound.T2Csound;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -12,51 +11,80 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class T2Cconfig {
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static void set(String path, String value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static void set(String path, Object value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static void set(String path, YamlConfiguration YamlConfiguration) {
|
||||
YamlConfiguration.set(path, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static void set(String path, Integer value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static void set(String path, Double value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static void set(String path, Boolean value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static void set(String path, List<String> value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static void set(String path, ItemStack value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static void setSound(String soundName, String sound1_8, String sound1_9, String sound1_13, YamlConfiguration yamlConfiguration) {
|
||||
set("Sound." + soundName + ".Enable", true, yamlConfiguration);
|
||||
String sound;
|
||||
@@ -68,6 +96,9 @@ public class T2Cconfig {
|
||||
set("Sound." + soundName + ".Sound", sound, yamlConfiguration);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static void setSound(String soundName, String sound1_8, String sound1_13, YamlConfiguration yamlConfiguration) {
|
||||
set("Sound." + soundName + ".Enable", true, yamlConfiguration);
|
||||
String sound;
|
||||
@@ -77,77 +108,102 @@ public class T2Cconfig {
|
||||
set("Sound." + soundName + ".Sound", sound, yamlConfiguration);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static void setSound(String soundName, String sound, YamlConfiguration yamlConfiguration) {
|
||||
set("Sound." + soundName + ".Enable", true, yamlConfiguration);
|
||||
set("Sound." + soundName + ".Sound", sound.toString(), yamlConfiguration);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static boolean selectSoundEnable(String soundName, YamlConfiguration yamlConfiguration) {
|
||||
return selectBoolean("Sound." + soundName + ".Enable", yamlConfiguration);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static String selectSound(String prefix, String soundName, YamlConfiguration yamlConfiguration) {
|
||||
return select(prefix, "Sound." + soundName + ".Sound", yamlConfiguration);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static Sound checkSound(String sound1_8, String sound1_9, String sound1_13, String selectSoundFromConfig, String prefix) {
|
||||
String SOUND;
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
SOUND = sound1_8;
|
||||
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
SOUND = sound1_9;
|
||||
} else SOUND = sound1_13;
|
||||
|
||||
return checkSound(SOUND, selectSoundFromConfig, prefix);
|
||||
return T2Csound.checkSound(sound1_8, sound1_9, sound1_13, selectSoundFromConfig, prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static Sound checkSound(String sound1_8, String sound1_13, String selectSoundFromConfig, String prefix) {
|
||||
String SOUND;
|
||||
if (T2CmcVersion.isMc1_8()) {
|
||||
SOUND = sound1_8;
|
||||
} else SOUND = sound1_13;
|
||||
|
||||
return checkSound(SOUND, selectSoundFromConfig, prefix);
|
||||
return T2Csound.checkSound(sound1_8, sound1_13, selectSoundFromConfig, prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static Sound checkSound(String sound, String selectSoundFromConfig, String prefix) {
|
||||
try {
|
||||
return Sound.valueOf(selectSoundFromConfig);
|
||||
} catch (Exception e) {
|
||||
T2Csend.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);
|
||||
}
|
||||
return T2Csound.checkSound(sound, selectSoundFromConfig, prefix);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static String select(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
||||
return T2Creplace.replace(prefix, yamlConfiguration.getString(path));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static Object selectObject(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
||||
return T2Creplace.replaceObject(prefix, yamlConfiguration.get(path));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static Integer selectInt(String path, YamlConfiguration yamlConfiguration) {
|
||||
return (yamlConfiguration.getInt(path));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static Boolean selectBoolean(String path, YamlConfiguration yamlConfiguration) {
|
||||
return (yamlConfiguration.getBoolean(path));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static Double selectDouble(String path, YamlConfiguration yamlConfiguration) {
|
||||
return (yamlConfiguration.getDouble(path));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static List<String> selectList(String path, YamlConfiguration yamlConfiguration) {
|
||||
return (yamlConfiguration.getStringList(path));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static ItemStack selectItemStack(String path, YamlConfiguration yamlConfiguration) {
|
||||
return (yamlConfiguration.getItemStack(path));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static List<String> selectList(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
||||
List<String> output = new ArrayList<>();
|
||||
List<String> input = yamlConfiguration.getStringList(path);
|
||||
@@ -157,6 +213,9 @@ public class T2Cconfig {
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since version 16.7, please use the new T2CconfigWriter.
|
||||
*/
|
||||
public static void select(String prefix, List<String> value, String path, YamlConfiguration yamlConfiguration) {
|
||||
List<String> output = new ArrayList<>();
|
||||
List<String> input = yamlConfiguration.getStringList(path);
|
||||
|
@@ -0,0 +1,64 @@
|
||||
// This class was created by JaTiTV.
|
||||
|
||||
package net.t2code.t2codelib.SPIGOT.api.yaml;
|
||||
|
||||
import net.t2code.t2codelib.T2CLanguageEnum;
|
||||
import net.t2code.t2codelib.T2CconfigItem;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class T2CconfigWriter {
|
||||
|
||||
private static FileConfiguration config;
|
||||
|
||||
public static void createConfig(File configFile, T2CconfigItem[] values, String... header) {
|
||||
boolean exist = configFile.exists();
|
||||
if (!exist) {
|
||||
configFile.getParentFile().mkdirs();
|
||||
try {
|
||||
configFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
} else exist = true;
|
||||
|
||||
config = YamlConfiguration.loadConfiguration(configFile);
|
||||
Map<String, List<String>> comments = new LinkedHashMap<>();
|
||||
|
||||
T2CLanguageEnum lang = T2CLanguageEnum.english;
|
||||
try {
|
||||
lang = T2CLanguageEnum.valueOf(config.getString(values[0].getLanguagePath().replace(".yml", "")));
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
|
||||
for (T2CconfigItem item : values) {
|
||||
if (item.getForceSet() || !exist) {
|
||||
config.addDefault(item.getPath(), item.getValue());
|
||||
|
||||
List<String> commandList = item.getComments().get(lang);
|
||||
if (commandList != null) {
|
||||
comments.put(item.getPath(), commandList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Copy default values if they are missing
|
||||
config.options().copyDefaults(true);
|
||||
|
||||
T2CymlWriter.saveConfigWithComments(configFile, config, comments, header);
|
||||
readConfig(config, values);
|
||||
}
|
||||
|
||||
private static void readConfig(FileConfiguration config, T2CconfigItem[] values) {
|
||||
for (T2CconfigItem value : values) {
|
||||
value.setValue(config.get(value.getPath()));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,89 @@
|
||||
// This class was created by JaTiTV.
|
||||
|
||||
package net.t2code.t2codelib.SPIGOT.api.yaml;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
import net.t2code.t2codelib.T2CLanguageEnum;
|
||||
import net.t2code.t2codelib.T2CconfigItemLanguages;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
public class T2CconfigWriterLanguage {
|
||||
|
||||
private static FileConfiguration config;
|
||||
|
||||
public static void createConfig(String prefix,File path, T2CconfigItemLanguages[] values, String loadConfig,boolean pluginStart, String... header) {
|
||||
|
||||
File f = new File(path + "/languages/");
|
||||
f.mkdirs();
|
||||
File[] fileArray = f.listFiles();
|
||||
if(fileArray.length == 0){
|
||||
List<File> zw = new ArrayList<>();
|
||||
for(T2CLanguageEnum lan : T2CLanguageEnum.values()){
|
||||
if(values[0].getLanguage().containsKey(lan)){
|
||||
zw.add(new File(path + "/languages/" + lan.name() + ".yml"));
|
||||
}
|
||||
}
|
||||
fileArray = zw.toArray(new File[0]);
|
||||
}
|
||||
for (File langFile : fileArray) {
|
||||
if (langFile.getName().endsWith(".yml")) {
|
||||
T2CLanguageEnum lang = T2CLanguageEnum.english;
|
||||
try {
|
||||
lang = T2CLanguageEnum.valueOf(langFile.getName().replace(".yml", ""));
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
|
||||
if (!langFile.exists()) {
|
||||
langFile.getParentFile().mkdirs();
|
||||
try {
|
||||
langFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
Map<String, List<String>> comments = new LinkedHashMap<>();
|
||||
// Copy default values if they are missing
|
||||
config = YamlConfiguration.loadConfiguration(langFile);
|
||||
config.options().copyDefaults(true);
|
||||
for (T2CconfigItemLanguages item : values) {
|
||||
config.addDefault(item.getPath(), item.getLanguage().get(lang));
|
||||
|
||||
|
||||
List<String> commandList = item.getComments().get(lang);
|
||||
if (commandList != null) {
|
||||
comments.put(item.getPath(), commandList);
|
||||
}
|
||||
}
|
||||
T2CymlWriter.saveConfigWithComments(langFile, config, comments, header);
|
||||
}
|
||||
}
|
||||
readConfig(prefix,path,values, loadConfig, pluginStart);
|
||||
}
|
||||
|
||||
private static void readConfig(String prefix, File path, T2CconfigItemLanguages[] values, String loadConfig, boolean pluginStart) {
|
||||
String selectMSG;
|
||||
File msg;
|
||||
msg = new File(path, "languages/" + loadConfig + ".yml");
|
||||
if (!msg.isFile()) {
|
||||
T2Ctemplate.setCenterAligned(prefix, "", pluginStart);
|
||||
T2Ctemplate.setCenterAligned(prefix, "§4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", pluginStart);
|
||||
T2Ctemplate.setCenterAligned(prefix, "§4The selected §c" + loadConfig + " §4language file was not found.", pluginStart);
|
||||
T2Ctemplate.setCenterAligned(prefix, "§6The default language §e" + T2CLanguageEnum.english.name() + " §6is used!", pluginStart);
|
||||
T2Ctemplate.setCenterAligned(prefix, "§4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", pluginStart);
|
||||
T2Ctemplate.setCenterAligned(prefix, "", pluginStart);
|
||||
msg = new File(path, "languages/" + T2CLanguageEnum.english.name() + ".yml");
|
||||
selectMSG = T2CLanguageEnum.english.name();
|
||||
} else selectMSG = loadConfig;
|
||||
YamlConfiguration yml = YamlConfiguration.loadConfiguration(msg);
|
||||
for (T2CconfigItemLanguages value : values) {
|
||||
value.setValue(yml.get(value.getPath()));
|
||||
}
|
||||
T2Ctemplate.setCenterAligned(prefix, "§2Language successfully selected to: §6" + selectMSG, pluginStart);
|
||||
}
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
// This class was created by JaTiTV.
|
||||
|
||||
package net.t2code.t2codelib.SPIGOT.api.yaml;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class T2CymlWriter {
|
||||
protected static void saveConfigWithComments(File file, FileConfiguration config, Map<String, List<String>> comments, String... headers) {
|
||||
try {
|
||||
StringBuilder configContent = new StringBuilder();
|
||||
for (String h : headers) {
|
||||
configContent.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();
|
||||
}
|
||||
}
|
||||
|
||||
protected static void addSection(ConfigurationSection section, Map<String, List<String>> comments, StringBuilder builder, String prefix, int indentLevel) {
|
||||
String indent = " ".repeat(indentLevel);
|
||||
|
||||
for (String key : section.getKeys(false)) {
|
||||
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 ConfigurationSection) {
|
||||
// Correctly add the section
|
||||
builder.append(indent).append(key).append(":\n");
|
||||
addSection((ConfigurationSection) 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) {
|
||||
builder.append(indent).append(key).append(": ").append("\n");
|
||||
List<Object> zw = (List<Object>) value;
|
||||
for (Object s : zw) {
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,8 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -7,6 +10,7 @@ import org.bukkit.entity.Player;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class T2CbungeeCommandSenderReciver {
|
||||
|
||||
@@ -24,18 +28,22 @@ public class T2CbungeeCommandSenderReciver {
|
||||
}
|
||||
}
|
||||
output.writeUTF(information);
|
||||
output.writeUTF(String.valueOf(T2CLibConfig.VALUES.serverUUID.getValue()));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
player.sendPluginMessage(T2CodeLibMain.getPlugin(), "t2c:bcmd", stream.toByteArray());
|
||||
}else {
|
||||
for(Player player : Bukkit.getOnlinePlayers()){
|
||||
player.sendPluginMessage(T2CodeLibMain.getPlugin(), "t2c:bcmd", stream.toByteArray());
|
||||
return;
|
||||
}
|
||||
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received T2CbungeeCommandSenderReciver: t2c:bcmd - " + Arrays.toString(stream.toByteArray()) + " Player: " + player.getName());
|
||||
} else {
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
player.sendPluginMessage(T2CodeLibMain.getPlugin(), "t2c:bcmd", stream.toByteArray());
|
||||
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received T2CbungeeCommandSenderReciver: t2c:bcmd - " + Arrays.toString(stream.toByteArray()) + " Player: " + player.getName());
|
||||
return;
|
||||
}
|
||||
//todo
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,19 +5,22 @@ import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import net.t2code.t2codelib.SPIGOT.api.bungeePlayers.T2CbungeePlayers;
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CnmsEnum;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CnmsVersions;
|
||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.system.bstats.Metrics;
|
||||
import net.t2code.t2codelib.SPIGOT.system.cmd.CmdExecuter;
|
||||
import net.t2code.t2codelib.SPIGOT.system.cmd.Development;
|
||||
import net.t2code.t2codelib.SPIGOT.system.cmd.ReportLogStorage;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.ConfigCreate;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.languages.LanguagesCreate;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.languages.SelectLibMsg;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages;
|
||||
import net.t2code.t2codelib.T2CplatformDetector;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@@ -28,29 +31,41 @@ import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public final class T2CodeLibMain extends JavaPlugin {
|
||||
@Getter
|
||||
private static T2CodeLibMain plugin;
|
||||
@Getter
|
||||
private static Economy eco = null;
|
||||
@Getter
|
||||
private static Permission perm = null;
|
||||
|
||||
@Getter
|
||||
private static List<String> autor;
|
||||
@Getter
|
||||
private static String version;
|
||||
|
||||
@Getter
|
||||
private static Boolean mmIsLoad = true;
|
||||
@Getter
|
||||
private static Boolean load = false;
|
||||
@Getter
|
||||
private static T2CplatformDetector.PlatformType plattform;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Plugin startup logic
|
||||
plugin = this;
|
||||
autor = plugin.getDescription().getAuthors();
|
||||
// logger = getLogger();
|
||||
version = plugin.getDescription().getVersion();
|
||||
|
||||
try {
|
||||
adventure = BukkitAudiences.create(this);
|
||||
} catch (Exception e) {
|
||||
mmIsLoad = false;
|
||||
}
|
||||
plattform = T2CplatformDetector.detectPlatform();
|
||||
long long_ = T2Ctemplate.onLoadHeader(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
||||
|
||||
checkIsBungee();
|
||||
String prefix = Util.getPrefix();
|
||||
|
||||
@@ -61,60 +76,102 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
}
|
||||
T2CmcVersion.onCheck();
|
||||
|
||||
if (T2CmcVersion.isNms1_20_R2()) {
|
||||
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.console(prefix);
|
||||
T2Csend.warning(plugin, "The 1.20.* (R2) 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");
|
||||
T2Csend.console(prefix);
|
||||
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
||||
if (!SelectLibConfig.getT2cTestDevelopment()) {
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (T2CnmsVersions.getT2CnmsEnum() == T2CnmsEnum.not_support) {
|
||||
T2Ctemplate.setCenterAligned(prefix, "", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "§4!!!!!!!!!!!!!!!!!!!!", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "The " + T2CmcVersion.getMcVersion() + " is a very fresh / new version.", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "The plugin may not yet be supported on this server!", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "If there are any bugs in our plugins,", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "please report them to us via our Discord: http://dc.t2code.net", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "§4!!!!!!!!!!!!!!!!!!!!", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "", true);
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
T2Csend.console(prefix + " §3Server run on: §6" + T2CmcVersion.getMcVersion() + " / " + T2CmcVersion.getNms());
|
||||
if (T2CmcVersion.isMc1_22()) {
|
||||
T2Ctemplate.setCenterAligned(prefix, "", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "§4!!!!!!!!!!!!!!!!!!!!", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "The 1.22 is a very fresh / new version.", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "If there are any bugs in our plugins,", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "please report them to us via our Discord: http://dc.t2code.net", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "§4!!!!!!!!!!!!!!!!!!!!", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "", true);
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
T2Ctemplate.onLoadSeparateStroke(prefix);
|
||||
T2Ctemplate.setCenterAligned(prefix, "§2Server run on:", true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "§3NMS: §6" + T2CmcVersion.getNms(), true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "§3Platform: §6" + plattform.name(), true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "§3Bukkit Version: §6" + T2CmcVersion.getBukkitVersion(), true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "§3Server Version: §6" + T2CmcVersion.getMcVersion(), true);
|
||||
|
||||
T2Ctemplate.onLoadSeparateStroke(prefix);
|
||||
if (eco != null) {
|
||||
String st = eco.getName();
|
||||
if (eco.getName().equals("CMIEconomy")) st = "CMI";
|
||||
if (Bukkit.getPluginManager().getPlugin(st) != null) {
|
||||
T2Csend.console(prefix + " §3Economy: §6" + eco.getName() + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion() + " §7- §e" +
|
||||
(System.currentTimeMillis() - long_) + "ms");
|
||||
} else T2Csend.console(prefix + " §3Economy: §6" + eco.getName() + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
} else T2Csend.console(prefix + " §3Economy: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
T2Ctemplate.setCenterAligned(prefix, "§3Economy: §6" + eco.getName() + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion() + " §7- §e" +
|
||||
(System.currentTimeMillis() - long_) + "ms", true);
|
||||
} else
|
||||
T2Ctemplate.setCenterAligned(prefix, "§3Economy: §6" + eco.getName() + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
} else
|
||||
T2Ctemplate.setCenterAligned(prefix, "§3Economy: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
|
||||
if (perm != null) {
|
||||
if (Bukkit.getPluginManager().getPlugin(perm.getName()) != null) {
|
||||
T2Csend.console(prefix + " §3Permission plugin: §6" + perm.getName() + " - " + Bukkit.getPluginManager().getPlugin(perm.getName()).getDescription().getVersion()
|
||||
+ " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
} else T2Csend.console(prefix + " §3Permission plugin: §6" + perm.getName() + " - §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
} else T2Csend.console(prefix + " §3Permission plugin: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
T2Ctemplate.setCenterAligned(prefix, "§3Permission plugin: §6" + perm.getName() + " - " + Bukkit.getPluginManager().getPlugin(perm.getName()).getDescription().getVersion()
|
||||
+ " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
} else
|
||||
T2Ctemplate.setCenterAligned(prefix, "§3Permission plugin: §6" + perm.getName() + " - §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
} else
|
||||
T2Ctemplate.setCenterAligned(prefix, "§3Permission plugin: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
|
||||
if (T2CpluginCheck.papi()) {
|
||||
T2Csend.console(prefix + " §3PlaceholderAPI: §6connected" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
T2Ctemplate.setCenterAligned(prefix, "§3PlaceholderAPI: §6connected" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
}
|
||||
|
||||
T2Csend.console(prefix + " §3Kyori MiniMessage Support: "+ (getMmIsLoad() ? "§2load" : "§4not load") + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
T2Ctemplate.setCenterAligned(prefix, "§3Kyori MiniMessage Support: " + (getMmIsLoad() ? "§2load" : "§4not load") + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
|
||||
|
||||
plugin.getCommand("t2code").setExecutor(new CmdExecuter());
|
||||
ConfigCreate.configCreate();
|
||||
T2CitemVersion.scan();
|
||||
LanguagesCreate.langCreate();
|
||||
SelectLibConfig.onSelect();
|
||||
SelectLibMsg.onSelect();
|
||||
|
||||
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), Util.getSpigotID(), Util.getDiscord(), SelectLibConfig.getUpdateCheckOnJoin(), SelectLibConfig.getSeePreReleaseUpdates(),
|
||||
SelectLibConfig.getUpdateCheckTimeInterval());
|
||||
T2Ctemplate.onLoadSeparateStroke(prefix);
|
||||
T2CLibConfig.set(true);
|
||||
|
||||
T2CitemVersion.scan();
|
||||
T2CLibLanguages.set(true);
|
||||
|
||||
T2Ctemplate.onLoadSeparateStroke(prefix);
|
||||
T2Ctemplate.setCenterAligned(prefix, "§3Use Proxy: §6" + (boolean) T2CLibConfig.VALUES.proxy.getValue(), true);
|
||||
T2Ctemplate.setCenterAligned(prefix, "§3serverUUID: §6" + T2CLibConfig.VALUES.serverUUID.getValue(), true);
|
||||
|
||||
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), Util.getSpigotID(), Util.getDiscord(),
|
||||
(boolean) T2CLibConfig.VALUES.updateCheckOnJoin.getValue(),
|
||||
(boolean) T2CLibConfig.VALUES.seePreReleaseUpdates.getValue(),
|
||||
(int) T2CLibConfig.VALUES.updateCheckTimeInterval.getValue());
|
||||
Metrics.Bstats(plugin, Util.getBstatsID());
|
||||
if (SelectLibConfig.getBungee()) {
|
||||
if ((boolean) T2CLibConfig.VALUES.proxy.getValue()) {
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
|
||||
T2Cdebug.debug(plugin, "registerIncomingPluginChannel §et2c:bcmd");
|
||||
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bonlp");
|
||||
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, "t2c:bonlp")) {
|
||||
T2Csend.debug(plugin, "registerIncomingPluginChannel §et2c:bonlp");
|
||||
T2Cdebug.debug(plugin, "registerIncomingPluginChannel §et2c:bonlp");
|
||||
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, "t2c:bonlp", new T2CbungeePlayers());
|
||||
T2CbungeePlayers.callAllBungeePlayers();
|
||||
}
|
||||
@@ -122,7 +179,7 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
|
||||
ReportLogStorage.load();
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new Development(), plugin);
|
||||
T2Ctemplate.onLoadFooter(prefix, long_);
|
||||
load = true;
|
||||
}
|
||||
@@ -132,14 +189,14 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
// Plugin shutdown logic
|
||||
if (!load) return;
|
||||
ReportLogStorage.save();
|
||||
if (SelectLibConfig.getInventoriesCloseByServerStop()) {
|
||||
if ((boolean) T2CLibConfig.VALUES.inventoriesCloseByServerStop.getValue()) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
player.closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
Vault.vaultDisable();
|
||||
T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
||||
T2Ctemplate.onDisable(Util.getPrefix(), this);
|
||||
if (mmIsLoad) {
|
||||
if (this.adventure != null) {
|
||||
this.adventure.close();
|
||||
@@ -160,26 +217,6 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
T2CodeLibMain.perm = perm;
|
||||
}
|
||||
|
||||
public static T2CodeLibMain getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public static Economy getEco() {
|
||||
return eco;
|
||||
}
|
||||
|
||||
public static Permission getPerm() {
|
||||
return perm;
|
||||
}
|
||||
|
||||
public static List<String> getAutor() {
|
||||
return autor;
|
||||
}
|
||||
|
||||
public static String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
private static BukkitAudiences adventure;
|
||||
|
||||
public BukkitAudiences getAdventure() {
|
||||
@@ -196,13 +233,7 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
isBungee = yamlConfiguration.getBoolean("settings.bungeecord");
|
||||
}
|
||||
|
||||
@Getter
|
||||
private static Boolean isBungee;
|
||||
|
||||
public static Boolean getIsBungee() {
|
||||
return isBungee;
|
||||
}
|
||||
|
||||
public static Boolean getMmIsLoad() {
|
||||
return mmIsLoad;
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ package net.t2code.t2codelib.SPIGOT.system;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
@@ -22,14 +22,15 @@ public class Vault {
|
||||
T2CodeLibMain.setEco(eco.getProvider());
|
||||
if (T2CodeLibMain.getEco() != null) {
|
||||
connected = true;
|
||||
T2Csend.console(Util.getPrefix() + " §2Vault / Economy successfully connected!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
|
||||
T2Ctemplate.setCenterAligned(Util.getPrefix(), " §2Vault / Economy successfully connected!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
} else {
|
||||
connected = false;
|
||||
T2Csend.console(Util.getPrefix() + " §4Economy could not be connected / found! [1]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
T2Ctemplate.setCenterAligned(Util.getPrefix(), " §4Economy could not be connected / found! [1]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
}
|
||||
} else {
|
||||
connected = false;
|
||||
T2Csend.console(Util.getPrefix() + " §4Economy could not be connected / found! [2]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
T2Ctemplate.setCenterAligned(Util.getPrefix(), " §4Economy could not be connected / found! [2]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
}
|
||||
RegisteredServiceProvider<Permission> perm = T2CodeLibMain.getPlugin().getServer().getServicesManager().getRegistration(Permission.class);
|
||||
if (perm != null) {
|
||||
@@ -38,13 +39,13 @@ public class Vault {
|
||||
} else {
|
||||
vaultEnable = false;
|
||||
connected = false;
|
||||
T2Csend.console(Util.getPrefix() + " §4Vault could not be connected! [3]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
T2Ctemplate.setCenterAligned(Util.getPrefix()," §4Vault could not be connected! [3]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
}
|
||||
}
|
||||
|
||||
public static void vaultDisable() {
|
||||
if (!connected) return;
|
||||
connected = false;
|
||||
T2Csend.console(Util.getPrefix() + " §4Vault / Economy successfully deactivated.");
|
||||
T2Ctemplate.setCenterAligned(Util.getPrefix(), " §4Vault / Economy successfully deactivated.", true);
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
package net.t2code.t2codelib.SPIGOT.system.bstats;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -31,7 +31,7 @@ public class Metrics {
|
||||
public static void Bstats(Plugin plugin, int bstatsID) {
|
||||
int pluginId = bstatsID; // <-- Replace with the id of your plugin!
|
||||
Metrics metrics = new Metrics((JavaPlugin) plugin, pluginId);
|
||||
metrics.addCustomChart(new SimplePie("updatecheckonjoin", () -> String.valueOf(SelectLibConfig.getUpdateCheckOnJoin())));
|
||||
metrics.addCustomChart(new SimplePie("updatecheckonjoin", () -> String.valueOf(T2CLibConfig.VALUES.updateCheckOnJoin.getValue())));
|
||||
}
|
||||
|
||||
private final Plugin plugin;
|
||||
|
@@ -1,10 +1,13 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system.cmd;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.api.bungeePlayers.T2CbungeePlayers;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CbungeeCommandSenderReciver;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages;
|
||||
import net.t2code.t2codelib.T2CupdateObject;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@@ -21,11 +24,11 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
if (args.length == 0) {
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
Commands.info(sender);
|
||||
return false;
|
||||
}
|
||||
@@ -35,23 +38,83 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
case "pl":
|
||||
case "version":
|
||||
case "ver":
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
Commands.info(sender);
|
||||
return false;
|
||||
case "updateinfo":
|
||||
Commands.updateInfo(sender,args);
|
||||
case "permtoggle":
|
||||
if (!sender.hasPermission("t2code.permtoggle.use")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.permtoggle.use");
|
||||
return false;
|
||||
}
|
||||
Commands.permtoggle(sender, args);
|
||||
return false;
|
||||
case "updateinfo":
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
Commands.updateInfo(sender, args);
|
||||
return false;
|
||||
// case "plugininfo": todo
|
||||
// if (!sender.hasPermission("t2code.admin")) {
|
||||
// T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
// return false;
|
||||
// }
|
||||
// Commands.updateInfo(sender, args);
|
||||
// return false;
|
||||
case "reloadconfig":
|
||||
SelectLibConfig.onSelect();
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
T2CLibConfig.set(false);
|
||||
T2CLibLanguages.set(false);
|
||||
T2Csend.sender(sender, Util.getPrefix() + " §2Config successfully reloaded");
|
||||
return false;
|
||||
case "debug":
|
||||
Commands.debug(sender,args);
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
Commands.debug(sender, args);
|
||||
return false;
|
||||
case "test":
|
||||
T2Csend.sender(sender, T2CbungeePlayers.getBungeePlayers().toString());
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
Commands.test(sender, args);
|
||||
return false;
|
||||
case "serverid":
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
T2Csend.sender(sender, ("[prefix] <red>T2C ServerID:</red> <gold><hover:show_text:'<yellow>copy</yellow>'>" +
|
||||
"<click:copy_to_clipboard:[id]>[id]</click></hover></gold>").replace("[prefix]", Util.getPrefix()).replace("[id]", String.valueOf(T2CLibConfig.VALUES.serverUUID.getValue())));
|
||||
return false;
|
||||
case "bcmd":
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
String cmd = "";
|
||||
for (String s : args) {
|
||||
cmd = cmd + s + " ";
|
||||
}
|
||||
cmd = cmd.replace("bcmd ", "");
|
||||
T2CbungeeCommandSenderReciver.sendToBungee(null, cmd, true);
|
||||
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage BCMD: " + cmd);
|
||||
return false;
|
||||
|
||||
default:
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
||||
return false;
|
||||
}
|
||||
@@ -61,6 +124,8 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
||||
put("debug", "t2code.admin");
|
||||
put("info", "t2code.admin");
|
||||
put("serverid", "t2code.admin");
|
||||
put("bcmd", "t2code.admin");
|
||||
put("reloadconfig", "t2code.admin");
|
||||
put("updateinfo", "t2code.admin");
|
||||
}};
|
||||
@@ -81,17 +146,23 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
if (args.length == 2 && args[0].equalsIgnoreCase("debug")) {
|
||||
if (sender.hasPermission("t2code.admin")) {
|
||||
if (hasPermission(p, arg1.get("debug"))) {
|
||||
if (passend("createReportLog",args[1])) list.add("createReportLog");
|
||||
if (passend("deleteReportLog",args[1])) list.add("deleteReportLog");
|
||||
if (passend("createReportLog", args[1])) list.add("createReportLog");
|
||||
if (passend("deleteReportLog", args[1])) list.add("deleteReportLog");
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
if (args.length == 2 && args[0].equalsIgnoreCase("bcmd")) {
|
||||
if (sender.hasPermission("t2code.admin")) {
|
||||
list.add("<command>");
|
||||
}
|
||||
return list;
|
||||
}
|
||||
if (args.length == 2 && args[0].equalsIgnoreCase("updateinfo")) {
|
||||
if (sender.hasPermission("t2code.admin")) {
|
||||
if (hasPermission(p, arg1.get("updateinfo"))) {
|
||||
for (Map.Entry<String, T2CupdateObject> pl : T2CupdateAPI.pluginVersions.entrySet()){
|
||||
if (passend(pl.getValue().pluginName,args[1])) list.add(pl.getValue().pluginName);
|
||||
for (Map.Entry<String, T2CupdateObject> pl : T2CupdateAPI.pluginVersions.entrySet()) {
|
||||
if (passend(pl.getValue().pluginName, args[1])) list.add(pl.getValue().pluginName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,11 +170,11 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
|
||||
|
||||
if (args.length == 3 && args[0].equalsIgnoreCase("debug")&& args[1].equalsIgnoreCase("deleteReportLog")) {
|
||||
if (args.length == 3 && args[0].equalsIgnoreCase("debug") && args[1].equalsIgnoreCase("deleteReportLog")) {
|
||||
if (sender.hasPermission("t2code.admin")) {
|
||||
if (hasPermission(p, arg1.get("debug"))) {
|
||||
for (String st : ReportLogStorage.list){
|
||||
if (passend(st,args[2])) list.add(st);
|
||||
for (String st : ReportLogStorage.list) {
|
||||
if (passend(st, args[2])) list.add(st);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,11 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system.cmd;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.commands.T2Ccmd;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -12,18 +14,22 @@ import org.bukkit.entity.Player;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Commands {
|
||||
public static void info(CommandSender sender) {
|
||||
protected static void info(CommandSender sender) {
|
||||
T2Ctemplate.sendInfo(sender, T2CodeLibMain.getPlugin(), Util.getSpigotID(), Util.getDiscord(), null, Util.getInfoText());
|
||||
}
|
||||
|
||||
public static void debug(CommandSender sender, String[] args) {
|
||||
protected static void test(CommandSender sender, String[] args) {
|
||||
T2Csend.sender(sender, Util.getPrefix() + " &4Currently there is no development test command");
|
||||
}
|
||||
|
||||
protected static void debug(CommandSender sender, String[] args) {
|
||||
if (args.length < 2) {
|
||||
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
||||
return;
|
||||
}
|
||||
switch (args[1].toLowerCase()) {
|
||||
case "createreportlog":
|
||||
switch (args.length){
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (sender instanceof Player) {
|
||||
T2Csend.sender(sender, "<dark_red>The debug zip file is <red>automatically uploaded</red> to T2Code's servers<br>and <red>automatically deleted</red> " +
|
||||
@@ -74,7 +80,26 @@ public class Commands {
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateInfo(CommandSender sender, String[] args) {
|
||||
protected static void updateInfo(CommandSender sender, String[] args) {
|
||||
T2Csend.sender(sender, T2CupdateAPI.updateInfo(args, sender instanceof Player));
|
||||
}
|
||||
|
||||
public static void permtoggle(CommandSender sender, String[] args) {
|
||||
Player player = (Player) Bukkit.getOfflinePlayer(args[1]);
|
||||
if (player == null) {
|
||||
T2Csend.sender(sender, "§4Player §6" + args[1] + " §4not exist!");
|
||||
return;
|
||||
}
|
||||
String permission = args[2];
|
||||
|
||||
if (player.hasPermission(permission)) {
|
||||
T2Ccmd.console(String.valueOf(T2CLibConfig.VALUES.commandPermToggleCommand.getValue()).replace("[player]",player.getName()).replace("%player_name%",player.getName()).replace("[perm]",permission).replace("[value]", "false"));
|
||||
T2Csend.sender(sender, "§2Permission §8'§6" + permission + "§8' §2was set to §6false §2for the player §6" + player.getName() + "§2.");
|
||||
} else {
|
||||
T2Ccmd.console(String.valueOf(T2CLibConfig.VALUES.commandPermToggleCommand.getValue()).replace("[player]",player.getName()).replace("%player_name%",player.getName()).replace("[perm]",permission).replace("[value]", "true"));
|
||||
T2Csend.sender(sender, "§2Permission §8'§6" + permission + "§8' §2was set to §6true §2for the player §6" + player.getName() + "§2.");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,10 @@ import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
@@ -101,18 +104,35 @@ public class CreateReportLog {
|
||||
pWriter.println("T2C-LuckyBox isV: " + LuckyBoxAPI.isV());
|
||||
pWriter.println();
|
||||
}
|
||||
|
||||
pWriter.println("OfflinePlayers amount: " + Bukkit.getOfflinePlayers().length);
|
||||
pWriter.println("OfflinePlayers: ");
|
||||
for (OfflinePlayer player : Bukkit.getOfflinePlayers()) {
|
||||
|
||||
ArrayList<OfflinePlayer> players = new ArrayList<>();
|
||||
Collections.addAll(players, Bukkit.getOfflinePlayers());
|
||||
players.sort(Comparator.comparing(OfflinePlayer::getName));
|
||||
for (OfflinePlayer player : players) {
|
||||
pWriter.println(" - " + player.getName() + " - " + player.getUniqueId());
|
||||
}
|
||||
|
||||
pWriter.println();
|
||||
pWriter.println("Plugins amount: " + Bukkit.getPluginManager().getPlugins().length);
|
||||
pWriter.println("Plugins: ");
|
||||
for (Plugin pl : Bukkit.getPluginManager().getPlugins()) {
|
||||
pWriter.println(" - " + pl.getName() + " - " + pl.getDescription().getVersion() + " - Enabled: " + pl.isEnabled() + " - Autors: "
|
||||
+ pl.getDescription().getAuthors() + " - SoftDepend: " + pl.getDescription().getSoftDepend() + " - Depend: " + pl.getDescription().getDepend()
|
||||
+ " LoadBefore: " + pl.getDescription().getLoadBefore() + " - Website: " + pl.getDescription().getWebsite());
|
||||
|
||||
ArrayList<Plugin> plugins = new ArrayList<>();
|
||||
Collections.addAll(plugins, Bukkit.getPluginManager().getPlugins());
|
||||
plugins.sort(Comparator.comparing(Plugin::getName));
|
||||
for (Plugin pl : plugins) {
|
||||
pWriter.println(" - " + pl.getName() +
|
||||
" - " + pl.getDescription().getVersion() +
|
||||
" - Enabled: " + pl.isEnabled() +
|
||||
" - Autors: " + pl.getDescription().getAuthors() +
|
||||
" - SoftDepend: " + pl.getDescription().getSoftDepend() +
|
||||
" - Depend: " + pl.getDescription().getDepend() +
|
||||
" - LoadBefore: " + pl.getDescription().getLoadBefore() +
|
||||
" - Website: " + pl.getDescription().getWebsite());
|
||||
}
|
||||
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
} finally {
|
||||
@@ -132,9 +152,9 @@ public class CreateReportLog {
|
||||
|
||||
addFileToZip("", "logs/latest.log", zip, false);
|
||||
|
||||
// for (String pl : Util.getT2cPlugins()) {
|
||||
// pluginToDebug(pl, zip);
|
||||
// }
|
||||
// for (String pl : Util.getT2cPlugins()) {
|
||||
// pluginToDebug(pl, zip);
|
||||
// }
|
||||
pluginToDebug(zip); //todo überprüfen
|
||||
|
||||
zip.closeEntry();
|
||||
@@ -178,7 +198,7 @@ public class CreateReportLog {
|
||||
"<br>[prefix] <green>You can download it <click:open_url:'[url]'><gold><hover:show_text:'<yellow>Download the debug file</yellow>'>here</hover></gold></click>." +
|
||||
"<br>[prefix] <green>Please enter the following key in the ticket: <gold><click:copy_to_clipboard:[key]><hover:show_text:'<yellow>Copy to clipboard</yellow>'>[key]</hover></click></gold></green>" +
|
||||
"<br>[prefix] <dark_red>Do not share the download URL with anyone!</dark_red>" +
|
||||
"<br><hover:show_text:'<yellow>Click to delete</yellow>'><click:run_command:'/t2code debug deleteReportLog [key]'>[prefix] <green>You can <b>delte</b> yor Debug-File by clicking me.</green>" +
|
||||
"<br>[prefix] <click:run_command:'/t2code debug deleteReportLog [key]'><hover:show_text:'<yellow>Click to delete</yellow>'><green>You can <b>delete</b> your Debug-File by clicking me.</green>" +
|
||||
"<br>[prefix] <color:#910d06>(If you do not delete the debug file, it will be deleted automatically after <red>14</red> days!)</color></click></hover>")
|
||||
.replace("[key]", fileID).replace("[url]", downloadURL).replace("[prefix]", Util.getPrefix()));
|
||||
}
|
||||
@@ -186,7 +206,7 @@ public class CreateReportLog {
|
||||
"<br><gold>Please enter the following key in the ticket:</gold> <yellow>[key]</yellow>." +
|
||||
"<br><dark_red>Do not share the download URL with anyone!</dark_red>" +
|
||||
"<br><color:#910d06>(If you do not delete the debug file, it will be deleted automatically after <red>14</red> days!)</color>" +
|
||||
"<br><dark_red>You can delte yor Debug-File with the following command:</dark_red> <red>/t2code debug deleteReportLog [key]</red>.")
|
||||
"<br><dark_red>You can delete your Debug-File with the following command:</dark_red> <red>/t2code debug deleteReportLog [key]</red>.")
|
||||
.replace("[key]", fileID).replace("[url]", downloadURL));
|
||||
ReportLogStorage.add(fileID);
|
||||
}
|
||||
@@ -208,16 +228,17 @@ public class CreateReportLog {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void pluginToDebug(ZipOutputStream zip) throws IOException {
|
||||
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()){
|
||||
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
||||
String plName = plugin.getDescription().getName();
|
||||
if (plName.contains("T2C-") || Util.getT2cPlugins().contains(plName)){
|
||||
if (plName.contains("T2C-") || Util.getT2cPlugins().contains(plName) || plugin.getDescription().getAuthors().contains("JaTiTV")) {
|
||||
File plConfigs = new File(plugin.getDataFolder().getPath());
|
||||
if (plConfigs.exists()) {
|
||||
addFolderToZip("T2Code-Plugins", plugin.getDataFolder().getPath(), zip);
|
||||
}
|
||||
File f = new File(plugin.getClass().getProtectionDomain().getCodeSource().getLocation().getPath());
|
||||
addFileToZip("T2Code-Plugins", f.getPath(), zip, false);
|
||||
addFileToZip("T2Code-Plugins", f.getPath(), zip, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,70 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system.cmd;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
import static net.t2code.t2codelib.SPIGOT.api.dev.T2CdevelopmentTool.removeLastChar;
|
||||
|
||||
public class Development implements Listener {
|
||||
@EventHandler
|
||||
public void onChat(AsyncPlayerChatEvent e) {
|
||||
String[] args = e.getMessage().split(" ");
|
||||
if (args.length == 0) {
|
||||
return;
|
||||
}
|
||||
if (!args[0].equals("_t2code_")) {
|
||||
return;
|
||||
}
|
||||
if (!(boolean) T2CLibConfig.VALUES.developerTool.getValue()) {
|
||||
T2Csend.player(e.getPlayer(), Util.getPrefix() + " The Development Tool is disabled.");
|
||||
}
|
||||
e.setCancelled(true);
|
||||
t2cPls(e.getPlayer());
|
||||
}
|
||||
|
||||
protected static void t2cPls(Player player) {
|
||||
String msg = "<red>T<gray>2</gray>Code</red> <dark_purple>Development</dark_purple><br>"
|
||||
+ T2CmcVersion.getMcVersion() + "<br>(" + Bukkit.getPluginManager().getPlugins().length + ") ";
|
||||
ArrayList<Plugin> plugins = new ArrayList<>();
|
||||
Collections.addAll(plugins, Bukkit.getPluginManager().getPlugins());
|
||||
plugins.sort(Comparator.comparing(Plugin::getName));
|
||||
for (Plugin plugin : plugins) {
|
||||
String plName = plugin.getDescription().getName();
|
||||
String hover = "<blue>" + plugin.getDescription().getName() + "</blue><br>" +
|
||||
"<green>Version:</green> <gold>" + plugin.getDescription().getVersion() + "</gold><br>" +
|
||||
"<green>APIVersion:</green> <gold>" + plugin.getDescription().getAPIVersion() + "</gold><br>" +
|
||||
"<green>Authors:</green> <gold>" + plugin.getDescription().getAuthors() + "</gold><br>" +
|
||||
"<green>SoftDepend:</green> <gold>" + plugin.getDescription().getSoftDepend() + "</gold><br>" +
|
||||
"<green>Depend:</green> <gold>" + plugin.getDescription().getDepend() + "</gold><br>" +
|
||||
"<green>LoadBefore:</green> <gold>" + plugin.getDescription().getLoadBefore() + "</gold><br>" +
|
||||
"<green>Website:</green> <gold>" + plugin.getDescription().getWebsite() + "</gold>";
|
||||
String plSt = "<hover:show_text:'" + hover + "'>" + plugin.getName() + "</hover>";
|
||||
|
||||
if (plugin.getDescription().getWebsite() != null && !plugin.getDescription().getWebsite().equalsIgnoreCase("null")) {
|
||||
plSt = "<click:open_url:'" + plugin.getDescription().getWebsite() + "'>" + plSt + "</click>";
|
||||
}
|
||||
if (plugin.isEnabled()) {
|
||||
if (plName.contains("T2C-") || Util.getT2cPlugins().contains(plName)) {
|
||||
msg = msg + "<dark_green>" + plSt + "</dark_green>, ";
|
||||
} else msg = msg + "<green>" + plSt + "</green>, ";
|
||||
} else if (plName.contains("T2C-") || Util.getT2cPlugins().contains(plName)) {
|
||||
msg = msg + "<dark_red>" + plSt + "</dark_red>, ";
|
||||
} else msg = msg + "<red>" + plSt + "</red>, ";
|
||||
}
|
||||
T2Csend.player(player, removeLastChar(msg, 2));
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -1,43 +0,0 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system.config.config;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class ConfigCreate {
|
||||
|
||||
public static void configCreate() {
|
||||
long long_ = System.currentTimeMillis();
|
||||
if (new File(T2CodeLibMain.getPath(), "config.yml").exists()){
|
||||
if (T2CodeLibMain.getPlugin().getConfig().getBoolean("Plugin.Debug")) T2Csend.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
|
||||
} else T2Csend.console(Util.getPrefix() + " §4config.yml are created...");
|
||||
|
||||
|
||||
File config = new File(T2CodeLibMain.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
|
||||
T2Cconfig.set("Plugin.UpdateCheck.OnJoin", true, yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.UpdateCheck.TimeInterval", 60, yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.UpdateCheck.SeePreReleaseUpdates", true, yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.UpdateCheck.AllPlugins.FullDisable", false, yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.language", "english", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("BungeeCord.Enable", T2CodeLibMain.getIsBungee(), yamlConfiguration);
|
||||
T2Cconfig.set("Player.Inventories.CloseByServerStop", true, yamlConfiguration);
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
T2Csend.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system.config.config;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.T2CconfigItem;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ConvertT2ClibConfig {
|
||||
|
||||
public static YamlConfiguration yamlConfiguration;
|
||||
|
||||
|
||||
public static void convert() {
|
||||
File config = new File(T2CodeLibMain.getPath(), "config.yml");
|
||||
yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
if (!config.exists()) return;
|
||||
if (yamlConfiguration.contains("plugin.updateCheck.onJoin")) return;
|
||||
|
||||
set("Plugin.UpdateCheck.OnJoin",T2CLibConfig.VALUES.updateCheckOnJoin);
|
||||
set("Plugin.UpdateCheck.TimeInterval",T2CLibConfig.VALUES.updateCheckTimeInterval);
|
||||
set("Plugin.UpdateCheck.SeePreReleaseUpdates",T2CLibConfig.VALUES.seePreReleaseUpdates);
|
||||
set("Plugin.UpdateCheck.AllPlugins.FullDisable",T2CLibConfig.VALUES.updateCheckFullDisable);
|
||||
set("Plugin.Debug",T2CLibConfig.VALUES.debug);
|
||||
set("Plugin.language",T2CLibConfig.VALUES.language);
|
||||
set("Plugin.Not recommended to disable.developerTool",T2CLibConfig.VALUES.developerTool);
|
||||
set("BungeeCord.Enable",T2CLibConfig.VALUES.proxy);
|
||||
set("Player.Inventories.CloseByServerStop",T2CLibConfig.VALUES.inventoriesCloseByServerStop);
|
||||
set("Command.PermToggle.PermissionSetCommand",T2CLibConfig.VALUES.updateCheckOnJoin);
|
||||
|
||||
config.delete();
|
||||
}
|
||||
|
||||
private static void set(String path, T2CconfigItem item){
|
||||
if (yamlConfiguration.contains(path)){
|
||||
item.setValue(yamlConfiguration.get(path));
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,47 +0,0 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system.config.config;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class SelectLibConfig {
|
||||
|
||||
@Getter
|
||||
private static Boolean updateCheckOnJoin;
|
||||
@Getter
|
||||
private static Boolean t2cTestDevelopment = false;
|
||||
@Getter
|
||||
private static Integer updateCheckTimeInterval;
|
||||
@Getter
|
||||
private static Boolean seePreReleaseUpdates;
|
||||
@Getter
|
||||
private static Boolean updateCheckFullDisable;
|
||||
@Getter
|
||||
private static Boolean debug;
|
||||
@Getter
|
||||
private static String language;
|
||||
@Getter
|
||||
private static Boolean bungee;
|
||||
@Getter
|
||||
private static Boolean inventoriesCloseByServerStop;
|
||||
|
||||
public static void onSelect() {
|
||||
File config = new File(T2CodeLibMain.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
if (yamlConfiguration.contains("t2cTestDevelopment")) {
|
||||
t2cTestDevelopment = yamlConfiguration.getBoolean("t2cTestDevelopment");
|
||||
}
|
||||
|
||||
updateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheck.OnJoin");
|
||||
updateCheckTimeInterval = yamlConfiguration.getInt("Plugin.UpdateCheck.TimeInterval");
|
||||
seePreReleaseUpdates = yamlConfiguration.getBoolean("Plugin.UpdateCheck.SeePreReleaseUpdates");
|
||||
updateCheckFullDisable = yamlConfiguration.getBoolean("Plugin.UpdateCheck.AllPlugins.FullDisable");
|
||||
debug = yamlConfiguration.getBoolean("Plugin.Debug");
|
||||
language = yamlConfiguration.getString("Plugin.language");
|
||||
bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
|
||||
inventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop");
|
||||
}
|
||||
}
|
@@ -0,0 +1,157 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system.config.config;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CconfigWriter;
|
||||
import net.t2code.t2codelib.T2CLanguageEnum;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.T2CconfigItem;
|
||||
import net.t2code.t2codelib.Util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
public class T2CLibConfig {
|
||||
|
||||
public enum VALUES implements T2CconfigItem {
|
||||
|
||||
updateCheckOnJoin("plugin.updateCheck.onJoin", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of("Mit dieser Option kannst du festlegen, ob Spieler mit der Berechtigung 't2code.lib.updatemsg' beim Join eine Update-Nachricht erhalten, wenn ein Update für das Plugin verfügbar ist."));
|
||||
put(T2CLanguageEnum.english, List.of("In this option you can set if players with the permission 't2code.lib.updatemsg' will get an update message on join when an update for the plugin is available."));
|
||||
}}),
|
||||
|
||||
updateCheckTimeInterval("plugin.updateCheck.timeInterval", 60, true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of("Mit dieser Option kannst du das Zeitintervall in Minuten festlegen, in dem Aktualisierungen überprüft werden sollen."));
|
||||
put(T2CLanguageEnum.english, List.of("In this option you can set the time interval in minutes in which updates should be checked."));
|
||||
}}),
|
||||
|
||||
seePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of("In dieser Option kannst du einstellen, ob du Beta- und Snapshot-Versionen in der Update-Prüfung erhalten und anzeigen möchten."));
|
||||
put(T2CLanguageEnum.english, List.of("In this option you can set whether you want to receive and display beta and snapshot versions in the update check."));
|
||||
}}),
|
||||
|
||||
updateCheckFullDisable("plugin.updateCheck.allPlugins.fullDisable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of("Diese Option deaktiviert alle Aktualisierungsprüfungen für Plugins, die die T2CodeLib verwenden."));
|
||||
put(T2CLanguageEnum.english, List.of("This option deactivates all update checks for plugins that use the T2CodeLib."));
|
||||
}}),
|
||||
|
||||
debug("plugin.debug.debugModus", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of("Der Debug-Modus sendet ausführlichere Debug-Informationen an die Konsole.", "In dieser Version des Plugins sind keine Debug-Meldungen eingebaut!"));
|
||||
put(T2CLanguageEnum.english, List.of("The debug mode sends more detailed debug information to the console.", "In this version of the plugin no debug messages are built in!"));
|
||||
}}),
|
||||
|
||||
developerTool("plugin.debug.developerTool", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of("Diese Option aktiviert erweiterte Werkzeuge für die Entwickler von Plugins, die die T2CodeLib verwenden.", "Wenn du nicht genau weist, wozu das gut ist, solltest du es deaktiviert lassen!"));
|
||||
put(T2CLanguageEnum.english, List.of("This option activates advanced tools for the developers of plugins that use the T2CodeLib.", "If you don't know exactly what this is for, you should leave it deactivated!"));
|
||||
}}),
|
||||
|
||||
language("plugin.language", "english", true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of("In dieser Option kannst du die Sprache des Plugins einstellen."));
|
||||
put(T2CLanguageEnum.english, List.of("In this option you can set the language of the plugin."));
|
||||
}}),
|
||||
|
||||
space_proxy("proxy", null, true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of());
|
||||
put(T2CLanguageEnum.english, List.of());
|
||||
}}),
|
||||
proxy("proxy.enable", T2CodeLibMain.getIsBungee(), true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of("Diese Option muss aktiviert werden, wenn du die T2CodeLib auf einem BungeeCord, Waterfall oder Velocity Proxy als Bridge verwenden möchtest."
|
||||
, "Bitte beachte, dass die einzelnen APIs der Plugins, die eine Bridge auf einem Proxy verwenden, in der config.yml der T2CodeLib auf dem Proxy aktiviert werden müssen!"));
|
||||
put(T2CLanguageEnum.english, List.of("This option must be activated if you use the T2CodeLib on a BungeeCord, Waterfall or Velocity Proxy as a bridge."
|
||||
, "Please note that the individual APIs of the plugins that use a bridge on a proxy must be activated in the config.yml of the T2CodeLib on the proxy!"));
|
||||
}}),
|
||||
|
||||
serverUUID("proxy.serverUUID", UUID.randomUUID(), true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of("Diese UUID wird für die Kommunikation der Plugins in einem Netzwerk mit mehreren Servern verwendet.", "Diese UUID darf nur einmal in einem Netz vorkommen!"));
|
||||
put(T2CLanguageEnum.english, List.of("This UUID is used for the communication of the plugins in a network with several servers.", "This UUID may only occur once in a network!"));
|
||||
}}),
|
||||
|
||||
space_player("player", null, true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of());
|
||||
put(T2CLanguageEnum.english, List.of());
|
||||
}}),
|
||||
|
||||
inventoriesCloseByServerStop("player.inventories.closeByServerStop", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of("Wenn diese Option aktiviert ist, werden bei allen Spielern auf dem Server (Spigot, Papier, etc.) das Inventar / GUIs geschlossen, wenn der Server heruntergefahren oder neu gestartet wird.",
|
||||
"(Damit ist nicht das gesamte Netz gemeint, wenn ein Proxy verwendet wird)"));
|
||||
put(T2CLanguageEnum.english, List.of("If this option is enabled, all players on the server (spigot, paper, etc.) will have their inventory / GUIs closed when the server is shut down or restarted.",
|
||||
"(This does not mean the entire network if a proxy is used)"));
|
||||
|
||||
}}),
|
||||
|
||||
space_command("command", null, true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of());
|
||||
put(T2CLanguageEnum.english, List.of());
|
||||
}}),
|
||||
|
||||
commandPermToggleCommand("command.permToggle.permissionSetCommand", "lp user [player] permission set [perm] [value]", true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of("Diese Option gibt an, welcher Befehl für den T2CodeLib-Befehl '/t2code permtoggle <player> <permission>' verwendet werden soll."));
|
||||
put(T2CLanguageEnum.english, List.of("This option specifies which command is to be used for the T2CodeLib command '/t2code permtoggle <player> <permission>'."));
|
||||
}}),
|
||||
;
|
||||
|
||||
private final String path;
|
||||
private Object value;
|
||||
private final boolean forceSet;
|
||||
private final HashMap<T2CLanguageEnum, List<String>> comments;
|
||||
|
||||
VALUES(String path, Object value, boolean forceSet, HashMap<T2CLanguageEnum, 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<T2CLanguageEnum, List<String>> getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLanguagePath() {
|
||||
return language.path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Object newValue) {
|
||||
value = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(boolean pluginStart) {
|
||||
long long_ = System.currentTimeMillis();
|
||||
ConvertT2ClibConfig.convert();
|
||||
T2CconfigWriter.createConfig(new File(T2CodeLibMain.getPath(), "config.yml"), VALUES.values(), Util.getConfigLogo());
|
||||
|
||||
T2Ctemplate.setCenterAligned(Util.getPrefix(), "§2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", pluginStart);
|
||||
}
|
||||
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system.config.languages;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.Util;
|
||||
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 = T2CodeLibMain.getPlugin();
|
||||
|
||||
public static void langCreate() {
|
||||
T2Csend.debug(plugin, "§4Language files are created / updated...");
|
||||
long long_ = System.currentTimeMillis();
|
||||
|
||||
|
||||
setFile("english", MSG.EN_VaultNotSetUp, MSG.EN_VotingPluginNotSetUp, MSG.EN_SoundNotFound);
|
||||
|
||||
setFile("german", MSG.DE_VaultNotSetUp, MSG.DE_VotingPluginNotSetUp, MSG.DE_SoundNotFound);
|
||||
|
||||
setFile("norwegian", MSG.NO_VaultNotSetUp, MSG.NO_VotingPluginNotSetUp, MSG.NO_SoundNotFound);
|
||||
|
||||
T2Csend.console(Util.getPrefix() + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
|
||||
private static void setFile(String language, String vaultNotSetUp, String votingPluginNotSetUp, String soundNotFound) {
|
||||
File messages = new File(T2CodeLibMain.getPath(), "languages/" + language + ".yml");
|
||||
YamlConfiguration yamlConfigurationNO = YamlConfiguration.loadConfiguration(messages);
|
||||
|
||||
T2Cconfig.set("Plugin.VaultNotSetUp", vaultNotSetUp, yamlConfigurationNO);
|
||||
T2Cconfig.set("Plugin.VotingPluginNotSetUp", votingPluginNotSetUp, yamlConfigurationNO);
|
||||
T2Cconfig.set("Plugin.SoundNotFound", soundNotFound, yamlConfigurationNO);
|
||||
|
||||
try {
|
||||
yamlConfigurationNO.save(messages);
|
||||
} catch (IOException e) {
|
||||
T2Csend.warning(plugin, e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,25 +0,0 @@
|
||||
// This claas was created by JaTiTV
|
||||
|
||||
package net.t2code.t2codelib.SPIGOT.system.config.languages;
|
||||
|
||||
public class MSG {
|
||||
|
||||
// EN
|
||||
public static String EN_VaultNotSetUp = "[prefix] &4Vault / Economy not set up!";
|
||||
public static String EN_VotingPluginNotSetUp = "[prefix] &4VotingPlugin is not present on the server!";
|
||||
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_VotingPluginNotSetUp = "[prefix] &4VotingPlugin ist auf dem Server nicht vorhanden!";
|
||||
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_VotingPluginNotSetUp = "[prefix] &4VotingPlugin er ikke til stede på serveren!";
|
||||
public static String NO_SoundNotFound = "[prefix] &4Lyden &6[sound] &4ble ikke bli funnet! Vennligst sjekk innstillingene.";
|
||||
|
||||
}
|
@@ -1,49 +0,0 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system.config.languages;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class SelectLibMsg {
|
||||
private static Plugin plugin = T2CodeLibMain.getPlugin();
|
||||
|
||||
public static String selectMSG;
|
||||
|
||||
public static String vaultNotSetUp;
|
||||
public static String votingPluginNotSetUp;
|
||||
public static String soundNotFound;
|
||||
|
||||
public static void onSelect() {
|
||||
String prefix = Util.getPrefix();
|
||||
|
||||
T2Csend.debug(plugin, "§4Select language...");
|
||||
long long_ = System.currentTimeMillis();
|
||||
|
||||
File msg;
|
||||
|
||||
msg = new File(T2CodeLibMain.getPath(), "languages/" + SelectLibConfig.getLanguage() + ".yml");
|
||||
if (!msg.isFile()) {
|
||||
T2Csend.console(prefix);
|
||||
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.console(prefix + " §4The selected §c" + SelectLibConfig.getLanguage() + " §4language file was not found.");
|
||||
T2Csend.console(prefix + " §6The default language §eEnglish §6is used!");
|
||||
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.console(prefix);
|
||||
msg = new File(T2CodeLibMain.getPath(), "languages/" + "english.yml");
|
||||
selectMSG = "english";
|
||||
} else selectMSG = SelectLibConfig.getLanguage();
|
||||
YamlConfiguration yamlConfiguration_msg = YamlConfiguration.loadConfiguration(msg);
|
||||
|
||||
vaultNotSetUp = T2Creplace.replace(prefix, yamlConfiguration_msg.getString("Plugin.VaultNotSetUp"));
|
||||
votingPluginNotSetUp = T2Creplace.replace(prefix, yamlConfiguration_msg.getString("Plugin.VotingPluginNotSetUp"));
|
||||
soundNotFound = T2Creplace.replace(prefix, yamlConfiguration_msg.getString("Plugin.SoundNotFound"));
|
||||
|
||||
T2Csend.console(prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
}
|
@@ -0,0 +1,108 @@
|
||||
// This class was created by JaTiTV.
|
||||
|
||||
package net.t2code.t2codelib.SPIGOT.system.config.languages;
|
||||
|
||||
|
||||
import lombok.NonNull;
|
||||
import net.t2code.t2codelib.T2CLanguageEnum;
|
||||
import net.t2code.t2codelib.T2CconfigItemLanguages;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CconfigWriterLanguage;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
|
||||
import net.t2code.t2codelib.Util;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class T2CLibLanguages {
|
||||
|
||||
public enum VALUES implements T2CconfigItemLanguages {
|
||||
otherLang("plugin", null,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, null);
|
||||
put(T2CLanguageEnum.english, null);
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of("Wenn du eine Eigene Sprache hinzufügen magst, dann kopiere einfach eine Sprachdatei und benenne sie in deine Sprache, dies kannst du dann in der config.yml einstellen.", ""));
|
||||
put(T2CLanguageEnum.english, List.of("If you want to add your own language, simply copy a language file and rename it to your language, you can then set this in config.yml.", ""));
|
||||
}}),
|
||||
|
||||
vaultNotSetUp("plugin.vaultNotSetUp",
|
||||
null,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, "[prefix] &4Vault / Economy nicht eingerichtet!");
|
||||
put(T2CLanguageEnum.english, "[prefix] &4Vault / Economy not set up!");
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of("Diese Meldung wird angezeigt, wenn ein Plugin auf die Vault Schnittstelle von T2CodeLib zugreift und Vault oder kein Economy System vorhanden ist."));
|
||||
put(T2CLanguageEnum.english, List.of("This message is displayed if a plugin accesses the Vault interface of T2CodeLib and Vault or no Economy System is available."));
|
||||
}}),
|
||||
|
||||
votingPluginNotSetUp("plugin.votingPluginNotSetUp",
|
||||
null,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, "[prefix] &4VotingPlugin ist auf dem Server nicht vorhanden!");
|
||||
put(T2CLanguageEnum.english, "[prefix] &4VotingPlugin is not present on the server!");
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of("Diese Meldung wird angezeigt, wenn ein Plugin auf die VotingPlugin Schnittstelle von T2CodeLib zugreift und VotingPlugin nicht vorhanden ist.", "VotingPlugin: https://spigotmc.org/resources/votingplugin.15358/"));
|
||||
put(T2CLanguageEnum.english, List.of("This message is displayed if a plugin accesses the VotingPlugin interface of T2CodeLib and VotingPlugin is not available.", "VotingPlugin: https://spigotmc.org/resources/votingplugin.15358/"));
|
||||
}}),
|
||||
soundNotFound("plugin.soundNotFound",
|
||||
null,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, "[prefix] &4Der Sound &6[sound] &4wurde nicht gefunden! Bitte überprüfe die Einstellungen.");
|
||||
put(T2CLanguageEnum.english, "[prefix] &4The sound &6[sound] &4was not found! Please check the settings.");
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of("Diese Meldung wird angezeigt, wenn ein Sound über die T2CodeLib abgespielt werden soll, den es nicht gibt"));
|
||||
put(T2CLanguageEnum.english, List.of());
|
||||
}}),
|
||||
|
||||
;
|
||||
|
||||
private final String path;
|
||||
private Object value;
|
||||
private final HashMap<T2CLanguageEnum, String> lang;
|
||||
private final HashMap<T2CLanguageEnum, List<String>> comments;
|
||||
|
||||
VALUES(String path, Object value, @NonNull HashMap<T2CLanguageEnum, String> lang, HashMap<T2CLanguageEnum, List<String>> comments) {
|
||||
this.path = path;
|
||||
this.value = value;
|
||||
this.lang = lang;
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
if (value == null) {
|
||||
return lang.get(T2CLanguageEnum.english);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<T2CLanguageEnum, String> getLanguage() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<T2CLanguageEnum, List<String>> getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Object newValue) {
|
||||
value = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(boolean pluginStart) {
|
||||
T2CconfigWriterLanguage.createConfig(Util.getPrefix(), T2CodeLibMain.getPath(), VALUES.values(), T2CLibConfig.VALUES.language.getValue().toString(), pluginStart, Util.getConfigLogo());
|
||||
|
||||
}
|
||||
}
|
7
src/main/java/net/t2code/t2codelib/T2CLanguageEnum.java
Normal file
7
src/main/java/net/t2code/t2codelib/T2CLanguageEnum.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package net.t2code.t2codelib;
|
||||
|
||||
public enum T2CLanguageEnum {
|
||||
german,
|
||||
english,
|
||||
norwegian
|
||||
}
|
40
src/main/java/net/t2code/t2codelib/T2CconfigItem.java
Normal file
40
src/main/java/net/t2code/t2codelib/T2CconfigItem.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package net.t2code.t2codelib;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public interface T2CconfigItem {
|
||||
/**
|
||||
* Returns the path of the option for the config
|
||||
* @return Config path of the option
|
||||
*/
|
||||
String getPath();
|
||||
|
||||
/**
|
||||
* Returns the default value of the option and, after reading the config, the value from the config
|
||||
* @return Value of the option
|
||||
*/
|
||||
Object getValue();
|
||||
|
||||
/**
|
||||
* Here you determine whether the value should always be set (true) or only when the config is first created (false)
|
||||
*/
|
||||
boolean getForceSet();
|
||||
|
||||
/**
|
||||
* Set the description of the option here, the '# ' is automatically set in front of it
|
||||
*/
|
||||
HashMap<T2CLanguageEnum,List<String>> getComments();
|
||||
|
||||
|
||||
String getLanguagePath();
|
||||
|
||||
/**
|
||||
* This @void is used to reset the value of @getValue()
|
||||
*/
|
||||
default void setValue(Object newValue){
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
package net.t2code.t2codelib;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public interface T2CconfigItemLanguages {
|
||||
/**
|
||||
* Returns the path of the option for the config
|
||||
*
|
||||
* @return Config path of the option
|
||||
*/
|
||||
String getPath();
|
||||
|
||||
/**
|
||||
* Returns the default value of the option and, after reading the config, the value from the config
|
||||
*
|
||||
* @return Value of the option
|
||||
*/
|
||||
Object getValue();
|
||||
|
||||
HashMap<T2CLanguageEnum, String> getLanguage();
|
||||
|
||||
|
||||
/**
|
||||
* Set the description of the option here, the '# ' is automatically set in front of it
|
||||
*/
|
||||
HashMap<T2CLanguageEnum, List<String>> getComments();
|
||||
|
||||
|
||||
/**
|
||||
* This @void is used to reset the value of @getValue()
|
||||
*/
|
||||
default void setValue(Object newValue) {
|
||||
|
||||
}
|
||||
}
|
47
src/main/java/net/t2code/t2codelib/T2CplatformDetector.java
Normal file
47
src/main/java/net/t2code/t2codelib/T2CplatformDetector.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package net.t2code.t2codelib;// This class was created by JaTiTV.
|
||||
|
||||
public class T2CplatformDetector {
|
||||
|
||||
public static PlatformType detectPlatform;
|
||||
|
||||
public enum PlatformType {
|
||||
SPIGOT,
|
||||
PAPER,
|
||||
BUNGEECORD,
|
||||
UNKNOWN
|
||||
}
|
||||
|
||||
public static PlatformType detectPlatform() {
|
||||
// Check for Bukkit/Spigot/Paper
|
||||
try {
|
||||
Class.forName("org.bukkit.Bukkit");
|
||||
if (isPaper()) {
|
||||
return PlatformType.PAPER;
|
||||
} else {
|
||||
return PlatformType.SPIGOT;
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
// Not a Bukkit/Spigot/Paper server
|
||||
}
|
||||
|
||||
// Check for BungeeCord
|
||||
try {
|
||||
Class.forName("net.md_5.bungee.api.ProxyServer");
|
||||
return PlatformType.BUNGEECORD;
|
||||
} catch (ClassNotFoundException e) {
|
||||
// Not a BungeeCord server
|
||||
}
|
||||
|
||||
return PlatformType.UNKNOWN;
|
||||
}
|
||||
|
||||
private static boolean isPaper() {
|
||||
// Paper has the PaperConfig class, which Spigot and Bukkit do not have
|
||||
try {
|
||||
Class.forName("com.destroystokyo.paper.PaperConfig");
|
||||
return true;
|
||||
} catch (ClassNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,7 +5,13 @@ public enum UpdateType {
|
||||
DEVELOPMENT("<dark_red>DEV</dark_red>"),
|
||||
BETA("<gold>BETA</gold>"),
|
||||
SNAPSHOT("<yellow>SNAPSHOT</yellow>"),
|
||||
STABLE("<dark_green>STABLE</dark_green>");
|
||||
STABLE("<dark_green>STABLE</dark_green>"),
|
||||
|
||||
PRERELEASE_("Pre-Release"),
|
||||
DEVELOPMENT_("DEV"),
|
||||
BETA_("BETA"),
|
||||
SNAPSHOT_("SNAPSHOT"),
|
||||
STABLE_("STABLE");
|
||||
|
||||
public String text;
|
||||
|
||||
|
@@ -1,61 +1,117 @@
|
||||
package net.t2code.t2codelib;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Util {
|
||||
|
||||
@Getter
|
||||
private static final UUID serverUUID = UUID.randomUUID();
|
||||
private static String infoText = "<yellow>Description:</yellow> <gold>" + T2CodeLibMain.getPlugin().getDescription().getDescription() + "</gold>";
|
||||
|
||||
@Getter
|
||||
private static String prefix = "<dark_gray>[<dark_red>T2Code</dark_red><dark_purple>Lib</dark_purple>]</dark_gray>";
|
||||
|
||||
@Getter
|
||||
private static String vPrefix = "[T2CodeLib]";
|
||||
|
||||
@Getter
|
||||
private static Integer spigotID = 96388;
|
||||
|
||||
@Getter
|
||||
private static String git = "JaTiTV/T2CodeLib";
|
||||
|
||||
@Getter
|
||||
private static Integer bstatsID = 12518;
|
||||
|
||||
@Getter
|
||||
private static String spigot = "https://www.spigotmc.org/resources/" + getSpigotID();
|
||||
|
||||
@Getter
|
||||
private static String discord = "http://dc.t2code.net";
|
||||
|
||||
@Getter
|
||||
private static List<String> T2cPlugins = Arrays.asList(
|
||||
"T2CodeLib",
|
||||
"T2C-LuckyBox",
|
||||
"WonderBagShop",
|
||||
"CommandGUI",
|
||||
// "T2C-OPSecurity",
|
||||
"OPSecurity",
|
||||
"PaPiTest",
|
||||
"T2C-Alias",
|
||||
"T2C-AutoResponse",
|
||||
"LoreEditor",
|
||||
"Booster",
|
||||
"AntiMapCopy",
|
||||
"AntiCopy",
|
||||
"T2C-LoginPermissionAuth"
|
||||
);
|
||||
|
||||
@Getter
|
||||
private static final List<String> configT2CodeLogo = Arrays.asList(
|
||||
"# ╔═════════════════════════════════════════════════════════════════════════════╗",
|
||||
"# ║ _______ ___ _____ _ _ ║",
|
||||
"# ║ |__ __| |__ \\ / ____| | | | | ║",
|
||||
"# ║ | | ) | | | ___ __| | ___ _ __ ___ | |_ ║",
|
||||
"# ║ | | / / | | / _ \\ / _` | / _ \\ | '_ \\ / _ \\ | __| ║",
|
||||
"# ║ | | / /_ | |____ | (_) | | (_| | | __/ _ | | | | | __/ | |_ ║",
|
||||
"# ║ |_| |____| \\_____| \\___/ \\__,_| \\___| (_) |_| |_| \\___| \\__| ║",
|
||||
"# ║ ║",
|
||||
"# ║ This plugin is from T2Code.net ║",
|
||||
"# ║ Development Team: JaTiTV & Jkobs ║",
|
||||
"# ║ Feel free to come to our Discord for support: https://dc.t2code.net ║",
|
||||
"# ╚═════════════════════════════════════════════════════════════════════════════╝",
|
||||
"",
|
||||
|
||||
"####################################################################################################################",
|
||||
"## ##",
|
||||
"## /$$$$$$$$ /$$$$$$ /$$$$$$ /$$ /$$ ##",
|
||||
"## |__ $$__//$$__ $$ /$$__ $$ | $$ | $$ ##",
|
||||
"## | $$ |__/ \\ $$| $$ \\__/ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ ##",
|
||||
"## | $$ /$$$$$$/| $$ /$$__ $$ /$$__ $$ /$$__ $$ | $$__ $$ /$$__ $$|_ $$_/ ##",
|
||||
"## | $$ /$$____/ | $$ | $$ \\ $$| $$ | $$| $$$$$$$$ | $$ \\ $$| $$$$$$$$ | $$ ##",
|
||||
"## | $$ | $$ | $$ $$| $$ | $$| $$ | $$| $$_____/ | $$ | $$| $$_____/ | $$ /$$ ##",
|
||||
"## | $$ | $$$$$$$$| $$$$$$/| $$$$$$/| $$$$$$$| $$$$$$$ /$$| $$ | $$| $$$$$$$ | $$$$/ ##",
|
||||
"## |__/ |________/ \\______/ \\______/ \\_______/ \\_______/|__/|__/ |__/ \\_______/ \\___/ ##",
|
||||
"## ##",
|
||||
"## T2CodeLib from JaTiTV / T2Code.net. In case of problems please contact the Discord: https://dc.t2code.net ##",
|
||||
"## ##",
|
||||
"####################################################################################################################");
|
||||
|
||||
|
||||
public static String getInfoText() {
|
||||
return "";
|
||||
public static String[] getConfigLogo() {
|
||||
|
||||
ArrayList<String> arrayList = new ArrayList<>(configT2CodeLogo);
|
||||
|
||||
arrayList.addAll(Arrays.asList("", "# Spigot: " + getSpigot()));
|
||||
|
||||
return arrayList.toArray(new String[0]);
|
||||
}
|
||||
|
||||
public static String getPrefix() {
|
||||
return "<dark_gray>[<dark_red>T2Code</dark_red><dark_purple>Lib</dark_purple>]</dark_gray>";
|
||||
}
|
||||
|
||||
public static Integer getSpigotID() {
|
||||
return 96388;
|
||||
}
|
||||
@Getter
|
||||
private static String[] loadLogo = new String[]{
|
||||
"╔═══════════════════════════════════════════════════════════════════════════╗",
|
||||
"║ _______ ___ _____ _ _ ║",
|
||||
"║ |__ __| |__ \\ / ____| | | | | ║",
|
||||
"║ | | ) | | | ___ __| | ___ _ __ ___ | |_ ║",
|
||||
"║ | | / / | | / _ \\ / _` | / _ \\ | '_ \\ / _ \\ | __| ║",
|
||||
"║ | | / /_ | |____ | (_) | | (_| | | __/ _ | | | | | __/ | |_ ║",
|
||||
"║ |_| |____| \\_____| \\___/ \\__,_| \\___| (_) |_| |_| \\___| \\__| ║",
|
||||
"║ ║",
|
||||
"║ This plugin is from T2Code.net ║",
|
||||
"║ Development Team: JaTiTV & Jkobs ║",
|
||||
"║ Feel free to come to our Discord for support: https://dc.t2code.net ║",
|
||||
"╠═══════════════════════════════════════════════════════════════════════════╣"
|
||||
};
|
||||
|
||||
public static String getGit() {
|
||||
return "JaTiTV/T2CodeLib";
|
||||
}
|
||||
|
||||
public static Integer getBstatsID() {
|
||||
return 12518;
|
||||
}
|
||||
|
||||
public static String getSpigot() {
|
||||
return "https://www.spigotmc.org/resources/" + getSpigotID();
|
||||
}
|
||||
|
||||
public static String getDiscord() {
|
||||
return "http://dc.t2code.net";
|
||||
}
|
||||
|
||||
public static List<String> getT2cPlugins() {
|
||||
return Arrays.asList(
|
||||
"T2CodeLib",
|
||||
"T2C-LuckyBox",
|
||||
"WonderBagShop",
|
||||
"CommandGUI",
|
||||
// "T2C-OPSecurity",
|
||||
"OPSecurity",
|
||||
"PaPiTest",
|
||||
"T2C-Alias",
|
||||
"T2C-AutoResponse",
|
||||
"LoreEditor",
|
||||
"Booster",
|
||||
"AntiMapCopy",
|
||||
"AntiCopy",
|
||||
"T2C-LoginPermissionAuth"
|
||||
);
|
||||
}
|
||||
private static String[] loadLogos = new String[]{
|
||||
"╔════════════════════════════════════╗",
|
||||
// "║ Version: "+version+" ║",
|
||||
"╚════════════════════════════════════╝"
|
||||
};
|
||||
}
|
||||
|
@@ -0,0 +1,32 @@
|
||||
// This class was created by JaTiTV.
|
||||
|
||||
package net.t2code.t2codelib.VELOCITY.api.commands;
|
||||
|
||||
import com.velocitypowered.api.command.CommandManager;
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.proxy.ConsoleCommandSource;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import net.t2code.t2codelib.VELOCITY.system.T2CodeVMain;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
public class T2CVcmd {
|
||||
|
||||
private static final ProxyServer server = T2CodeVMain.getServer();
|
||||
private static final Logger logger = T2CodeVMain.getLogger();
|
||||
|
||||
public static void Console(String cmd) {
|
||||
// Get the console command source
|
||||
ConsoleCommandSource console = server.getConsoleCommandSource();
|
||||
|
||||
// Dispatch the command
|
||||
server.getCommandManager().executeAsync(console, cmd).join();
|
||||
}
|
||||
|
||||
public static void Player(CommandSource player, String cmd) {
|
||||
CommandManager commandManager = server.getCommandManager();
|
||||
|
||||
// Dispatch the command
|
||||
commandManager.executeImmediatelyAsync(player, cmd);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,97 @@
|
||||
package net.t2code.t2codelib.VELOCITY.api.messages;
|
||||
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.title.Title;
|
||||
import net.t2code.t2codelib.VELOCITY.system.config.T2CVlibConfig;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class T2CVsend {
|
||||
|
||||
public static void console(Logger logger, String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
logger.info(msg);
|
||||
}
|
||||
|
||||
public static void player(Player player, String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
player.sendMessage(Component.text(msg));
|
||||
}
|
||||
|
||||
public static void sender(CommandSource sender, String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
sender.sendMessage(Component.text(msg));
|
||||
}
|
||||
|
||||
public static void console(Logger logger, Object object) {
|
||||
for (String msg : list(object)) {
|
||||
if (msg == null || msg.contains("[empty]")) continue;
|
||||
logger.info(msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void player(Player player, Object object) {
|
||||
for (String msg : list(object)) {
|
||||
if (msg == null || msg.contains("[empty]")) continue;
|
||||
player.sendMessage(Component.text(msg));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void sender(CommandSource sender, Object object) {
|
||||
for (String msg : list(object)) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
sender.sendMessage(Component.text(msg));
|
||||
}
|
||||
}
|
||||
|
||||
public static void title(Player player, @Nullable String title, @Nullable String subtitle, Integer fadeIn, Integer stay, Integer fadeOut) {
|
||||
Component titleComponent = title != null ? Component.text(title) : Component.empty();
|
||||
Component subtitleComponent = subtitle != null ? Component.text(subtitle) : Component.empty();
|
||||
|
||||
Title.Times times = Title.Times.times(Duration.ofSeconds(fadeIn == null ? 1 : fadeIn), Duration.ofSeconds(stay == null ? 3 : stay), Duration.ofSeconds(fadeOut == null ? 1 : fadeOut));
|
||||
Title playerTitle = Title.title(titleComponent, subtitleComponent, times);
|
||||
|
||||
player.showTitle(playerTitle);
|
||||
}
|
||||
|
||||
|
||||
public static void debugmsg(Logger logger, String msg) {
|
||||
logger.warn(msg);
|
||||
}
|
||||
|
||||
public static void debug(Logger logger, String msg) {
|
||||
if (!(boolean)T2CVlibConfig.VALUES.debug.getValue()) return;
|
||||
logger.warn(msg);
|
||||
}
|
||||
|
||||
public static void info(Logger logger, String msg) {
|
||||
logger.info(msg);
|
||||
}
|
||||
|
||||
public static void warning(Logger logger, String msg) {
|
||||
logger.warn(msg);
|
||||
}
|
||||
|
||||
public static void error(Logger logger, String msg) {
|
||||
logger.error(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,56 @@
|
||||
// This class was created by JaTiTV.
|
||||
|
||||
package net.t2code.t2codelib.VELOCITY.api.pluginMessaging;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import net.t2code.t2codelib.VELOCITY.api.commands.T2CVcmd;
|
||||
import net.t2code.t2codelib.VELOCITY.system.T2CodeVMain;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
public class T2CVplmsgCmd {
|
||||
|
||||
private final ProxyServer server;
|
||||
private final Logger logger;
|
||||
|
||||
|
||||
public T2CVplmsgCmd(ProxyServer server, Logger logger) {
|
||||
this.server = server;
|
||||
this.logger = logger;
|
||||
server.getChannelRegistrar().register(T2CodeVMain.bcmd);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onPluginMessageFromPlayer(PluginMessageEvent event) {
|
||||
if (event.getIdentifier() != T2CodeVMain.bcmd) {
|
||||
return;
|
||||
}
|
||||
ByteArrayDataInput stream = ByteStreams.newDataInput(event.getData());
|
||||
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")) {
|
||||
logger.info("{} [{}] T2C BCMD Command Console: {}", Util.getVPrefix(), serverID, input);
|
||||
T2CVcmd.Console(input);
|
||||
} else {
|
||||
Player player = server.getPlayer(channel).orElse(null);
|
||||
if (player != null) {
|
||||
logger.info("{} [{}] T2C BCMD Command {}: {}", Util.getVPrefix(), serverID, player, input);
|
||||
T2CVcmd.Player(player, input);
|
||||
}
|
||||
}
|
||||
event.setResult(PluginMessageEvent.ForwardResult.handled());
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
// This class was created by JaTiTV.
|
||||
|
||||
package net.t2code.t2codelib.VELOCITY.api.pluginMessaging.autoResponse;
|
||||
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import net.t2code.t2codelib.VELOCITY.api.commands.T2CVcmd;
|
||||
import net.t2code.t2codelib.VELOCITY.api.messages.T2CVsend;
|
||||
import net.t2code.t2codelib.VELOCITY.system.T2CodeVMain;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class T2CVapiAutoResponse {
|
||||
private final ProxyServer server;
|
||||
private final Logger logger;
|
||||
|
||||
public T2CVapiAutoResponse(ProxyServer server, Logger logger) {
|
||||
this.server = server;
|
||||
this.logger = logger;
|
||||
server.getChannelRegistrar().register(T2CodeVMain.aresp);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onPluginmessage(PluginMessageEvent event) {
|
||||
if (event.getIdentifier() != T2CodeVMain.aresp) {
|
||||
return;
|
||||
}
|
||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
||||
|
||||
try {
|
||||
String channel = stream.readUTF();
|
||||
String input = stream.readUTF();
|
||||
|
||||
switch (channel) {
|
||||
case "ConC":
|
||||
logger.info("Command Console: {}", input);
|
||||
T2CVcmd.Console(input);
|
||||
break;
|
||||
case "ALLPMSG":
|
||||
for (Player player : server.getAllPlayers()) {
|
||||
T2CVsend.player(player, input);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Player player = server.getPlayer(channel).orElse(null);
|
||||
if (player != null) {
|
||||
logger.info("Command Console: {}", input);
|
||||
T2CVcmd.Player(player, input);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,75 @@
|
||||
// This class was created by JaTiTV.
|
||||
|
||||
package net.t2code.t2codelib.VELOCITY.api.pluginMessaging.commandgui;
|
||||
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.connection.DisconnectEvent;
|
||||
import com.velocitypowered.api.event.connection.PostLoginEvent;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import net.t2code.t2codelib.VELOCITY.system.T2CodeVMain;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class T2CVapiCGUI {
|
||||
|
||||
private static ProxyServer server;
|
||||
private static Logger logger;
|
||||
|
||||
public T2CVapiCGUI(ProxyServer server, Logger logger) {
|
||||
T2CVapiCGUI.server = server;
|
||||
T2CVapiCGUI.logger = logger;
|
||||
server.getChannelRegistrar().register(T2CodeVMain.cguiopl);
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onJoin(PostLoginEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
sendToSpigotPlayer(player.getUsername(), true);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onDisconnect(DisconnectEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
sendToSpigotPlayer(player.getUsername(), false);
|
||||
}
|
||||
|
||||
public 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.warn(e.getMessage());
|
||||
}
|
||||
byte[] data = stream.toByteArray();
|
||||
for (RegisteredServer server : server.getAllServers()) {
|
||||
server.sendPluginMessage(T2CodeVMain.cguiopl, data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendToSpigotDeleteAll() {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream output = new DataOutputStream(stream);
|
||||
try {
|
||||
output.writeUTF("clear");
|
||||
output.writeUTF("");
|
||||
} catch (IOException e) {
|
||||
logger.warn(e.getMessage());
|
||||
}
|
||||
byte[] data = stream.toByteArray();
|
||||
for (RegisteredServer server : server.getAllServers()) {
|
||||
server.sendPluginMessage(T2CodeVMain.cguiopl, data);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
// This class was created by JaTiTV.
|
||||
|
||||
package net.t2code.t2codelib.VELOCITY.api.pluginMessaging.opSecurity;
|
||||
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import net.t2code.t2codelib.VELOCITY.system.T2CodeVMain;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class T2CVapiOpSecurity {
|
||||
private static ProxyServer server ;
|
||||
private static Logger logger ;
|
||||
|
||||
public T2CVapiOpSecurity(ProxyServer server, Logger logger) {
|
||||
T2CVapiOpSecurity.server = server;
|
||||
T2CVapiOpSecurity.logger = logger;
|
||||
server.getChannelRegistrar().register(T2CodeVMain.opsec);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onPluginmessage(PluginMessageEvent event) {
|
||||
if (event.getIdentifier() != T2CodeVMain.opsec) {
|
||||
return;
|
||||
}
|
||||
|
||||
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.error(e.getMessage());
|
||||
}
|
||||
for (RegisteredServer server : server.getAllServers()) {
|
||||
server.sendPluginMessage(T2CodeVMain.opsec, stream.toByteArray());
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,111 @@
|
||||
// This class was created by JaTiTV.
|
||||
|
||||
package net.t2code.t2codelib.VELOCITY.api.proxyPlayers;
|
||||
|
||||
|
||||
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.connection.DisconnectEvent;
|
||||
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
||||
import com.velocitypowered.api.event.connection.PostLoginEvent;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import net.t2code.t2codelib.SPIGOT.api.bungeePlayers.T2CbungeePlayersEnum;
|
||||
import net.t2code.t2codelib.VELOCITY.api.messages.T2CVsend;
|
||||
import net.t2code.t2codelib.VELOCITY.system.T2CodeVMain;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
|
||||
public class T2CVPlayers {
|
||||
|
||||
public static ProxyServer server = T2CodeVMain.getServer();
|
||||
public static Logger logger = T2CodeVMain.getLogger();
|
||||
|
||||
@Subscribe
|
||||
public void onJoin(PostLoginEvent e) {
|
||||
sendToSpigotPlayer(e.getPlayer().getUsername(), T2CbungeePlayersEnum.JOIN, "");
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onDisconnect(DisconnectEvent e) {
|
||||
sendToSpigotPlayer(e.getPlayer().getUsername(), T2CbungeePlayersEnum.QUIT, "");
|
||||
}
|
||||
|
||||
public void sendToSpigotPlayer(String name, T2CbungeePlayersEnum value, String uuid) {
|
||||
switch (value) {
|
||||
case JOIN:
|
||||
case QUIT:
|
||||
sendToSpigotPlayerExecute(name, value, uuid);
|
||||
break;
|
||||
case GIVEALL:
|
||||
StringBuilder input = new StringBuilder();
|
||||
for (Player player : server.getAllPlayers()) {
|
||||
input.append(player.getUsername()).append(";");
|
||||
}
|
||||
sendToSpigotPlayerExecute(input.toString(), T2CbungeePlayersEnum.GIVEALL, uuid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void sendToSpigotPlayerExecute(String name, T2CbungeePlayersEnum 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.error (e.getMessage());
|
||||
}
|
||||
T2CVsend.debug(logger, "PluginMessage received channel: t2c:bonlp");
|
||||
T2CVsend.debug(logger, "PluginMessage received subChannel: " + value.name());
|
||||
T2CVsend.debug(logger, "PluginMessage received input: " + name);
|
||||
T2CVsend.debug(logger, "PluginMessage received input2/uuid: " + uuid);
|
||||
byte[] data = stream.toByteArray();
|
||||
for (RegisteredServer server : server.getAllServers()) {
|
||||
server.sendPluginMessage(T2CodeVMain.bonlp, data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void sendToSpigotDeleteAll() {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream output = new DataOutputStream(stream);
|
||||
try {
|
||||
output.writeUTF(T2CbungeePlayersEnum.CLEAR.name());
|
||||
output.writeUTF("");
|
||||
output.writeUTF("");
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
byte[] data = stream.toByteArray();
|
||||
for (RegisteredServer server : server.getAllServers()) {
|
||||
server.sendPluginMessage(T2CodeVMain.bonlp, data);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onPluginMessage(PluginMessageEvent event) {
|
||||
if (event.getIdentifier() != T2CodeVMain.bonlp) {
|
||||
return;
|
||||
}
|
||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
||||
|
||||
try {
|
||||
T2CbungeePlayersEnum subChannel = T2CbungeePlayersEnum.valueOf(stream.readUTF());
|
||||
String input = stream.readUTF();
|
||||
|
||||
T2CVsend.debug(logger, "PluginMessage received channel: " + T2CodeVMain.bonlp);
|
||||
T2CVsend.debug(logger, "PluginMessage received subChannel: " + subChannel.name());
|
||||
T2CVsend.debug(logger, "PluginMessage received input/uuid: " + input);
|
||||
|
||||
sendToSpigotPlayer("", subChannel, input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,77 @@
|
||||
package net.t2code.t2codelib.VELOCITY.api.update;
|
||||
|
||||
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import net.t2code.t2codelib.T2CupdateObject;
|
||||
import net.t2code.t2codelib.T2CupdateWebData;
|
||||
import net.t2code.t2codelib.UpdateType;
|
||||
import net.t2code.t2codelib.VELOCITY.api.messages.T2CVsend;
|
||||
import net.t2code.t2codelib.VELOCITY.system.config.T2CVlibConfig;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class T2CVupdateAPI {
|
||||
public static HashMap<String, T2CupdateObject> bungeePluginVersins = new HashMap<>();
|
||||
|
||||
public static void sendUpdateMsg(Logger logger, String prefix, String discord, T2CupdateWebData webData, PluginContainer plugin) {
|
||||
String publicVersion = webData.getVersion();
|
||||
String pluginVersion = plugin.getDescription().getVersion().orElse("unknown");
|
||||
String value;
|
||||
if (webData.isPreRelease()) {
|
||||
value = UpdateType.PRERELEASE_.text;
|
||||
if (publicVersion.toLowerCase().contains("dev")) {
|
||||
value = UpdateType.DEVELOPMENT_.text;
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("beta")) {
|
||||
value = UpdateType.BETA_.text;
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("snapshot")) {
|
||||
value = UpdateType.SNAPSHOT_.text;
|
||||
}
|
||||
} else value = UpdateType.STABLE_.text;
|
||||
T2CVsend.console(logger, "╔══════════════" + prefix + "══════════════");
|
||||
T2CVsend.console(logger, "║ A new [value] version was found!".replace("[value]", value));
|
||||
T2CVsend.console(logger, "║ Your version: " + pluginVersion + " - Current version: " + webData.getVersion());
|
||||
T2CVsend.console(logger, "║ You can download it here: " + webData.getUpdateUrl());
|
||||
T2CVsend.console(logger, "║ You can find more information on Discord: " + discord);
|
||||
T2CVsend.console(logger, "╚══════════════" + prefix + "══════════════");
|
||||
}
|
||||
|
||||
private static Boolean noUpdate = true;
|
||||
private static String pluginVersion;
|
||||
|
||||
public static void onUpdateCheckTimer(Logger logger, PluginContainer plugin, ProxyServer server, String prefix, String discord, Integer spigotID, String url) {
|
||||
if ((int) T2CVlibConfig.VALUES.updateTimer.getValue() < 1) {
|
||||
T2CVlibConfig.VALUES.updateTimer.setValue(1);
|
||||
}
|
||||
|
||||
server.getScheduler().buildTask(plugin, () -> {
|
||||
(new T2CVupdateCheckerGit(plugin,logger)).getVersion((webData) -> {
|
||||
pluginVersion = plugin.getDescription().getVersion().toString();
|
||||
T2CupdateObject update = new T2CupdateObject(
|
||||
plugin.getDescription().getName().toString(),
|
||||
plugin.getDescription().getVersion().toString(),
|
||||
webData,
|
||||
false,
|
||||
!plugin.getDescription().getVersion().equals(webData.getVersion()),
|
||||
true
|
||||
);
|
||||
bungeePluginVersins.put(plugin.getDescription().getName().toString(), update);
|
||||
if (!pluginVersion.replace("_Velocity", "").equalsIgnoreCase(webData.getVersion())) {
|
||||
sendUpdateMsg(logger,prefix, discord, webData, plugin);
|
||||
noUpdate = true;
|
||||
} else {
|
||||
if (noUpdate) {
|
||||
T2CVsend.console(logger, " No update found.");
|
||||
noUpdate = false;
|
||||
}
|
||||
}
|
||||
}, pluginVersion, spigotID, url);
|
||||
|
||||
}).repeat(Duration.ofMinutes((int) T2CVlibConfig.VALUES.updateTimer.getValue())).schedule();
|
||||
}
|
||||
}
|
@@ -0,0 +1,101 @@
|
||||
package net.t2code.t2codelib.VELOCITY.api.update;
|
||||
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
|
||||
import net.t2code.t2codelib.T2CupdateObject;
|
||||
import net.t2code.t2codelib.T2CupdateWebData;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
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 T2CVupdateCheckerGit {
|
||||
private PluginContainer plugin;
|
||||
private Logger logger;
|
||||
|
||||
|
||||
public T2CVupdateCheckerGit(PluginContainer plugin, Logger logger) {
|
||||
this.plugin = plugin;
|
||||
this.logger=logger;
|
||||
|
||||
}
|
||||
|
||||
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String gitKey) {
|
||||
String RepoURL = "https://git.t2code.net/api/v1/repos/" + gitKey + "/releases?limit=1";
|
||||
if (!(boolean)T2CBlibConfig.VALUES.seePreReleaseUpdates.getValue() ) {
|
||||
RepoURL = RepoURL + "&pre-release=false";
|
||||
}
|
||||
String finalRepoURL = RepoURL;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
T2CupdateWebData webData = new T2CupdateWebData(updateTitle, version, updateDescription, updateUrl, publishedAt, downloadURL, gitURL, preRelease);
|
||||
consumer.accept(webData);
|
||||
} catch (Exception var10) {
|
||||
Boolean load = false;
|
||||
if (T2CVupdateAPI.bungeePluginVersins.containsKey(plugin.getDescription().getName().toString())) {
|
||||
load = T2CVupdateAPI.bungeePluginVersins.get(plugin.getDescription().getName().toString()).load;
|
||||
}
|
||||
T2CupdateObject update = new T2CupdateObject(
|
||||
plugin.getDescription().getName().toString(),
|
||||
pluginVersion,
|
||||
null,
|
||||
load,
|
||||
false,
|
||||
true
|
||||
);
|
||||
T2CVupdateAPI.bungeePluginVersins.put(plugin.getDescription().getName().toString(), update);
|
||||
logger.error("Cannot look for updates: {}", var10.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,165 @@
|
||||
package net.t2code.t2codelib.VELOCITY.api.yml;// This class was created by JaTiTV.
|
||||
|
||||
|
||||
import net.t2code.t2codelib.T2CLanguageEnum;
|
||||
import net.t2code.t2codelib.T2CconfigItem;
|
||||
import org.slf4j.Logger;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
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 T2CVconfigWriter {
|
||||
|
||||
public static void createConfig(Logger logger, File configFile, T2CconfigItem[] manager, String... header) throws IOException {
|
||||
boolean exist = configFile.exists();
|
||||
if (!exist) {
|
||||
configFile.getParentFile().mkdirs();
|
||||
try {
|
||||
configFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Yaml yaml = new Yaml();
|
||||
Map<String, Object> config = yaml.load(Files.newInputStream(configFile.toPath()));
|
||||
Map<String, List<String>> comments = new LinkedHashMap<>();
|
||||
if (config == null) {
|
||||
config = new LinkedHashMap<>();
|
||||
}
|
||||
|
||||
T2CLanguageEnum lang = T2CLanguageEnum.english;
|
||||
|
||||
for (T2CconfigItem item : manager) {
|
||||
if (item.getForceSet() || !exist) {
|
||||
readValue(config, item.getPath(), item);
|
||||
addValue(config, item.getPath(), item.getValue());
|
||||
List<String> commandList = item.getComments().get(lang);
|
||||
if (commandList != null) {
|
||||
comments.put(item.getPath(), commandList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
saveConfigWithComments(configFile, comments, config, header);
|
||||
}
|
||||
|
||||
private static void readValue(Map<String, Object> config, String path, T2CconfigItem value) {
|
||||
if (path.contains(".")) {
|
||||
String[] pathsplit = path.split("\\.");
|
||||
String key = pathsplit[0];
|
||||
if (config.containsKey(key)) {
|
||||
StringBuilder zw = new StringBuilder();
|
||||
for (int i = 1; i < pathsplit.length; i++) {
|
||||
zw.append(pathsplit[i]);
|
||||
if (i != (pathsplit.length - 1)) {
|
||||
zw.append(".");
|
||||
}
|
||||
}
|
||||
readValue((Map<String, Object>) config.get(key), zw.toString(), value);
|
||||
}
|
||||
} else {
|
||||
Object vl = config.get(path);
|
||||
if (vl != null) {
|
||||
value.setValue(vl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addValue(Map<String, Object> config, String path, Object value) {
|
||||
if (path.contains(".")) {
|
||||
String[] pathsplit = path.split("\\.");
|
||||
String key = pathsplit[0];
|
||||
if (config.containsKey(key)) {
|
||||
StringBuilder zw = new StringBuilder();
|
||||
for (int i = 1; i < pathsplit.length; i++) {
|
||||
zw.append(pathsplit[i]);
|
||||
if (i != (pathsplit.length - 1)) {
|
||||
zw.append(".");
|
||||
}
|
||||
}
|
||||
addValue((Map<String, Object>) config.get(key), zw.toString(), value);
|
||||
} else {
|
||||
Map<String, Object> newMap = new LinkedHashMap<>();
|
||||
StringBuilder zw = new StringBuilder();
|
||||
for (int i = 1; i < pathsplit.length; i++) {
|
||||
zw.append(pathsplit[i]);
|
||||
if (i != (pathsplit.length - 1)) {
|
||||
zw.append(".");
|
||||
}
|
||||
}
|
||||
addValue(newMap, zw.toString(), value);
|
||||
config.put(key, newMap);
|
||||
}
|
||||
} else {
|
||||
if (!config.containsKey(path)) {
|
||||
config.put(path, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void saveConfigWithComments(File file, Map<String, List<String>> comments, Map<String, Object> config, String... headers) {
|
||||
try {
|
||||
StringBuilder configContent = new StringBuilder();
|
||||
for (String h : headers) {
|
||||
configContent.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(Map<String, Object> config, Map<String, List<String>> comments, StringBuilder builder, String prefix, int indentLevel) {
|
||||
String indent = " ".repeat(indentLevel);
|
||||
|
||||
|
||||
for (Map.Entry<String, Object> key : config.entrySet()) {
|
||||
String fullKey = prefix.isEmpty() ? key.getKey() : prefix + "." + key.getKey();
|
||||
Object value = key.getValue();
|
||||
|
||||
// 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 Map) {
|
||||
// Correctly add the section
|
||||
builder.append(indent).append(key.getKey()).append(":\n");
|
||||
addSection((Map<String, Object>) value, comments, builder, fullKey, indentLevel + 1);
|
||||
} else {
|
||||
// Add value with proper indentation
|
||||
// builder.append(indent).append(key.getKey()).append(": ").append(value).append("\n");
|
||||
if (value instanceof List) {
|
||||
builder.append(indent).append(key.getKey()).append(": ").append("\n");
|
||||
List<Object> zw = (List<Object>) value;
|
||||
for (Object s : zw) {
|
||||
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.getKey()).append(": \"").append(value).append("\"\n");
|
||||
} else builder.append(indent).append(key.getKey()).append(": ").append(value).append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,124 @@
|
||||
// This class was created by JaTiTV.
|
||||
|
||||
package net.t2code.t2codelib.VELOCITY.system;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||
import lombok.Getter;
|
||||
|
||||
import net.t2code.t2codelib.Util;
|
||||
import net.t2code.t2codelib.VELOCITY.api.pluginMessaging.T2CVplmsgCmd;
|
||||
import net.t2code.t2codelib.VELOCITY.api.pluginMessaging.autoResponse.T2CVapiAutoResponse;
|
||||
import net.t2code.t2codelib.VELOCITY.api.pluginMessaging.commandgui.T2CVapiCGUI;
|
||||
import net.t2code.t2codelib.VELOCITY.api.pluginMessaging.opSecurity.T2CVapiOpSecurity;
|
||||
import net.t2code.t2codelib.VELOCITY.api.proxyPlayers.T2CVPlayers;
|
||||
import net.t2code.t2codelib.VELOCITY.api.update.T2CVupdateAPI;
|
||||
import net.t2code.t2codelib.VELOCITY.system.bstats.Metrics;
|
||||
import net.t2code.t2codelib.VELOCITY.system.config.T2CVlibConfig;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class T2CodeVMain {
|
||||
|
||||
@Getter
|
||||
private static ProxyServer server;
|
||||
@Getter
|
||||
private static Logger logger;
|
||||
@Getter
|
||||
private PluginContainer plugin;
|
||||
@Getter
|
||||
private final long starttime;
|
||||
@Getter
|
||||
private static Path dataDirectory;
|
||||
|
||||
private final Metrics.Factory metricsFactory;
|
||||
|
||||
|
||||
public static final MinecraftChannelIdentifier bcmd = MinecraftChannelIdentifier.from("t2c:bcmd");
|
||||
public static final MinecraftChannelIdentifier bonlp = MinecraftChannelIdentifier.from("t2c:bonlp");
|
||||
public static final MinecraftChannelIdentifier cguiopl = MinecraftChannelIdentifier.from("t2c:cguiopl");
|
||||
public static final MinecraftChannelIdentifier aresp = MinecraftChannelIdentifier.from("t2c:aresp");
|
||||
public static final MinecraftChannelIdentifier opsec = MinecraftChannelIdentifier.from("t2c:opsec");
|
||||
|
||||
|
||||
@Inject
|
||||
public T2CodeVMain(ProxyServer server, Logger logger, @DataDirectory Path dataDirectory, Metrics.Factory metricsFactory) {
|
||||
starttime = System.currentTimeMillis();
|
||||
T2CodeVMain.server = server;
|
||||
T2CodeVMain.logger = logger;
|
||||
T2CodeVMain.dataDirectory = dataDirectory;
|
||||
this.metricsFactory = metricsFactory;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onLoad(ProxyInitializeEvent e) {
|
||||
new pl(this, server);
|
||||
logger.info("╔════════════════════════════════════");
|
||||
// logger.info("║");
|
||||
for (String s : Util.getLoadLogo()) {
|
||||
logger.info("║ {}", s);
|
||||
}
|
||||
logger.info("║");
|
||||
// Thread.sleep(5000);
|
||||
logger.info("║ Author: {}", String.valueOf(plugin.getDescription().getAuthors()).replace("[", "").replace("]", ""));
|
||||
logger.info("║ Version: {}", plugin.getDescription().getVersion().orElse("unknown"));
|
||||
logger.info("║ Spigot: {}", Util.getSpigot());
|
||||
logger.info("║ Discord: {}", Util.getDiscord());
|
||||
|
||||
try {
|
||||
T2CVlibConfig.set(dataDirectory, logger);
|
||||
} catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
|
||||
// new T2CVcmd(server, logger);
|
||||
// server.getEventManager().register(this, new T2CVpluginMessagingCmd(server, logger));
|
||||
|
||||
//API
|
||||
|
||||
server.getEventManager().register(this, new T2CVplmsgCmd(server, logger));
|
||||
|
||||
|
||||
server.getChannelRegistrar().register(T2CodeVMain.bonlp);
|
||||
T2CVPlayers.sendToSpigotDeleteAll();
|
||||
|
||||
if ((boolean) T2CVlibConfig.VALUES.apiCommandGUIEnable.getValue()) {
|
||||
server.getEventManager().register(this, new T2CVapiCGUI(server, logger));
|
||||
T2CVapiCGUI.sendToSpigotDeleteAll();
|
||||
}
|
||||
|
||||
if ((boolean) T2CVlibConfig.VALUES.apiAutoResponse.getValue()) {
|
||||
server.getEventManager().register(this, new T2CVapiAutoResponse(server, logger));
|
||||
}
|
||||
|
||||
if ((boolean) T2CVlibConfig.VALUES.apiOpSecurity.getValue()) {
|
||||
server.getEventManager().register(this, new T2CVapiOpSecurity(server, logger));
|
||||
}
|
||||
|
||||
|
||||
Metrics.bStats(this, Util.getBstatsID(), metricsFactory);
|
||||
T2CVupdateAPI.onUpdateCheckTimer(logger, plugin, server, Util.getVPrefix(), Util.getDiscord(), Util.getSpigotID(), Util.getGit());
|
||||
logger.info("║");
|
||||
logger.info("║ Plugin loaded successfully - {}ms", System.currentTimeMillis() - starttime);
|
||||
logger.info("╚════════════════════════════════════");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class pl {
|
||||
public pl(Object pl, ProxyServer server) {
|
||||
plugin = server.getPluginManager().fromInstance(pl)
|
||||
.orElseThrow(() -> new IllegalArgumentException("The provided instance is not a plugin"));
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,95 @@
|
||||
package net.t2code.t2codelib.VELOCITY.system.config;
|
||||
|
||||
import net.t2code.t2codelib.T2CLanguageEnum;
|
||||
import net.t2code.t2codelib.T2CconfigItem;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import net.t2code.t2codelib.VELOCITY.api.messages.T2CVsend;
|
||||
import net.t2code.t2codelib.VELOCITY.api.yml.T2CVconfigWriter;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class T2CVlibConfig {
|
||||
|
||||
public enum VALUES implements T2CconfigItem {
|
||||
updateTimer("updateCheck.timerInMin", 60, true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.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(T2CLanguageEnum.english, List.of("In this option you can set whether you want to receive and display beta and snapshot versions in the update check."));
|
||||
}}),
|
||||
|
||||
debug("plugin.debug.debugModus", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.english, List.of("The debug mode sends more detailed debug information to the console."));
|
||||
}}),
|
||||
|
||||
apiCommandGUIEnable("api.commandGUI.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.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(T2CLanguageEnum.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(T2CLanguageEnum.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<T2CLanguageEnum, List<String>> comments;
|
||||
|
||||
VALUES(String path, Object value, boolean forceSet, HashMap<T2CLanguageEnum, 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<T2CLanguageEnum, List<String>> getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLanguagePath() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Object newValue) {
|
||||
value = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(Path dataDirectory, Logger logger) throws IOException {
|
||||
long long_ = System.currentTimeMillis();
|
||||
T2CVconfigWriter.createConfig(logger, new File(dataDirectory.getParent() + "/T2CodeLib", "config.yml"), VALUES.values(), Util.getConfigLogo());
|
||||
T2CVsend.info(logger, "║ The config.yml were successfully created / updated." + " - " + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
}
|
@@ -3,9 +3,9 @@ version: '${project.version}'
|
||||
main: net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain
|
||||
api-version: 1.13
|
||||
prefix: T2CodeLib
|
||||
authors: [ JaTiTV, Jkobs ]
|
||||
authors: [ JaTiTV ]
|
||||
description: Library from T2Code Plugins
|
||||
website: T2Code.net
|
||||
website: https://spigotmc.org/resources/96388/
|
||||
load: STARTUP
|
||||
|
||||
softdepend:
|
||||
@@ -29,3 +29,10 @@ commands:
|
||||
permissions:
|
||||
t2code.admin:
|
||||
default: op
|
||||
children:
|
||||
t2code.permtoggle.use: true
|
||||
t2code.lib.updatemsg: true
|
||||
t2code.permtoggle.use:
|
||||
default: op
|
||||
t2code.lib.updatemsg:
|
||||
default: op
|
||||
|
1
src/main/resources/velocity-plugin.json
Normal file
1
src/main/resources/velocity-plugin.json
Normal file
@@ -0,0 +1 @@
|
||||
{"id":"t2codelib","name":"T2CodeLib","version":"${project.version}","authors":["JaTiTV"],"dependencies":[],"main":"net.t2code.t2codelib.VELOCITY.system.T2CodeVMain"}
|
Reference in New Issue
Block a user