Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
a834adc8c9 | |||
290b9264f3 | |||
eb991d01e3 | |||
ec7714c9fe | |||
260dae2aa0 | |||
addc485ca8 | |||
f8619e4802 | |||
e97fadfbec | |||
567b0a2442 | |||
7b04697895 | |||
59133a36f9 | |||
c2adf6957d | |||
2e1ef9c46d | |||
a7c7877ac6 | |||
71c746b752 | |||
6f054a8993 | |||
a3ec7117dd | |||
034bf241e5 | |||
b2ebce50ed |
2
pom.xml
2
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>T2CodeLib</artifactId>
|
<artifactId>T2CodeLib</artifactId>
|
||||||
<version>15.0</version>
|
<version>15.6</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-->
|
||||||
|
@@ -10,31 +10,55 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class T2CBtab {
|
public class T2CBtab {
|
||||||
public static Iterable<String> tab(CommandSender sender, String[] args, String perm,Boolean onlinePlayer){
|
|
||||||
List<String> matches = new ArrayList<>();
|
|
||||||
Iterator var6 = ProxyServer.getInstance().getPlayers().iterator();
|
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, String perm, Boolean onlinePlayer) {
|
||||||
while (var6.hasNext()) {
|
if (args.length != arg + 1) return;
|
||||||
ProxiedPlayer player1 = (ProxiedPlayer) var6.next();
|
for (ProxiedPlayer player1 : ProxyServer.getInstance().getPlayers()) {
|
||||||
if (passend(player1.getName(), args[0]) && hasPermission(sender, perm)){
|
if (passend(player1.getName(), args[arg]) && hasPermission(sender, perm)) {
|
||||||
matches.add(player1.getName());
|
matches.add(player1.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Iterable<String> tab(CommandSender sender, String[] args, HashMap<String, String> permMap) {
|
public static void tab(List<String> matches, CommandSender sender, int argEquals, String equalsValue, int arg, String[] args, String perm, Boolean onlinePlayer) {
|
||||||
List<String> matches = new ArrayList<>();
|
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()) {
|
for (String command : permMap.keySet()) {
|
||||||
if (hasPermission(sender, permMap.get(command)) && passend(command, args[0])) {
|
if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||||
|
matches.add(command);
|
||||||
|
} else if (onlinePlayer != null && permForPlayer != null) {
|
||||||
|
tab(matches, sender, arg, args, permForPlayer, onlinePlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, HashMap<String, String> permMap) {
|
||||||
|
tab(matches, sender, arg, args, permMap, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void tab(List<String> matches, CommandSender sender, int argEquals, String equalsValue, int arg, String[] args, HashMap<String, String> permMap) {
|
||||||
|
if (args.length != arg + 1) return;
|
||||||
|
if (!args[argEquals].toLowerCase().equals(equalsValue)) return;
|
||||||
|
for (String command : permMap.keySet()) {
|
||||||
|
if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||||
matches.add(command);
|
matches.add(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return matches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Iterable<String> tab(CommandSender sender, String[] args, String perm, String command) {
|
public static List<String> tab(CommandSender sender, int arg, String[] args, String perm, String command) {
|
||||||
List<String> matches = new ArrayList<>();
|
List<String> matches = new ArrayList<>();
|
||||||
if (hasPermission(sender, perm) && passend(command, args[0])) {
|
if (hasPermission(sender, perm) && passend(command, args[arg])) {
|
||||||
matches.add(command);
|
matches.add(command);
|
||||||
}
|
}
|
||||||
return matches;
|
return matches;
|
||||||
|
@@ -5,7 +5,6 @@ import net.md_5.bungee.api.ProxyServer;
|
|||||||
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;
|
||||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
|
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
|
||||||
import net.t2code.t2codelib.T2CupdateObject;
|
import net.t2code.t2codelib.T2CupdateObject;
|
||||||
import net.t2code.t2codelib.T2CupdateWebData;
|
import net.t2code.t2codelib.T2CupdateWebData;
|
||||||
import net.t2code.t2codelib.UpdateType;
|
import net.t2code.t2codelib.UpdateType;
|
||||||
|
@@ -43,8 +43,6 @@ public class T2CodeBMain extends Plugin {
|
|||||||
mmIsLoad = false;
|
mmIsLoad = false;
|
||||||
}
|
}
|
||||||
T2CBload.onLoad(plugin, Util.getPrefix(), autor, 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());
|
||||||
String[] fv = orgVersion.split("_");
|
|
||||||
plugin.getDescription().setVersion(fv[0]);
|
|
||||||
version = plugin.getDescription().getVersion();
|
version = plugin.getDescription().getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,6 +5,7 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
|
|||||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
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 java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
@@ -19,13 +20,14 @@ 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();
|
||||||
if (channel.equals("T2Code-Console")) {
|
if (channel.equals("T2Code-Console")) {
|
||||||
ProxyServer.getInstance().getConsole().sendMessage("Command Console: "+ input);
|
ProxyServer.getInstance().getConsole().sendMessage(Util.getPrefix()+" [§6"+serverID+"§r] §cT2C BCMD Command Console: §r"+ input);
|
||||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);
|
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);
|
||||||
} else {
|
} else {
|
||||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(channel);
|
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(channel);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
ProxyServer.getInstance().getConsole().sendMessage("Command " + player +": "+ input);
|
ProxyServer.getInstance().getConsole().sendMessage(Util.getPrefix()+" [§6"+serverID+"§r] §cT2C BCMD Command §r" + player +": "+ input);
|
||||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(player, input);
|
ProxyServer.getInstance().getPluginManager().dispatchCommand(player, input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,9 @@
|
|||||||
|
package net.t2code.t2codelib.SPIGOT.api.dev;
|
||||||
|
|
||||||
|
public class T2CdevelopmentTool {
|
||||||
|
public static String removeLastChar(String s, int amount) {
|
||||||
|
return (s == null || s.length() == 0)
|
||||||
|
? null
|
||||||
|
: (s.substring(0, s.length() - amount));
|
||||||
|
}
|
||||||
|
}
|
@@ -52,6 +52,20 @@ public class T2CitemBuilder {
|
|||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setItem(Integer slot, Integer amount, String material, String displayName, List<String> lore, Inventory inventory) {
|
||||||
|
ItemStack item;
|
||||||
|
if (getLegacy && material.contains(",")) {
|
||||||
|
String[] split = material.split(",");
|
||||||
|
item = new ItemStack(Material.valueOf(split[0]), 1, Short.parseShort(split[1]));
|
||||||
|
} else item = new ItemStack(Material.valueOf(material));
|
||||||
|
ItemMeta itemMeta = item.getItemMeta();
|
||||||
|
itemMeta.setDisplayName(displayName);
|
||||||
|
itemMeta.setLore(lore);
|
||||||
|
item.setItemMeta(itemMeta);
|
||||||
|
item.setAmount(amount);
|
||||||
|
inventory.setItem(slot, item);
|
||||||
|
}
|
||||||
|
|
||||||
public static ItemStack base64(String base64Value, Integer amount, String displayName, List<String> lore) {
|
public static ItemStack base64(String base64Value, Integer amount, String displayName, List<String> lore) {
|
||||||
ItemStack itemStack = new ItemStack(T2CitemVersion.getHead());
|
ItemStack itemStack = new ItemStack(T2CitemVersion.getHead());
|
||||||
SkullMeta itemMeta = (SkullMeta) itemStack.getItemMeta();
|
SkullMeta itemMeta = (SkullMeta) itemStack.getItemMeta();
|
||||||
|
@@ -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,11 +8,25 @@ 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);
|
||||||
@@ -21,10 +35,24 @@ 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);
|
||||||
@@ -33,6 +61,13 @@ 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;
|
||||||
|
@@ -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) {
|
||||||
|
|
||||||
|
if (T2CpluginCheck.papi()) {
|
||||||
object = PlaceholderAPI.setPlaceholders(player, replaceLegacyColor((String) object).replace("[prefix]", prefix).replace("[ue]", "ü")
|
object = PlaceholderAPI.setPlaceholders(player, replaceLegacyColor((String) object).replace("[prefix]", prefix).replace("[ue]", "ü")
|
||||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n"));
|
.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) {
|
||||||
|
if (T2CpluginCheck.papi()) {
|
||||||
output.add(PlaceholderAPI.setPlaceholders(player, replaceLegacyColor(input).replace("[prefix]", prefix)
|
output.add(PlaceholderAPI.setPlaceholders(player, replaceLegacyColor(input).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")));
|
||||||
|
} 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) {
|
||||||
|
if (T2CpluginCheck.papi()) {
|
||||||
output.add(PlaceholderAPI.setPlaceholders(player, replaceLegacyColor(input).replace("[prefix]", prefix)
|
output.add(PlaceholderAPI.setPlaceholders(player, replaceLegacyColor(input).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")));
|
||||||
|
} 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;
|
||||||
}
|
}
|
||||||
@@ -110,25 +140,20 @@ public class T2Creplace {
|
|||||||
.replace("&c", "").replace("&d", "").replace("&e", "").replace("&f", "")
|
.replace("&c", "").replace("&d", "").replace("&e", "").replace("&f", "")
|
||||||
.replace("&k", "").replace("&l", "").replace("&m", "").replace("&n", "")
|
.replace("&k", "").replace("&l", "").replace("&m", "").replace("&n", "")
|
||||||
.replace("&o", "").replace("&r", "");
|
.replace("&o", "").replace("&r", "");
|
||||||
// String text = value.replace("&", "§");
|
|
||||||
// while (text.contains("§")) {
|
|
||||||
// int stelle = text.indexOf("§");
|
|
||||||
// if (text.length() >= stelle + 2) {
|
|
||||||
// text = text.substring(0, stelle) + text.substring(stelle + 2);
|
|
||||||
// } else {
|
|
||||||
// text = text.substring(0, stelle) + text.substring(stelle + 1);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return (text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> replacePrice(String prefix, Player player, List<String> Text, String price) {
|
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;
|
||||||
}
|
}
|
||||||
@@ -142,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) {
|
||||||
@@ -181,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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,36 +12,62 @@ import java.util.logging.Level;
|
|||||||
public class T2Csend {
|
public class T2Csend {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spigot
|
* @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);
|
String msg = String.valueOf(object);
|
||||||
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, Object object) {
|
public static void player(Player player, Object object) {
|
||||||
String msg = String.valueOf(object);
|
String msg = String.valueOf(object);
|
||||||
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, Object object) {
|
public static void sender(CommandSender sender, Object object) {
|
||||||
String msg = String.valueOf(object);
|
String msg = String.valueOf(object);
|
||||||
if (msg == null || msg.contains("[empty]")) return;
|
if (msg == null || msg.contains("[empty]")) return;
|
||||||
|
@@ -68,21 +68,44 @@ public class T2Ctemplate {
|
|||||||
T2Csend.console(prefix + " §8-------------------------------");
|
T2Csend.console(prefix + " §8-------------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onLoadFooter(String prefix, Long long_, String version) {
|
public static void onLoadFooter(String prefix, Long long_, String v) {
|
||||||
onLoadSeparateStroke(prefix);
|
onLoadFooter(prefix,long_);
|
||||||
T2Csend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param prefix
|
||||||
|
* @param autor
|
||||||
|
* @param spigot
|
||||||
|
* @param discord
|
||||||
|
*
|
||||||
|
* @deprecated reason this method is deprecated <br/>
|
||||||
|
* {will be removed in next version} <br/>
|
||||||
|
* use {@link #onDisable(Plugin)} instead like this:
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* <blockquote><pre>
|
||||||
|
* onDisable(getPlugin())
|
||||||
|
* </pre></blockquote>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static void onDisable(String prefix, List<String> autor, String version, String spigot, String discord) {
|
public static void onDisable(String prefix, List<String> 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.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void onDisable(String prefix, Plugin plugin) {
|
||||||
|
T2Csend.console(prefix + " §4 §e╔══════════════════════════");
|
||||||
|
T2Csend.console(prefix + " §4 §e║ §2Version: §6" + plugin.getDescription().getVersion());
|
||||||
|
T2Csend.console(prefix + " §4 §e║ §2Autors: §6" + plugin.getDescription().getAuthors());
|
||||||
|
T2Csend.console(prefix + " §4 §e║ §4Plugin successfully disabled.");
|
||||||
|
T2Csend.console(prefix + " §4 §e╚══════════════════════════");
|
||||||
|
}
|
||||||
|
|
||||||
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 = T2CupdateAPI.pluginVersions.get(plugin.getName()).webData.getVersion();
|
||||||
|
@@ -43,6 +43,7 @@ public class T2CmcVersion {
|
|||||||
nms1_19_R1 = nms.contains("1_19_R1");
|
nms1_19_R1 = nms.contains("1_19_R1");
|
||||||
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String mcVersion;
|
private static String mcVersion;
|
||||||
@@ -83,6 +84,7 @@ public class T2CmcVersion {
|
|||||||
private static boolean nms1_19_R1;
|
private static boolean nms1_19_R1;
|
||||||
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;
|
||||||
|
|
||||||
public static String getMcVersion() {
|
public static String getMcVersion() {
|
||||||
return mcVersion;
|
return mcVersion;
|
||||||
@@ -231,4 +233,62 @@ public class T2CmcVersion {
|
|||||||
public static boolean isNms1_20_R1() {
|
public static boolean isNms1_20_R1() {
|
||||||
return nms1_20_R1;
|
return nms1_20_R1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isNms1_20_R2() {
|
||||||
|
return nms1_20_R2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean minMc1_8() {
|
||||||
|
return isMc1_8();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean minMc1_9() {
|
||||||
|
return !isMc1_8();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean minMc1_10() {
|
||||||
|
return !isMc1_8() && !isMc1_9();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean minMc1_11() {
|
||||||
|
return !isMc1_8() && !isMc1_9() && !isMc1_10();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean minMc1_12() {
|
||||||
|
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean minMc1_13() {
|
||||||
|
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean minMc1_14() {
|
||||||
|
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean minMc1_15() {
|
||||||
|
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean minMc1_16() {
|
||||||
|
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean minMc1_17() {
|
||||||
|
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean minMc1_18() {
|
||||||
|
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16() && !isMc1_17();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean minMc1_19() {
|
||||||
|
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16() && !isMc1_17() && !isMc1_18();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean minMc1_20() {
|
||||||
|
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16() && !isMc1_17()
|
||||||
|
&& !isMc1_18() && !isMc1_19();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.system;
|
package net.t2code.t2codelib.SPIGOT.system;
|
||||||
|
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||||
|
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;
|
||||||
@@ -7,6 +9,7 @@ import org.bukkit.entity.Player;
|
|||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class T2CbungeeCommandSenderReciver {
|
public class T2CbungeeCommandSenderReciver {
|
||||||
|
|
||||||
@@ -24,18 +27,22 @@ public class T2CbungeeCommandSenderReciver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
output.writeUTF(information);
|
output.writeUTF(information);
|
||||||
|
output.writeUTF(String.valueOf(Util.getServerUUID()));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
player.sendPluginMessage(T2CodeLibMain.getPlugin(), "t2c:bcmd", stream.toByteArray());
|
player.sendPluginMessage(T2CodeLibMain.getPlugin(), "t2c:bcmd", stream.toByteArray());
|
||||||
|
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received T2CbungeeCommandSenderReciver: t2c:bcmd - " + Arrays.toString(stream.toByteArray()) + " Player: " + player.getName());
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
player.sendPluginMessage(T2CodeLibMain.getPlugin(), "t2c:bcmd", stream.toByteArray());
|
player.sendPluginMessage(T2CodeLibMain.getPlugin(), "t2c:bcmd", stream.toByteArray());
|
||||||
|
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received T2CbungeeCommandSenderReciver: t2c:bcmd - " + Arrays.toString(stream.toByteArray()) + " Player: " + player.getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//todo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -13,6 +13,7 @@ import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
|||||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.bstats.Metrics;
|
import net.t2code.t2codelib.SPIGOT.system.bstats.Metrics;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.cmd.CmdExecuter;
|
import net.t2code.t2codelib.SPIGOT.system.cmd.CmdExecuter;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.system.cmd.Development;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.cmd.ReportLogStorage;
|
import net.t2code.t2codelib.SPIGOT.system.cmd.ReportLogStorage;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.config.config.ConfigCreate;
|
import net.t2code.t2codelib.SPIGOT.system.config.config.ConfigCreate;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||||
@@ -61,10 +62,10 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
T2CmcVersion.onCheck();
|
T2CmcVersion.onCheck();
|
||||||
|
|
||||||
if (T2CmcVersion.isMc1_20()) {
|
if (T2CmcVersion.isNms1_20_R2()) {
|
||||||
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
||||||
T2Csend.console(prefix);
|
T2Csend.console(prefix);
|
||||||
T2Csend.warning(plugin, "The 1.20.* 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.* (R2) is a very fresh / new version. If there are any bugs in our plugins, please report them to us via our Discord: http://dc.t2code.net");
|
||||||
T2Csend.console(prefix);
|
T2Csend.console(prefix);
|
||||||
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
||||||
if (!SelectLibConfig.getT2cTestDevelopment()) {
|
if (!SelectLibConfig.getT2cTestDevelopment()) {
|
||||||
@@ -111,6 +112,7 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
Metrics.Bstats(plugin, Util.getBstatsID());
|
Metrics.Bstats(plugin, Util.getBstatsID());
|
||||||
if (SelectLibConfig.getBungee()) {
|
if (SelectLibConfig.getBungee()) {
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
|
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
|
||||||
|
T2Csend.debug(plugin, "registerIncomingPluginChannel §et2c:bcmd");
|
||||||
|
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bonlp");
|
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bonlp");
|
||||||
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, "t2c:bonlp")) {
|
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, "t2c:bonlp")) {
|
||||||
@@ -122,7 +124,7 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
|
|
||||||
ReportLogStorage.load();
|
ReportLogStorage.load();
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
|
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
|
||||||
|
Bukkit.getServer().getPluginManager().registerEvents(new Development(), plugin);
|
||||||
T2Ctemplate.onLoadFooter(prefix, long_);
|
T2Ctemplate.onLoadFooter(prefix, long_);
|
||||||
load = true;
|
load = true;
|
||||||
}
|
}
|
||||||
@@ -139,7 +141,7 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vault.vaultDisable();
|
Vault.vaultDisable();
|
||||||
T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
T2Ctemplate.onDisable(Util.getPrefix(), this);
|
||||||
if (mmIsLoad) {
|
if (mmIsLoad) {
|
||||||
if (this.adventure != null) {
|
if (this.adventure != null) {
|
||||||
this.adventure.close();
|
this.adventure.close();
|
||||||
|
@@ -1,8 +1,12 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.system.cmd;
|
package net.t2code.t2codelib.SPIGOT.system.cmd;
|
||||||
|
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.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.api.bungeePlayers.T2CbungeePlayers;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.system.T2CbungeeCommandSenderReciver;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||||
import net.t2code.t2codelib.T2CupdateObject;
|
import net.t2code.t2codelib.T2CupdateObject;
|
||||||
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;
|
||||||
@@ -21,11 +25,11 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
if (args.length == 0) {
|
||||||
if (!sender.hasPermission("t2code.admin")) {
|
if (!sender.hasPermission("t2code.admin")) {
|
||||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length == 0) {
|
|
||||||
Commands.info(sender);
|
Commands.info(sender);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -35,23 +39,67 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
|||||||
case "pl":
|
case "pl":
|
||||||
case "version":
|
case "version":
|
||||||
case "ver":
|
case "ver":
|
||||||
|
if (!sender.hasPermission("t2code.admin")) {
|
||||||
|
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Commands.info(sender);
|
Commands.info(sender);
|
||||||
return false;
|
return false;
|
||||||
case "updateinfo":
|
case "updateinfo":
|
||||||
|
if (!sender.hasPermission("t2code.admin")) {
|
||||||
|
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Commands.updateInfo(sender, args);
|
Commands.updateInfo(sender, args);
|
||||||
return false;
|
return false;
|
||||||
case "reloadconfig":
|
case "reloadconfig":
|
||||||
|
if (!sender.hasPermission("t2code.admin")) {
|
||||||
|
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
SelectLibConfig.onSelect();
|
SelectLibConfig.onSelect();
|
||||||
T2Csend.sender(sender, Util.getPrefix() + " §2Config successfully reloaded");
|
T2Csend.sender(sender, Util.getPrefix() + " §2Config successfully reloaded");
|
||||||
return false;
|
return false;
|
||||||
case "debug":
|
case "debug":
|
||||||
|
if (!sender.hasPermission("t2code.admin")) {
|
||||||
|
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Commands.debug(sender, args);
|
Commands.debug(sender, args);
|
||||||
return false;
|
return false;
|
||||||
case "test":
|
case "test":
|
||||||
T2Csend.sender(sender, T2CbungeePlayers.getBungeePlayers().toString());
|
if (!sender.hasPermission("t2code.admin")) {
|
||||||
|
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Commands.test(sender, args);
|
||||||
|
return false;
|
||||||
|
case "serverid":if (!sender.hasPermission("t2code.admin")) {
|
||||||
|
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
T2Csend.sender(sender, ("[prefix] <red>T2C ServerID:</red> <gold><hover:show_text:'<yellow>copy</yellow>'>" +
|
||||||
|
"<click:copy_to_clipboard:[id]>[id]</click></hover></gold>").replace("[prefix]", Util.getPrefix()).replace("[id]", String.valueOf(Util.getServerUUID())));
|
||||||
|
return false;
|
||||||
|
case "bcmd":
|
||||||
|
if (!sender.hasPermission("t2code.admin")) {
|
||||||
|
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String cmd = "";
|
||||||
|
for (String s : args) {
|
||||||
|
cmd = cmd + s + " ";
|
||||||
|
}
|
||||||
|
cmd = cmd.replace("bcmd ", "");
|
||||||
|
T2CbungeeCommandSenderReciver.sendToBungee(null, cmd, true);
|
||||||
|
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage BCMD: " + cmd);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if (!sender.hasPermission("t2code.admin")) {
|
||||||
|
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -61,6 +109,8 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
|||||||
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
||||||
put("debug", "t2code.admin");
|
put("debug", "t2code.admin");
|
||||||
put("info", "t2code.admin");
|
put("info", "t2code.admin");
|
||||||
|
put("serverid", "t2code.admin");
|
||||||
|
put("bcmd", "t2code.admin");
|
||||||
put("reloadconfig", "t2code.admin");
|
put("reloadconfig", "t2code.admin");
|
||||||
put("updateinfo", "t2code.admin");
|
put("updateinfo", "t2code.admin");
|
||||||
}};
|
}};
|
||||||
@@ -87,6 +137,12 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
if (args.length == 2 && args[0].equalsIgnoreCase("bcmd")) {
|
||||||
|
if (sender.hasPermission("t2code.admin")) {
|
||||||
|
list.add("<command>");
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
if (args.length == 2 && args[0].equalsIgnoreCase("updateinfo")) {
|
if (args.length == 2 && args[0].equalsIgnoreCase("updateinfo")) {
|
||||||
if (sender.hasPermission("t2code.admin")) {
|
if (sender.hasPermission("t2code.admin")) {
|
||||||
if (hasPermission(p, arg1.get("updateinfo"))) {
|
if (hasPermission(p, arg1.get("updateinfo"))) {
|
||||||
|
@@ -8,15 +8,21 @@ 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 {
|
||||||
public static void info(CommandSender sender) {
|
protected static void info(CommandSender sender) {
|
||||||
T2Ctemplate.sendInfo(sender, T2CodeLibMain.getPlugin(), Util.getSpigotID(), Util.getDiscord(), null, Util.getInfoText());
|
T2Ctemplate.sendInfo(sender, T2CodeLibMain.getPlugin(), Util.getSpigotID(), Util.getDiscord(), null, Util.getInfoText());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void debug(CommandSender sender, String[] args) {
|
protected static void test(CommandSender sender, String[] args) {
|
||||||
|
T2Csend.sender(sender, Util.getPrefix() + " &4Currently there is no development test command");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void debug(CommandSender sender, String[] args) {
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
||||||
return;
|
return;
|
||||||
@@ -74,7 +80,7 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateInfo(CommandSender sender, String[] args) {
|
protected static void updateInfo(CommandSender sender, String[] args) {
|
||||||
T2Csend.sender(sender, T2CupdateAPI.updateInfo(args, sender instanceof Player));
|
T2Csend.sender(sender, T2CupdateAPI.updateInfo(args, sender instanceof Player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,10 @@ import java.net.URL;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
@@ -101,18 +104,35 @@ public class CreateReportLog {
|
|||||||
pWriter.println("T2C-LuckyBox isV: " + LuckyBoxAPI.isV());
|
pWriter.println("T2C-LuckyBox isV: " + LuckyBoxAPI.isV());
|
||||||
pWriter.println();
|
pWriter.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pWriter.println("OfflinePlayers amount: " + Bukkit.getOfflinePlayers().length);
|
||||||
pWriter.println("OfflinePlayers: ");
|
pWriter.println("OfflinePlayers: ");
|
||||||
for (OfflinePlayer player : Bukkit.getOfflinePlayers()) {
|
|
||||||
|
ArrayList<OfflinePlayer> players = new ArrayList<>();
|
||||||
|
Collections.addAll(players, Bukkit.getOfflinePlayers());
|
||||||
|
players.sort(Comparator.comparing(OfflinePlayer::getName));
|
||||||
|
for (OfflinePlayer player : players) {
|
||||||
pWriter.println(" - " + player.getName() + " - " + player.getUniqueId());
|
pWriter.println(" - " + player.getName() + " - " + player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
pWriter.println();
|
pWriter.println();
|
||||||
pWriter.println("Plugins amount: " + Bukkit.getPluginManager().getPlugins().length);
|
pWriter.println("Plugins amount: " + Bukkit.getPluginManager().getPlugins().length);
|
||||||
pWriter.println("Plugins: ");
|
pWriter.println("Plugins: ");
|
||||||
for (Plugin pl : Bukkit.getPluginManager().getPlugins()) {
|
|
||||||
pWriter.println(" - " + pl.getName() + " - " + pl.getDescription().getVersion() + " - Enabled: " + pl.isEnabled() + " - Autors: "
|
ArrayList<Plugin> plugins = new ArrayList<>();
|
||||||
+ pl.getDescription().getAuthors() + " - SoftDepend: " + pl.getDescription().getSoftDepend() + " - Depend: " + pl.getDescription().getDepend()
|
Collections.addAll(plugins, Bukkit.getPluginManager().getPlugins());
|
||||||
+ " LoadBefore: " + pl.getDescription().getLoadBefore() + " - Website: " + pl.getDescription().getWebsite());
|
plugins.sort(Comparator.comparing(Plugin::getName));
|
||||||
|
for (Plugin pl : plugins) {
|
||||||
|
pWriter.println(" - " + pl.getName() +
|
||||||
|
" - " + pl.getDescription().getVersion() +
|
||||||
|
" - Enabled: " + pl.isEnabled() +
|
||||||
|
" - Autors: " + pl.getDescription().getAuthors() +
|
||||||
|
" - SoftDepend: " + pl.getDescription().getSoftDepend() +
|
||||||
|
" - Depend: " + pl.getDescription().getDepend() +
|
||||||
|
" - LoadBefore: " + pl.getDescription().getLoadBefore() +
|
||||||
|
" - Website: " + pl.getDescription().getWebsite());
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
ioe.printStackTrace();
|
ioe.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
@@ -208,10 +228,11 @@ public class CreateReportLog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void pluginToDebug(ZipOutputStream zip) throws IOException {
|
private static void pluginToDebug(ZipOutputStream zip) throws IOException {
|
||||||
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
||||||
String plName = plugin.getDescription().getName();
|
String plName = plugin.getDescription().getName();
|
||||||
if (plName.contains("T2C-") || Util.getT2cPlugins().contains(plName)){
|
if (plName.contains("T2C-") || Util.getT2cPlugins().contains(plName) || plugin.getDescription().getAuthors().contains("JaTiTV")) {
|
||||||
File plConfigs = new File(plugin.getDataFolder().getPath());
|
File plConfigs = new File(plugin.getDataFolder().getPath());
|
||||||
if (plConfigs.exists()) {
|
if (plConfigs.exists()) {
|
||||||
addFolderToZip("T2Code-Plugins", plugin.getDataFolder().getPath(), zip);
|
addFolderToZip("T2Code-Plugins", plugin.getDataFolder().getPath(), zip);
|
||||||
|
@@ -0,0 +1,71 @@
|
|||||||
|
package net.t2code.t2codelib.SPIGOT.system.cmd;
|
||||||
|
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||||
|
import net.t2code.t2codelib.Util;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import static net.t2code.t2codelib.SPIGOT.api.dev.T2CdevelopmentTool.removeLastChar;
|
||||||
|
|
||||||
|
public class Development implements Listener {
|
||||||
|
@EventHandler
|
||||||
|
public void onChat(AsyncPlayerChatEvent e) {
|
||||||
|
String[] args = e.getMessage().split(" ");
|
||||||
|
if (args.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!args[0].equals("_t2code_")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!SelectLibConfig.getDeveloperTool()) {
|
||||||
|
T2Csend.player(e.getPlayer(), Util.getPrefix() + " The Development Tool is disabled.");
|
||||||
|
}
|
||||||
|
e.setCancelled(true);
|
||||||
|
t2cPls(e.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void t2cPls(Player player) {
|
||||||
|
String msg = "<red>T<gray>2</gray>Code</red> <dark_purple>Development</dark_purple><br>"
|
||||||
|
+ T2CmcVersion.getMcVersion() + "<br>(" + Bukkit.getPluginManager().getPlugins().length + ") ";
|
||||||
|
ArrayList<Plugin> plugins = new ArrayList<>();
|
||||||
|
Collections.addAll(plugins, Bukkit.getPluginManager().getPlugins());
|
||||||
|
plugins.sort(Comparator.comparing(Plugin::getName));
|
||||||
|
for (Plugin plugin : plugins) {
|
||||||
|
String plName = plugin.getDescription().getName();
|
||||||
|
String hover = "<blue>" + plugin.getDescription().getName() + "</blue><br>" +
|
||||||
|
"<green>Version:</green> <gold>" + plugin.getDescription().getVersion() + "</gold><br>" +
|
||||||
|
"<green>APIVersion:</green> <gold>" + plugin.getDescription().getAPIVersion() + "</gold><br>" +
|
||||||
|
"<green>Authors:</green> <gold>" + plugin.getDescription().getAuthors() + "</gold><br>" +
|
||||||
|
"<green>SoftDepend:</green> <gold>" + plugin.getDescription().getSoftDepend() + "</gold><br>" +
|
||||||
|
"<green>Depend:</green> <gold>" + plugin.getDescription().getDepend() + "</gold><br>" +
|
||||||
|
"<green>LoadBefore:</green> <gold>" + plugin.getDescription().getLoadBefore() + "</gold><br>" +
|
||||||
|
"<green>Website:</green> <gold>" + plugin.getDescription().getWebsite() + "</gold>";
|
||||||
|
String plSt = "<hover:show_text:'" + hover + "'>" + plugin.getName() + "</hover>";
|
||||||
|
|
||||||
|
if (plugin.getDescription().getWebsite() != null && !plugin.getDescription().getWebsite().equalsIgnoreCase("null")) {
|
||||||
|
plSt = "<click:open_url:'" + plugin.getDescription().getWebsite() + "'>" + plSt + "</click>";
|
||||||
|
}
|
||||||
|
if (plugin.isEnabled()) {
|
||||||
|
if (plName.contains("T2C-") || Util.getT2cPlugins().contains(plName)) {
|
||||||
|
msg = msg + "<dark_green>" + plSt + "</dark_green>, ";
|
||||||
|
} else msg = msg + "<green>" + plSt + "</green>, ";
|
||||||
|
} else if (plName.contains("T2C-") || Util.getT2cPlugins().contains(plName)) {
|
||||||
|
msg = msg + "<dark_red>" + plSt + "</dark_red>, ";
|
||||||
|
} else msg = msg + "<red>" + plSt + "</red>, ";
|
||||||
|
}
|
||||||
|
T2Csend.player(player, removeLastChar(msg, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -28,6 +28,7 @@ public class ConfigCreate {
|
|||||||
T2Cconfig.set("Plugin.UpdateCheck.SeePreReleaseUpdates", true, yamlConfiguration);
|
T2Cconfig.set("Plugin.UpdateCheck.SeePreReleaseUpdates", true, yamlConfiguration);
|
||||||
T2Cconfig.set("Plugin.UpdateCheck.AllPlugins.FullDisable", false, yamlConfiguration);
|
T2Cconfig.set("Plugin.UpdateCheck.AllPlugins.FullDisable", false, yamlConfiguration);
|
||||||
T2Cconfig.set("Plugin.language", "english", yamlConfiguration);
|
T2Cconfig.set("Plugin.language", "english", yamlConfiguration);
|
||||||
|
T2Cconfig.set("Plugin.Not recommended to disable.developerTool", true, yamlConfiguration);
|
||||||
|
|
||||||
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);
|
||||||
|
@@ -23,6 +23,8 @@ public class SelectLibConfig {
|
|||||||
@Getter
|
@Getter
|
||||||
private static String language;
|
private static String language;
|
||||||
@Getter
|
@Getter
|
||||||
|
private static Boolean developerTool;
|
||||||
|
@Getter
|
||||||
private static Boolean bungee;
|
private static Boolean bungee;
|
||||||
@Getter
|
@Getter
|
||||||
private static Boolean inventoriesCloseByServerStop;
|
private static Boolean inventoriesCloseByServerStop;
|
||||||
@@ -41,6 +43,7 @@ public class SelectLibConfig {
|
|||||||
updateCheckFullDisable = yamlConfiguration.getBoolean("Plugin.UpdateCheck.AllPlugins.FullDisable");
|
updateCheckFullDisable = yamlConfiguration.getBoolean("Plugin.UpdateCheck.AllPlugins.FullDisable");
|
||||||
debug = yamlConfiguration.getBoolean("Plugin.Debug");
|
debug = yamlConfiguration.getBoolean("Plugin.Debug");
|
||||||
language = yamlConfiguration.getString("Plugin.language");
|
language = yamlConfiguration.getString("Plugin.language");
|
||||||
|
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");
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@ api-version: 1.13
|
|||||||
prefix: T2CodeLib
|
prefix: T2CodeLib
|
||||||
authors: [ JaTiTV, Jkobs ]
|
authors: [ JaTiTV, Jkobs ]
|
||||||
description: Library from T2Code Plugins
|
description: Library from T2Code Plugins
|
||||||
website: T2Code.net
|
website: https://spigotmc.org/resources/96388/
|
||||||
load: STARTUP
|
load: STARTUP
|
||||||
|
|
||||||
softdepend:
|
softdepend:
|
||||||
|
Reference in New Issue
Block a user