This update introduces the possibility to disable messages.
Just write '[empty]' in the message to disable it.
This commit is contained in:
JaTiTV 2022-04-16 16:56:16 +02:00
parent 4bdbe98f8a
commit efb66696eb
12 changed files with 63 additions and 139 deletions

View File

@ -6,7 +6,11 @@
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId> <artifactId>T2CodeLib</artifactId>
<version>11.4</version> <<<<<<< Updated upstream
<version>11.1</version>
=======
<version>11.5</version>
>>>>>>> Stashed changes
<packaging>jar</packaging> <packaging>jar</packaging>
<name>T2CodeLib</name> <name>T2CodeLib</name>
@ -103,7 +107,7 @@
<dependency> <dependency>
<groupId>me.clip</groupId> <groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId> <artifactId>placeholderapi</artifactId>
<version>2.11.1</version> <version>2.9.2</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -7,34 +7,10 @@ import org.bukkit.inventory.ItemStack;
public class ItemVersion { public class ItemVersion {
private static Material Head; private static Material Head;
private static ItemStack HeadIS; private static ItemStack HeadIS;
private static ItemStack CRAFTING_TABLE;
private static ItemStack YELLOW_WOOL;
private static ItemStack ORANGE_WOOL;
private static ItemStack GREEN_WOOL;
private static ItemStack GRAY_WOOL;
private static ItemStack RED_WOOL;
private static ItemStack RED_STAINED_GLASS_PANE;
public static void scan(){ public static void scan(){
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) { if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
Head = Material.valueOf("SKULL"); Head = Material.valueOf("SKULL");
YELLOW_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 4); } else Head = Material.valueOf("PLAYER_HEAD");
ORANGE_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 1);
GREEN_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 5);
GRAY_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 8);
RED_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 14);
RED_STAINED_GLASS_PANE = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, (short) 14);
CRAFTING_TABLE = new ItemStack(Material.valueOf("WORKBENCH"));
} else {
Head = Material.valueOf("PLAYER_HEAD");
CRAFTING_TABLE = new ItemStack(Material.CRAFTING_TABLE);
YELLOW_WOOL = new ItemStack(Material.YELLOW_WOOL);
ORANGE_WOOL = new ItemStack(Material.ORANGE_WOOL);
GREEN_WOOL = new ItemStack(Material.GREEN_WOOL);
GRAY_WOOL = new ItemStack(Material.GRAY_WOOL);
RED_WOOL = new ItemStack(Material.RED_WOOL);
RED_STAINED_GLASS_PANE = new ItemStack(Material.RED_STAINED_GLASS_PANE);
}
HeadIS = new ItemStack(Head); HeadIS = new ItemStack(Head);
} }
@ -45,32 +21,4 @@ public class ItemVersion {
public static ItemStack getHeadIS() { public static ItemStack getHeadIS() {
return HeadIS; 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;
}
} }

View File

