Compare commits

..

No commits in common. "59133a36f9eedeb583ece64af6f7bf407f93e21e" and "6f054a899334112754eee80ca08b580dec46eeae" have entirely different histories.

14 changed files with 43 additions and 238 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>15.4</version>
<version>15.3</version>
<!--version>VERSION_snapshot-0</version-->
<!--version>VERSION_beta-0</version-->
<!--version>VERSION_dev-0</version-->

View File

@ -1,9 +0,0 @@
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));
}
}

View File

@ -8,25 +8,11 @@ import org.bukkit.entity.Player;
public class T2ChoverModule {
/**
* @deprecated reason this method is deprecated <br/>
* The T2Code Hover Module will be removed soon,<br/>
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
* and the Kyori MiniMessage format!
*/
@Deprecated
public static void modulePlayer(String text, String hover, String action, String actionValue, Player player) {
modulePlayer((text != null ? text : "null") + "/*/" + (hover != null ? hover : "null") + "/*/" + (action != null ? action : "null")
+ "/*/" + (actionValue != null ? actionValue : "null"), player);
}
/**
* @deprecated reason this method is deprecated <br/>
* The T2Code Hover Module will be removed soon,<br/>
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
* and the Kyori MiniMessage format!
*/
@Deprecated
public static void modulePlayer(String msg, Player player) {
if (msg.contains("/*/")) {
t2cmodule(msg, player);
@ -35,24 +21,10 @@ public class T2ChoverModule {
T2CminiMessage.sendPlayerMiniMessage(msg, player);
}
/**
* @deprecated reason this method is deprecated <br/>
* The T2Code Hover Module will be removed soon,<br/>
* please use 'T2CminiMessage.sendSenderMiniMessage(msg, sender);'<br/>
* and the Kyori MiniMessage format!
*/
@Deprecated
public static void moduleSender(String msg, CommandSender sender) {
T2CminiMessage.sendSenderMiniMessage(msg, sender);
}
/**
* @deprecated reason this method is deprecated <br/>
* The T2Code Hover Module will be removed soon,<br/>
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
* and the Kyori MiniMessage format!
*/
@Deprecated
public static void moduleConsole(String msg) {
if (T2CodeLibMain.getMmIsLoad()) {
T2CminiMessage.sendConsoleMiniMessage(msg);
@ -61,13 +33,6 @@ public class T2ChoverModule {
Bukkit.getConsoleSender().sendMessage(msg);
}
/**
* @deprecated reason this method is deprecated <br/>
* The T2Code Hover Module will be removed soon,<br/>
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
* and the Kyori MiniMessage format!
*/
@Deprecated
private static void t2cmodule(String msg, Player player) {
String[] split = msg.split("/\\*/");
int i = split.length;

View File

@ -110,6 +110,16 @@ public class T2Creplace {
.replace("&c", "").replace("&d", "").replace("&e", "").replace("&f", "")
.replace("&k", "").replace("&l", "").replace("&m", "").replace("&n", "")
.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) {

View File

@ -12,62 +12,36 @@ import java.util.logging.Level;
public class T2Csend {
/**
* @deprecated reason this method is deprecated <br/>
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
* Spigot
*/
@Deprecated
public static void console(String msg) {
if (msg == null || msg.contains("[empty]")) return;
T2ChoverModule.moduleConsole(msg);
}
/**
* @deprecated reason this method is deprecated <br/>
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
*/
@Deprecated
public static void player(Player player, String msg) {
if (msg == null || msg.contains("[empty]")) return;
T2ChoverModule.modulePlayer(msg, player);
}
/**
* @deprecated reason this method is deprecated <br/>
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
*/
@Deprecated
public static void sender(CommandSender sender, String msg) {
if (msg == null || msg.contains("[empty]")) return;
T2ChoverModule.moduleSender(msg, sender);
}
/**
* @deprecated reason this method is deprecated <br/>
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
*/
@Deprecated
public static void console(Object object) {
String msg = String.valueOf(object);
if (msg == null || msg.contains("[empty]")) return;
T2ChoverModule.moduleConsole(msg);
}
/**
* @deprecated reason this method is deprecated <br/>
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
*/
@Deprecated
public static void player(Player player, Object object) {
String msg = String.valueOf(object);
if (msg == null || msg.contains("[empty]")) return;
T2ChoverModule.modulePlayer(msg, player);
}
/**
* @deprecated reason this method is deprecated <br/>
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
*/
@Deprecated
public static void sender(CommandSender sender, Object object) {
String msg = String.valueOf(object);
if (msg == null || msg.contains("[empty]")) return;

View File

@ -68,41 +68,21 @@ public class T2Ctemplate {
T2Csend.console(prefix + " §8-------------------------------");
}
public static void onLoadFooter(String prefix, Long long_, String version) {
onLoadSeparateStroke(prefix);
T2Csend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
public static void onLoadFooter(String prefix, Long long_) {
onLoadSeparateStroke(prefix);
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) {
T2Csend.console(prefix + " §2Version: §6" + version);
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) {
String pluginVersion = plugin.getDescription().getVersion();
String publicVersion = T2CupdateAPI.pluginVersions.get(plugin.getName()).webData.getVersion();

View File

@ -13,7 +13,6 @@ import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import net.t2code.t2codelib.SPIGOT.system.bstats.Metrics;
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.config.config.ConfigCreate;
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
@ -97,7 +96,7 @@ public final class T2CodeLibMain extends JavaPlugin {
T2Csend.console(prefix + " §3PlaceholderAPI: §6connected" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
T2Csend.console(prefix + " §3Kyori MiniMessage Support: " + (getMmIsLoad() ? "§2load" : "§4not load") + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
T2Csend.console(prefix + " §3Kyori MiniMessage Support: "+ (getMmIsLoad() ? "§2load" : "§4not load") + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
plugin.getCommand("t2code").setExecutor(new CmdExecuter());
@ -124,7 +123,7 @@ public final class T2CodeLibMain extends JavaPlugin {
ReportLogStorage.load();
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
Bukkit.getServer().getPluginManager().registerEvents(new Development(), plugin);
T2Ctemplate.onLoadFooter(prefix, long_);
load = true;
}
@ -141,7 +140,7 @@ public final class T2CodeLibMain extends JavaPlugin {
}
Vault.vaultDisable();
T2Ctemplate.onDisable(Util.getPrefix(), this);
T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
if (mmIsLoad) {
if (this.adventure != null) {
this.adventure.close();

View File

@ -25,11 +25,11 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length == 0) {
if (!sender.hasPermission("t2code.admin")) {
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
return false;
}
if (args.length == 0) {
Commands.info(sender);
return false;
}
@ -39,53 +39,26 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
case "pl":
case "version":
case "ver":
if (!sender.hasPermission("t2code.admin")) {
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
return false;
}
Commands.info(sender);
return false;
case "updateinfo":
if (!sender.hasPermission("t2code.admin")) {
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
return false;
}
Commands.updateInfo(sender, args);
return false;
case "reloadconfig":
if (!sender.hasPermission("t2code.admin")) {
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
return false;
}
SelectLibConfig.onSelect();
T2Csend.sender(sender, Util.getPrefix() + " §2Config successfully reloaded");
return false;
case "debug":
if (!sender.hasPermission("t2code.admin")) {
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
return false;
}
Commands.debug(sender, args);
return false;
case "test":
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;
}
case "serverid":
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 + " ";
@ -96,10 +69,6 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
return false;
default:
if (!sender.hasPermission("t2code.admin")) {
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
return false;
}
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
return false;
}

View File

@ -3,33 +3,31 @@ package net.t2code.t2codelib.SPIGOT.system.cmd;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import net.t2code.t2codelib.SPIGOT.system.T2CbungeeCommandSenderReciver;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import net.t2code.t2codelib.Util;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import java.io.File;
import java.io.IOException;
public class Commands {
protected static void info(CommandSender sender) {
public static void info(CommandSender sender) {
T2Ctemplate.sendInfo(sender, T2CodeLibMain.getPlugin(), Util.getSpigotID(), Util.getDiscord(), null, Util.getInfoText());
}
protected static void test(CommandSender sender, String[] args) {
T2Csend.sender(sender, Util.getPrefix() + " &4Currently there is no development test command");
public 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) {
public static void debug(CommandSender sender, String[] args) {
if (args.length < 2) {
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
return;
}
switch (args[1].toLowerCase()) {
case "createreportlog":
switch (args.length) {
switch (args.length){
case 2:
if (sender instanceof Player) {
T2Csend.sender(sender, "<dark_red>The debug zip file is <red>automatically uploaded</red> to T2Code's servers<br>and <red>automatically deleted</red> " +
@ -80,7 +78,7 @@ public class Commands {
}
}
protected static void updateInfo(CommandSender sender, String[] args) {
public static void updateInfo(CommandSender sender, String[] args) {
T2Csend.sender(sender, T2CupdateAPI.updateInfo(args, sender instanceof Player));
}
}

View File

@ -123,14 +123,9 @@ public class CreateReportLog {
Collections.addAll(plugins, Bukkit.getPluginManager().getPlugins());
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());
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) {
@ -228,11 +223,10 @@ public class CreateReportLog {
}
}
}
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();
if (plName.contains("T2C-") || Util.getT2cPlugins().contains(plName) || plugin.getDescription().getAuthors().contains("JaTiTV")) {
if (plName.contains("T2C-") || Util.getT2cPlugins().contains(plName)){
File plConfigs = new File(plugin.getDataFolder().getPath());
if (plConfigs.exists()) {
addFolderToZip("T2Code-Plugins", plugin.getDataFolder().getPath(), zip);

View File

@ -1,71 +0,0 @@
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));
}
}

View File

@ -28,7 +28,6 @@ public class ConfigCreate {
T2Cconfig.set("Plugin.UpdateCheck.SeePreReleaseUpdates", true, yamlConfiguration);
T2Cconfig.set("Plugin.UpdateCheck.AllPlugins.FullDisable", false, 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("Player.Inventories.CloseByServerStop", true, yamlConfiguration);

View File

@ -23,8 +23,6 @@ public class SelectLibConfig {
@Getter
private static String language;
@Getter
private static Boolean developerTool;
@Getter
private static Boolean bungee;
@Getter
private static Boolean inventoriesCloseByServerStop;
@ -43,7 +41,6 @@ public class SelectLibConfig {
updateCheckFullDisable = yamlConfiguration.getBoolean("Plugin.UpdateCheck.AllPlugins.FullDisable");
debug = yamlConfiguration.getBoolean("Plugin.Debug");
language = yamlConfiguration.getString("Plugin.language");
developerTool = yamlConfiguration.getBoolean("Plugin.Not recommended to disable.developerTool");
bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
inventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop");
}

View File

@ -5,7 +5,7 @@ api-version: 1.13
prefix: T2CodeLib
authors: [ JaTiTV, Jkobs ]
description: Library from T2Code Plugins
website: https://spigotmc.org/resources/96388/
website: T2Code.net
load: STARTUP
softdepend: