Development tool added
This commit is contained in:
parent
71c746b752
commit
a7c7877ac6
@ -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.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;
|
||||
@ -96,7 +97,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());
|
||||
@ -123,7 +124,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;
|
||||
}
|
||||
@ -140,7 +141,7 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
}
|
||||
|
||||
Vault.vaultDisable();
|
||||
T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
||||
T2Ctemplate.onDisable(Util.getPrefix(), this);
|
||||
if (mmIsLoad) {
|
||||
if (this.adventure != null) {
|
||||
this.adventure.close();
|
||||
|
@ -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.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);
|
||||
|
@ -23,6 +23,8 @@ public class SelectLibConfig {
|
||||
@Getter
|
||||
private static String language;
|
||||
@Getter
|
||||
private static Boolean developerTool;
|
||||
@Getter
|
||||
private static Boolean bungee;
|
||||
@Getter
|
||||
private static Boolean inventoriesCloseByServerStop;
|
||||
@ -41,6 +43,7 @@ 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");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user