Compare commits
1 Commits
velocity-d
...
16.9
Author | SHA1 | Date | |
---|---|---|---|
f034567aec |
1
.idea/encodings.xml
generated
1
.idea/encodings.xml
generated
@@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="Encoding">
|
<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/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
</component>
|
</component>
|
||||||
|
5
.idea/jarRepositories.xml
generated
5
.idea/jarRepositories.xml
generated
@@ -56,10 +56,5 @@
|
|||||||
<option name="name" value="BenCodez Repo" />
|
<option name="name" value="BenCodez Repo" />
|
||||||
<option name="url" value="https://nexus.bencodez.com/repository/maven-public/" />
|
<option name="url" value="https://nexus.bencodez.com/repository/maven-public/" />
|
||||||
</remote-repository>
|
</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>
|
</component>
|
||||||
</project>
|
</project>
|
3
.idea/misc.xml
generated
3
.idea/misc.xml
generated
@@ -5,9 +5,6 @@
|
|||||||
<item index="0" class="java.lang.String" itemvalue="net.md_5.bungee.event.EventHandler" />
|
<item index="0" class="java.lang.String" itemvalue="net.md_5.bungee.event.EventHandler" />
|
||||||
<item index="1" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
|
<item index="1" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
|
||||||
</list>
|
</list>
|
||||||
<writeAnnotations>
|
|
||||||
<writeAnnotation name="lombok.Getter" />
|
|
||||||
</writeAnnotations>
|
|
||||||
</component>
|
</component>
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="MavenProjectsManager">
|
<component name="MavenProjectsManager">
|
||||||
|
23
pom.xml
23
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>T2CodeLib</artifactId>
|
<artifactId>T2CodeLib</artifactId>
|
||||||
<version>16.7_dev-19</version>
|
<version>16.9</version>
|
||||||
<!--version>VERSION_snapshot-0</version-->
|
<!--version>VERSION_snapshot-0</version-->
|
||||||
<!--version>VERSION_beta-0</version-->
|
<!--version>VERSION_beta-0</version-->
|
||||||
<!--version>VERSION_dev-0</version-->
|
<!--version>VERSION_dev-0</version-->
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
<name>T2CodeLib</name>
|
<name>T2CodeLib</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>11</java.version>
|
<java.version>1.8</java.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>${java.version}</source>
|
<source>9</source>
|
||||||
<target>${java.version}</target>
|
<target>9</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -63,10 +63,6 @@
|
|||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
|
||||||
<id>papermc</id>
|
|
||||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
|
||||||
</repository>
|
|
||||||
<!-- Spigot -->
|
<!-- Spigot -->
|
||||||
<repository>
|
<repository>
|
||||||
<id>spigot-repo</id>
|
<id>spigot-repo</id>
|
||||||
@@ -150,14 +146,6 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Velocity -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.velocitypowered</groupId>
|
|
||||||
<artifactId>velocity-api</artifactId>
|
|
||||||
<version>3.2.0-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- repo.t2code / T2Code -->
|
<!-- repo.t2code / T2Code -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
@@ -214,7 +202,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.30</version>
|
<version>1.18.24</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -239,7 +227,6 @@
|
|||||||
<version>20230227</version>
|
<version>20230227</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@@ -6,6 +6,7 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class T2CBtab {
|
public class T2CBtab {
|
||||||
|
@@ -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.bstats.T2CBmetrics;
|
||||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
|
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
|
||||||
import net.t2code.t2codelib.BUNGEE.api.bungeePlayers.T2CBbungeePlayers;
|
import net.t2code.t2codelib.BUNGEE.api.bungeePlayers.T2CBbungeePlayers;
|
||||||
import net.t2code.t2codelib.BUNGEE.api.pluginMessaging.T2CplmsgBcmd;
|
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.T2CplmsgBcmd;
|
||||||
import net.t2code.t2codelib.BUNGEE.api.pluginMessaging.autoResponse.T2CapiAutoResponse;
|
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.autoResponse.T2CapiAutoResponse;
|
||||||
import net.t2code.t2codelib.BUNGEE.api.pluginMessaging.commandgui.T2CapiCGUI;
|
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.commandgui.T2CapiCGUI;
|
||||||
import net.t2code.t2codelib.BUNGEE.api.pluginMessaging.opSecurity.T2CapiOpSecurity;
|
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.opSecurity.T2CapiOpSecurity;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class T2CBload {
|
public class T2CBload {
|
||||||
public static void onLoad(Plugin plugin, String prefix, String author, String version, String spigot, String discord, Integer spigotID, Integer bstatsID, String url) {
|
public static void onLoad(Plugin plugin, String prefix, String autor, String version, String spigot, String discord, Integer spigotID, Integer bstatsID, String url) {
|
||||||
long long_ = System.currentTimeMillis();
|
long long_ = System.currentTimeMillis();
|
||||||
T2CBsend.console(prefix + "§4============================= " + prefix + " §4=============================");
|
T2CBsend.console(prefix + "§4============================= " + prefix + " §4=============================");
|
||||||
T2CBsend.console(prefix + " §2Author: §6" + String.valueOf(author).replace("[", "").replace("]", ""));
|
T2CBsend.console(prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||||
T2CBsend.console(prefix + " §2Version: §6" + version);
|
T2CBsend.console(prefix + " §2Version: §6" + version);
|
||||||
T2CBsend.console(prefix + " §2Spigot: §6" + spigot);
|
T2CBsend.console(prefix + " §2Spigot: §6" + spigot);
|
||||||
T2CBsend.console(prefix + " §2Discord: §6" + discord);
|
T2CBsend.console(prefix + " §2Discord: §6" + discord);
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
package net.t2code.t2codelib.BUNGEE.system;
|
package net.t2code.t2codelib.BUNGEE.system;
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import net.kyori.adventure.platform.bungeecord.BungeeAudiences;
|
import net.kyori.adventure.platform.bungeecord.BungeeAudiences;
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
|
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
|
||||||
@@ -9,12 +8,16 @@ import net.t2code.t2codelib.Util;
|
|||||||
|
|
||||||
public class T2CodeBMain extends Plugin {
|
public class T2CodeBMain extends Plugin {
|
||||||
|
|
||||||
@Getter
|
|
||||||
private static Plugin plugin;
|
private static Plugin plugin;
|
||||||
|
|
||||||
private static String version;
|
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 Boolean mmIsLoad = true;
|
||||||
private static BungeeAudiences adventure;
|
private static BungeeAudiences adventure;
|
||||||
|
|
||||||
@@ -30,8 +33,8 @@ public class T2CodeBMain extends Plugin {
|
|||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
// Plugin startup logic
|
// Plugin startup logic
|
||||||
plugin = this;
|
plugin = this;
|
||||||
String orgVersion = plugin.getDescription().getVersion();
|
orgVersion = plugin.getDescription().getVersion();
|
||||||
String author = plugin.getDescription().getAuthor();
|
autor = plugin.getDescription().getAuthor();
|
||||||
try {
|
try {
|
||||||
adventure = BungeeAudiences.create(this);
|
adventure = BungeeAudiences.create(this);
|
||||||
T2CBsend.info(this,"Adventure load!");
|
T2CBsend.info(this,"Adventure load!");
|
||||||
@@ -39,7 +42,7 @@ public class T2CodeBMain extends Plugin {
|
|||||||
T2CBsend.error(this,"Adventure can not be load!");
|
T2CBsend.error(this,"Adventure can not be load!");
|
||||||
mmIsLoad = false;
|
mmIsLoad = false;
|
||||||
}
|
}
|
||||||
T2CBload.onLoad(plugin, Util.getPrefix(), author, orgVersion, Util.getSpigot(), Util.getDiscord(), Util.getSpigotID(), Util.getBstatsID(),Util.getGit());
|
T2CBload.onLoad(plugin, Util.getPrefix(), autor, orgVersion, Util.getSpigot(), Util.getDiscord(), Util.getSpigotID(), Util.getBstatsID(),Util.getGit());
|
||||||
version = plugin.getDescription().getVersion();
|
version = plugin.getDescription().getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,4 +64,7 @@ public class T2CodeBMain extends Plugin {
|
|||||||
T2CBsend.console(Util.getPrefix() + " §4Plugin successfully disabled.");
|
T2CBsend.console(Util.getPrefix() + " §4Plugin successfully disabled.");
|
||||||
T2CBsend.console(Util.getPrefix() + "§4============================= " + Util.getPrefix() + " §4=============================");
|
T2CBsend.console(Util.getPrefix() + "§4============================= " + Util.getPrefix() + " §4=============================");
|
||||||
}
|
}
|
||||||
|
public static Boolean getMmIsLoad() {
|
||||||
|
return mmIsLoad;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
package net.t2code.t2codelib.BUNGEE.api.pluginMessaging;
|
package net.t2code.t2codelib.BUNGEE.system.pluginMessaging;
|
||||||
|
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
@@ -6,6 +6,7 @@ import net.md_5.bungee.api.event.PluginMessageEvent;
|
|||||||
import net.md_5.bungee.api.plugin.Listener;
|
import net.md_5.bungee.api.plugin.Listener;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.Util;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
@@ -1,4 +1,4 @@
|
|||||||
package net.t2code.t2codelib.BUNGEE.api.pluginMessaging.autoResponse;
|
package net.t2code.t2codelib.BUNGEE.system.pluginMessaging.autoResponse;
|
||||||
|
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
@@ -1,4 +1,4 @@
|
|||||||
package net.t2code.t2codelib.BUNGEE.api.pluginMessaging.commandgui;
|
package net.t2code.t2codelib.BUNGEE.system.pluginMessaging.commandgui;
|
||||||
|
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
@@ -1,4 +1,4 @@
|
|||||||
package net.t2code.t2codelib.BUNGEE.api.pluginMessaging.opSecurity;
|
package net.t2code.t2codelib.BUNGEE.system.pluginMessaging.opSecurity;
|
||||||
|
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
import net.md_5.bungee.api.event.PluginMessageEvent;
|
@@ -1,11 +1,14 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.api.commands;
|
package net.t2code.t2codelib.SPIGOT.api.commands;
|
||||||
|
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.T2CbungeeCommandSenderReciver;
|
import net.t2code.t2codelib.SPIGOT.system.T2CbungeeCommandSenderReciver;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Unmodifiable;
|
||||||
|
|
||||||
|
import java.rmi.MarshalledObject;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class T2Ccmd {
|
public class T2Ccmd {
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||||
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
@@ -3,23 +3,23 @@ package net.t2code.t2codelib.SPIGOT.api.messages;
|
|||||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||||
import net.t2code.t2codelib.T2CupdateWebData;
|
import net.t2code.t2codelib.T2CupdateWebData;
|
||||||
|
import net.t2code.t2codelib.UpdateType;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class T2Ctemplate {
|
public class T2Ctemplate {
|
||||||
public static Long onLoadHeader(String prefix, List<String> author, String version, String spigot, String discord) {
|
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord) {
|
||||||
return onLoadHeader(prefix, author, version, spigot, discord, null, null);
|
return onLoadHeader(prefix, autor, version, spigot, discord, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Long onLoadHeader(String prefix, List<String> author, String version, String spigot, String discord, Boolean isPremium) {
|
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord, Boolean isPremium) {
|
||||||
return onLoadHeader(prefix, author, version, spigot, discord, isPremium, null);
|
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, Boolean isVerify) {
|
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord, Boolean isPremium, Boolean isVerify) {
|
||||||
Long long_ = System.currentTimeMillis();
|
Long long_ = System.currentTimeMillis();
|
||||||
T2Csend.console(prefix + " <dark_red> _______ </dark_red><gray>___ </gray><dark_red>_____ </dark_red>");
|
T2Csend.console(prefix + " <dark_red> _______ </dark_red><gray>___ </gray><dark_red>_____ </dark_red>");
|
||||||
T2Csend.console(prefix + " <dark_red> |__ __|</dark_red><gray>__ \\ </gray><dark_red>/ ____|</dark_red>");
|
T2Csend.console(prefix + " <dark_red> |__ __|</dark_red><gray>__ \\ </gray><dark_red>/ ____|</dark_red>");
|
||||||
@@ -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 + " <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╔══════════════════════════");
|
||||||
T2Csend.console(prefix + " §4 §e║ §2Author: §6" + String.valueOf(author).replace("[", "").replace("]", ""));
|
T2Csend.console(prefix + " §4 §e║ §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||||
T2Csend.console(prefix + " §4 §e║ §2Version: §6" + version);
|
T2Csend.console(prefix + " §4 §e║ §2Version: §6" + version);
|
||||||
T2Csend.console(prefix + " §4 §e║ §2Spigot: §6" + spigot);
|
T2Csend.console(prefix + " §4 §e║ §2Spigot: §6" + spigot);
|
||||||
T2Csend.console(prefix + " §4 §e║ §2Discord: §6" + discord);
|
T2Csend.console(prefix + " §4 §e║ §2Discord: §6" + discord);
|
||||||
@@ -81,7 +81,7 @@ public class T2Ctemplate {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param prefix
|
* @param prefix
|
||||||
* @param author
|
* @param autor
|
||||||
* @param spigot
|
* @param spigot
|
||||||
* @param discord
|
* @param discord
|
||||||
* @deprecated reason this method is deprecated <br/>
|
* @deprecated reason this method is deprecated <br/>
|
||||||
@@ -94,7 +94,7 @@ public class T2Ctemplate {
|
|||||||
* </pre></blockquote>
|
* </pre></blockquote>
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void onDisable(String prefix, List<String> author, String version, String spigot, String discord) {
|
public static void onDisable(String prefix, List<String> autor, String version, String spigot, String discord) {
|
||||||
T2Csend.console(prefix + " §2Version: §6" + version);
|
T2Csend.console(prefix + " §2Version: §6" + version);
|
||||||
T2Csend.console(prefix + " §4Plugin successfully disabled.");
|
T2Csend.console(prefix + " §4Plugin successfully disabled.");
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@ public class T2Ctemplate {
|
|||||||
public static void onDisable(String prefix, Plugin plugin) {
|
public static void onDisable(String prefix, Plugin plugin) {
|
||||||
T2Csend.console(prefix + " §4 §e╔══════════════════════════");
|
T2Csend.console(prefix + " §4 §e╔══════════════════════════");
|
||||||
T2Csend.console(prefix + " §4 §e║ §2Version: §6" + plugin.getDescription().getVersion());
|
T2Csend.console(prefix + " §4 §e║ §2Version: §6" + plugin.getDescription().getVersion());
|
||||||
T2Csend.console(prefix + " §4 §e║ §2Authors: §6" + plugin.getDescription().getAuthors());
|
T2Csend.console(prefix + " §4 §e║ §2Autors: §6" + plugin.getDescription().getAuthors());
|
||||||
T2Csend.console(prefix + " §4 §e║ §4Plugin successfully disabled.");
|
T2Csend.console(prefix + " §4 §e║ §4Plugin successfully disabled.");
|
||||||
T2Csend.console(prefix + " §4 §e╚══════════════════════════");
|
T2Csend.console(prefix + " §4 §e╚══════════════════════════");
|
||||||
}
|
}
|
||||||
@@ -130,29 +130,11 @@ public class T2Ctemplate {
|
|||||||
boolean player = sender instanceof Player;
|
boolean player = sender instanceof Player;
|
||||||
String stPlugin = "<dark_red>║</dark_red> <yellow>Plugin:</yellow> <gold>[pl]</gold>".replace("[pl]", plugin.getName());
|
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 stVersion = "<dark_red>║</dark_red> <yellow>Version:</yellow> <gold>[ver]</gold>".replace("[ver]", pluginVersion);
|
||||||
String stAuthor = "<dark_red>║</dark_red> <yellow>Author(s):</yellow> <gold>[author]</gold>".replace("[author]", plugin.getDescription().getAuthors().toString());
|
String stAutor = "<dark_red>║</dark_red> <yellow>Autor(s):</yellow> <gold>[autor]</gold>".replace("[autor]", plugin.getDescription().getAuthors().toString());
|
||||||
|
|
||||||
String stUpdate = "<dark_red>║</dark_red> <yellow>New version available:</yellow> [up]".replace("[up]", webData != null ? update ?
|
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>");
|
"<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) : "";
|
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 stLink = getString(spigotID, discord, player);
|
|
||||||
String pr = premiumVerified != null ? "<br><dark_red>║</dark_red> <yellow>Premium verified:</yellow> [pr]".replace("[pr]",
|
|
||||||
premiumVerified ? "<dark_green>YES</dark_green>" : "<red>NO</red>") : "";
|
|
||||||
|
|
||||||
String stMSG = text == null || text.isEmpty() ? "" : "<br><dark_red>║</dark_red> " + text;
|
|
||||||
T2Csend.sender(sender, "<br><dark_red>╔════════════════════════════════</dark_red>"
|
|
||||||
+ "<br>" + stPlugin
|
|
||||||
+ "<br>" + stVersion
|
|
||||||
+ stMSG
|
|
||||||
+ "<br>" + stAuthor
|
|
||||||
+ "<br>" + stUpdate
|
|
||||||
+ stNVersion
|
|
||||||
+ "<br>" + stLink
|
|
||||||
+ pr
|
|
||||||
+ "<br><dark_red>╚════════════════════════════════</dark_red>");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static @NotNull String getString(int spigotID, String discord, boolean player) {
|
|
||||||
String stLinkPlayer = "<dark_red>║</dark_red> <yellow><hover:show_text:'<green>Go to the Spigot page</green>'><click:open_url:'[slink]'>Spigot</click></hover></yellow> "
|
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)
|
.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>"
|
+ "<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>"
|
||||||
@@ -160,7 +142,20 @@ public class T2Ctemplate {
|
|||||||
String stLinkConsole = "<dark_red>║</dark_red> <yellow>Spigot:</yellow> <gold>https://www.spigotmc.org/resources/" + spigotID + "</gold>"
|
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>";
|
+ "<br><dark_red>║</dark_red> <yellow>Discord:</yellow> <gold>" + discord + "</gold>";
|
||||||
String stLink = player ? stLinkPlayer : stLinkConsole;
|
String stLink = player ? stLinkPlayer : stLinkConsole;
|
||||||
return stLink;
|
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;
|
||||||
|
T2Csend.sender(sender, "<br><dark_red>╔════════════════════════════════</dark_red>"
|
||||||
|
+ "<br>" + stPlugin
|
||||||
|
+ "<br>" + stVersion
|
||||||
|
+ stMSG
|
||||||
|
+ "<br>" + stAutor
|
||||||
|
+ "<br>" + stUpdate
|
||||||
|
+ stNVersion
|
||||||
|
+ "<br>" + stLink
|
||||||
|
+ pr
|
||||||
|
+ "<br><dark_red>╚════════════════════════════════</dark_red>");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendInfo(CommandSender sender, Plugin plugin, int spigotID, String discord, String text) {
|
public static void sendInfo(CommandSender sender, Plugin plugin, int spigotID, String discord, String text) {
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.api.minecraftVersion;
|
package net.t2code.t2codelib.SPIGOT.api.minecraftVersion;
|
||||||
|
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
|
||||||
@@ -11,9 +13,9 @@ public class T2CmcVersion {
|
|||||||
bukkitVersion = Bukkit.getServer().getBukkitVersion();
|
bukkitVersion = Bukkit.getServer().getBukkitVersion();
|
||||||
T2CnmsVersions.init();
|
T2CnmsVersions.init();
|
||||||
nms = String.valueOf(T2CnmsVersions.getT2CnmsEnum());
|
nms = String.valueOf(T2CnmsVersions.getT2CnmsEnum());
|
||||||
// T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), "mcVersion: " + mcVersion);
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), "mcVersion: " + mcVersion);
|
||||||
// T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), "bukkitVersion: " + bukkitVersion);
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), "bukkitVersion: " + bukkitVersion);
|
||||||
// T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), "nms: " + nms);
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), "nms: " + nms);
|
||||||
|
|
||||||
mc1_8 = mcVersion.contains("MC: 1.8");
|
mc1_8 = mcVersion.contains("MC: 1.8");
|
||||||
mc1_9 = mcVersion.contains("MC: 1.9");
|
mc1_9 = mcVersion.contains("MC: 1.9");
|
||||||
@@ -29,6 +31,7 @@ public class T2CmcVersion {
|
|||||||
mc1_19 = mcVersion.contains("MC: 1.19");
|
mc1_19 = mcVersion.contains("MC: 1.19");
|
||||||
mc1_20 = mcVersion.contains("MC: 1.20");
|
mc1_20 = mcVersion.contains("MC: 1.20");
|
||||||
mc1_21 = mcVersion.contains("MC: 1.21");
|
mc1_21 = mcVersion.contains("MC: 1.21");
|
||||||
|
mc1_22 = mcVersion.contains("MC: 1.22");
|
||||||
|
|
||||||
nms1_8_R1 = nms.contains("1_8_R1");
|
nms1_8_R1 = nms.contains("1_8_R1");
|
||||||
nms1_8_R2 = nms.contains("1_8_R2");
|
nms1_8_R2 = nms.contains("1_8_R2");
|
||||||
@@ -55,6 +58,8 @@ public class T2CmcVersion {
|
|||||||
nms1_20_R3 = nms.contains("1_20_R3");
|
nms1_20_R3 = nms.contains("1_20_R3");
|
||||||
nms1_20_R4 = nms.contains("1_20_R4");
|
nms1_20_R4 = nms.contains("1_20_R4");
|
||||||
nms1_21_R1 = nms.contains("1_21_R1");
|
nms1_21_R1 = nms.contains("1_21_R1");
|
||||||
|
nms1_21_R2 = nms.contains("1_21_R2");
|
||||||
|
nms1_22_R1 = nms.contains("1_22_R1");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String mcVersion;
|
private static String mcVersion;
|
||||||
@@ -73,6 +78,7 @@ public class T2CmcVersion {
|
|||||||
private static boolean mc1_19;
|
private static boolean mc1_19;
|
||||||
private static boolean mc1_20;
|
private static boolean mc1_20;
|
||||||
private static boolean mc1_21;
|
private static boolean mc1_21;
|
||||||
|
private static boolean mc1_22;
|
||||||
|
|
||||||
private static String nms;
|
private static String nms;
|
||||||
private static boolean nms1_8_R1;
|
private static boolean nms1_8_R1;
|
||||||
@@ -100,6 +106,8 @@ public class T2CmcVersion {
|
|||||||
private static boolean nms1_20_R3;
|
private static boolean nms1_20_R3;
|
||||||
private static boolean nms1_20_R4;
|
private static boolean nms1_20_R4;
|
||||||
private static boolean nms1_21_R1;
|
private static boolean nms1_21_R1;
|
||||||
|
private static boolean nms1_21_R2;
|
||||||
|
private static boolean nms1_22_R1;
|
||||||
|
|
||||||
public static String getMcVersion() {
|
public static String getMcVersion() {
|
||||||
return mcVersion;
|
return mcVersion;
|
||||||
@@ -164,6 +172,11 @@ public class T2CmcVersion {
|
|||||||
public static boolean isMc1_21() {
|
public static boolean isMc1_21() {
|
||||||
return mc1_21;
|
return mc1_21;
|
||||||
}
|
}
|
||||||
|
public static boolean isMc1_22() {
|
||||||
|
return mc1_22;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String getNms() {
|
public static String getNms() {
|
||||||
return nms;
|
return nms;
|
||||||
@@ -268,6 +281,12 @@ public class T2CmcVersion {
|
|||||||
public static boolean isNms1_21_R1() {
|
public static boolean isNms1_21_R1() {
|
||||||
return nms1_21_R1;
|
return nms1_21_R1;
|
||||||
}
|
}
|
||||||
|
public static boolean isNms1_21_R2() {
|
||||||
|
return nms1_21_R2;
|
||||||
|
}
|
||||||
|
public static boolean isNms1_22_R1() {
|
||||||
|
return nms1_22_R1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static boolean minMc1_8() {
|
public static boolean minMc1_8() {
|
||||||
@@ -322,4 +341,8 @@ public class T2CmcVersion {
|
|||||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16() && !isMc1_17()
|
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16() && !isMc1_17()
|
||||||
&& !isMc1_18() && !isMc1_19();
|
&& !isMc1_18() && !isMc1_19();
|
||||||
}
|
}
|
||||||
|
public static boolean minMc1_21() {
|
||||||
|
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16() && !isMc1_17()
|
||||||
|
&& !isMc1_18() && !isMc1_19()&& !isMc1_20();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.api.minecraftVersion;
|
package net.t2code.t2codelib.SPIGOT.api.minecraftVersion;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||||
|
|
||||||
|
|
||||||
public class T2CnmsVersions {
|
public class T2CnmsVersions {
|
||||||
@@ -15,57 +17,84 @@ public class T2CnmsVersions {
|
|||||||
|
|
||||||
if (mc.contains("(MC: 1.8)") || mc.contains("(MC: 1.8.1)")) {
|
if (mc.contains("(MC: 1.8)") || mc.contains("(MC: 1.8.1)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_8_R1;
|
t2CnmsEnum = T2CnmsEnum.v1_8_R1;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.8.3)")) {
|
} else if (mc.contains("(MC: 1.8.3)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_8_R2;
|
t2CnmsEnum = T2CnmsEnum.v1_8_R2;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} 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)")) {
|
} 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;
|
t2CnmsEnum = T2CnmsEnum.v1_8_R3;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.9)") || mc.contains("(MC: 1.9.2)")) {
|
} else if (mc.contains("(MC: 1.9)") || mc.contains("(MC: 1.9.2)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_9_R1;
|
t2CnmsEnum = T2CnmsEnum.v1_9_R1;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.9.3)") || mc.contains("(MC: 1.9.4)")) {
|
} else if (mc.contains("(MC: 1.9.3)") || mc.contains("(MC: 1.9.4)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_9_R2;
|
t2CnmsEnum = T2CnmsEnum.v1_9_R2;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.10")) {
|
} else if (mc.contains("(MC: 1.10")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_10_R1;
|
t2CnmsEnum = T2CnmsEnum.v1_10_R1;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.11")) {
|
} else if (mc.contains("(MC: 1.11")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_11_R1;
|
t2CnmsEnum = T2CnmsEnum.v1_11_R1;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.12")) {
|
} else if (mc.contains("(MC: 1.12")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_12_R1;
|
t2CnmsEnum = T2CnmsEnum.v1_12_R1;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.13)")) {
|
} else if (mc.contains("(MC: 1.13)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_13_R1;
|
t2CnmsEnum = T2CnmsEnum.v1_13_R1;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.13.1)") || mc.contains("(MC: 1.13.2)")) {
|
} else if (mc.contains("(MC: 1.13.1)") || mc.contains("(MC: 1.13.2)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_13_R2;
|
t2CnmsEnum = T2CnmsEnum.v1_13_R2;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.14")) {
|
} else if (mc.contains("(MC: 1.14")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_14_R1;
|
t2CnmsEnum = T2CnmsEnum.v1_14_R1;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.15")) {
|
} else if (mc.contains("(MC: 1.15")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_15_R1;
|
t2CnmsEnum = T2CnmsEnum.v1_15_R1;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.16)") || mc.contains("(MC: 1.16.1)")) {
|
} else if (mc.contains("(MC: 1.16)") || mc.contains("(MC: 1.16.1)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_16_R1;
|
t2CnmsEnum = T2CnmsEnum.v1_16_R1;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.16.2)") || mc.contains("(MC: 1.16.3)")) {
|
} else if (mc.contains("(MC: 1.16.2)") || mc.contains("(MC: 1.16.3)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_16_R2;
|
t2CnmsEnum = T2CnmsEnum.v1_16_R2;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.16.4)") || mc.contains("(MC: 1.16.5)")) {
|
} else if (mc.contains("(MC: 1.16.4)") || mc.contains("(MC: 1.16.5)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_16_R3;
|
t2CnmsEnum = T2CnmsEnum.v1_16_R3;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.17")) {
|
} else if (mc.contains("(MC: 1.17")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_17_R1;
|
t2CnmsEnum = T2CnmsEnum.v1_17_R1;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.18)") || mc.contains("(MC: 1.18.1)")) {
|
} else if (mc.contains("(MC: 1.18)") || mc.contains("(MC: 1.18.1)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_18_R1;
|
t2CnmsEnum = T2CnmsEnum.v1_18_R1;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.18.2)")) {
|
} else if (mc.contains("(MC: 1.18.2)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_18_R2;
|
t2CnmsEnum = T2CnmsEnum.v1_18_R2;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.19)") || mc.contains("(MC: 1.19.1)") || mc.contains("(MC: 1.19.2)")) {
|
} else if (mc.contains("(MC: 1.19)") || mc.contains("(MC: 1.19.1)") || mc.contains("(MC: 1.19.2)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_19_R1;
|
t2CnmsEnum = T2CnmsEnum.v1_19_R1;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.19.3)")) {
|
} else if (mc.contains("(MC: 1.19.3)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_19_R2;
|
t2CnmsEnum = T2CnmsEnum.v1_19_R2;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.19.4)")) {
|
} else if (mc.contains("(MC: 1.19.4)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_19_R3;
|
t2CnmsEnum = T2CnmsEnum.v1_19_R3;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.20)") || mc.contains("(MC: 1.20.1)")) {
|
} else if (mc.contains("(MC: 1.20)") || mc.contains("(MC: 1.20.1)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_20_R1;
|
t2CnmsEnum = T2CnmsEnum.v1_20_R1;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.20.2)")) {
|
} else if (mc.contains("(MC: 1.20.2)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_20_R2;
|
t2CnmsEnum = T2CnmsEnum.v1_20_R2;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.20.3)") || mc.contains("(MC: 1.20.4)")) {
|
} else if (mc.contains("(MC: 1.20.3)") || mc.contains("(MC: 1.20.4)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_20_R3;
|
t2CnmsEnum = T2CnmsEnum.v1_20_R3;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else if (mc.contains("(MC: 1.20.6)")) {
|
} else if (mc.contains("(MC: 1.20.6)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_20_R4;
|
t2CnmsEnum = T2CnmsEnum.v1_20_R4;
|
||||||
} else if (mc.contains("(MC: 1.21)")) {
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
|
} else if (mc.contains("(MC: 1.21)") || mc.contains("(MC: 1.21.1)")) {
|
||||||
t2CnmsEnum = T2CnmsEnum.v1_21_R1;
|
t2CnmsEnum = T2CnmsEnum.v1_21_R1;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
} else t2CnmsEnum = T2CnmsEnum.not_support;
|
} else t2CnmsEnum = T2CnmsEnum.not_support;
|
||||||
|
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), String.valueOf(t2CnmsEnum));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,7 @@ import java.io.*;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
@@ -79,10 +79,10 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (T2CmcVersion.isMc1_21()) {
|
if (T2CmcVersion.isMc1_22()) {
|
||||||
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
||||||
T2Csend.console(prefix);
|
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.warning(plugin, "The 1.22 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);
|
||||||
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
||||||
if (!SelectLibConfig.getT2cTestDevelopment()) {
|
if (!SelectLibConfig.getT2cTestDevelopment()) {
|
||||||
|
@@ -2,7 +2,9 @@ package net.t2code.t2codelib.SPIGOT.system.cmd;
|
|||||||
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
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.update.T2CupdateAPI;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.bungeePlayers.T2CbungeePlayers;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.T2CbungeeCommandSenderReciver;
|
import net.t2code.t2codelib.SPIGOT.system.T2CbungeeCommandSenderReciver;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||||
import net.t2code.t2codelib.T2CupdateObject;
|
import net.t2code.t2codelib.T2CupdateObject;
|
||||||
|
@@ -10,7 +10,9 @@ import net.t2code.t2codelib.Util;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Commands {
|
public class Commands {
|
||||||
|
@@ -17,6 +17,7 @@ import org.apache.http.impl.client.DefaultHttpClient;
|
|||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
@@ -5,6 +5,7 @@ import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
|||||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.Util;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
@@ -1,28 +0,0 @@
|
|||||||
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,8 +1,6 @@
|
|||||||
package net.t2code.t2codelib;
|
package net.t2code.t2codelib;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class T2CupdateObject {
|
public class T2CupdateObject {
|
||||||
|
|
||||||
public String pluginName;
|
public String pluginName;
|
||||||
|
@@ -5,10 +5,10 @@ import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class Util {
|
public class Util {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static final UUID serverUUID = UUID.randomUUID();
|
private static final UUID serverUUID = UUID.randomUUID();
|
||||||
|
|
||||||
|
@@ -1,101 +0,0 @@
|
|||||||
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);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
@@ -1,30 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,88 +0,0 @@
|
|||||||
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;
|
|
||||||
// }
|
|
||||||
}
|
|
@@ -1,58 +0,0 @@
|
|||||||
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=======");
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,34 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,67 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,55 +0,0 @@
|
|||||||
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());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,55 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,68 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,50 +0,0 @@
|
|||||||
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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,107 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,79 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,102 +0,0 @@
|
|||||||
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());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,86 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,65 +0,0 @@
|
|||||||
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=============================");
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,81 +0,0 @@
|
|||||||
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());
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,134 +0,0 @@
|
|||||||
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"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,60 +0,0 @@
|
|||||||
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;
|
|
||||||
//
|
|
||||||
}
|
|
@@ -1,131 +0,0 @@
|
|||||||
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,18 +1,5 @@
|
|||||||
name: T2CodeLib
|
name: T2CodeLib
|
||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
main: net.t2code.t2codelib.bungee.system.T2CodeBMain
|
main: net.t2code.t2codelib.BUNGEE.system.T2CodeBMain
|
||||||
author: JaTiTV, Jkobs
|
author: JaTiTV, Jkobs
|
||||||
description: Library from T2Code Plugins
|
description: Library from T2Code Plugins
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_______ ___ _____ _ _
|
|
||||||
|__ __|__ \ / ____| | | | |
|
|
||||||
| | ) | | ___ __| | ___ _ __ ___| |_
|
|
||||||
| | / /| | / _ \ / _` |/ _ \ | '_ \ / _ \ __|
|
|
||||||
| | / /_| |___| (_) | (_| | __/_| | | | __/ |_
|
|
||||||
|_| |____|\_____\___/ \__,_|\___(_)_| |_|\___|\__|
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
name: T2CodeLib
|
name: T2CodeLib
|
||||||
version: '${project.version}'
|
version: '${project.version}'
|
||||||
main: net.t2code.t2codelib.spigot.system.T2CodeLibMain
|
main: net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
prefix: T2CodeLib
|
prefix: T2CodeLib
|
||||||
authors: [ JaTiTV ]
|
authors: [ JaTiTV ]
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
{"id":"t2codelib","name":"T2CodeLib","version":"${project.version}","authors":["JaTiTV"],"dependencies":[],"main":"net.t2code.t2codelib.VELOCITY.system.T2CodeVMain"}
|
|
Reference in New Issue
Block a user