@ -28,6 +28,7 @@ public class TextBuilder {
} }
public TextComponent build() { public TextComponent build() {
if (this.text.contains("[empty]")) return null;
TextComponent textComponent = new TextComponent(); TextComponent textComponent = new TextComponent();
textComponent.setText(this.text); textComponent.setText(this.text);
if (this.hover != null) { if (this.hover != null) {

View File

@ -14,22 +14,29 @@ public class send {
*/ */
public static void console(String msg) { public static void console(String msg) {
if (msg == null || msg.contains("[empty]")) return;
Bukkit.getConsoleSender().sendMessage(msg); Bukkit.getConsoleSender().sendMessage(msg);
} }
public static void player(Player player, String msg) { public static void player(Player player, String msg) {
if (msg == null || msg.contains("[empty]")) return;
player.sendMessage(msg); player.sendMessage(msg);
} }
public static void title(Player player, String msg, String msg2) { public static void title(Player player, String msg, String msg2) {
if (msg == null || msg.contains("[empty]")) return;
if (msg2 == null || msg2.contains("[empty]")) return;
player.sendTitle(msg, msg2); player.sendTitle(msg, msg2);
} }
public static void title(Player player, String msg, String msg2, int i, int i1, int i2) { public static void title(Player player, String msg, String msg2, int i, int i1, int i2) {
if (msg == null || msg.contains("[empty]")) return;
if (msg2 == null || msg2.contains("[empty]")) return;
player.sendTitle(msg, msg2, i, i1, i2); player.sendTitle(msg, msg2, i, i1, i2);
} }
public static void sender(CommandSender sender, String msg) { public static void sender(CommandSender sender, String msg) {
if (msg == null || msg.contains("[empty]")) return;
sender.sendMessage(msg); sender.sendMessage(msg);
} }

View File

@ -22,7 +22,6 @@ public class NMSVersion {
public static boolean v1_17_R1; public static boolean v1_17_R1;
public static boolean v1_18_R1; public static boolean v1_18_R1;
public static boolean v1_18_R2; public static boolean v1_18_R2;
public static boolean v1_19_R1;
public static void onCheck() { public static void onCheck() {
isNMS = Bukkit.getServer().getClass().getPackage().getName(); isNMS = Bukkit.getServer().getClass().getPackage().getName();
@ -44,6 +43,5 @@ public class NMSVersion {
v1_17_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_17_R1"); v1_17_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_17_R1");
v1_18_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_18_R1"); v1_18_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_18_R1");
v1_18_R2 = Bukkit.getServer().getClass().getPackage().getName().contains("1_18_R2"); v1_18_R2 = Bukkit.getServer().getClass().getPackage().getName().contains("1_18_R2");
v1_19_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_19_R1");
} }
} }

View File

@ -43,9 +43,6 @@ public class PluginCheck {
public static Boolean luckyBox(){ public static Boolean luckyBox(){
return Bukkit.getPluginManager().getPlugin("T2C-LuckyBox") != null; return Bukkit.getPluginManager().getPlugin("T2C-LuckyBox") != null;
} }
public static Boolean autoResponse(){
return Bukkit.getPluginManager().getPlugin("T2C-AutoResponse") != null;
}
public static Boolean opSec(){ public static Boolean opSec(){
return Bukkit.getPluginManager().getPlugin("OPSecurity") != null; return Bukkit.getPluginManager().getPlugin("OPSecurity") != null;
} }
@ -56,7 +53,7 @@ public class PluginCheck {
return Bukkit.getPluginManager().getPlugin("Booster") != null; return Bukkit.getPluginManager().getPlugin("Booster") != null;
} }
public static Boolean antiMapCopy(){ public static Boolean antiMapCopy(){
return Bukkit.getPluginManager().getPlugin("AntiMapCopy") != null; return Bukkit.getPluginManager().getPlugin("AAntiMapCopy") != null;
} }
public static Boolean loreEditor(){ public static Boolean loreEditor(){
return Bukkit.getPluginManager().getPlugin("LoreEditor") != null; return Bukkit.getPluginManager().getPlugin("LoreEditor") != null;

View File

@ -26,7 +26,7 @@ public class UpdateAPI {
public static void join(Plugin plugin, String prefix, String perm, Player player, String spigot, String discord) { public static void join(Plugin plugin, String prefix, String perm, Player player, String spigot, String discord) {
String pluginVersion = plugin.getDescription().getVersion(); String pluginVersion = plugin.getDescription().getVersion();
if (!player.hasPermission(perm) && !player.isOp()) { if (!player.hasPermission(perm) || !player.isOp()) {
return; return;
} }
if (UpdateAPI.PluginVersionen.get(plugin.getName()) == null) { if (UpdateAPI.PluginVersionen.get(plugin.getName()) == null) {

View File

@ -22,20 +22,12 @@ public class Vault {
} }
p.sendMessage(prefix + "\n" + SelectLibMsg.VaultNotSetUp + "\n" + prefix); p.sendMessage(prefix + "\n" + SelectLibMsg.VaultNotSetUp + "\n" + prefix);
} else { } else {
return Main.eco.withdrawPlayer(p,price).transactionSuccess(); if (Main.eco.getBalance(p) < price) {
}
return false; return false;
}
public static boolean addMoney(String prefix, Player p, Double price) {
if (Main.eco == null) {
if (Bukkit.getPluginManager().getPlugin("Vault") == null) {
send.console(prefix + " §4\n" + prefix + " §4Vault could not be found! §9Please download it here: " +
"§6https://www.spigotmc.org/resources/vault.34315/§4\n" + prefix);
}
p.sendMessage(prefix + "\n" + SelectLibMsg.VaultNotSetUp + "\n" + prefix);
} else { } else {
return Main.eco.depositPlayer(p,price).transactionSuccess(); Main.eco.withdrawPlayer(p, price);
return true;
}
} }
return false; return false;
} }

View File

@ -32,8 +32,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
} }
if (args.length == 0) { if (args.length == 0) {
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion); T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
return false; } else {
}
switch (args[0].toLowerCase()) { switch (args[0].toLowerCase()) {
case "info": case "info":
case "plugin": case "plugin":
@ -42,20 +41,20 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
case "ver": case "ver":
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion); T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
return false; return false;
case "debug": }
if ("debug".equals(args[0].toLowerCase())) {
if (args.length != 2) { if (args.length != 2) {
send.sender(sender, "§4Use: §7/t2code debug createReportLog"); send.sender(sender, "§4Use: §7/t2code debug createReportLog");
return false; return false;
} }
if ("createreportlog".equals(args[1].toLowerCase())) { if ("createreportlog".equals(args[1].toLowerCase())) {
CreateReportLog.create(sender);
} else send.sender(sender, "§4Use: §7/t2code debug createReportLog");
return false;
default: CreateReportLog.create(sender);
send.sender(sender, "§4Use: §7/t2code debug createReportLog");
return false; } else send.sender(sender, "§4Use: §7/t2code debug createReportLog");
} else send.sender(sender, "§4Use: §7/t2code debug createReportLog");
} }
return false;
} }

