Compare commits
15 Commits
15.7
...
velocity-d
Author | SHA1 | Date | |
---|---|---|---|
17d3aed11f | |||
a01b4b4330 | |||
b8c65cb537 | |||
32b57de55c | |||
cb4a81a3c1 | |||
|
76862db7c9 | ||
e5cba7fe6d | |||
770b7daa94 | |||
0f645300f4 | |||
65e0082322 | |||
150d9f4933 | |||
f40c47e6ab | |||
de6ecdf7a8 | |||
cdd375a673 | |||
1cfaf32ee1 |
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="ASK" />
|
||||
<option name="description" value="" />
|
||||
</component>
|
||||
</project>
|
8
.idea/encodings.xml
generated
Normal file
8
.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main" charset="UTF-8" />
|
||||
<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 |
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="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>
|
||||
<remote-repository>
|
||||
<option name="id" value="papermc" />
|
||||
<option name="name" value="papermc" />
|
||||
<option name="url" value="https://repo.papermc.io/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>
|
41
pom.xml
41
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>15.7</version>
|
||||
<version>16.7_dev-19</version>
|
||||
<!--version>VERSION_snapshot-0</version-->
|
||||
<!--version>VERSION_beta-0</version-->
|
||||
<!--version>VERSION_dev-0</version-->
|
||||
@@ -15,7 +15,7 @@
|
||||
<name>T2CodeLib</name>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<java.version>11</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
@@ -63,6 +63,10 @@
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<!-- Spigot -->
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
@@ -105,11 +109,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 +122,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 +138,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.2.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- repo.t2code / T2Code -->
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
@@ -182,19 +194,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>
|
||||
|
||||
@@ -202,7 +214,7 @@
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.24</version>
|
||||
<version>1.18.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -221,6 +233,13 @@
|
||||
<version>4.5.14</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20230227</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@@ -6,7 +6,6 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class T2CBtab {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package net.t2code.t2codelib.BUNGEE.system.pluginMessaging;
|
||||
package net.t2code.t2codelib.BUNGEE.api.pluginMessaging;
|
||||
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
@@ -20,7 +20,13 @@ public class T2CplmsgBcmd implements Listener {
|
||||
try {
|
||||
String channel = stream.readUTF();
|
||||
String input = stream.readUTF();
|
||||
String serverID = stream.readUTF();
|
||||
String serverID;
|
||||
try {
|
||||
serverID = stream.readUTF();
|
||||
} catch (Exception i){
|
||||
serverID = "not Found";
|
||||
}
|
||||
|
||||
if (channel.equals("T2Code-Console")) {
|
||||
ProxyServer.getInstance().getConsole().sendMessage(Util.getPrefix()+" [§6"+serverID+"§r] §cT2C BCMD Command Console: §r"+ input);
|
||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);
|
@@ -1,4 +1,4 @@
|
||||
package net.t2code.t2codelib.BUNGEE.system.pluginMessaging.autoResponse;
|
||||
package net.t2code.t2codelib.BUNGEE.api.pluginMessaging.autoResponse;
|
||||
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
@@ -1,4 +1,4 @@
|
||||
package net.t2code.t2codelib.BUNGEE.system.pluginMessaging.commandgui;
|
||||
package net.t2code.t2codelib.BUNGEE.api.pluginMessaging.commandgui;
|
||||
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
@@ -1,4 +1,4 @@
|
||||
package net.t2code.t2codelib.BUNGEE.system.pluginMessaging.opSecurity;
|
||||
package net.t2code.t2codelib.BUNGEE.api.pluginMessaging.opSecurity;
|
||||
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
@@ -6,18 +6,18 @@ 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.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 net.t2code.t2codelib.BUNGEE.api.pluginMessaging.T2CplmsgBcmd;
|
||||
import net.t2code.t2codelib.BUNGEE.api.pluginMessaging.autoResponse.T2CapiAutoResponse;
|
||||
import net.t2code.t2codelib.BUNGEE.api.pluginMessaging.commandgui.T2CapiCGUI;
|
||||
import net.t2code.t2codelib.BUNGEE.api.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) {
|
||||
public static void onLoad(Plugin plugin, String prefix, String author, String version, String spigot, String discord, Integer spigotID, Integer bstatsID, String url) {
|
||||
long long_ = System.currentTimeMillis();
|
||||
T2CBsend.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
T2CBsend.console(prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
T2CBsend.console(prefix + " §2Author: §6" + String.valueOf(author).replace("[", "").replace("]", ""));
|
||||
T2CBsend.console(prefix + " §2Version: §6" + version);
|
||||
T2CBsend.console(prefix + " §2Spigot: §6" + spigot);
|
||||
T2CBsend.console(prefix + " §2Discord: §6" + discord);
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package net.t2code.t2codelib.BUNGEE.system;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.kyori.adventure.platform.bungeecord.BungeeAudiences;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
|
||||
@@ -8,16 +9,12 @@ import net.t2code.t2codelib.Util;
|
||||
|
||||
public class T2CodeBMain extends Plugin {
|
||||
|
||||
@Getter
|
||||
private static Plugin plugin;
|
||||
|
||||
public static Plugin getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
private static String version;
|
||||
private static String orgVersion;
|
||||
private static String autor;
|
||||
|
||||
@Getter
|
||||
private static Boolean mmIsLoad = true;
|
||||
private static BungeeAudiences adventure;
|
||||
|
||||
@@ -33,8 +30,8 @@ public class T2CodeBMain extends Plugin {
|
||||
public void onEnable() {
|
||||
// Plugin startup logic
|
||||
plugin = this;
|
||||
orgVersion = plugin.getDescription().getVersion();
|
||||
autor = plugin.getDescription().getAuthor();
|
||||
String orgVersion = plugin.getDescription().getVersion();
|
||||
String author = plugin.getDescription().getAuthor();
|
||||
try {
|
||||
adventure = BungeeAudiences.create(this);
|
||||
T2CBsend.info(this,"Adventure load!");
|
||||
@@ -42,7 +39,7 @@ public class T2CodeBMain extends Plugin {
|
||||
T2CBsend.error(this,"Adventure can not be load!");
|
||||
mmIsLoad = false;
|
||||
}
|
||||
T2CBload.onLoad(plugin, Util.getPrefix(), autor, orgVersion, Util.getSpigot(), Util.getDiscord(), Util.getSpigotID(), Util.getBstatsID(),Util.getGit());
|
||||
T2CBload.onLoad(plugin, Util.getPrefix(), author, orgVersion, Util.getSpigot(), Util.getDiscord(), Util.getSpigotID(), Util.getBstatsID(),Util.getGit());
|
||||
version = plugin.getDescription().getVersion();
|
||||
}
|
||||
|
||||
@@ -64,7 +61,4 @@ public class T2CodeBMain extends Plugin {
|
||||
T2CBsend.console(Util.getPrefix() + " §4Plugin successfully disabled.");
|
||||
T2CBsend.console(Util.getPrefix() + "§4============================= " + Util.getPrefix() + " §4=============================");
|
||||
}
|
||||
public static Boolean getMmIsLoad() {
|
||||
return mmIsLoad;
|
||||
}
|
||||
}
|
||||
|
@@ -1,25 +1,67 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.commands;
|
||||
|
||||
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 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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
@@ -66,7 +75,13 @@ public class T2CitemBuilder {
|
||||
inventory.setItem(slot, item);
|
||||
}
|
||||
|
||||
public static ItemStack base64(String base64Value, Integer amount, String displayName, List<String> lore) {
|
||||
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();
|
||||
|
||||
@@ -81,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";
|
||||
}
|
||||
}
|
||||
|
@@ -8,25 +8,11 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class T2ChoverModule {
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* The T2Code Hover Module will be removed soon,<br/>
|
||||
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
|
||||
* and the Kyori MiniMessage format!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void modulePlayer(String text, String hover, String action, String actionValue, Player player) {
|
||||
modulePlayer((text != null ? text : "null") + "/*/" + (hover != null ? hover : "null") + "/*/" + (action != null ? action : "null")
|
||||
+ "/*/" + (actionValue != null ? actionValue : "null"), player);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* The T2Code Hover Module will be removed soon,<br/>
|
||||
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
|
||||
* and the Kyori MiniMessage format!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void modulePlayer(String msg, Player player) {
|
||||
if (msg.contains("/*/")) {
|
||||
t2cmodule(msg, player);
|
||||
@@ -35,24 +21,10 @@ public class T2ChoverModule {
|
||||
T2CminiMessage.sendPlayerMiniMessage(msg, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* The T2Code Hover Module will be removed soon,<br/>
|
||||
* please use 'T2CminiMessage.sendSenderMiniMessage(msg, sender);'<br/>
|
||||
* and the Kyori MiniMessage format!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void moduleSender(String msg, CommandSender sender) {
|
||||
T2CminiMessage.sendSenderMiniMessage(msg, sender);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* The T2Code Hover Module will be removed soon,<br/>
|
||||
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
|
||||
* and the Kyori MiniMessage format!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void moduleConsole(String msg) {
|
||||
if (T2CodeLibMain.getMmIsLoad()) {
|
||||
T2CminiMessage.sendConsoleMiniMessage(msg);
|
||||
@@ -61,13 +33,6 @@ public class T2ChoverModule {
|
||||
Bukkit.getConsoleSender().sendMessage(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* The T2Code Hover Module will be removed soon,<br/>
|
||||
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
|
||||
* and the Kyori MiniMessage format!
|
||||
*/
|
||||
@Deprecated
|
||||
private static void t2cmodule(String msg, Player player) {
|
||||
String[] split = msg.split("/\\*/");
|
||||
int i = split.length;
|
||||
|
@@ -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,77 +1,52 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class T2Csend {
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void console(String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleConsole(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void player(Player player, String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.modulePlayer(msg, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void sender(CommandSender sender, String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleSender(msg, sender);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
@Deprecated
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
@Deprecated
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
@Deprecated
|
||||
|
||||
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) {
|
||||
@@ -106,4 +81,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;
|
||||
}
|
||||
}
|
||||
|
@@ -3,23 +3,23 @@ package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import net.t2code.t2codelib.T2CupdateWebData;
|
||||
import net.t2code.t2codelib.UpdateType;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class 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> author, String version, String spigot, String discord) {
|
||||
return onLoadHeader(prefix, author, 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> author, String version, String spigot, String discord, Boolean isPremium) {
|
||||
return onLoadHeader(prefix, author, version, spigot, discord, isPremium, null);
|
||||
}
|
||||
|
||||
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord, Boolean isPremium, Boolean isVerify) {
|
||||
public static Long onLoadHeader(String prefix, List<String> author, 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>");
|
||||
@@ -28,7 +28,7 @@ public class T2Ctemplate {
|
||||
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║ §2Author: §6" + String.valueOf(author).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);
|
||||
@@ -81,7 +81,7 @@ public class T2Ctemplate {
|
||||
|
||||
/**
|
||||
* @param prefix
|
||||
* @param autor
|
||||
* @param author
|
||||
* @param spigot
|
||||
* @param discord
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
@@ -94,7 +94,7 @@ public class T2Ctemplate {
|
||||
* </pre></blockquote>
|
||||
*/
|
||||
@Deprecated
|
||||
public static void onDisable(String prefix, List<String> autor, String version, String spigot, String discord) {
|
||||
public static void onDisable(String prefix, List<String> author, String version, String spigot, String discord) {
|
||||
T2Csend.console(prefix + " §2Version: §6" + version);
|
||||
T2Csend.console(prefix + " §4Plugin successfully disabled.");
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class T2Ctemplate {
|
||||
public static void onDisable(String prefix, Plugin plugin) {
|
||||
T2Csend.console(prefix + " §4 §e╔══════════════════════════");
|
||||
T2Csend.console(prefix + " §4 §e║ §2Version: §6" + plugin.getDescription().getVersion());
|
||||
T2Csend.console(prefix + " §4 §e║ §2Autors: §6" + plugin.getDescription().getAuthors());
|
||||
T2Csend.console(prefix + " §4 §e║ §2Authors: §6" + plugin.getDescription().getAuthors());
|
||||
T2Csend.console(prefix + " §4 §e║ §4Plugin successfully disabled.");
|
||||
T2Csend.console(prefix + " §4 §e╚══════════════════════════");
|
||||
}
|
||||
@@ -130,27 +130,21 @@ public class T2Ctemplate {
|
||||
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 stAuthor = "<dark_red>║</dark_red> <yellow>Author(s):</yellow> <gold>[author]</gold>".replace("[author]", plugin.getDescription().getAuthors().toString());
|
||||
|
||||
String stUpdate = "<dark_red>║</dark_red> <yellow>New version available:</yellow> [up]".replace("[up]", webData != null ? update ?
|
||||
"<dark_green>YES</dark_green>" : "<red>no</red>" : "<b><dark_red>It could not be checked for updates!</dark_red></b>");
|
||||
stNVersion = update ? "<br><dark_red>║</dark_red> <yellow>Newest Version:</yellow> <gold>[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>"
|
||||
.replace("[dlink]", discord);
|
||||
String stLinkConsole = "<dark_red>║</dark_red> <yellow>Spigot:</yellow> <gold>https://www.spigotmc.org/resources/" + spigotID + "</gold>"
|
||||
+ "<br><dark_red>║</dark_red> <yellow>Discord:</yellow> <gold>" + discord + "</gold>";
|
||||
String stLink = player ? stLinkPlayer : stLinkConsole;
|
||||
String stLink = getString(spigotID, discord, player);
|
||||
String pr = premiumVerified != null ? "<br><dark_red>║</dark_red> <yellow>Premium verified:</yellow> [pr]".replace("[pr]",
|
||||
premiumVerified ? "<dark_green>YES</dark_green>" : "<red>NO</red>") : "";
|
||||
|
||||
String stMSG = text == null || text.equals("") ? "" : "<br><dark_red>║</dark_red> " + text;
|
||||
String stMSG = text == null || text.isEmpty() ? "" : "<br><dark_red>║</dark_red> " + text;
|
||||
T2Csend.sender(sender, "<br><dark_red>╔════════════════════════════════</dark_red>"
|
||||
+ "<br>" + stPlugin
|
||||
+ "<br>" + stVersion
|
||||
+ stMSG
|
||||
+ "<br>" + stAutor
|
||||
+ "<br>" + stAuthor
|
||||
+ "<br>" + stUpdate
|
||||
+ stNVersion
|
||||
+ "<br>" + stLink
|
||||
@@ -158,6 +152,17 @@ public class T2Ctemplate {
|
||||
+ "<br><dark_red>╚════════════════════════════════</dark_red>");
|
||||
}
|
||||
|
||||
private static @NotNull String getString(int spigotID, String discord, boolean player) {
|
||||
String stLinkPlayer = "<dark_red>║</dark_red> <yellow><hover:show_text:'<green>Go to the Spigot page</green>'><click:open_url:'[slink]'>Spigot</click></hover></yellow> "
|
||||
.replace("[slink]", "https://www.spigotmc.org/resources/" + spigotID)
|
||||
+ "<dark_red>-</dark_red> <dark_purple><hover:show_text:'<green>Go to the T2Code Support Discord</green>'><click:open_url:'[dlink]'>Discord</click></hover></dark_purple>"
|
||||
.replace("[dlink]", discord);
|
||||
String stLinkConsole = "<dark_red>║</dark_red> <yellow>Spigot:</yellow> <gold>https://www.spigotmc.org/resources/" + spigotID + "</gold>"
|
||||
+ "<br><dark_red>║</dark_red> <yellow>Discord:</yellow> <gold>" + discord + "</gold>";
|
||||
String stLink = player ? stLinkPlayer : stLinkConsole;
|
||||
return stLink;
|
||||
}
|
||||
|
||||
public static void sendInfo(CommandSender sender, Plugin plugin, int spigotID, String discord, String text) {
|
||||
sendInfo(sender, plugin, spigotID, discord, null, text);
|
||||
}
|
||||
|
@@ -2,25 +2,33 @@ package net.t2code.t2codelib.SPIGOT.api.minecraftVersion;
|
||||
|
||||
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");
|
||||
|
||||
nms1_8_R1 = nms.contains("1_8_R1");
|
||||
nms1_8_R2 = nms.contains("1_8_R2");
|
||||
@@ -44,6 +52,9 @@ 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");
|
||||
}
|
||||
|
||||
private static String mcVersion;
|
||||
@@ -61,6 +72,7 @@ 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 String nms;
|
||||
private static boolean nms1_8_R1;
|
||||
@@ -85,6 +97,9 @@ 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;
|
||||
|
||||
public static String getMcVersion() {
|
||||
return mcVersion;
|
||||
@@ -146,6 +161,10 @@ public class T2CmcVersion {
|
||||
return mc1_20;
|
||||
}
|
||||
|
||||
public static boolean isMc1_21() {
|
||||
return mc1_21;
|
||||
}
|
||||
|
||||
public static String getNms() {
|
||||
return nms;
|
||||
}
|
||||
@@ -238,6 +257,18 @@ public class T2CmcVersion {
|
||||
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();
|
||||
@@ -260,7 +291,7 @@ public class T2CmcVersion {
|
||||
}
|
||||
|
||||
public static boolean minMc1_13() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() ;
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12();
|
||||
}
|
||||
|
||||
public static boolean minMc1_14() {
|
||||
@@ -268,7 +299,7 @@ public class T2CmcVersion {
|
||||
}
|
||||
|
||||
public static boolean minMc1_15() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() ;
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14();
|
||||
}
|
||||
|
||||
public static boolean minMc1_16() {
|
||||
|
@@ -0,0 +1,31 @@
|
||||
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,
|
||||
}
|
@@ -0,0 +1,100 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.minecraftVersion;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
|
||||
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");
|
||||
//
|
||||
// }
|
||||
}
|
@@ -15,7 +15,6 @@ import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@@ -53,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() {
|
||||
@@ -74,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) {
|
||||
|
@@ -9,6 +9,8 @@ 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;
|
||||
@@ -62,10 +64,11 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
}
|
||||
T2CmcVersion.onCheck();
|
||||
|
||||
if (T2CmcVersion.isNms1_20_R2()) {
|
||||
if (T2CnmsVersions.getT2CnmsEnum() == T2CnmsEnum.not_support) {
|
||||
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.warning(plugin, "The " + T2CmcVersion.getMcVersion() + " is a very fresh / new version.");
|
||||
T2Csend.warning(plugin, "The plugin may not yet be supported on this server! 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()) {
|
||||
@@ -76,22 +79,45 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
}
|
||||
T2Csend.console(prefix + " §3Server run on: §6" + T2CmcVersion.getMcVersion() + " / " + T2CmcVersion.getNms());
|
||||
if (T2CmcVersion.isMc1_21()) {
|
||||
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.console(prefix);
|
||||
T2Csend.warning(plugin, "The 1.21 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
T2Ctemplate.onLoadSeparateStroke(prefix);
|
||||
T2Csend.console(prefix + " §2Server run on:");
|
||||
T2Csend.console(prefix + " §3mcVersion: §6" + T2CmcVersion.getMcVersion());
|
||||
T2Csend.console(prefix + " §3bukkitVersion: §6" + T2CmcVersion.getBukkitVersion());
|
||||
T2Csend.console(prefix + " §3nms: §6" + T2CmcVersion.getNms());
|
||||
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");
|
||||
} 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");
|
||||
|
||||
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");
|
||||
} 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");
|
||||
|
||||
if (T2CpluginCheck.papi()) {
|
||||
T2Csend.console(prefix + " §3PlaceholderAPI: §6connected" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
|
@@ -2,9 +2,7 @@ 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.minecraftVersion.T2CmcVersion;
|
||||
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.T2CupdateObject;
|
||||
@@ -45,6 +43,13 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
Commands.info(sender);
|
||||
return false;
|
||||
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");
|
||||
@@ -52,13 +57,13 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
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 "plugininfo": todo
|
||||
// if (!sender.hasPermission("t2code.admin")) {
|
||||
// T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
// return false;
|
||||
// }
|
||||
// Commands.updateInfo(sender, args);
|
||||
// return false;
|
||||
case "reloadconfig":
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
|
@@ -1,16 +1,16 @@
|
||||
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.SelectLibConfig;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Commands {
|
||||
@@ -83,4 +83,23 @@ public class Commands {
|
||||
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(SelectLibConfig.getCommandPermToggleCommand().replace("[player]",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(SelectLibConfig.getCommandPermToggleCommand().replace("[player]",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.");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@ import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -198,7 +197,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()));
|
||||
}
|
||||
@@ -206,7 +205,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);
|
||||
}
|
||||
|
@@ -5,7 +5,6 @@ import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
@@ -33,6 +33,8 @@ public class ConfigCreate {
|
||||
T2Cconfig.set("BungeeCord.Enable", T2CodeLibMain.getIsBungee(), yamlConfiguration);
|
||||
T2Cconfig.set("Player.Inventories.CloseByServerStop", true, yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Command.PermToggle.PermissionSetCommand","lp user [player] permission set [perm] [value]",yamlConfiguration);
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
|
@@ -28,6 +28,8 @@ public class SelectLibConfig {
|
||||
private static Boolean bungee;
|
||||
@Getter
|
||||
private static Boolean inventoriesCloseByServerStop;
|
||||
@Getter
|
||||
private static String commandPermToggleCommand;
|
||||
|
||||
public static void onSelect() {
|
||||
File config = new File(T2CodeLibMain.getPath(), "config.yml");
|
||||
@@ -46,5 +48,6 @@ public class SelectLibConfig {
|
||||
developerTool = yamlConfiguration.getBoolean("Plugin.Not recommended to disable.developerTool");
|
||||
bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
|
||||
inventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop");
|
||||
commandPermToggleCommand = yamlConfiguration.getString("Command.PermToggle.PermissionSetCommand");
|
||||
}
|
||||
}
|
||||
|
28
src/main/java/net/t2code/t2codelib/T2CVupdateObject.java
Normal file
28
src/main/java/net/t2code/t2codelib/T2CVupdateObject.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package net.t2code.t2codelib;
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class T2CVupdateObject {
|
||||
|
||||
public Optional<String> pluginName;
|
||||
public Optional<String> pluginVersion;
|
||||
public T2CupdateWebData webData;
|
||||
public Boolean load;
|
||||
public Boolean updateAvailable;
|
||||
public Boolean updateCheckOnJoin;
|
||||
|
||||
public T2CVupdateObject(Optional<String> pluginName,
|
||||
Optional<String> pluginVersion,
|
||||
T2CupdateWebData webData,
|
||||
Boolean load,
|
||||
Boolean updateAvailable,
|
||||
Boolean updateCheckOnJoin) {
|
||||
this.pluginName = pluginName;
|
||||
this.pluginVersion = pluginVersion;
|
||||
this.webData = webData;
|
||||
this.load = load;
|
||||
this.updateAvailable = updateAvailable;
|
||||
this.updateCheckOnJoin = updateCheckOnJoin;
|
||||
}
|
||||
}
|
@@ -1,6 +1,8 @@
|
||||
package net.t2code.t2codelib;
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class T2CupdateObject {
|
||||
|
||||
public String pluginName;
|
||||
|
@@ -5,10 +5,10 @@ import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Util {
|
||||
|
||||
@Getter
|
||||
private static final UUID serverUUID = UUID.randomUUID();
|
||||
|
||||
|
101
src/main/java/net/t2code/t2codelib/VELOCITY/VelocityMain.java
Normal file
101
src/main/java/net/t2code/t2codelib/VELOCITY/VelocityMain.java
Normal file
@@ -0,0 +1,101 @@
|
||||
package net.t2code.t2codelib.VELOCITY;
|
||||
|
||||
|
||||
//@Plugin(id = "t2codelib", name = "T2CodeLib", version = "16.7_dev-01", authors = {"JaTiTV"})
|
||||
public class VelocityMain {
|
||||
//
|
||||
// String prefix = "[T2CodeLib]";
|
||||
//
|
||||
// protected final ProxyServer server;
|
||||
// protected final Logger logger;
|
||||
// public static final MinecraftChannelIdentifier IDENTIFIER = MinecraftChannelIdentifier.from("t2c:bcmd");
|
||||
// // public static final MinecraftChannelIdentifier IDENTIFIER2 = MinecraftChannelIdentifier.from("booster:activate");
|
||||
//
|
||||
// @Inject
|
||||
// public VelocityMain(ProxyServer server, Logger logger) {
|
||||
// long long_ = System.currentTimeMillis();
|
||||
// this.server = server;
|
||||
// this.logger = logger;
|
||||
//
|
||||
// logger.info("============================= {} =============================", prefix);
|
||||
// logger.info("Autor: JaTiTV");
|
||||
// logger.info("Version: 16.7_dev-01");
|
||||
// logger.info("Plugin loaded successfully. - {}ms", System.currentTimeMillis() - long_);
|
||||
// logger.info("============================= {} =============================", prefix);
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Subscribe
|
||||
// public void onProxyInitialization(ProxyInitializeEvent event) {
|
||||
// server.getChannelRegistrar().register(IDENTIFIER);
|
||||
// // server.getChannelRegistrar().register(IDENTIFIER2);
|
||||
// }
|
||||
//
|
||||
// @Subscribe
|
||||
// public void onPluginMessageFromPlayer(PluginMessageEvent event) {
|
||||
// if (event.getIdentifier() != IDENTIFIER) {
|
||||
// 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: {}", prefix, serverID, input);
|
||||
// dispatchCommand(input);
|
||||
// } else {
|
||||
// Player player = server.getPlayer(channel).orElse(null);
|
||||
// if (player != null) {
|
||||
// logger.info("{} [{}] T2C BCMD Command {}: {}", prefix, serverID, player, input);
|
||||
// executeCommand(player, input);
|
||||
// }
|
||||
// }
|
||||
// event.setResult(PluginMessageEvent.ForwardResult.handled());
|
||||
// }
|
||||
//
|
||||
//// public void sendToSpigot(String sender, String boostertype, String step, String starter, String starttime, String starteruuid) {
|
||||
//// ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
//// DataOutputStream output = new DataOutputStream(stream);
|
||||
//// try {
|
||||
//// output.writeUTF(boostertype);
|
||||
//// output.writeUTF(step);
|
||||
//// output.writeUTF(starter);
|
||||
//// output.writeUTF(starttime);
|
||||
//// output.writeUTF(starteruuid);
|
||||
//// } catch (IOException e) {
|
||||
//// java.util.logging.Logger.getLogger(e.getMessage());
|
||||
//// }
|
||||
//// Optional<Player> player = server.getPlayer(sender);
|
||||
//// if (!player.isPresent()) {
|
||||
//// return;
|
||||
//// }
|
||||
//// server.getAllServers().forEach((server) -> {
|
||||
//// if (server != player.get().getCurrentServer().get().getServer()) {
|
||||
//// server.sendPluginMessage(IDENTIFIER2, stream.toByteArray());
|
||||
//// }
|
||||
//// });
|
||||
//// }
|
||||
//
|
||||
// public void dispatchCommand(String input) {
|
||||
// // Get the console command source
|
||||
// ConsoleCommandSource console = server.getConsoleCommandSource();
|
||||
//
|
||||
// // Dispatch the command
|
||||
// server.getCommandManager().executeAsync(console, input).join();
|
||||
// }
|
||||
//
|
||||
// public void executeCommand(Player player, String input) {
|
||||
// CommandManager commandManager = server.getCommandManager();
|
||||
//
|
||||
// // Dispatch the command
|
||||
// commandManager.executeImmediatelyAsync(player, input);
|
||||
// }
|
||||
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
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 {
|
||||
|
||||
public static ProxyServer server = T2CodeVMain.server;
|
||||
public static Logger logger = T2CodeVMain.logger;
|
||||
|
||||
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,88 @@
|
||||
package net.t2code.t2codelib.VELOCITY.api.commands;
|
||||
//
|
||||
//import net.md_5.bungee.api.CommandSender;
|
||||
//import net.md_5.bungee.api.ProxyServer;
|
||||
//import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.List;
|
||||
//
|
||||
public class T2CVtab {
|
||||
//
|
||||
//
|
||||
// public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, String perm, Boolean onlinePlayer) {
|
||||
// if (args.length != arg + 1) return;
|
||||
// for (ProxiedPlayer player1 : ProxyServer.getInstance().getPlayers()) {
|
||||
// if (passend(player1.getName(), args[arg]) && hasPermission(sender, perm)) {
|
||||
// matches.add(player1.getName());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static void tab(List<String> matches, CommandSender sender, int argEquals, String equalsValue, int arg, String[] args, String perm, Boolean onlinePlayer) {
|
||||
// if (args.length != arg + 1) return;
|
||||
// if (!args[argEquals].toLowerCase().equals(equalsValue)) return;
|
||||
// for (ProxiedPlayer player1 : ProxyServer.getInstance().getPlayers()) {
|
||||
// if (passend(player1.getName(), args[arg]) && hasPermission(sender, perm)) {
|
||||
// matches.add(player1.getName());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, HashMap<String, String> permMap, Boolean onlinePlayer, String permForPlayer) {
|
||||
// if (args.length != arg + 1) return;
|
||||
// for (String command : permMap.keySet()) {
|
||||
// if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||
// matches.add(command);
|
||||
// } else if (onlinePlayer != null && permForPlayer != null) {
|
||||
// tab(matches, sender, arg, args, permForPlayer, onlinePlayer);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, HashMap<String, String> permMap) {
|
||||
// tab(matches, sender, arg, args, permMap, null, null);
|
||||
// }
|
||||
//
|
||||
// public static void tab(List<String> matches, CommandSender sender, int argEquals, String equalsValue, int arg, String[] args, HashMap<String, String> permMap) {
|
||||
// if (args.length != arg + 1) return;
|
||||
// if (!args[argEquals].toLowerCase().equals(equalsValue)) return;
|
||||
// for (String command : permMap.keySet()) {
|
||||
// if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||
// matches.add(command);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static List<String> tab(CommandSender sender, int arg, String[] args, String perm, String command) {
|
||||
// List<String> matches = new ArrayList<>();
|
||||
// if (hasPermission(sender, perm) && passend(command, args[arg])) {
|
||||
// matches.add(command);
|
||||
// }
|
||||
// return matches;
|
||||
// }
|
||||
//
|
||||
// public static Boolean passend(String command, String arg) {
|
||||
// for (int i = 0; i < arg.toUpperCase().length(); i++) {
|
||||
// if (arg.toUpperCase().length() >= command.toUpperCase().length()) {
|
||||
// return false;
|
||||
// } else {
|
||||
// if (arg.toUpperCase().charAt(i) != command.toUpperCase().charAt(i)) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// public static boolean hasPermission(CommandSender sender, String permission) {
|
||||
// String[] Permissions = permission.split(";");
|
||||
// for (String perm : Permissions) {
|
||||
// if (sender.hasPermission(perm)) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
package net.t2code.t2codelib.VELOCITY.api.messages;
|
||||
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import net.t2code.t2codelib.T2CupdateWebData;
|
||||
import net.t2code.t2codelib.VELOCITY.api.update.T2CVupdateAPI;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class T2CBtemplate {
|
||||
|
||||
|
||||
public static Long onLoadHeader(String prefix, String autor, String version, String spigot, String discord) {
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
T2CVsend.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
T2CVsend.console(prefix + " §2Autor: §6" + autor.replace("[", "").replace("]", ""));
|
||||
T2CVsend.console(prefix + " §2Version: §6" + version);
|
||||
T2CVsend.console(prefix + " §2Spigot: §6" + spigot);
|
||||
T2CVsend.console(prefix + " §2Discord: §6" + discord);
|
||||
T2CVsend.console(prefix + " §8-------------------------------");
|
||||
return long_;
|
||||
}
|
||||
|
||||
public static void onLoadSeparateStroke(String prefix) {
|
||||
T2CVsend.console(prefix + " §8-------------------------------");
|
||||
}
|
||||
|
||||
public static void onLoadFooter(String prefix, Long long_) {
|
||||
T2CVsend.console(prefix + " §8-------------------------------");
|
||||
T2CVsend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
T2CVsend.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
}
|
||||
|
||||
public static void onDisable(String prefix, String autor, String version, String spigot, String discord) {
|
||||
T2CVsend.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
T2CVsend.console(prefix + " §2Autor: §6" + autor.replace("[", "").replace("]", ""));
|
||||
T2CVsend.console(prefix + " §2Version: §6" + version);
|
||||
T2CVsend.console(prefix + " §2Spigot: §6" + spigot);
|
||||
T2CVsend.console(prefix + " §2Discord: §6" + discord);
|
||||
T2CVsend.console(prefix + " §4Plugin successfully disabled.");
|
||||
T2CVsend.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
}
|
||||
|
||||
public static void sendInfo(CommandSource sender, PluginContainer plugin, String prefix, String spigot, String discord, String autor) {
|
||||
T2CupdateWebData webData = T2CVupdateAPI.bungeePluginVersins.get(plugin.getDescription().getName()).webData;
|
||||
String pluginVersion = String.valueOf(plugin.getDescription().getVersion());
|
||||
T2CVsend.sender(sender, prefix + "§4======= " + prefix + " §4=======");
|
||||
T2CVsend.sender(sender, prefix + " §2Autor: §6" + autor);
|
||||
if (webData.getVersion().equalsIgnoreCase(pluginVersion)) {
|
||||
T2CVsend.sender(sender, prefix + " §2Version: §6" + pluginVersion);
|
||||
} else {
|
||||
T2CVupdateAPI.sendUpdateMsg(prefix, discord, webData, Optional.of(plugin), sender);
|
||||
}
|
||||
T2CVsend.sender(sender, prefix + " §2Spigot: §6" + spigot);
|
||||
T2CVsend.sender(sender, prefix + " §2Discord: §6" + discord);
|
||||
T2CVsend.sender(sender, prefix + "§4======= " + prefix + " §4=======");
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package net.t2code.t2codelib.VELOCITY.api.messages;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class T2CVreplace {
|
||||
|
||||
public static String replace(String prefix, String Text) {
|
||||
return Text.replace("[prefix]", prefix).replace("&", "§").replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä");
|
||||
}
|
||||
|
||||
public static List<String> replace(String prefix, List<String> Text) {
|
||||
List<String> output = new ArrayList<>();
|
||||
for (String input : Text) {
|
||||
output.add(input.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä"));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public static List replacePrice(String prefix,List<String> Text, String price) {
|
||||
List rp = new ArrayList();
|
||||
for (String s : Text) {
|
||||
rp.add(s.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[price]", String.valueOf(price)));
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
}
|
@@ -0,0 +1,67 @@
|
||||
package net.t2code.t2codelib.VELOCITY.api.messages;
|
||||
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.title.Title;
|
||||
import net.t2code.t2codelib.VELOCITY.system.T2CodeVMain;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
public class T2CVsend {
|
||||
public static ProxyServer server = T2CodeVMain.server;
|
||||
public static Logger logger = T2CodeVMain.logger;
|
||||
|
||||
public static void console(String msg) {
|
||||
logger.info(msg);
|
||||
}
|
||||
|
||||
public static void player(Player player, String msg) {
|
||||
player.sendMessage(Component.text(msg));
|
||||
}
|
||||
|
||||
public static void title(Player player, Title msg) {
|
||||
player.showTitle(msg);
|
||||
}
|
||||
|
||||
public static void sender(CommandSource sender, String msg) {
|
||||
sender.sendMessage(Component.text( msg));
|
||||
}
|
||||
|
||||
public static void debug(Optional<PluginContainer> plugin, String msg) {
|
||||
debug(plugin, msg, null);
|
||||
}
|
||||
|
||||
public static void debug(Optional<PluginContainer> plugin, String msg, Integer stage) {
|
||||
// if (!new File(Main.getPath(), "config.yml").exists()) return;
|
||||
// if (stage == null) {
|
||||
// if (plugin.getConfig().getBoolean("Plugin.Debug")) {
|
||||
// ProxyServer.getInstance().getConsole().sendMessage(plugin.getDescription().getName() + " §5DEBUG: §6" + msg);
|
||||
// }
|
||||
// return;
|
||||
//}
|
||||
//if (plugin.getConfig().getInt("Plugin.Debug") >= stage) {
|
||||
// ProxyServer.getInstance().getConsole().sendMessage(plugin.getDescription().getName() + " §5DEBUG: §6" + msg);
|
||||
//}
|
||||
}
|
||||
|
||||
public static void debugmsg(PluginContainer plugin, String msg) {
|
||||
logger.info("{} §5DEBUG-MSG: §6{}", plugin.getDescription().getName(), msg);
|
||||
}
|
||||
|
||||
public static void info(PluginContainer plugin, String msg) {
|
||||
logger.info("{} {}", plugin.getDescription().getName(), msg);
|
||||
}
|
||||
|
||||
public static void warning(PluginContainer plugin, String msg) {
|
||||
logger.warn("{} {}", plugin.getDescription().getName(), msg);
|
||||
}
|
||||
|
||||
public static void error(PluginContainer plugin, String msg) {
|
||||
logger.error("{} {}", plugin.getDescription().getName(), msg);
|
||||
}
|
||||
}
|
@@ -0,0 +1,55 @@
|
||||
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.event.proxy.ProxyInitializeEvent;
|
||||
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.system.T2CodeVMain;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
public class T2CplmsgBcmd {
|
||||
|
||||
public static ProxyServer server = T2CodeVMain.server;
|
||||
public static Logger logger = T2CodeVMain.logger;
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onProxyInitialization(ProxyInitializeEvent event) {
|
||||
server.getChannelRegistrar().register(T2CodeVMain.bcmd);
|
||||
// server.getChannelRegistrar().register(IDENTIFIER2);
|
||||
}
|
||||
|
||||
@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: {}", T2CodeVMain.prefix, serverID, input);
|
||||
T2CVcmd.Console(input);
|
||||
} else {
|
||||
Player player = server.getPlayer(channel).orElse(null);
|
||||
if (player != null) {
|
||||
logger.info("{} [{}] T2C BCMD Command {}: {}", T2CodeVMain.prefix, serverID, player, input);
|
||||
T2CVcmd.Player(player, input);
|
||||
}
|
||||
}
|
||||
event.setResult(PluginMessageEvent.ForwardResult.handled());
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,55 @@
|
||||
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 T2CapiAutoResponse {
|
||||
public static ProxyServer server = T2CodeVMain.server;
|
||||
public static Logger logger = T2CodeVMain.logger;
|
||||
|
||||
@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,68 @@
|
||||
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 {
|
||||
|
||||
public static ProxyServer server = T2CodeVMain.server;
|
||||
public static Logger logger = T2CodeVMain.logger;
|
||||
|
||||
|
||||
@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,50 @@
|
||||
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 java.io.*;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class T2CapiOpSecurity {
|
||||
public static ProxyServer server = T2CodeVMain.server;
|
||||
|
||||
@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.getLogger(e.getMessage());
|
||||
}
|
||||
for (RegisteredServer server : server.getAllServers()) {
|
||||
server.sendPluginMessage(T2CodeVMain.opsec, stream.toByteArray());
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,107 @@
|
||||
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 java.io.*;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class T2CVPlayers {
|
||||
|
||||
public static ProxyServer server = T2CodeVMain.server;
|
||||
public static org.slf4j.Logger logger = T2CodeVMain.logger;
|
||||
|
||||
@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.getLogger(e.getMessage());
|
||||
}
|
||||
T2CVsend.debug(T2CodeVMain.pluginContainer, "PluginMessage received channel: t2c:bonlp");
|
||||
T2CVsend.debug(T2CodeVMain.pluginContainer, "PluginMessage received subChannel: " + value.name());
|
||||
T2CVsend.debug(T2CodeVMain.pluginContainer, "PluginMessage received input: " + name);
|
||||
T2CVsend.debug(T2CodeVMain.pluginContainer, "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.getLogger(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(T2CodeVMain.pluginContainer, "PluginMessage received channel: " + T2CodeVMain.bonlp);
|
||||
T2CVsend.debug(T2CodeVMain.pluginContainer, "PluginMessage received subChannel: " + subChannel.name());
|
||||
T2CVsend.debug(T2CodeVMain.pluginContainer, "PluginMessage received input/uuid: " + input);
|
||||
|
||||
sendToSpigotPlayer("", subChannel, input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,79 @@
|
||||
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.T2CVupdateObject;
|
||||
import net.t2code.t2codelib.T2CupdateWebData;
|
||||
import net.t2code.t2codelib.UpdateType;
|
||||
import net.t2code.t2codelib.VELOCITY.api.messages.T2CVsend;
|
||||
import net.t2code.t2codelib.VELOCITY.system.T2CodeVMain;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Optional;
|
||||
|
||||
public class T2CVupdateAPI {
|
||||
public static HashMap<Optional<String>, T2CVupdateObject> bungeePluginVersins = new HashMap<>();
|
||||
public static ProxyServer server = T2CodeVMain.server;
|
||||
|
||||
|
||||
public static void sendUpdateMsg(String prefix, String discord, T2CupdateWebData webData, Optional<PluginContainer> plugin, CommandSource sender) {
|
||||
String publicVersion = webData.getVersion();
|
||||
String pluginVersion = String.valueOf(plugin.get().getDescription().getVersion());
|
||||
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;
|
||||
String h = "<br><dark_red>╔══════════════</dark_red>" + prefix + "<dark_red>══════════════</dark_red>";
|
||||
String s1 = "<br><dark_red>║</dark_red> <gold>A new [value] version was found!</gold>".replace("[value]", value);
|
||||
String s2 = "<br><dark_red>║</dark_red> <gold>Your version: <red>" + pluginVersion + "</red> <gray>-</gray> Current version:</gold> <green>" + webData.getVersion() + "</green>";
|
||||
String s3 = "<br><dark_red>║</dark_red> <gold>You can download it here:</gold> <yellow>" + webData.getUpdateUrl() + "</yellow>";
|
||||
String s4 = "<br><dark_red>║</dark_red> <gold>You can find more information on Discord:</gold> <yellow>" + discord + "</yellow>";
|
||||
String f = "<br><dark_red>╚══════════════</dark_red>" + prefix + "<dark_red>══════════════</dark_red>";
|
||||
String text = h + s1 + s2 + s3 + s4 + f;
|
||||
if (sender == null) {
|
||||
T2CVsend.console(text);
|
||||
} else T2CVsend.sender(sender, text);
|
||||
|
||||
}
|
||||
|
||||
private static Boolean noUpdate = true;
|
||||
private static String pluginVersion;
|
||||
|
||||
|
||||
public static void checkForUpdates(Optional<PluginContainer> plugin, String prefix, String discord, Integer spigotID, String url) {
|
||||
|
||||
// if (T2CVlibConfig.getUpdateCheckFullDisable()) return;
|
||||
(new T2CVupdateCheckerGit(plugin, spigotID)).getVersion((webData) -> {
|
||||
pluginVersion = T2CodeVMain.version;
|
||||
T2CVupdateObject update = new T2CVupdateObject(
|
||||
plugin.get().getDescription().getName(),
|
||||
plugin.get().getDescription().getVersion(),
|
||||
webData,
|
||||
false,
|
||||
!plugin.get().getDescription().getVersion().equals(webData.getVersion()),
|
||||
true
|
||||
);
|
||||
bungeePluginVersins.put(plugin.get().getDescription().getName(), update);
|
||||
if (!pluginVersion.replace("_Bungee", "").equalsIgnoreCase(webData.getVersion())) {
|
||||
sendUpdateMsg(prefix, discord, webData, plugin, null);
|
||||
noUpdate = true;
|
||||
} else {
|
||||
if (noUpdate) {
|
||||
T2CVsend.console(prefix + " §2No update found.");
|
||||
noUpdate = false;
|
||||
}
|
||||
}
|
||||
}, pluginVersion, spigotID, url);
|
||||
}
|
||||
}
|
@@ -0,0 +1,102 @@
|
||||
package net.t2code.t2codelib.VELOCITY.api.update;
|
||||
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import net.t2code.t2codelib.T2CVupdateObject;
|
||||
import net.t2code.t2codelib.T2CupdateWebData;
|
||||
import net.t2code.t2codelib.VELOCITY.system.T2CodeVMain;
|
||||
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.Optional;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class T2CVupdateCheckerGit {
|
||||
private Optional<PluginContainer> plugin;
|
||||
private int resourceId;
|
||||
public static ProxyServer server = T2CodeVMain.server;
|
||||
public static Logger logger = T2CodeVMain.logger;
|
||||
|
||||
public T2CVupdateCheckerGit(Optional<PluginContainer> plugin, int resourceId) {
|
||||
this.plugin = plugin;
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String gitKey) {
|
||||
// if (T2CVlibConfig.getUpdateCheckFullDisable()) return;
|
||||
String RepoURL = "https://git.t2code.net/api/v1/repos/" + gitKey + "/releases?limit=1";
|
||||
// if (!T2CVlibConfig.getSeePreReleaseUpdates()) {
|
||||
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.get().getDescription().getName())) {
|
||||
load = T2CVupdateAPI.bungeePluginVersins.get(plugin.get().getDescription().getName()).load;
|
||||
}
|
||||
T2CVupdateObject update = new T2CVupdateObject(
|
||||
plugin.get().getDescription().getName(),
|
||||
Optional.ofNullable(pluginVersion),
|
||||
null,
|
||||
load,
|
||||
false,
|
||||
true
|
||||
);
|
||||
T2CVupdateAPI.bungeePluginVersins.put(plugin.get().getDescription().getName(), update);
|
||||
logger.info("§4 Cannot look for updates: {}", var10.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,86 @@
|
||||
package net.t2code.t2codelib.VELOCITY.api.yaml;
|
||||
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import ninja.leaping.configurate.ConfigurationNode;
|
||||
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
|
||||
import ninja.leaping.configurate.yaml.YAMLConfigurationLoader;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class T2CVconfig {
|
||||
private final Path configPath;
|
||||
private final @NonNull YAMLConfigurationLoader loader;
|
||||
private CommentedConfigurationNode configNode;
|
||||
|
||||
public T2CVconfig(Path configPath, ProxyServer proxy, PluginContainer pluginContainer, Logger logger) {
|
||||
this.configPath = configPath;
|
||||
loader = YAMLConfigurationLoader.builder().setPath(configPath).build();
|
||||
try {
|
||||
this.configNode = (CommentedConfigurationNode) loader.load();
|
||||
} catch (IOException e) {
|
||||
logger.error("Error loading configuration file {}", configPath.getFileName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveConfig() {
|
||||
try {
|
||||
loader.save(configNode);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Error saving configuration file " + configPath.getFileName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public void set(String path, Object value) {
|
||||
configNode.getNode((Object[]) path.split("\\.")).setValue(value);
|
||||
}
|
||||
|
||||
public String select(String path) {
|
||||
return configNode.getNode((Object[]) path.split("\\.")).getString();
|
||||
}
|
||||
|
||||
public int selectInt(String path) {
|
||||
return configNode.getNode((Object[]) path.split("\\.")).getInt();
|
||||
}
|
||||
|
||||
public boolean selectBoolean(String path) {
|
||||
return configNode.getNode((Object[]) path.split("\\.")).getBoolean();
|
||||
}
|
||||
|
||||
public double selectDouble(String path) {
|
||||
return configNode.getNode((Object[]) path.split("\\.")).getDouble();
|
||||
}
|
||||
|
||||
public List<String> selectList(String path) {
|
||||
List<String> list = new ArrayList<>();
|
||||
ConfigurationNode node = configNode.getNode((Object[]) path.split("\\."));
|
||||
if (node.hasListChildren()) {
|
||||
for (ConfigurationNode child : node.getChildrenList()) {
|
||||
list.add(child.getString(""));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<String> selectList(String prefix, String path) {
|
||||
List<String> output = new ArrayList<>();
|
||||
ConfigurationNode node = configNode.getNode((Object[]) path.split("\\."));
|
||||
if (node.hasListChildren()) {
|
||||
for (ConfigurationNode child : node.getChildrenList()) {
|
||||
output.add(prefix + child.getString());
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
public void setList(List<String> value, String path) {
|
||||
configNode.getNode((Object[]) path.split("\\.")).setValue(value);
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
package net.t2code.t2codelib.VELOCITY.system;
|
||||
|
||||
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import net.t2code.t2codelib.VELOCITY.api.proxyPlayers.T2CVPlayers;
|
||||
import net.t2code.t2codelib.VELOCITY.api.messages.T2CVsend;
|
||||
import net.t2code.t2codelib.VELOCITY.system.config.VelocityConfig;
|
||||
import net.t2code.t2codelib.VELOCITY.api.pluginMessaging.commandgui.T2CVapiCGUI;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class T2CVload {
|
||||
public static ProxyServer server = T2CodeVMain.server;
|
||||
public static Logger logger = T2CodeVMain.logger;
|
||||
|
||||
|
||||
|
||||
public static void onLoad(Optional<PluginContainer> plugin, String prefix, String version, String spigot, String discord, Integer spigotID, Integer bstatsID, String url) {
|
||||
long long_ = System.currentTimeMillis();
|
||||
T2CVsend.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
// T2CVsend.console(prefix + " §2Autor: §6" + String.valueOf(plugin.get().getDescription().getAuthors()).replace("[", "").replace("]", ""));
|
||||
T2CVsend.console(prefix + " §2Version: §6" + version);
|
||||
T2CVsend.console(prefix + " §2Spigot: §6" + spigot);
|
||||
T2CVsend.console(prefix + " §2Discord: §6" + discord);
|
||||
|
||||
|
||||
|
||||
//T2CVlibConfig.create();
|
||||
VelocityConfig.main();
|
||||
// try {
|
||||
// T2CVlibConfig.select();
|
||||
// } catch (IOException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//API
|
||||
server.getChannelRegistrar().register(T2CodeVMain.bcmd);
|
||||
|
||||
server.getChannelRegistrar().register(T2CodeVMain.bonlp);
|
||||
T2CVPlayers.sendToSpigotDeleteAll();
|
||||
|
||||
// if (T2CVlibConfig.getApiCommandGUIEnable()) {
|
||||
server.getChannelRegistrar().register(T2CodeVMain.cguiopl);
|
||||
T2CVapiCGUI.sendToSpigotDeleteAll();
|
||||
// }
|
||||
|
||||
// if (T2CVlibConfig.getApiAutoResponse()) {
|
||||
server.getChannelRegistrar().register(T2CodeVMain.aresp);
|
||||
// }
|
||||
|
||||
// if (T2CVlibConfig.getApiOpSecurity()) {
|
||||
server.getChannelRegistrar().register(T2CodeVMain.opsec);
|
||||
//}
|
||||
|
||||
|
||||
T2CVsend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
T2CVsend.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||
}
|
||||
}
|
@@ -0,0 +1,81 @@
|
||||
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.event.proxy.ProxyShutdownEvent;
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||
import com.velocitypowered.api.scheduler.Scheduler;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import net.t2code.t2codelib.VELOCITY.api.proxyPlayers.T2CVPlayers;
|
||||
import net.t2code.t2codelib.VELOCITY.api.messages.T2CVsend;
|
||||
import net.t2code.t2codelib.VELOCITY.api.update.T2CVupdateAPI;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class T2CodeVMain {
|
||||
|
||||
|
||||
public static Optional<PluginContainer> pluginContainer;
|
||||
|
||||
|
||||
|
||||
public static final String prefix = "[T2CodeLib]";
|
||||
public static ProxyServer server;
|
||||
public static Logger logger;
|
||||
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) throws IOException {
|
||||
// Plugin startup logic
|
||||
T2CodeVMain.server = server;
|
||||
T2CodeVMain.logger = logger;
|
||||
pluginContainer = server.getPluginManager().getPlugin("t2codelib");
|
||||
|
||||
// orgVersion = plugin.getDescription().getVersion();
|
||||
// autor = plugin.getDescription().getAuthor();
|
||||
|
||||
int pluginId = Util.getBstatsID();
|
||||
// T2CVmetrics metrics = metricsFactory.make(this, pluginId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onProxyShutdown(ProxyShutdownEvent event) {
|
||||
// Plugin shutdown logic
|
||||
T2CVPlayers.sendToSpigotDeleteAll();
|
||||
|
||||
T2CVsend.console(Util.getPrefix() + "§4============================= " + Util.getPrefix() + " §4=============================");
|
||||
T2CVsend.console(Util.getPrefix() + " §2Autor: §6" + String.valueOf(pluginContainer.get().getDescription().getAuthors()).replace("[", "").replace("]", ""));
|
||||
|
||||
T2CVsend.console(Util.getPrefix() + " §2Spigot: §6" + Util.getSpigot());
|
||||
T2CVsend.console(Util.getPrefix() + " §2Discord: §6" + Util.getDiscord());
|
||||
T2CVsend.console(Util.getPrefix() + " §4Plugin successfully disabled.");
|
||||
T2CVsend.console(Util.getPrefix() + "§4============================= " + Util.getPrefix() + " §4=============================");
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onProxyInitialize(ProxyInitializeEvent event) {
|
||||
// Schedule the task to check for updates every 60 minutes
|
||||
Scheduler scheduler = server.getScheduler();
|
||||
|
||||
scheduler.buildTask(this, this:: checkForUpdates)
|
||||
.repeat(60, TimeUnit.MINUTES)
|
||||
.schedule();
|
||||
}
|
||||
private void checkForUpdates() {
|
||||
T2CVupdateAPI.checkForUpdates(pluginContainer, prefix, Util.getDiscord(), Util.getSpigotID(), Util.getGit());
|
||||
}
|
||||
}
|
@@ -0,0 +1,134 @@
|
||||
package net.t2code.t2codelib.VELOCITY.system.bstats;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import com.velocitypowered.api.plugin.PluginDescription;
|
||||
import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import org.bstats.MetricsBase;
|
||||
import org.bstats.charts.CustomChart;
|
||||
import org.bstats.config.MetricsConfig;
|
||||
import org.bstats.json.JsonObjectBuilder;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class T2CVmetrics {
|
||||
|
||||
/**
|
||||
* A factory to create new Metrics classes.
|
||||
*/
|
||||
public static class Factory {
|
||||
|
||||
private final ProxyServer server;
|
||||
private final Logger logger;
|
||||
private final Path dataDirectory;
|
||||
|
||||
// The constructor is not meant to be called by the user.
|
||||
// The instance is created using Dependency Injection
|
||||
@Inject
|
||||
private Factory(ProxyServer server, Logger logger, @DataDirectory Path dataDirectory) {
|
||||
this.server = server;
|
||||
this.logger = logger;
|
||||
this.dataDirectory = dataDirectory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Metrics class.
|
||||
*
|
||||
* @param plugin The plugin instance.
|
||||
* @param serviceId The id of the service.
|
||||
* It can be found at <a href="https://bstats.org/what-is-my-plugin-id">What is my plugin id?</a>
|
||||
* <p>Not to be confused with Velocity's {@link PluginDescription#getId()} method!
|
||||
* @return A Metrics instance that can be used to register custom charts.
|
||||
* <p>The return value can be ignored, when you do not want to register custom charts.
|
||||
*/
|
||||
public T2CVmetrics make(Object plugin, int serviceId) {
|
||||
return new T2CVmetrics(plugin, server, logger, dataDirectory, serviceId);
|
||||
}
|
||||
}
|
||||
|
||||
private final PluginContainer pluginContainer;
|
||||
private final ProxyServer server;
|
||||
private MetricsBase metricsBase;
|
||||
|
||||
private T2CVmetrics(Object plugin, ProxyServer server, Logger logger, Path dataDirectory, int serviceId) {
|
||||
pluginContainer = server.getPluginManager().fromInstance(plugin)
|
||||
.orElseThrow(() -> new IllegalArgumentException("The provided instance is not a plugin"));
|
||||
this.server = server;
|
||||
|
||||
File configFile = dataDirectory.getParent().resolve("bStats").resolve("config.txt").toFile();
|
||||
MetricsConfig config;
|
||||
try {
|
||||
config = new MetricsConfig(configFile, true);
|
||||
} catch (IOException e) {
|
||||
logger.error("Failed to create bStats config", e);
|
||||
return;
|
||||
}
|
||||
|
||||
metricsBase = new MetricsBase(
|
||||
"velocity",
|
||||
config.getServerUUID(),
|
||||
serviceId,
|
||||
config.isEnabled(),
|
||||
this::appendPlatformData,
|
||||
this::appendServiceData,
|
||||
task -> server.getScheduler().buildTask(plugin, task).schedule(),
|
||||
() -> true,
|
||||
logger::warn,
|
||||
logger::info,
|
||||
config.isLogErrorsEnabled(),
|
||||
config.isLogSentDataEnabled(),
|
||||
config.isLogResponseStatusTextEnabled()
|
||||
);
|
||||
|
||||
if (!config.didExistBefore()) {
|
||||
// Send an info message when the bStats config file gets created for the first time
|
||||
logger.info("Velocity and some of its plugins collect metrics and send them to bStats (https://bStats.org).");
|
||||
logger.info("bStats collects some basic information for plugin authors, like how many people use");
|
||||
logger.info("their plugin and their total player count. It's recommend to keep bStats enabled, but");
|
||||
logger.info("if you're not comfortable with this, you can opt-out by editing the config.txt file in");
|
||||
logger.info("the '/plugins/bStats/' folder and setting enabled to false.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shuts down the underlying scheduler service.
|
||||
*/
|
||||
public void shutdown() {
|
||||
metricsBase.shutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a custom chart.
|
||||
*
|
||||
* @param chart The chart to add.
|
||||
*/
|
||||
public void addCustomChart(CustomChart chart) {
|
||||
if (metricsBase != null) {
|
||||
metricsBase.addCustomChart(chart);
|
||||
}
|
||||
}
|
||||
|
||||
private void appendPlatformData(JsonObjectBuilder builder) {
|
||||
builder.appendField("playerAmount", server.getPlayerCount());
|
||||
builder.appendField("managedServers", server.getAllServers().size());
|
||||
builder.appendField("onlineMode", server.getConfiguration().isOnlineMode() ? 1 : 0);
|
||||
builder.appendField("velocityVersionVersion", server.getVersion().getVersion());
|
||||
builder.appendField("velocityVersionName", server.getVersion().getName());
|
||||
builder.appendField("velocityVersionVendor", server.getVersion().getVendor());
|
||||
|
||||
builder.appendField("javaVersion", System.getProperty("java.version"));
|
||||
builder.appendField("osName", System.getProperty("os.name"));
|
||||
builder.appendField("osArch", System.getProperty("os.arch"));
|
||||
builder.appendField("osVersion", System.getProperty("os.version"));
|
||||
builder.appendField("coreCount", Runtime.getRuntime().availableProcessors());
|
||||
}
|
||||
|
||||
private void appendServiceData(JsonObjectBuilder builder) {
|
||||
builder.appendField("pluginVersion", pluginContainer.getDescription().getVersion().orElse("unknown"));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,60 @@
|
||||
package net.t2code.t2codelib.VELOCITY.system.config;
|
||||
|
||||
public class T2CVlibConfig {
|
||||
|
||||
// public static void create() throws IOException {
|
||||
// long startTime = System.currentTimeMillis();
|
||||
// Path configFile = Paths.get("config.yml");
|
||||
//
|
||||
// if (!T2CodeVMain.getPlugin().getDataFolder().exists()) {
|
||||
// T2CodeVMain.getPlugin().getDataFolder().mkdir();
|
||||
// }
|
||||
//
|
||||
// if (!configFile.exists()) {
|
||||
// configFile.createNewFile();
|
||||
// }
|
||||
//
|
||||
// Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile);
|
||||
//
|
||||
// configuration.set("UpdateCheck.TimerInMin", 60);
|
||||
// configuration.set("UpdateCheck.SeePreReleaseUpdates", true);
|
||||
// configuration.set("Plugin.UpdateCheck.AllPlugins.FullDisable", false);
|
||||
//
|
||||
// configuration.set("API.CommandGUI.Enable", false);
|
||||
// configuration.set("API.AutoResponse.Enable", false);
|
||||
// configuration.set("API.OPSecurity.Enable", false);
|
||||
//
|
||||
// ConfigurationProvider.getProvider(YamlConfiguration.class).save(configuration, configFile);
|
||||
//
|
||||
// long elapsedTime = System.currentTimeMillis() - startTime;
|
||||
// T2CVsend.console(Util.getPrefix() + " §2config.yml was successfully created / updated. §7- §e" + elapsedTime + "ms");
|
||||
// }
|
||||
//
|
||||
// public static void select() throws IOException {
|
||||
// File configFile = new File(T2CodeVMain.getPlugin().getDataFolder(), "config.yml");
|
||||
// Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile);
|
||||
//
|
||||
// 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");
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @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;
|
||||
//
|
||||
}
|
@@ -0,0 +1,131 @@
|
||||
package net.t2code.t2codelib.VELOCITY.system.config;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class VelocityConfig {
|
||||
|
||||
private static final String CONFIG_FILE = "plugin_config.yml";
|
||||
|
||||
private String pluginName;
|
||||
private int maxConnections;
|
||||
private boolean isEnabled;
|
||||
private boolean debugMode;
|
||||
private int timeoutSeconds;
|
||||
|
||||
public VelocityConfig(String pluginName, int maxConnections, boolean isEnabled, boolean debugMode, int timeoutSeconds) {
|
||||
this.pluginName = pluginName;
|
||||
this.maxConnections = maxConnections;
|
||||
this.isEnabled = isEnabled;
|
||||
this.debugMode = debugMode;
|
||||
this.timeoutSeconds = timeoutSeconds;
|
||||
}
|
||||
|
||||
public static VelocityConfig loadConfig() {
|
||||
Path configFile = Paths.get(CONFIG_FILE);
|
||||
if (!Files.exists(configFile)) {
|
||||
// Default configuration if file doesn't exist
|
||||
return new VelocityConfig("MyPlugin", 100, true, false, 30);
|
||||
}
|
||||
|
||||
try {
|
||||
// Read configuration from file
|
||||
String content = Files.readString(configFile);
|
||||
String[] lines = content.split("\\r?\\n");
|
||||
|
||||
// Parse the configuration
|
||||
String pluginName = lines[0].split(":")[1].trim();
|
||||
int maxConnections = Integer.parseInt(lines[1].split(":")[1].trim());
|
||||
boolean isEnabled = Boolean.parseBoolean(lines[2].split(":")[1].trim());
|
||||
boolean debugMode = Boolean.parseBoolean(lines[3].split(":")[1].trim());
|
||||
int timeoutSeconds = Integer.parseInt(lines[4].split(":")[1].trim());
|
||||
|
||||
return new VelocityConfig(pluginName, maxConnections, isEnabled, debugMode, timeoutSeconds);
|
||||
} catch (IOException | ArrayIndexOutOfBoundsException | NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
// Handle exception: default configuration or logging
|
||||
return new VelocityConfig("MyPlugin", 100, true, false, 30);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveConfig() {
|
||||
Path configFile = Paths.get(CONFIG_FILE);
|
||||
try {
|
||||
// Write configuration to file
|
||||
String configContent = "pluginName: " + pluginName + "\n"
|
||||
+ "maxConnections: " + maxConnections + "\n"
|
||||
+ "isEnabled: " + isEnabled + "\n"
|
||||
+ "debugMode: " + debugMode + "\n"
|
||||
+ "timeoutSeconds: " + timeoutSeconds + "\n";
|
||||
Files.writeString(configFile, configContent);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
// Handle exception: logging or alerting
|
||||
}
|
||||
}
|
||||
|
||||
// Getters and setters
|
||||
public String getPluginName() {
|
||||
return pluginName;
|
||||
}
|
||||
|
||||
public void setPluginName(String pluginName) {
|
||||
this.pluginName = pluginName;
|
||||
}
|
||||
|
||||
public int getMaxConnections() {
|
||||
return maxConnections;
|
||||
}
|
||||
|
||||
public void setMaxConnections(int maxConnections) {
|
||||
this.maxConnections = maxConnections;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return isEnabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
isEnabled = enabled;
|
||||
}
|
||||
|
||||
public boolean isDebugMode() {
|
||||
return debugMode;
|
||||
}
|
||||
|
||||
public void setDebugMode(boolean debugMode) {
|
||||
this.debugMode = debugMode;
|
||||
}
|
||||
|
||||
public int getTimeoutSeconds() {
|
||||
return timeoutSeconds;
|
||||
}
|
||||
|
||||
public void setTimeoutSeconds(int timeoutSeconds) {
|
||||
this.timeoutSeconds = timeoutSeconds;
|
||||
}
|
||||
|
||||
public static void main() {
|
||||
// Example usage:
|
||||
VelocityConfig config = VelocityConfig.loadConfig();
|
||||
System.out.println("Loaded Configuration:");
|
||||
System.out.println("Plugin Name: " + config.getPluginName());
|
||||
System.out.println("Max Connections: " + config.getMaxConnections());
|
||||
System.out.println("Is Enabled: " + config.isEnabled());
|
||||
System.out.println("Debug Mode: " + config.isDebugMode());
|
||||
System.out.println("Timeout Seconds: " + config.getTimeoutSeconds());
|
||||
|
||||
// Modify configuration
|
||||
config.setMaxConnections(150);
|
||||
config.setEnabled(false);
|
||||
config.setDebugMode(true);
|
||||
config.setTimeoutSeconds(60);
|
||||
|
||||
// Save configuration
|
||||
config.saveConfig();
|
||||
System.out.println("Configuration saved.");
|
||||
}
|
||||
}
|
@@ -1,5 +1,18 @@
|
||||
name: T2CodeLib
|
||||
version: ${project.version}
|
||||
main: net.t2code.t2codelib.BUNGEE.system.T2CodeBMain
|
||||
main: net.t2code.t2codelib.bungee.system.T2CodeBMain
|
||||
author: JaTiTV, Jkobs
|
||||
description: Library from T2Code Plugins
|
||||
description: Library from T2Code Plugins
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_______ ___ _____ _ _
|
||||
|__ __|__ \ / ____| | | | |
|
||||
| | ) | | ___ __| | ___ _ __ ___| |_
|
||||
| | / /| | / _ \ / _` |/ _ \ | '_ \ / _ \ __|
|
||||
| | / /_| |___| (_) | (_| | __/_| | | | __/ |_
|
||||
|_| |____|\_____\___/ \__,_|\___(_)_| |_|\___|\__|
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
name: T2CodeLib
|
||||
version: '${project.version}'
|
||||
main: net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain
|
||||
main: net.t2code.t2codelib.spigot.system.T2CodeLibMain
|
||||
api-version: 1.13
|
||||
prefix: T2CodeLib
|
||||
authors: [ JaTiTV ]
|
||||
@@ -29,3 +29,7 @@ commands:
|
||||
permissions:
|
||||
t2code.admin:
|
||||
default: op
|
||||
children:
|
||||
t2code.permtoggle.use: true
|
||||
t2code.permtoggle.use:
|
||||
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