Compare commits
23 Commits
15.4
...
developmen
Author | SHA1 | Date |
---|---|---|
JaTiTV | 76862db7c9 | |
JaTiTV | e5cba7fe6d | |
JaTiTV | 770b7daa94 | |
JaTiTV | 0f645300f4 | |
JaTiTV | 65e0082322 | |
JaTiTV | 150d9f4933 | |
JaTiTV | f40c47e6ab | |
JaTiTV | de6ecdf7a8 | |
JaTiTV | cdd375a673 | |
JaTiTV | 1cfaf32ee1 | |
JaTiTV | c72edafd0a | |
JaTiTV | 610cb74868 | |
JaTiTV | 3a3c9b3208 | |
JaTiTV | a834adc8c9 | |
JaTiTV | 290b9264f3 | |
JaTiTV | eb991d01e3 | |
JaTiTV | ec7714c9fe | |
JaTiTV | 260dae2aa0 | |
JaTiTV | addc485ca8 | |
JaTiTV | f8619e4802 | |
JaTiTV | e97fadfbec | |
JaTiTV | 567b0a2442 | |
JaTiTV | 7b04697895 |
|
@ -1,6 +1,4 @@
|
||||||
# User-specific stuff
|
# User-specific stuff
|
||||||
.idea/
|
|
||||||
.idea
|
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
*.iws
|
*.iws
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<module name="T2CodeLib" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DiscordProjectSettings">
|
||||||
|
<option name="show" value="ASK" />
|
||||||
|
<option name="description" value="" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 295 KiB |
|
@ -0,0 +1,55 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jitpack.io" />
|
||||||
|
<option name="name" value="jitpack.io" />
|
||||||
|
<option name="url" value="https://jitpack.io" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="T2Code" />
|
||||||
|
<option name="name" value="T2Code" />
|
||||||
|
<option name="url" value="https://repo.t2code.net/repository/T2Code/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="spigot-repo" />
|
||||||
|
<option name="name" value="spigot-repo" />
|
||||||
|
<option name="url" value="https://hub.spigotmc.org/nexus/content/repositories/snapshots/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="placeholderapi" />
|
||||||
|
<option name="name" value="placeholderapi" />
|
||||||
|
<option name="url" value="https://repo.extendedclip.com/content/repositories/placeholderapi/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Maven Central repository" />
|
||||||
|
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jboss.community" />
|
||||||
|
<option name="name" value="JBoss Community repository" />
|
||||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="minecraft-repo" />
|
||||||
|
<option name="name" value="minecraft-repo" />
|
||||||
|
<option name="url" value="https://libraries.minecraft.net/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="bungeecord-repo" />
|
||||||
|
<option name="name" value="bungeecord-repo" />
|
||||||
|
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="BenCodez Repo" />
|
||||||
|
<option name="name" value="BenCodez Repo" />
|
||||||
|
<option name="url" value="https://nexus.bencodez.com/repository/maven-public/" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="EntryPointsManager">
|
||||||
|
<list size="2">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="net.md_5.bungee.event.EventHandler" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
|
||||||
|
</list>
|
||||||
|
</component>
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
<option name="workspaceImportForciblyTurnedOn" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="16" project-jdk-type="JavaSDK" />
|
||||||
|
</project>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/T2CodeLib.iml" filepath="$PROJECT_DIR$/T2CodeLib.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
20
pom.xml
20
pom.xml
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>T2CodeLib</artifactId>
|
<artifactId>T2CodeLib</artifactId>
|
||||||
<version>15.4</version>
|
<version>16.5_DEV</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-->
|
||||||
|
@ -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>
|
||||||
|
@ -118,7 +118,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.20-R0.1-SNAPSHOT</version>
|
<version>1.20.4-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -182,19 +182,19 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-text-minimessage</artifactId>
|
<artifactId>adventure-text-minimessage</artifactId>
|
||||||
<version>4.14.0</version>
|
<version>4.16.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-platform-bukkit</artifactId>
|
<artifactId>adventure-platform-bukkit</artifactId>
|
||||||
<version>4.3.0</version>
|
<version>4.3.2</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-platform-bungeecord</artifactId>
|
<artifactId>adventure-platform-bungeecord</artifactId>
|
||||||
<version>4.3.0</version>
|
<version>4.3.2</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -221,6 +221,12 @@
|
||||||
<version>4.5.14</version>
|
<version>4.5.14</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.json</groupId>
|
||||||
|
<artifactId>json</artifactId>
|
||||||
|
<version>20230227</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -50,20 +50,20 @@ public class T2CBupdateCheckerGit {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JSONObject obj = new JSONObject(data);
|
JSONObject obj = new JSONObject(data);
|
||||||
String UpdateName = obj.getString("name");
|
String updateTitle = obj.getString("name");
|
||||||
String tag_name = obj.getString("tag_name");
|
String version = obj.getString("tag_name");
|
||||||
String body = obj.getString("body").replace("\n", "<br>").replace("\r", "").replace("'", "''");
|
String updateDescription = obj.getString("body").replace("\n", "<br>").replace("\r", "").replace("'", "''");
|
||||||
String updateurl = obj.getString("html_url");
|
String updateUrl = obj.getString("html_url");
|
||||||
boolean prerelease = obj.getBoolean("prerelease");
|
boolean preRelease = obj.getBoolean("prerelease");
|
||||||
|
|
||||||
String date = obj.getString("published_at");
|
String date = obj.getString("published_at");
|
||||||
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||||
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss a");
|
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss a");
|
||||||
Date parsedDate = inputFormat.parse(date);
|
Date parsedDate = inputFormat.parse(date);
|
||||||
String formattedDate = outputFormat.format(parsedDate);
|
String publishedAt = outputFormat.format(parsedDate);
|
||||||
|
|
||||||
JSONArray downloadArray = obj.getJSONArray("assets");
|
JSONArray downloadArray = obj.getJSONArray("assets");
|
||||||
String gitURL = updateurl;
|
String gitURL = updateUrl;
|
||||||
String downloadURL;
|
String downloadURL;
|
||||||
if (downloadArray.isEmpty()) {
|
if (downloadArray.isEmpty()) {
|
||||||
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
||||||
|
@ -71,12 +71,12 @@ public class T2CBupdateCheckerGit {
|
||||||
downloadURL = downloadArray.getJSONObject(0).getString("browser_download_url");
|
downloadURL = downloadArray.getJSONObject(0).getString("browser_download_url");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!prerelease) {
|
if (!preRelease) {
|
||||||
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
||||||
updateurl = "https://www.spigotmc.org/resources/" + spigotID;
|
updateUrl = "https://www.spigotmc.org/resources/" + spigotID;
|
||||||
}
|
}
|
||||||
|
|
||||||
T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, formattedDate, downloadURL, gitURL, prerelease);
|
T2CupdateWebData webData = new T2CupdateWebData(updateTitle, version, updateDescription, updateUrl, publishedAt, downloadURL, gitURL, preRelease);
|
||||||
consumer.accept(webData);
|
consumer.accept(webData);
|
||||||
} catch (Exception var10) {
|
} catch (Exception var10) {
|
||||||
Boolean load = false;
|
Boolean load = false;
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -20,7 +21,13 @@ public class T2CplmsgBcmd implements Listener {
|
||||||
try {
|
try {
|
||||||
String channel = stream.readUTF();
|
String channel = stream.readUTF();
|
||||||
String input = stream.readUTF();
|
String input = stream.readUTF();
|
||||||
String serverID = stream.readUTF();
|
String serverID;
|
||||||
|
try {
|
||||||
|
serverID = stream.readUTF();
|
||||||
|
} catch (Exception i){
|
||||||
|
serverID = "not Found";
|
||||||
|
}
|
||||||
|
|
||||||
if (channel.equals("T2Code-Console")) {
|
if (channel.equals("T2Code-Console")) {
|
||||||
ProxyServer.getInstance().getConsole().sendMessage(Util.getPrefix()+" [§6"+serverID+"§r] §cT2C BCMD Command Console: §r"+ input);
|
ProxyServer.getInstance().getConsole().sendMessage(Util.getPrefix()+" [§6"+serverID+"§r] §cT2C BCMD Command Console: §r"+ input);
|
||||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);
|
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);
|
||||||
|
|
|
@ -1,25 +1,70 @@
|
||||||
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 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.Unmodifiable;
|
||||||
|
|
||||||
|
import java.rmi.MarshalledObject;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class T2Ccmd {
|
public class T2Ccmd {
|
||||||
public static void console(String cmd) {
|
public static void console(String cmdInput) {
|
||||||
if (cmd.contains("!onBungee")){
|
Map.Entry<String,Integer> map = delay(cmdInput);
|
||||||
T2CbungeeCommandSenderReciver.sendToBungee(null, cmd.replace("!onBungee", ""), true);
|
int delay = map.getValue();
|
||||||
}else Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd);
|
String cmd = map.getKey();
|
||||||
|
Bukkit.getScheduler().runTaskLater(T2CodeLibMain.getPlugin(), new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (cmd.contains("!onBungee")) {
|
||||||
|
T2CbungeeCommandSenderReciver.sendToBungee(null, cmd.replace("!onBungee", ""), true);
|
||||||
|
} else Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd);
|
||||||
|
}
|
||||||
|
}, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void player(Player player, String cmd) {
|
public static void player(Player player, String cmdInput) {
|
||||||
if (cmd.contains("!asConsole")) {
|
Map.Entry<String,Integer> map = delay(cmdInput);
|
||||||
if (cmd.contains("!onBungee")) {
|
int delay = map.getValue();
|
||||||
T2CbungeeCommandSenderReciver.sendToBungee(player, cmd.replace("!asConsole", "").replace("!onBungee", ""), true);
|
String cmd = map.getKey();
|
||||||
} else console(cmd.replace("!asConsole", ""));
|
Bukkit.getScheduler().runTaskLater(T2CodeLibMain.getPlugin(), new Runnable() {
|
||||||
} else {
|
@Override
|
||||||
if (cmd.contains("!onBungee")) {
|
public void run() {
|
||||||
T2CbungeeCommandSenderReciver.sendToBungee(player, cmd.replace("!onBungee", ""), false);
|
if (cmd.contains("!asConsole")) {
|
||||||
} else player.chat("/" + cmd);
|
if (cmd.contains("!onBungee")) {
|
||||||
}
|
T2CbungeeCommandSenderReciver.sendToBungee(player, cmd.replace("!asConsole", "").replace("!onBungee", ""), true);
|
||||||
|
} else console(cmd.replace("!asConsole", ""));
|
||||||
|
} else {
|
||||||
|
if (cmd.contains("!onBungee")) {
|
||||||
|
T2CbungeeCommandSenderReciver.sendToBungee(player, cmd.replace("!onBungee", ""), false);
|
||||||
|
} else player.chat("/" + cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Map.Entry<String, Integer> delay(@NotNull String cmdInput) {
|
||||||
|
int delay = 0;
|
||||||
|
String cmd;
|
||||||
|
if (cmdInput.contains("!delay:")) {
|
||||||
|
int i = cmdInput.indexOf("!delay:") + 7;
|
||||||
|
String s2 = cmdInput.substring(i);
|
||||||
|
int i2 = 1;
|
||||||
|
if(s2.contains(" ")) {
|
||||||
|
i2 = s2.indexOf(" ");
|
||||||
|
}else{
|
||||||
|
i2 = s2.length();
|
||||||
|
}
|
||||||
|
delay = Integer.parseInt(cmdInput.substring(i, i + i2));
|
||||||
|
cmd = cmdInput.replace("!delay:" + delay, "");
|
||||||
|
|
||||||
|
} else cmd = cmdInput;
|
||||||
|
|
||||||
|
return Map.entry(cmd, delay);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,22 @@ package net.t2code.t2codelib.SPIGOT.api.items;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
|
import org.bukkit.profile.PlayerProfile;
|
||||||
|
import org.bukkit.profile.PlayerTextures;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -52,7 +61,27 @@ public class T2CitemBuilder {
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack base64(String base64Value, Integer amount, String displayName, List<String> lore) {
|
public static void setItem(Integer slot, Integer amount, String material, String displayName, List<String> lore, Inventory inventory) {
|
||||||
|
ItemStack item;
|
||||||
|
if (getLegacy && material.contains(",")) {
|
||||||
|
String[] split = material.split(",");
|
||||||
|
item = new ItemStack(Material.valueOf(split[0]), 1, Short.parseShort(split[1]));
|
||||||
|
} else item = new ItemStack(Material.valueOf(material));
|
||||||
|
ItemMeta itemMeta = item.getItemMeta();
|
||||||
|
itemMeta.setDisplayName(displayName);
|
||||||
|
itemMeta.setLore(lore);
|
||||||
|
item.setItemMeta(itemMeta);
|
||||||
|
item.setAmount(amount);
|
||||||
|
inventory.setItem(slot, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack base64(String base64Value) {
|
||||||
|
if (!T2CmcVersion.minMc1_20() || T2CmcVersion.isNms1_20_R1()|| T2CmcVersion.isNms1_20_R2()|| T2CmcVersion.isNms1_20_R3()) {
|
||||||
|
return base64Old(base64Value);
|
||||||
|
} else return base64New(base64Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ItemStack base64Old(String base64Value) {
|
||||||
ItemStack itemStack = new ItemStack(T2CitemVersion.getHead());
|
ItemStack itemStack = new ItemStack(T2CitemVersion.getHead());
|
||||||
SkullMeta itemMeta = (SkullMeta) itemStack.getItemMeta();
|
SkullMeta itemMeta = (SkullMeta) itemStack.getItemMeta();
|
||||||
|
|
||||||
|
@ -67,11 +96,33 @@ public class T2CitemBuilder {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
itemMeta.setDisplayName(displayName);
|
|
||||||
itemMeta.setLore(lore);
|
|
||||||
itemStack.setItemMeta(itemMeta);
|
itemStack.setItemMeta(itemMeta);
|
||||||
|
|
||||||
itemStack.setAmount(amount);
|
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ItemStack base64New(String base64Value) {
|
||||||
|
ItemStack itemStack = new ItemStack(T2CitemVersion.getHead());
|
||||||
|
SkullMeta itemMeta = (SkullMeta) itemStack.getItemMeta();
|
||||||
|
|
||||||
|
PlayerProfile profile = Bukkit.createPlayerProfile(UUID.randomUUID());
|
||||||
|
PlayerTextures textures = profile.getTextures();
|
||||||
|
try {
|
||||||
|
textures.setSkin(new URL(base64Convert(base64Value)));
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
profile.setTextures(textures);
|
||||||
|
itemMeta.setOwnerProfile(profile);
|
||||||
|
itemStack.setItemMeta(itemMeta);
|
||||||
|
return itemStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String base64Convert(String base64Value) {
|
||||||
|
String jsonString = new String(Base64.getDecoder().decode(base64Value));
|
||||||
|
JSONObject obj = new JSONObject(jsonString);
|
||||||
|
String output = obj.getJSONObject("textures").getJSONObject("SKIN").getString("url");
|
||||||
|
if (output.startsWith("http://textures.minecraft.net/texture/")){
|
||||||
|
return output;
|
||||||
|
} else return "http://textures.minecraft.net/texture/d5d20330da59c207d78352838e91a48ea1e42b45a9893226144b251fe9b9d535";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,76 +1,54 @@
|
||||||
package net.t2code.t2codelib.SPIGOT.api.items;
|
package net.t2code.t2codelib.SPIGOT.api.items;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class T2CitemVersion {
|
public class T2CitemVersion {
|
||||||
|
@Getter
|
||||||
private static Material Head;
|
private static Material Head;
|
||||||
|
@Getter
|
||||||
private static ItemStack HeadIS;
|
private static ItemStack HeadIS;
|
||||||
private static ItemStack CRAFTING_TABLE;
|
@Getter
|
||||||
private static ItemStack YELLOW_WOOL;
|
private static ItemStack CraftingTable;
|
||||||
private static ItemStack ORANGE_WOOL;
|
@Getter
|
||||||
private static ItemStack GREEN_WOOL;
|
private static ItemStack YellowWool;
|
||||||
private static ItemStack GRAY_WOOL;
|
@Getter
|
||||||
private static ItemStack RED_WOOL;
|
private static ItemStack OrangeWool;
|
||||||
private static ItemStack RED_STAINED_GLASS_PANE;
|
@Getter
|
||||||
|
private static ItemStack GreenWool;
|
||||||
|
@Getter
|
||||||
|
private static ItemStack GrayWool;
|
||||||
|
@Getter
|
||||||
|
private static ItemStack RedWool;
|
||||||
|
@Getter
|
||||||
|
private static ItemStack RedStainedGlassPane;
|
||||||
|
@Getter
|
||||||
|
private static ItemStack BlackStainedGlassPane;
|
||||||
|
|
||||||
public static void scan() {
|
public static void scan() {
|
||||||
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||||
Head = Material.valueOf("SKULL_ITEM");
|
Head = Material.valueOf("SKULL_ITEM");
|
||||||
YELLOW_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 4);
|
YellowWool = new ItemStack(Material.valueOf("WOOL"), 1, (short) 4);
|
||||||
ORANGE_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 1);
|
OrangeWool = new ItemStack(Material.valueOf("WOOL"), 1, (short) 1);
|
||||||
GREEN_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 5);
|
GreenWool = new ItemStack(Material.valueOf("WOOL"), 1, (short) 5);
|
||||||
GRAY_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 8);
|
GrayWool = new ItemStack(Material.valueOf("WOOL"), 1, (short) 8);
|
||||||
RED_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 14);
|
RedWool = new ItemStack(Material.valueOf("WOOL"), 1, (short) 14);
|
||||||
RED_STAINED_GLASS_PANE = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, (short) 14);
|
RedStainedGlassPane = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, (short) 14);
|
||||||
CRAFTING_TABLE = new ItemStack(Material.valueOf("WORKBENCH"));
|
BlackStainedGlassPane = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, (short) 15);
|
||||||
|
CraftingTable = new ItemStack(Material.valueOf("WORKBENCH"));
|
||||||
} else {
|
} else {
|
||||||
Head = Material.valueOf("PLAYER_HEAD");
|
Head = Material.valueOf("PLAYER_HEAD");
|
||||||
CRAFTING_TABLE = new ItemStack(Material.CRAFTING_TABLE);
|
CraftingTable = new ItemStack(Material.CRAFTING_TABLE);
|
||||||
YELLOW_WOOL = new ItemStack(Material.YELLOW_WOOL);
|
YellowWool = new ItemStack(Material.YELLOW_WOOL);
|
||||||
ORANGE_WOOL = new ItemStack(Material.ORANGE_WOOL);
|
OrangeWool = new ItemStack(Material.ORANGE_WOOL);
|
||||||
GREEN_WOOL = new ItemStack(Material.GREEN_WOOL);
|
GreenWool = new ItemStack(Material.GREEN_WOOL);
|
||||||
GRAY_WOOL = new ItemStack(Material.GRAY_WOOL);
|
GrayWool = new ItemStack(Material.GRAY_WOOL);
|
||||||
RED_WOOL = new ItemStack(Material.RED_WOOL);
|
RedWool = new ItemStack(Material.RED_WOOL);
|
||||||
RED_STAINED_GLASS_PANE = new ItemStack(Material.RED_STAINED_GLASS_PANE);
|
RedStainedGlassPane = new ItemStack(Material.RED_STAINED_GLASS_PANE);
|
||||||
|
BlackStainedGlassPane = new ItemStack(Material.BLACK_STAINED_GLASS_PANE);
|
||||||
}
|
}
|
||||||
HeadIS = new ItemStack(Head, 1, (byte) 3);
|
HeadIS = new ItemStack(Head, 1, (byte) 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Material getHead() {
|
|
||||||
return Head;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getHeadIS() {
|
|
||||||
return HeadIS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getCraftingTable() {
|
|
||||||
return CRAFTING_TABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getYellowWool() {
|
|
||||||
return YELLOW_WOOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getOrangeWool() {
|
|
||||||
return ORANGE_WOOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getGreenWool() {
|
|
||||||
return GREEN_WOOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getGrayWool() {
|
|
||||||
return GRAY_WOOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getRedWool() {
|
|
||||||
return RED_WOOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getRedStainedGlassPane() {
|
|
||||||
return RED_STAINED_GLASS_PANE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,25 +8,11 @@ import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class T2ChoverModule {
|
public class T2ChoverModule {
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated reason this method is deprecated <br/>
|
|
||||||
* The T2Code Hover Module will be removed soon,<br/>
|
|
||||||
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
|
|
||||||
* and the Kyori MiniMessage format!
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void modulePlayer(String text, String hover, String action, String actionValue, Player player) {
|
public static void modulePlayer(String text, String hover, String action, String actionValue, Player player) {
|
||||||
modulePlayer((text != null ? text : "null") + "/*/" + (hover != null ? hover : "null") + "/*/" + (action != null ? action : "null")
|
modulePlayer((text != null ? text : "null") + "/*/" + (hover != null ? hover : "null") + "/*/" + (action != null ? action : "null")
|
||||||
+ "/*/" + (actionValue != null ? actionValue : "null"), player);
|
+ "/*/" + (actionValue != null ? actionValue : "null"), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated reason this method is deprecated <br/>
|
|
||||||
* The T2Code Hover Module will be removed soon,<br/>
|
|
||||||
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
|
|
||||||
* and the Kyori MiniMessage format!
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void modulePlayer(String msg, Player player) {
|
public static void modulePlayer(String msg, Player player) {
|
||||||
if (msg.contains("/*/")) {
|
if (msg.contains("/*/")) {
|
||||||
t2cmodule(msg, player);
|
t2cmodule(msg, player);
|
||||||
|
@ -35,24 +21,10 @@ public class T2ChoverModule {
|
||||||
T2CminiMessage.sendPlayerMiniMessage(msg, player);
|
T2CminiMessage.sendPlayerMiniMessage(msg, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated reason this method is deprecated <br/>
|
|
||||||
* The T2Code Hover Module will be removed soon,<br/>
|
|
||||||
* please use 'T2CminiMessage.sendSenderMiniMessage(msg, sender);'<br/>
|
|
||||||
* and the Kyori MiniMessage format!
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void moduleSender(String msg, CommandSender sender) {
|
public static void moduleSender(String msg, CommandSender sender) {
|
||||||
T2CminiMessage.sendSenderMiniMessage(msg, sender);
|
T2CminiMessage.sendSenderMiniMessage(msg, sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated reason this method is deprecated <br/>
|
|
||||||
* The T2Code Hover Module will be removed soon,<br/>
|
|
||||||
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
|
|
||||||
* and the Kyori MiniMessage format!
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void moduleConsole(String msg) {
|
public static void moduleConsole(String msg) {
|
||||||
if (T2CodeLibMain.getMmIsLoad()) {
|
if (T2CodeLibMain.getMmIsLoad()) {
|
||||||
T2CminiMessage.sendConsoleMiniMessage(msg);
|
T2CminiMessage.sendConsoleMiniMessage(msg);
|
||||||
|
@ -61,13 +33,6 @@ public class T2ChoverModule {
|
||||||
Bukkit.getConsoleSender().sendMessage(msg);
|
Bukkit.getConsoleSender().sendMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated reason this method is deprecated <br/>
|
|
||||||
* The T2Code Hover Module will be removed soon,<br/>
|
|
||||||
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
|
|
||||||
* and the Kyori MiniMessage format!
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
private static void t2cmodule(String msg, Player player) {
|
private static void t2cmodule(String msg, Player player) {
|
||||||
String[] split = msg.split("/\\*/");
|
String[] split = msg.split("/\\*/");
|
||||||
int i = split.length;
|
int i = split.length;
|
||||||
|
|
|
@ -11,7 +11,12 @@ public class T2CminiMessage {
|
||||||
private static final BukkitAudiences bukkitAudiences = T2CodeLibMain.getPlugin().getAdventure();
|
private static final BukkitAudiences bukkitAudiences = T2CodeLibMain.getPlugin().getAdventure();
|
||||||
|
|
||||||
public static void sendSenderMiniMessage(String msg, CommandSender sender) {
|
public static void sendSenderMiniMessage(String msg, CommandSender sender) {
|
||||||
bukkitAudiences.sender(sender).sendMessage(replace(msg));
|
String string = "";
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
Player player = (Player) sender;
|
||||||
|
string =T2Creplace.replace("",player,msg);
|
||||||
|
} else string = msg;
|
||||||
|
bukkitAudiences.sender(sender).sendMessage(replace(string));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendConsoleMiniMessage(String msg) {
|
public static void sendConsoleMiniMessage(String msg) {
|
||||||
|
@ -19,7 +24,7 @@ public class T2CminiMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPlayerMiniMessage(String msg, Player player) {
|
public static void sendPlayerMiniMessage(String msg, Player player) {
|
||||||
bukkitAudiences.player(player).sendMessage(replace(msg));
|
bukkitAudiences.player(player).sendMessage(replace(T2Creplace.replace("", player, msg)));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static Component replace(String text) {
|
protected static Component replace(String text) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||||
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -17,10 +18,16 @@ public class T2Creplace {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String replace(String prefix, Player player, String Text) {
|
public static String replace(String prefix, Player player, String Text) {
|
||||||
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix)
|
String input = Text.replace("[prefix]", prefix)
|
||||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||||
.replace("[nl]", "\n")));
|
.replace("[nl]", "\n");
|
||||||
|
if (T2CpluginCheck.papi()) {
|
||||||
|
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, input));
|
||||||
|
} else {
|
||||||
|
return replaceLegacyColor(input);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object replaceObject(String prefix, Object object) {
|
public static Object replaceObject(String prefix, Object object) {
|
||||||
|
@ -46,18 +53,33 @@ public class T2Creplace {
|
||||||
|
|
||||||
public static Object replaceObject(String prefix, Player player, Object object) {
|
public static Object replaceObject(String prefix, Player player, Object object) {
|
||||||
if (object instanceof String) {
|
if (object instanceof String) {
|
||||||
object = PlaceholderAPI.setPlaceholders(player, replaceLegacyColor((String) object).replace("[prefix]", prefix).replace("[ue]", "ü")
|
|
||||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
if (T2CpluginCheck.papi()) {
|
||||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n"));
|
object = PlaceholderAPI.setPlaceholders(player, replaceLegacyColor((String) object).replace("[prefix]", prefix).replace("[ue]", "ü")
|
||||||
|
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||||
|
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n"));
|
||||||
|
} else {
|
||||||
|
object = replaceLegacyColor((String) object).replace("[prefix]", prefix).replace("[ue]", "ü")
|
||||||
|
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||||
|
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (object instanceof List) {
|
if (object instanceof List) {
|
||||||
List<String> in = (List<String>) object;
|
List<String> in = (List<String>) object;
|
||||||
List<String> output = new ArrayList<>();
|
List<String> output = new ArrayList<>();
|
||||||
for (String input : in) {
|
for (String input : in) {
|
||||||
output.add(PlaceholderAPI.setPlaceholders(player, replaceLegacyColor(input).replace("[prefix]", prefix)
|
if (T2CpluginCheck.papi()) {
|
||||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
output.add(PlaceholderAPI.setPlaceholders(player, replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||||
.replace("[nl]", "\n")));
|
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||||
|
.replace("[nl]", "\n")));
|
||||||
|
} else {
|
||||||
|
output.add(replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||||
|
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||||
|
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||||
|
.replace("[nl]", "\n"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
object = output;
|
object = output;
|
||||||
}
|
}
|
||||||
|
@ -84,10 +106,18 @@ public class T2Creplace {
|
||||||
return Collections.singletonList("Text is null");
|
return Collections.singletonList("Text is null");
|
||||||
}
|
}
|
||||||
for (String input : Text) {
|
for (String input : Text) {
|
||||||
output.add(PlaceholderAPI.setPlaceholders(player, replaceLegacyColor(input).replace("[prefix]", prefix)
|
if (T2CpluginCheck.papi()) {
|
||||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
output.add(PlaceholderAPI.setPlaceholders(player, replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||||
.replace("[nl]", "\n")));
|
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||||
|
.replace("[nl]", "\n")));
|
||||||
|
} else {
|
||||||
|
output.add(replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||||
|
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||||
|
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||||
|
.replace("[nl]", "\n"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
@ -115,10 +145,15 @@ public class T2Creplace {
|
||||||
public static List<String> replacePrice(String prefix, Player player, List<String> Text, String price) {
|
public static List<String> replacePrice(String prefix, Player player, List<String> Text, String price) {
|
||||||
List<String> rp = new ArrayList<>();
|
List<String> rp = new ArrayList<>();
|
||||||
for (String s : Text) {
|
for (String s : Text) {
|
||||||
rp.add(replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, s.replace("[prefix]", prefix)
|
String input = s.replace("[prefix]", prefix)
|
||||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n")
|
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n")
|
||||||
.replace("[price]", String.valueOf(price)))));
|
.replace("[price]", String.valueOf(price));
|
||||||
|
if (T2CpluginCheck.papi()) {
|
||||||
|
rp.add(replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, input)));
|
||||||
|
} else {
|
||||||
|
rp.add(replaceLegacyColor(input));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return rp;
|
return rp;
|
||||||
}
|
}
|
||||||
|
@ -132,10 +167,16 @@ public class T2Creplace {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String replacePrice(String prefix, Player player, String Text, String price) {
|
public static String replacePrice(String prefix, Player player, String Text, String price) {
|
||||||
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix)
|
String input = Text.replace("[prefix]", prefix)
|
||||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||||
.replace("[price]", String.valueOf(price)).replace("[nl]", "\n")));
|
.replace("[price]", String.valueOf(price)).replace("[nl]", "\n");
|
||||||
|
if (T2CpluginCheck.papi()) {
|
||||||
|
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, input));
|
||||||
|
} else {
|
||||||
|
return replaceLegacyColor(input);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String replaceLegacyColor(String text) {
|
public static String replaceLegacyColor(String text) {
|
||||||
|
@ -171,4 +212,19 @@ public class T2Creplace {
|
||||||
.replace("&o", "<italic>").replace("§o", "<italic>")
|
.replace("&o", "<italic>").replace("§o", "<italic>")
|
||||||
.replace("&r", "<reset>").replace("§r", "<reset>");
|
.replace("&r", "<reset>").replace("§r", "<reset>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Object replace(Object object, String placeholder, String replacement) {
|
||||||
|
if (object instanceof String) {
|
||||||
|
object = ((String) object).replace(placeholder, replacement);
|
||||||
|
}
|
||||||
|
if ((object instanceof List) || (object instanceof ArrayList)) {
|
||||||
|
List<String> in = (List<String>) object;
|
||||||
|
List<String> output = new ArrayList<>();
|
||||||
|
for (String input : in) {
|
||||||
|
output.add(input.replace(placeholder, replacement));
|
||||||
|
}
|
||||||
|
object = output;
|
||||||
|
}
|
||||||
|
return object;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,71 +7,47 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class T2Csend {
|
public class T2Csend {
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated reason this method is deprecated <br/>
|
|
||||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void console(String msg) {
|
public static void console(String msg) {
|
||||||
if (msg == null || msg.contains("[empty]")) return;
|
if (msg == null || msg.contains("[empty]")) return;
|
||||||
T2ChoverModule.moduleConsole(msg);
|
T2ChoverModule.moduleConsole(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated reason this method is deprecated <br/>
|
|
||||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void player(Player player, String msg) {
|
public static void player(Player player, String msg) {
|
||||||
if (msg == null || msg.contains("[empty]")) return;
|
if (msg == null || msg.contains("[empty]")) return;
|
||||||
T2ChoverModule.modulePlayer(msg, player);
|
T2ChoverModule.modulePlayer(msg, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated reason this method is deprecated <br/>
|
|
||||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void sender(CommandSender sender, String msg) {
|
public static void sender(CommandSender sender, String msg) {
|
||||||
if (msg == null || msg.contains("[empty]")) return;
|
if (msg == null || msg.contains("[empty]")) return;
|
||||||
T2ChoverModule.moduleSender(msg, sender);
|
T2ChoverModule.moduleSender(msg, sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated reason this method is deprecated <br/>
|
|
||||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void console(Object object) {
|
public static void console(Object object) {
|
||||||
String msg = String.valueOf(object);
|
for (String msg : list(object)){
|
||||||
if (msg == null || msg.contains("[empty]")) return;
|
if (msg == null || msg.contains("[empty]")) continue;
|
||||||
T2ChoverModule.moduleConsole(msg);
|
T2ChoverModule.moduleConsole(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated reason this method is deprecated <br/>
|
|
||||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void player(Player player, Object object) {
|
public static void player(Player player, Object object) {
|
||||||
String msg = String.valueOf(object);
|
for (String msg : list(object)){
|
||||||
if (msg == null || msg.contains("[empty]")) return;
|
if (msg == null || msg.contains("[empty]")) continue;
|
||||||
T2ChoverModule.modulePlayer(msg, player);
|
T2ChoverModule.modulePlayer(msg, player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated reason this method is deprecated <br/>
|
|
||||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void sender(CommandSender sender, Object object) {
|
public static void sender(CommandSender sender, Object object) {
|
||||||
String msg = String.valueOf(object);
|
for (String msg : list(object)){
|
||||||
if (msg == null || msg.contains("[empty]")) return;
|
if (msg == null || msg.contains("[empty]")) return;
|
||||||
T2ChoverModule.moduleSender(msg, sender);
|
T2ChoverModule.moduleSender(msg, sender);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void title(Player player, @Nullable String title, @Nullable String subtitle) {
|
public static void title(Player player, @Nullable String title, @Nullable String subtitle) {
|
||||||
|
@ -106,4 +82,16 @@ public class T2Csend {
|
||||||
public static void error(Plugin plugin, String msg) {
|
public static void error(Plugin plugin, String msg) {
|
||||||
plugin.getLogger().log(Level.SEVERE, msg);
|
plugin.getLogger().log(Level.SEVERE, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ArrayList<String> list(Object object){
|
||||||
|
ArrayList<String> list = new ArrayList<>();
|
||||||
|
|
||||||
|
if (object instanceof List){
|
||||||
|
list= (ArrayList<String>) object;
|
||||||
|
}
|
||||||
|
if (object instanceof String){
|
||||||
|
list.add((String) object);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@ 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.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;
|
||||||
|
@ -46,7 +48,7 @@ public class T2Ctemplate {
|
||||||
T2Csend.console(prefix + " §eYou are running §4" + version + " §eof " + prefix + "§e! Some features may not be working as expected. Please report all" +
|
T2Csend.console(prefix + " §eYou are running §4" + version + " §eof " + prefix + "§e! Some features may not be working as expected. Please report all" +
|
||||||
" bugs here: http://dc.t2code.net §4UpdateChecker & bStats may be disabled!");
|
" bugs here: http://dc.t2code.net §4UpdateChecker & bStats may be disabled!");
|
||||||
onLoadSeparateStroke(prefix);
|
onLoadSeparateStroke(prefix);
|
||||||
if (!SelectLibConfig.getT2cTestDevelopment()){
|
if (!SelectLibConfig.getT2cTestDevelopment()) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(5000);
|
Thread.sleep(5000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
@ -68,6 +70,10 @@ public class T2Ctemplate {
|
||||||
T2Csend.console(prefix + " §8-------------------------------");
|
T2Csend.console(prefix + " §8-------------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void onLoadFooter(String prefix, Long long_, String v) {
|
||||||
|
onLoadFooter(prefix, long_);
|
||||||
|
}
|
||||||
|
|
||||||
public static void onLoadFooter(String prefix, Long long_) {
|
public static void onLoadFooter(String prefix, Long long_) {
|
||||||
onLoadSeparateStroke(prefix);
|
onLoadSeparateStroke(prefix);
|
||||||
T2Csend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
T2Csend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||||
|
@ -78,16 +84,14 @@ public class T2Ctemplate {
|
||||||
* @param autor
|
* @param autor
|
||||||
* @param spigot
|
* @param spigot
|
||||||
* @param discord
|
* @param discord
|
||||||
*
|
* @deprecated reason this method is deprecated <br/>
|
||||||
* @deprecated reason this method is deprecated <br/>
|
* {will be removed in next version} <br/>
|
||||||
* {will be removed in next version} <br/>
|
* use {@link #onDisable(String, Plugin)} instead like this:
|
||||||
* use {@link #onDisable(Plugin)} instead like this:
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* <blockquote><pre>
|
* <blockquote><pre>
|
||||||
* onDisable(getPlugin())
|
* onDisable(getPlugin())
|
||||||
* </pre></blockquote>
|
* </pre></blockquote>
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void onDisable(String prefix, List<String> autor, String version, String spigot, String discord) {
|
public static void onDisable(String prefix, List<String> autor, String version, String spigot, String discord) {
|
||||||
|
@ -105,15 +109,32 @@ public class T2Ctemplate {
|
||||||
|
|
||||||
public static void sendInfo(CommandSender sender, Plugin plugin, int spigotID, String discord, Boolean premiumVerified, String text) {
|
public static void sendInfo(CommandSender sender, Plugin plugin, int spigotID, String discord, Boolean premiumVerified, String text) {
|
||||||
String pluginVersion = plugin.getDescription().getVersion();
|
String pluginVersion = plugin.getDescription().getVersion();
|
||||||
String publicVersion = T2CupdateAPI.pluginVersions.get(plugin.getName()).webData.getVersion();
|
String publicVersion = "";
|
||||||
boolean update = !publicVersion.equalsIgnoreCase(pluginVersion);
|
boolean update;
|
||||||
boolean player = sender instanceof Player;
|
String stNVersion;
|
||||||
|
T2CupdateWebData webData;
|
||||||
|
try {
|
||||||
|
webData = T2CupdateAPI.pluginVersions.get(plugin.getName()).webData;
|
||||||
|
} catch (Exception ex) {
|
||||||
|
webData = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (webData != null) {
|
||||||
|
publicVersion = T2CupdateAPI.pluginVersions.get(plugin.getName()).webData.getVersion();
|
||||||
|
update = !publicVersion.equalsIgnoreCase(pluginVersion);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
update = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean player = sender instanceof Player;
|
||||||
String stPlugin = "<dark_red>║</dark_red> <yellow>Plugin:</yellow> <gold>[pl]</gold>".replace("[pl]", plugin.getName());
|
String 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 stAutor = "<dark_red>║</dark_red> <yellow>Autor(s):</yellow> <gold>[autor]</gold>".replace("[autor]", plugin.getDescription().getAuthors().toString());
|
String stAutor = "<dark_red>║</dark_red> <yellow>Autor(s):</yellow> <gold>[autor]</gold>".replace("[autor]", plugin.getDescription().getAuthors().toString());
|
||||||
String stNVersion = "<dark_red>║</dark_red> <yellow>Newest Version:</yellow> <gold>[nver]</gold>".replace("[nver]", publicVersion);
|
|
||||||
String stStable = "<dark_red>║</dark_red> <yellow>Stable version available:</yellow> [up]".replace("[up]", update ? "<dark_green>YES</dark_green>" : "<red>no</red>");
|
String stUpdate = "<dark_red>║</dark_red> <yellow>New version available:</yellow> [up]".replace("[up]", webData != null ? update ?
|
||||||
|
"<dark_green>YES</dark_green>" : "<red>no</red>" : "<b><dark_red>It could not be checked for updates!</dark_red></b>");
|
||||||
|
stNVersion = update ? "<br><dark_red>║</dark_red> <yellow>Newest Version:</yellow> <gold>[nver]</gold>".replace("[nver]",player ? "<hover:show_text:'<yellow>Click for the update information</yellow>'><click:run_command:'/t2code updateinfo "+plugin.getName()+"'>"+publicVersion+"</click></hover>":publicVersion) : "";
|
||||||
String stLinkPlayer = "<dark_red>║</dark_red> <yellow><hover:show_text:'<green>Go to the Spigot page</green>'><click:open_url:'[slink]'>Spigot</click></hover></yellow> "
|
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>"
|
||||||
|
@ -121,16 +142,17 @@ 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;
|
||||||
String pr = premiumVerified != null ? "<br><dark_red>║</dark_red> <yellow>Premium verified:</yellow> [pr]".replace("[pr]", premiumVerified ? "<dark_green>YES</dark_green>" : "<red>NO</red>") : "";
|
String pr = premiumVerified != null ? "<br><dark_red>║</dark_red> <yellow>Premium verified:</yellow> [pr]".replace("[pr]",
|
||||||
|
premiumVerified ? "<dark_green>YES</dark_green>" : "<red>NO</red>") : "";
|
||||||
|
|
||||||
String stMSG = text == null || text.equals("") ? "" : "<br><dark_red>║</dark_red> " + text + "<br>";
|
String stMSG = text == null || text.equals("") ? "" : "<br><dark_red>║</dark_red> " + text;
|
||||||
T2Csend.sender(sender, "<dark_red>╔════════════════════════════════</dark_red>"
|
T2Csend.sender(sender, "<br><dark_red>╔════════════════════════════════</dark_red>"
|
||||||
+ "<br>" + stPlugin
|
+ "<br>" + stPlugin
|
||||||
|
+ "<br>" + stVersion
|
||||||
+ stMSG
|
+ stMSG
|
||||||
+ stVersion
|
|
||||||
+ "<br>" + stAutor
|
+ "<br>" + stAutor
|
||||||
+ "<br>" + stNVersion
|
+ "<br>" + stUpdate
|
||||||
+ "<br>" + stStable
|
+ stNVersion
|
||||||
+ "<br>" + stLink
|
+ "<br>" + stLink
|
||||||
+ pr
|
+ pr
|
||||||
+ "<br><dark_red>╚════════════════════════════════</dark_red>");
|
+ "<br><dark_red>╚════════════════════════════════</dark_red>");
|
||||||
|
|
|
@ -21,6 +21,7 @@ public class T2CmcVersion {
|
||||||
mc1_18 = nms.contains("1_18");
|
mc1_18 = nms.contains("1_18");
|
||||||
mc1_19 = nms.contains("1_19");
|
mc1_19 = nms.contains("1_19");
|
||||||
mc1_20 = nms.contains("1_20");
|
mc1_20 = nms.contains("1_20");
|
||||||
|
mc1_21 = nms.contains("1_21");
|
||||||
|
|
||||||
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");
|
||||||
|
@ -44,6 +45,9 @@ public class T2CmcVersion {
|
||||||
nms1_19_R2 = nms.contains("1_19_R2");
|
nms1_19_R2 = nms.contains("1_19_R2");
|
||||||
nms1_20_R1 = nms.contains("1_20_R1");
|
nms1_20_R1 = nms.contains("1_20_R1");
|
||||||
nms1_20_R2 = nms.contains("1_20_R2");
|
nms1_20_R2 = nms.contains("1_20_R2");
|
||||||
|
nms1_20_R2 = nms.contains("1_20_R3");
|
||||||
|
nms1_20_R2 = nms.contains("1_20_R4");
|
||||||
|
nms1_21_R1 = nms.contains("1_21_R1");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String mcVersion;
|
private static String mcVersion;
|
||||||
|
@ -61,6 +65,7 @@ public class T2CmcVersion {
|
||||||
private static boolean mc1_18;
|
private static boolean mc1_18;
|
||||||
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 String nms;
|
private static String nms;
|
||||||
private static boolean nms1_8_R1;
|
private static boolean nms1_8_R1;
|
||||||
|
@ -85,6 +90,9 @@ public class T2CmcVersion {
|
||||||
private static boolean nms1_19_R2;
|
private static boolean nms1_19_R2;
|
||||||
private static boolean nms1_20_R1;
|
private static boolean nms1_20_R1;
|
||||||
private static boolean nms1_20_R2;
|
private static boolean nms1_20_R2;
|
||||||
|
private static boolean nms1_20_R3;
|
||||||
|
private static boolean nms1_20_R4;
|
||||||
|
private static boolean nms1_21_R1;
|
||||||
|
|
||||||
public static String getMcVersion() {
|
public static String getMcVersion() {
|
||||||
return mcVersion;
|
return mcVersion;
|
||||||
|
@ -146,6 +154,10 @@ public class T2CmcVersion {
|
||||||
return mc1_20;
|
return mc1_20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isMc1_21() {
|
||||||
|
return mc1_21;
|
||||||
|
}
|
||||||
|
|
||||||
public static String getNms() {
|
public static String getNms() {
|
||||||
return nms;
|
return nms;
|
||||||
}
|
}
|
||||||
|
@ -236,6 +248,14 @@ public class T2CmcVersion {
|
||||||
|
|
||||||
public static boolean isNms1_20_R2() {
|
public static boolean isNms1_20_R2() {
|
||||||
return nms1_20_R2;
|
return nms1_20_R2;
|
||||||
|
}public static boolean isNms1_20_R3() {
|
||||||
|
return nms1_20_R3;
|
||||||
|
}public static boolean isNms1_20_R4() {
|
||||||
|
return nms1_20_R4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isNms1_21_R1() {
|
||||||
|
return nms1_21_R1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -260,7 +280,7 @@ public class T2CmcVersion {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean minMc1_13() {
|
public static boolean minMc1_13() {
|
||||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() ;
|
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean minMc1_14() {
|
public static boolean minMc1_14() {
|
||||||
|
@ -268,7 +288,7 @@ public class T2CmcVersion {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean minMc1_15() {
|
public static boolean minMc1_15() {
|
||||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() ;
|
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean minMc1_16() {
|
public static boolean minMc1_16() {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||||
import net.t2code.t2codelib.UpdateType;
|
import net.t2code.t2codelib.UpdateType;
|
||||||
import net.t2code.t2codelib.T2CupdateObject;
|
import net.t2code.t2codelib.T2CupdateObject;
|
||||||
import net.t2code.t2codelib.T2CupdateWebData;
|
import net.t2code.t2codelib.T2CupdateWebData;
|
||||||
|
import net.t2code.t2codelib.Util;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
@ -68,44 +69,44 @@ public class T2CupdateAPI {
|
||||||
"[prefix] <color:#ff9499><hover:show_text:'<red>Click for more information</red>'><click:run_command:'/t2c updateinfo " + plugin.getName() + "'>Update information</click></hover></color><br>" +
|
"[prefix] <color:#ff9499><hover:show_text:'<red>Click for more information</red>'><click:run_command:'/t2c updateinfo " + plugin.getName() + "'>Update information</click></hover></color><br>" +
|
||||||
"[prefix]";
|
"[prefix]";
|
||||||
|
|
||||||
String value;
|
String updateStatusVersion;
|
||||||
|
|
||||||
if (webData.isPreRelease()) {
|
if (webData.isPreRelease()) {
|
||||||
//todo if (!SelectLibConfig.getSeePreReleaseUpdates()) return;
|
//todo if (!SelectLibConfig.getSeePreReleaseUpdates()) return;
|
||||||
value = UpdateType.PRERELEASE.text;
|
updateStatusVersion = UpdateType.PRERELEASE.text;
|
||||||
if (publicVersion.toLowerCase().contains("dev")) {
|
if (publicVersion.toLowerCase().contains("dev")) {
|
||||||
value = UpdateType.DEVELOPMENT.text;
|
updateStatusVersion = UpdateType.DEVELOPMENT.text;
|
||||||
}
|
}
|
||||||
if (publicVersion.toLowerCase().contains("beta")) {
|
if (publicVersion.toLowerCase().contains("beta")) {
|
||||||
value = UpdateType.BETA.text;
|
updateStatusVersion = UpdateType.BETA.text;
|
||||||
}
|
}
|
||||||
if (publicVersion.toLowerCase().contains("snapshot")) {
|
if (publicVersion.toLowerCase().contains("snapshot")) {
|
||||||
value = UpdateType.SNAPSHOT.text;
|
updateStatusVersion = UpdateType.SNAPSHOT.text;
|
||||||
}
|
}
|
||||||
} else value = UpdateType.STABLE.text;
|
} else updateStatusVersion = UpdateType.STABLE.text;
|
||||||
|
|
||||||
T2Csend.player(player, st.replace("[prefix]", prefix).replace("[value]", value).replace("[link]", webData.getUpdateUrl())
|
T2Csend.player(player, st.replace("[prefix]", prefix).replace("[value]", updateStatusVersion).replace("[link]", webData.getUpdateUrl())
|
||||||
.replace("[plv]", pluginVersion).replace("[puv]", publicVersion).replace("[dc]", discord));
|
.replace("[plv]", pluginVersion).replace("[puv]", publicVersion).replace("[dc]", discord));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendUpdateMsg(String prefix, String discord, T2CupdateWebData webData, Plugin plugin) {
|
public static void sendUpdateMsg(String prefix, String discord, T2CupdateWebData webData, Plugin plugin) {
|
||||||
String publicVersion = webData.getVersion();
|
String publicVersion = webData.getVersion();
|
||||||
String pluginVersion = plugin.getDescription().getVersion();
|
String pluginVersion = plugin.getDescription().getVersion();
|
||||||
String value;
|
String updateStatusVersion;
|
||||||
if (webData.isPreRelease()) {
|
if (webData.isPreRelease()) {
|
||||||
value = UpdateType.PRERELEASE.text;
|
updateStatusVersion = UpdateType.PRERELEASE.text;
|
||||||
if (publicVersion.toLowerCase().contains("dev")) {
|
if (publicVersion.toLowerCase().contains("dev")) {
|
||||||
value = UpdateType.DEVELOPMENT.text;
|
updateStatusVersion = UpdateType.DEVELOPMENT.text;
|
||||||
}
|
}
|
||||||
if (publicVersion.toLowerCase().contains("beta")) {
|
if (publicVersion.toLowerCase().contains("beta")) {
|
||||||
value = UpdateType.BETA.text;
|
updateStatusVersion = UpdateType.BETA.text;
|
||||||
}
|
}
|
||||||
if (publicVersion.toLowerCase().contains("snapshot")) {
|
if (publicVersion.toLowerCase().contains("snapshot")) {
|
||||||
value = UpdateType.SNAPSHOT.text;
|
updateStatusVersion = UpdateType.SNAPSHOT.text;
|
||||||
}
|
}
|
||||||
} else value = UpdateType.STABLE.text;
|
} else updateStatusVersion = UpdateType.STABLE.text;
|
||||||
String h = "<br><dark_red>╔══════════════</dark_red>" + prefix + "<dark_red>══════════════</dark_red>";
|
String h = "<br><dark_red>╔══════════════</dark_red>" + prefix + "<dark_red>══════════════</dark_red>";
|
||||||
String s1 = "<br><dark_red>║</dark_red> <color:#6e90ff>A new [value] version was found!</color>".replace("[value]", value);
|
String s1 = "<br><dark_red>║</dark_red> <color:#6e90ff>A new [value] version was found!</color>".replace("[value]", updateStatusVersion);
|
||||||
String s2 = "<br><dark_red>║</dark_red> <color:#6e90ff>Your version: <red>" + pluginVersion + "</red> <gray>-</gray> Current version:</color> <green>" + webData.getVersion() + "</green>";
|
String s2 = "<br><dark_red>║</dark_red> <color:#6e90ff>Your version: <red>" + pluginVersion + "</red> <gray>-</gray> Current version:</color> <green>" + webData.getVersion() + "</green>";
|
||||||
String s3 = "<br><dark_red>║</dark_red> <color:#6e90ff>You can download it here:</color> <yellow>" + webData.getUpdateUrl() + "</yellow>";
|
String s3 = "<br><dark_red>║</dark_red> <color:#6e90ff>You can download it here:</color> <yellow>" + webData.getUpdateUrl() + "</yellow>";
|
||||||
String s4 = "<br><dark_red>║</dark_red> <color:#6e90ff>You can find more information on Discord:</color> <yellow>" + discord + "</yellow>";
|
String s4 = "<br><dark_red>║</dark_red> <color:#6e90ff>You can find more information on Discord:</color> <yellow>" + discord + "</yellow>";
|
||||||
|
@ -119,9 +120,13 @@ public class T2CupdateAPI {
|
||||||
try {
|
try {
|
||||||
object = T2CupdateAPI.pluginVersions.get(args[1]);
|
object = T2CupdateAPI.pluginVersions.get(args[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return "Das Plugin " + args[1] + " gibts net"; // todo
|
return Util.getPrefix() + " <red>The plugin <yellow>" + args[1] + "</yellow> is not registered in the update checker of T2Code!</red>";
|
||||||
}
|
}
|
||||||
|
if (object == null) return Util.getPrefix() + " <red>The plugin <yellow>" + args[1] + "</yellow> is not registered in the update checker of T2Code!</red>";
|
||||||
T2CupdateWebData webData = object.webData;
|
T2CupdateWebData webData = object.webData;
|
||||||
|
if (webData == null) {
|
||||||
|
return Util.getPrefix() + " <b><dark_red>It could not be checked for updates with the plugin <yellow>" + args[1] + "</yellow>!</dark_red></b>";
|
||||||
|
}
|
||||||
String pluginName = T2CupdateAPI.pluginVersions.get(args[1]).pluginName;
|
String pluginName = T2CupdateAPI.pluginVersions.get(args[1]).pluginName;
|
||||||
String pluginVersion = T2CupdateAPI.pluginVersions.get(args[1]).pluginVersion;
|
String pluginVersion = T2CupdateAPI.pluginVersions.get(args[1]).pluginVersion;
|
||||||
|
|
||||||
|
@ -162,7 +167,7 @@ public class T2CupdateAPI {
|
||||||
|
|
||||||
String text;
|
String text;
|
||||||
|
|
||||||
text = "<dark_red>╔══════════════════════</dark_red>";
|
text = "<br><dark_red>╔══════════════════════</dark_red>";
|
||||||
text = text + pluginNameString;
|
text = text + pluginNameString;
|
||||||
text = text + pluginVersionString;
|
text = text + pluginVersionString;
|
||||||
text = text + updateInfoString.replace("[value]", object.updateAvailable ? "Update available" : "Info about your version");
|
text = text + updateInfoString.replace("[value]", object.updateAvailable ? "Update available" : "Info about your version");
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ public class T2CupdateCheckerGit {
|
||||||
String finalRepoURL = RepoURL;
|
String finalRepoURL = RepoURL;
|
||||||
|
|
||||||
Integer finalInterval;
|
Integer finalInterval;
|
||||||
if (timeInterval < 1){
|
if (timeInterval < 1) {
|
||||||
finalInterval = 1;
|
finalInterval = 1;
|
||||||
} else finalInterval = timeInterval;
|
} else finalInterval = timeInterval;
|
||||||
|
|
||||||
|
@ -52,6 +53,10 @@ public class T2CupdateCheckerGit {
|
||||||
);
|
);
|
||||||
|
|
||||||
T2CupdateAPI.pluginVersions.put(plugin.getName(), update);
|
T2CupdateAPI.pluginVersions.put(plugin.getName(), update);
|
||||||
|
if (T2CupdateAPI.pluginVersions.get(plugin.getName()) == null){
|
||||||
|
T2Csend.debugmsg(T2CodeLibMain.getPlugin(),plugin.getName() + " UpdateAPI T2CupdateAPI.pluginVersions.get(plugin.getName()) == null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (T2CupdateAPI.pluginVersions.get(plugin.getName()).updateAvailable) {
|
if (T2CupdateAPI.pluginVersions.get(plugin.getName()).updateAvailable) {
|
||||||
if (!update.load) {
|
if (!update.load) {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
|
@ -73,7 +78,7 @@ public class T2CupdateCheckerGit {
|
||||||
|
|
||||||
}, plugin.getDescription().getVersion(), spigotID, finalRepoURL, updateCheckOnJoin, seePreReleaseUpdates, timeInterval);
|
}, plugin.getDescription().getVersion(), spigotID, finalRepoURL, updateCheckOnJoin, seePreReleaseUpdates, timeInterval);
|
||||||
}
|
}
|
||||||
}, 0L, finalInterval * 60 * 20L);
|
}, 10L, finalInterval * 60 * 20L);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String URL, Boolean updateCheckOnJoin, Boolean seePreReleaseUpdates, Integer timeInterval) {
|
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String URL, Boolean updateCheckOnJoin, Boolean seePreReleaseUpdates, Integer timeInterval) {
|
||||||
|
@ -98,19 +103,19 @@ public class T2CupdateCheckerGit {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JSONObject obj = new JSONObject(data);
|
JSONObject obj = new JSONObject(data);
|
||||||
String UpdateName = obj.getString("name");
|
String updateTitle = obj.getString("name");
|
||||||
String tag_name = obj.getString("tag_name");
|
String version = obj.getString("tag_name");
|
||||||
String body = obj.getString("body").replace("\n", "<br>").replace("\r", "").replace("'", "''").replace("**", "");
|
String updateDescription = obj.getString("body").replace("\n", "<br>").replace("\r", "").replace("'", "''").replace("**", "");
|
||||||
String updateurl = obj.getString("html_url");
|
String updateUrl = obj.getString("html_url");
|
||||||
boolean prerelease = obj.getBoolean("prerelease");
|
boolean preRelease = obj.getBoolean("prerelease");
|
||||||
|
|
||||||
String date = obj.getString("published_at");
|
String date = obj.getString("published_at");
|
||||||
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||||
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss a");
|
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss a");
|
||||||
Date parsedDate = inputFormat.parse(date);
|
Date parsedDate = inputFormat.parse(date);
|
||||||
String formattedDate = outputFormat.format(parsedDate);
|
String publishedAt = outputFormat.format(parsedDate);
|
||||||
|
|
||||||
String gitURL = updateurl;
|
String gitURL = updateUrl;
|
||||||
JSONArray downloadArray = obj.getJSONArray("assets");
|
JSONArray downloadArray = obj.getJSONArray("assets");
|
||||||
String downloadURL;
|
String downloadURL;
|
||||||
if (downloadArray.isEmpty()) {
|
if (downloadArray.isEmpty()) {
|
||||||
|
@ -119,14 +124,14 @@ public class T2CupdateCheckerGit {
|
||||||
downloadURL = downloadArray.getJSONObject(0).getString("browser_download_url");
|
downloadURL = downloadArray.getJSONObject(0).getString("browser_download_url");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!prerelease) {
|
if (!preRelease) {
|
||||||
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
||||||
updateurl = "https://www.spigotmc.org/resources/" + spigotID;
|
updateUrl = "https://www.spigotmc.org/resources/" + spigotID;
|
||||||
}
|
}
|
||||||
|
|
||||||
T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, formattedDate, downloadURL, gitURL, prerelease);
|
T2CupdateWebData webData = new T2CupdateWebData(updateTitle, version, updateDescription, updateUrl, publishedAt, downloadURL, gitURL, preRelease);
|
||||||
consumer.accept(webData);
|
consumer.accept(webData);
|
||||||
} catch (Exception var10) {
|
} catch (Exception exception) {
|
||||||
Boolean load = false;
|
Boolean load = false;
|
||||||
if (T2CupdateAPI.pluginVersions.containsKey(plugin.getName())) {
|
if (T2CupdateAPI.pluginVersions.containsKey(plugin.getName())) {
|
||||||
load = T2CupdateAPI.pluginVersions.get(plugin.getName()).load;
|
load = T2CupdateAPI.pluginVersions.get(plugin.getName()).load;
|
||||||
|
@ -140,7 +145,9 @@ public class T2CupdateCheckerGit {
|
||||||
updateCheckOnJoin
|
updateCheckOnJoin
|
||||||
);
|
);
|
||||||
T2CupdateAPI.pluginVersions.put(plugin.getName(), update);
|
T2CupdateAPI.pluginVersions.put(plugin.getName(), update);
|
||||||
this.plugin.getLogger().severe("§4 Cannot look for updates: " + var10.getMessage());
|
|
||||||
|
T2Csend.error(this.plugin,"§4 Cannot look for updates: " + exception.getMessage());
|
||||||
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,10 +62,23 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||||
}
|
}
|
||||||
T2CmcVersion.onCheck();
|
T2CmcVersion.onCheck();
|
||||||
|
|
||||||
if (T2CmcVersion.isNms1_20_R2()) {
|
if (T2CmcVersion.isNms1_20_R4()) {
|
||||||
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
||||||
T2Csend.console(prefix);
|
T2Csend.console(prefix);
|
||||||
T2Csend.warning(plugin, "The 1.20.* (R2) is a very fresh / new version. If there are any bugs in our plugins, please report them to us via our Discord: http://dc.t2code.net");
|
T2Csend.warning(plugin, "The 1.20.* (NMS R4) is a very fresh / new version. If there are any bugs in our plugins, please report them to us via our Discord: http://dc.t2code.net");
|
||||||
|
T2Csend.console(prefix);
|
||||||
|
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
||||||
|
if (!SelectLibConfig.getT2cTestDevelopment()) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(5000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}if (T2CmcVersion.isMc1_21()) {
|
||||||
|
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
||||||
|
T2Csend.console(prefix);
|
||||||
|
T2Csend.warning(plugin, "The 1.21 is a very fresh / new version. If there are any bugs in our plugins, please report them to us via our Discord: http://dc.t2code.net");
|
||||||
T2Csend.console(prefix);
|
T2Csend.console(prefix);
|
||||||
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
||||||
if (!SelectLibConfig.getT2cTestDevelopment()) {
|
if (!SelectLibConfig.getT2cTestDevelopment()) {
|
||||||
|
|
|
@ -45,6 +45,13 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||||
}
|
}
|
||||||
Commands.info(sender);
|
Commands.info(sender);
|
||||||
return false;
|
return false;
|
||||||
|
case "permtoggle":
|
||||||
|
if (!sender.hasPermission("t2code.permtoggle.use")) {
|
||||||
|
T2Csend.sender(sender, "§4No Permission §8t2code.permtoggle.use");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Commands.permtoggle(sender, args);
|
||||||
|
return false;
|
||||||
case "updateinfo":
|
case "updateinfo":
|
||||||
if (!sender.hasPermission("t2code.admin")) {
|
if (!sender.hasPermission("t2code.admin")) {
|
||||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||||
|
@ -52,6 +59,13 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||||
}
|
}
|
||||||
Commands.updateInfo(sender, args);
|
Commands.updateInfo(sender, args);
|
||||||
return false;
|
return false;
|
||||||
|
// case "plugininfo": todo
|
||||||
|
// if (!sender.hasPermission("t2code.admin")) {
|
||||||
|
// T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// Commands.updateInfo(sender, args);
|
||||||
|
// return false;
|
||||||
case "reloadconfig":
|
case "reloadconfig":
|
||||||
if (!sender.hasPermission("t2code.admin")) {
|
if (!sender.hasPermission("t2code.admin")) {
|
||||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||||
|
@ -74,10 +88,11 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||||
}
|
}
|
||||||
Commands.test(sender, args);
|
Commands.test(sender, args);
|
||||||
return false;
|
return false;
|
||||||
case "serverid":if (!sender.hasPermission("t2code.admin")) {
|
case "serverid":
|
||||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
if (!sender.hasPermission("t2code.admin")) {
|
||||||
return false;
|
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
T2Csend.sender(sender, ("[prefix] <red>T2C ServerID:</red> <gold><hover:show_text:'<yellow>copy</yellow>'>" +
|
T2Csend.sender(sender, ("[prefix] <red>T2C ServerID:</red> <gold><hover:show_text:'<yellow>copy</yellow>'>" +
|
||||||
"<click:copy_to_clipboard:[id]>[id]</click></hover></gold>").replace("[prefix]", Util.getPrefix()).replace("[id]", String.valueOf(Util.getServerUUID())));
|
"<click:copy_to_clipboard:[id]>[id]</click></hover></gold>").replace("[prefix]", Util.getPrefix()).replace("[id]", String.valueOf(Util.getServerUUID())));
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package net.t2code.t2codelib.SPIGOT.system.cmd;
|
package net.t2code.t2codelib.SPIGOT.system.cmd;
|
||||||
|
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.commands.T2Ccmd;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||||
|
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.command.CommandSender;
|
||||||
|
@ -83,4 +85,23 @@ public class Commands {
|
||||||
protected static void updateInfo(CommandSender sender, String[] args) {
|
protected static void updateInfo(CommandSender sender, String[] args) {
|
||||||
T2Csend.sender(sender, T2CupdateAPI.updateInfo(args, sender instanceof Player));
|
T2Csend.sender(sender, T2CupdateAPI.updateInfo(args, sender instanceof Player));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void permtoggle(CommandSender sender, String[] args) {
|
||||||
|
Player player = (Player) Bukkit.getOfflinePlayer(args[1]);
|
||||||
|
if (player == null) {
|
||||||
|
T2Csend.sender(sender, "§4Player §6" + args[1] + " §4not exist!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String permission = args[2];
|
||||||
|
|
||||||
|
if (player.hasPermission(permission)) {
|
||||||
|
T2Ccmd.console(SelectLibConfig.getCommandPermToggleCommand().replace("[player]",player.getName()).replace("[perm]",permission).replace("[value]", "false"));
|
||||||
|
T2Csend.sender(sender, "§2Permission §8'§6" + permission + "§8' §2was set to §6false §2for the player §6" + player.getName() + "§2.");
|
||||||
|
} else {
|
||||||
|
T2Ccmd.console(SelectLibConfig.getCommandPermToggleCommand().replace("[player]",player.getName()).replace("[perm]",permission).replace("[value]", "true"));
|
||||||
|
T2Csend.sender(sender, "§2Permission §8'§6" + permission + "§8' §2was set to §6true §2for the player §6" + player.getName() + "§2.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ public class CreateReportLog {
|
||||||
"<br>[prefix] <green>You can download it <click:open_url:'[url]'><gold><hover:show_text:'<yellow>Download the debug file</yellow>'>here</hover></gold></click>." +
|
"<br>[prefix] <green>You can download it <click:open_url:'[url]'><gold><hover:show_text:'<yellow>Download the debug file</yellow>'>here</hover></gold></click>." +
|
||||||
"<br>[prefix] <green>Please enter the following key in the ticket: <gold><click:copy_to_clipboard:[key]><hover:show_text:'<yellow>Copy to clipboard</yellow>'>[key]</hover></click></gold></green>" +
|
"<br>[prefix] <green>Please enter the following key in the ticket: <gold><click:copy_to_clipboard:[key]><hover:show_text:'<yellow>Copy to clipboard</yellow>'>[key]</hover></click></gold></green>" +
|
||||||
"<br>[prefix] <dark_red>Do not share the download URL with anyone!</dark_red>" +
|
"<br>[prefix] <dark_red>Do not share the download URL with anyone!</dark_red>" +
|
||||||
"<br><hover:show_text:'<yellow>Click to delete</yellow>'><click:run_command:'/t2code debug deleteReportLog [key]'>[prefix] <green>You can <b>delte</b> yor Debug-File by clicking me.</green>" +
|
"<br>[prefix] <click:run_command:'/t2code debug deleteReportLog [key]'><hover:show_text:'<yellow>Click to delete</yellow>'><green>You can <b>delete</b> your Debug-File by clicking me.</green>" +
|
||||||
"<br>[prefix] <color:#910d06>(If you do not delete the debug file, it will be deleted automatically after <red>14</red> days!)</color></click></hover>")
|
"<br>[prefix] <color:#910d06>(If you do not delete the debug file, it will be deleted automatically after <red>14</red> days!)</color></click></hover>")
|
||||||
.replace("[key]", fileID).replace("[url]", downloadURL).replace("[prefix]", Util.getPrefix()));
|
.replace("[key]", fileID).replace("[url]", downloadURL).replace("[prefix]", Util.getPrefix()));
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ public class CreateReportLog {
|
||||||
"<br><gold>Please enter the following key in the ticket:</gold> <yellow>[key]</yellow>." +
|
"<br><gold>Please enter the following key in the ticket:</gold> <yellow>[key]</yellow>." +
|
||||||
"<br><dark_red>Do not share the download URL with anyone!</dark_red>" +
|
"<br><dark_red>Do not share the download URL with anyone!</dark_red>" +
|
||||||
"<br><color:#910d06>(If you do not delete the debug file, it will be deleted automatically after <red>14</red> days!)</color>" +
|
"<br><color:#910d06>(If you do not delete the debug file, it will be deleted automatically after <red>14</red> days!)</color>" +
|
||||||
"<br><dark_red>You can delte yor Debug-File with the following command:</dark_red> <red>/t2code debug deleteReportLog [key]</red>.")
|
"<br><dark_red>You can delete your Debug-File with the following command:</dark_red> <red>/t2code debug deleteReportLog [key]</red>.")
|
||||||
.replace("[key]", fileID).replace("[url]", downloadURL));
|
.replace("[key]", fileID).replace("[url]", downloadURL));
|
||||||
ReportLogStorage.add(fileID);
|
ReportLogStorage.add(fileID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,8 @@ public class ConfigCreate {
|
||||||
T2Cconfig.set("BungeeCord.Enable", T2CodeLibMain.getIsBungee(), yamlConfiguration);
|
T2Cconfig.set("BungeeCord.Enable", T2CodeLibMain.getIsBungee(), yamlConfiguration);
|
||||||
T2Cconfig.set("Player.Inventories.CloseByServerStop", true, yamlConfiguration);
|
T2Cconfig.set("Player.Inventories.CloseByServerStop", true, yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("Command.PermToggle.PermissionSetCommand","lp user [player] permission set [perm] [value]",yamlConfiguration);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
yamlConfiguration.save(config);
|
yamlConfiguration.save(config);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -28,6 +28,8 @@ public class SelectLibConfig {
|
||||||
private static Boolean bungee;
|
private static Boolean bungee;
|
||||||
@Getter
|
@Getter
|
||||||
private static Boolean inventoriesCloseByServerStop;
|
private static Boolean inventoriesCloseByServerStop;
|
||||||
|
@Getter
|
||||||
|
private static String commandPermToggleCommand;
|
||||||
|
|
||||||
public static void onSelect() {
|
public static void onSelect() {
|
||||||
File config = new File(T2CodeLibMain.getPath(), "config.yml");
|
File config = new File(T2CodeLibMain.getPath(), "config.yml");
|
||||||
|
@ -46,5 +48,6 @@ public class SelectLibConfig {
|
||||||
developerTool = yamlConfiguration.getBoolean("Plugin.Not recommended to disable.developerTool");
|
developerTool = yamlConfiguration.getBoolean("Plugin.Not recommended to disable.developerTool");
|
||||||
bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
|
bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
|
||||||
inventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop");
|
inventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop");
|
||||||
|
commandPermToggleCommand = yamlConfiguration.getString("Command.PermToggle.PermissionSetCommand");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.t2code.t2codelib;
|
package net.t2code.t2codelib;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -13,7 +14,7 @@ public class Util {
|
||||||
|
|
||||||
|
|
||||||
public static String getInfoText() {
|
public static String getInfoText() {
|
||||||
return "";
|
return "<yellow>Description:</yellow> <gold>"+T2CodeLibMain.getPlugin().getDescription().getDescription()+"</gold>" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPrefix() {
|
public static String getPrefix() {
|
||||||
|
|
|
@ -3,7 +3,7 @@ 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, Jkobs ]
|
authors: [ JaTiTV ]
|
||||||
description: Library from T2Code Plugins
|
description: Library from T2Code Plugins
|
||||||
website: https://spigotmc.org/resources/96388/
|
website: https://spigotmc.org/resources/96388/
|
||||||
load: STARTUP
|
load: STARTUP
|
||||||
|
@ -29,3 +29,7 @@ commands:
|
||||||
permissions:
|
permissions:
|
||||||
t2code.admin:
|
t2code.admin:
|
||||||
default: op
|
default: op
|
||||||
|
children:
|
||||||
|
t2code.permtoggle.use: true
|
||||||
|
t2code.permtoggle.use:
|
||||||
|
default: op
|
||||||
|
|
Loading…
Reference in New Issue