View File

@ -5,10 +5,10 @@ import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion; import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck; import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
import net.t2code.lib.Spigot.Lib.vault.Vault; import net.t2code.lib.Spigot.Lib.vault.Vault;
import net.t2code.lib.Util;
import net.t2code.luckyBox.api.LuckyBoxAPI; import net.t2code.luckyBox.api.LuckyBoxAPI;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
@ -20,6 +20,7 @@ import java.util.Calendar;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
public class CreateReportLog { public class CreateReportLog {
protected static void create(CommandSender sender) { protected static void create(CommandSender sender) {
send.sender(sender, Main.prefix + " §6A DebugLog is created..."); send.sender(sender, Main.prefix + " §6A DebugLog is created...");
@ -101,26 +102,24 @@ public class CreateReportLog {
zip.putNextEntry(new ZipEntry(fileToZip.getName())); zip.putNextEntry(new ZipEntry(fileToZip.getName()));
Files.copy(fileToZip.toPath(), zip); Files.copy(fileToZip.toPath(), zip);
//File logToZip = new File(log);
//zipOut.putNextEntry(new ZipEntry(logToZip.getName()));
//Files.copy(logToZip.toPath(), zipOut);
addFileToZip("", "logs/latest.log", zip, false); addFileToZip("", "logs/latest.log", zip, false);
for (String pl : Util.getT2cPlugins()){ //pluginToDebug("T2CodeLib", "T2CodeLib", zip); todo bugfix (servercrash)
pluginToDebug(pl, zip); pluginToDebug("T2C-LuckyBox", "T2C-LuckyBox", zip);
} pluginToDebug("WonderBagShop", "WonderBagShop", zip);
pluginToDebug("CommandGUI", "CommandGUI", zip);
//pluginToDebug("T2C-LuckyBox", zip); pluginToDebug("OPSecurity", "OPSecurity", zip);
//pluginToDebug("WonderBagShop", zip); pluginToDebug("PaPiTest", "PaPiTest", zip);
//pluginToDebug("CommandGUI", zip); pluginToDebug("PlotSquaredGUI", "PlotSquaredGUI", zip);
//pluginToDebug("OPSecurity", zip); pluginToDebug("T2C-Alias", "T2Code-Alias", zip);
//pluginToDebug("PaPiTest", zip);
//pluginToDebug("PlotSquaredGUI", zip);
//pluginToDebug("T2C-Alias", zip);
//pluginToDebug("T2C-AutoResponse", zip);
//
//pluginToDebug("LoreEditor", zip);
//pluginToDebug("Booster", zip);
//pluginToDebug("AntiMapCopy", zip);
//pluginToDebug("AntiCopy", zip);
pluginToDebug("LoreEditor", "LoreEditor", zip);
pluginToDebug("Booster", "Booster", zip);
pluginToDebug("AntiMapCopy", "AntiCopy", zip);
zip.closeEntry(); zip.closeEntry();
zip.close(); zip.close();
} catch (IOException e) { } catch (IOException e) {
@ -134,7 +133,7 @@ public class CreateReportLog {
} }
private static void pluginToDebug(String pluginName, ZipOutputStream zip) throws IOException { private static void pluginToDebug(String pluginName, String jar, ZipOutputStream zip) throws IOException {
if (PluginCheck.pluginCheck(pluginName)) { if (PluginCheck.pluginCheck(pluginName)) {
Plugin plugin = Bukkit.getPluginManager().getPlugin(pluginName); Plugin plugin = Bukkit.getPluginManager().getPlugin(pluginName);
File plConfigs = new File(plugin.getDataFolder().getPath()); File plConfigs = new File(plugin.getDataFolder().getPath());
@ -145,7 +144,7 @@ public class CreateReportLog {
File[] fileArray = f.listFiles(); File[] fileArray = f.listFiles();
for (File config : fileArray) { for (File config : fileArray) {
if (config.getName().contains(pluginName) && config.getName().contains(".jar")) { if (config.getName().contains(jar) && config.getName().contains(".jar")) {
addFileToZip("T2Code-Plugins", config.getPath(), zip, false); addFileToZip("T2Code-Plugins", config.getPath(), zip, false);
} }
} }

View File

@ -41,6 +41,8 @@ public class SelectLibMsg {
VaultNotSetUp = Replace.replace(prefix, yamlConfiguration_msg.getString("Plugin.VaultNotSetUp")); VaultNotSetUp = Replace.replace(prefix, yamlConfiguration_msg.getString("Plugin.VaultNotSetUp"));
SoundNotFound = Replace.replace(prefix, yamlConfiguration_msg.getString("Plugin.SoundNotFound")); SoundNotFound = Replace.replace(prefix, yamlConfiguration_msg.getString("Plugin.SoundNotFound"));
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
} }
} }

View File

@ -1,8 +1,5 @@
package net.t2code.lib; package net.t2code.lib;
import java.util.Arrays;
import java.util.List;
public class Util { public class Util {
private static Boolean Snapshot = false; private static Boolean Snapshot = false;
@ -35,24 +32,4 @@ public class Util {
public static Boolean getSnapshot(){ public static Boolean getSnapshot(){
return Snapshot; return Snapshot;
} }
public static List<String> getT2cPlugins() {
return t2cPlugins;
}
private static List<String> t2cPlugins =
Arrays.asList(
"T2C-LuckyBox",
"WonderBagShop",
"CommandGUI",
"OPSecurity",
"PaPiTest",
"PlotSquaredGUI",
"T2C-Alias",
"T2C-AutoResponse",
"LoreEditor",
"Booster",
"AntiMapCopy",
"AntiCopy"
);
} }