Initial Commit
This commit is contained in:
14
src/main/java/net/t2code/lib/Spigot/Lib/commands/Cmd.java
Normal file
14
src/main/java/net/t2code/lib/Spigot/Lib/commands/Cmd.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package net.t2code.lib.Spigot.Lib.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Cmd {
|
||||
public static void console(String cmd) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd);
|
||||
}
|
||||
|
||||
public static void player(Player player, String cmd) {
|
||||
player.chat("/" + cmd);
|
||||
}
|
||||
}
|
104
src/main/java/net/t2code/lib/Spigot/Lib/commands/Tab.java
Normal file
104
src/main/java/net/t2code/lib/Spigot/Lib/commands/Tab.java
Normal file
@@ -0,0 +1,104 @@
|
||||
package net.t2code.lib.Spigot.Lib.commands;
|
||||
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class Tab {
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, String perm, Boolean onlinePlayer) {
|
||||
if (args.length == arg + 1) {
|
||||
Iterator var6 = Bukkit.getOnlinePlayers().iterator();
|
||||
while (var6.hasNext()) {
|
||||
Player player1 = (Player) var6.next();
|
||||
if (passend(player1.getName(), args[arg]) && hasPermission(sender, perm)) {
|
||||
matches.add(player1.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int argEquals, String equalsValue, int arg, String[] args, String perm, Boolean onlinePlayer) {
|
||||
if (args.length == arg + 1) {
|
||||
if (args[argEquals].toLowerCase().equals(equalsValue)) {
|
||||
Iterator var6 = Bukkit.getOnlinePlayers().iterator();
|
||||
while (var6.hasNext()) {
|
||||
Player player1 = (Player) var6.next();
|
||||
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) {
|
||||
//
|
||||
// for (String command : permMap.keySet()) {
|
||||
// if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||
// matches.add(command);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, HashMap<String, String> permMap) {
|
||||
if (args.length == arg + 1) {
|
||||
for (String command : permMap.keySet()) {
|
||||
if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||
matches.add(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
if (args[argEquals].toLowerCase().equals(equalsValue)) {
|
||||
for (String command : permMap.keySet()) {
|
||||
if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||
matches.add(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> tab(CommandSender sender, int arg, String[] args, String perm, String command) {
|
||||
List<String> matches = new ArrayList<>();
|
||||
if (hasPermission(sender, perm) && passend(command, args[arg])) {
|
||||
matches.add(command);
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
|
||||
private static Boolean passend(String command, String arg) {
|
||||
for (int i = 0; i < arg.toUpperCase().length(); i++) {
|
||||
if (arg.toUpperCase().length() >= command.toUpperCase().length()) {
|
||||
return false;
|
||||
} else {
|
||||
if (arg.toUpperCase().charAt(i) != command.toUpperCase().charAt(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean hasPermission(CommandSender sender, String permission) {
|
||||
String[] Permissions = permission.split(";");
|
||||
for (String perm : Permissions) {
|
||||
if (sender.hasPermission(perm)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package net.t2code.lib.Spigot.Lib.items;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class ItemVersion {
|
||||
public static Material Head;
|
||||
public static void scan(){
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
Head = Material.valueOf("SKULL");
|
||||
} else Head = Material.valueOf("PLAYER_HEAD");
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,89 @@
|
||||
package net.t2code.lib.Spigot.Lib.messages;
|
||||
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class T2CodeTemplate {
|
||||
public static Long onLoadHeader(String prefix, List autor, String version, String spigot, String discord) {
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
// send.console(prefix +" §4===================== " + prefix + " §4=====================");
|
||||
send.console(prefix + " §4 _______ §7___ §4_____ ");
|
||||
send.console(prefix + " §4 |__ __|§7__ \\ §4/ ____|");
|
||||
send.console(prefix + " §4 | | §7 ) §4| | ");
|
||||
send.console(prefix + " §4 | | §7 / /§4| | ");
|
||||
send.console(prefix + " §4 | | §7/ /_§4| |____ ");
|
||||
send.console(prefix + " §4 |_| §7|____|§4\\_____|");
|
||||
send.console(prefix + " §4 §e------------------");
|
||||
send.console(prefix + " §4 §e| §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
send.console(prefix + " §4 §e| §2Version: §6" + version);
|
||||
send.console(prefix + " §4 §e| §2Spigot: §6" + spigot);
|
||||
send.console(prefix + " §4 §e| §2Discord: §6" + discord);
|
||||
send.console(prefix + " §4 §e-------------------");
|
||||
//onLoadSeparateStroke(prefix);
|
||||
return long_;
|
||||
}
|
||||
|
||||
public static Long onLoadHeader(String prefix) {
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
send.console(prefix + "§4===================== " + prefix + " §4=====================");
|
||||
return long_;
|
||||
}
|
||||
|
||||
public static void onLoadSeparateStroke(String prefix) {
|
||||
send.console(prefix + " §8-------------------------------");
|
||||
}
|
||||
|
||||
public static void onLoadFooter(String prefix, Long long_, String version) {
|
||||
onLoadSeparateStroke(prefix);
|
||||
send.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
// send.console(prefix +" §4===================== " + prefix + "§4=====================");
|
||||
}
|
||||
|
||||
public static void onLoadFooter(String prefix, Long long_) {
|
||||
onLoadSeparateStroke(prefix);
|
||||
send.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
// send.console(prefix +" §4===================== " + prefix + "§4=====================");
|
||||
}
|
||||
|
||||
public static void onDisable(String prefix, List autor, String version, String spigot, String discord) {
|
||||
//send.console(prefix + "§4===================== " + prefix + " §7- §6" + version + " §4=====================");
|
||||
//send.console(prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
//send.console(prefix + " §2Version: §6" + version);
|
||||
//send.console(prefix + " §2Spigot: §6" + spigot);
|
||||
//send.console(prefix + " §2Discord: §6" + discord);
|
||||
//send.console(prefix + " §4Plugin successfully disabled.");
|
||||
//send.console(prefix + "§4===================== " + prefix + " §7- §6" + version + " §4=====================");
|
||||
send.console(prefix + " §2Version: §6" + version);
|
||||
send.console(prefix + " §4Plugin successfully disabled.");
|
||||
}
|
||||
|
||||
public static void sendInfo(CommandSender sender, String prefix, String spigot, String discord, List autor, String pluginVersion, String publicVersion) {
|
||||
send.sender(sender, prefix + "§4======= " + prefix + " §4=======");
|
||||
send.sender(sender, prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
|
||||
|
||||
if (publicVersion.equalsIgnoreCase(pluginVersion)) {
|
||||
send.sender(sender, prefix + " §2Version: §6" + pluginVersion);
|
||||
} else {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
UpdateAPI.sendUpdateMsg(prefix, spigot, discord, pluginVersion, publicVersion, player);
|
||||
}
|
||||
}
|
||||
send.sender(sender, prefix + " §2Spigot: §6" + spigot);
|
||||
send.sender(sender, prefix + " §2Discord: §6" + discord);
|
||||
send.sender(sender, prefix + "§4======= " + prefix + " §4=======");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
package net.t2code.lib.Spigot.Lib.messages;
|
||||
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
||||
public class TextBuilder {
|
||||
|
||||
private final String text;
|
||||
private String hover;
|
||||
private String click;
|
||||
private ClickEvent.Action action;
|
||||
|
||||
public TextBuilder(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public TextBuilder addHover(String hover) {
|
||||
this.hover = hover;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TextBuilder addClickEvent(ClickEvent.Action clickEventAction, String value) {
|
||||
this.action = clickEventAction;
|
||||
this.click = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TextComponent build() {
|
||||
TextComponent textComponent = new TextComponent();
|
||||
textComponent.setText(this.text);
|
||||
if (this.hover != null) {
|
||||
textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(this.hover).create()));
|
||||
}
|
||||
if (this.click != null && (this.action != null)) {
|
||||
textComponent.setClickEvent(new ClickEvent(action, this.click));
|
||||
}
|
||||
return textComponent;
|
||||
}
|
||||
|
||||
public enum ClickEventType {
|
||||
OPEN_URL, OPEN_FILE, RUN_COMMAND, SUGGEST_COMMAND, CHANGE_PAGE, COPY_TO_CLIPBOARD
|
||||
}
|
||||
}
|
64
src/main/java/net/t2code/lib/Spigot/Lib/messages/send.java
Normal file
64
src/main/java/net/t2code/lib/Spigot/Lib/messages/send.java
Normal file
@@ -0,0 +1,64 @@
|
||||
package net.t2code.lib.Spigot.Lib.messages;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class send {
|
||||
|
||||
/**
|
||||
* Spigot
|
||||
*/
|
||||
|
||||
public static void console(String msg) {
|
||||
Bukkit.getConsoleSender().sendMessage(msg);
|
||||
}
|
||||
|
||||
public static void player(Player player, String msg) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
|
||||
public static void title(Player player, String msg, String msg2) {
|
||||
player.sendTitle(msg, msg2);
|
||||
}
|
||||
|
||||
public static void title(Player player, String msg, String msg2, int i, int i1, int i2) {
|
||||
player.sendTitle(msg, msg2, i, i1, i2);
|
||||
}
|
||||
|
||||
public static void sender(CommandSender sender, String msg) {
|
||||
sender.sendMessage(msg);
|
||||
}
|
||||
|
||||
public static void debug(Plugin plugin, String msg) {
|
||||
debug(plugin, msg, null);
|
||||
}
|
||||
|
||||
public static void debug(Plugin plugin, String msg, Integer stage) {
|
||||
// if (!new File(Main.getPath(), "config.yml").exists()) return;
|
||||
if (stage == null) {
|
||||
if (plugin.getConfig().getBoolean("Plugin.Debug")) Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
||||
return;
|
||||
}
|
||||
if (plugin.getConfig().getInt("Plugin.Debug") >= stage) Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
||||
}
|
||||
|
||||
public static void debugmsg(Plugin plugin, String msg) {
|
||||
Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG-MSG: §6" + msg);
|
||||
}
|
||||
|
||||
public static void info(Plugin plugin, String msg) {
|
||||
plugin.getLogger().log(Level.INFO, msg);
|
||||
}
|
||||
|
||||
public static void warning(Plugin plugin, String msg) {
|
||||
plugin.getLogger().log(Level.WARNING, msg);
|
||||
}
|
||||
|
||||
public static void error(Plugin plugin, String msg) {
|
||||
plugin.getLogger().log(Level.SEVERE, msg);
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package net.t2code.lib.Spigot.Lib.minecraftVersion;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class MCVersion {
|
||||
public static String isVersion;
|
||||
public static String isBuckitVersion;
|
||||
public static boolean minecraft1_8;
|
||||
public static boolean minecraft1_9;
|
||||
public static boolean minecraft1_10;
|
||||
public static boolean minecraft1_11;
|
||||
public static boolean minecraft1_12;
|
||||
public static boolean minecraft1_13;
|
||||
public static boolean minecraft1_14;
|
||||
public static boolean minecraft1_15;
|
||||
public static boolean minecraft1_16;
|
||||
public static boolean minecraft1_17;
|
||||
public static boolean minecraft1_18;
|
||||
public static void onCheck(){
|
||||
isVersion = Bukkit.getServer().getVersion();
|
||||
isBuckitVersion = Bukkit.getServer().getBukkitVersion();
|
||||
minecraft1_8 = Bukkit.getServer().getClass().getPackage().getName().contains("1_8");
|
||||
minecraft1_9 = Bukkit.getServer().getClass().getPackage().getName().contains("1_9");
|
||||
minecraft1_10 = Bukkit.getServer().getClass().getPackage().getName().contains("1_10");
|
||||
minecraft1_11 = Bukkit.getServer().getClass().getPackage().getName().contains("1_11");
|
||||
minecraft1_12 = Bukkit.getServer().getClass().getPackage().getName().contains("1_12");
|
||||
minecraft1_13 = Bukkit.getServer().getClass().getPackage().getName().contains("1_13");
|
||||
minecraft1_14 = Bukkit.getServer().getClass().getPackage().getName().contains("1_14");
|
||||
minecraft1_15 = Bukkit.getServer().getClass().getPackage().getName().contains("1_15");
|
||||
minecraft1_16 = Bukkit.getServer().getClass().getPackage().getName().contains("1_16");
|
||||
minecraft1_17 = Bukkit.getServer().getClass().getPackage().getName().contains("1_17");
|
||||
minecraft1_18 = Bukkit.getServer().getClass().getPackage().getName().contains("1_18");
|
||||
}
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
package net.t2code.lib.Spigot.Lib.minecraftVersion;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class NMSVersion {
|
||||
public static String isNMS;
|
||||
public static boolean v1_8_R1;
|
||||
public static boolean v1_8_R2;
|
||||
public static boolean v1_8_R3;
|
||||
public static boolean v1_9_R1;
|
||||
public static boolean v1_9_R2;
|
||||
public static boolean v1_10_R1;
|
||||
public static boolean v1_11_R1;
|
||||
public static boolean v1_12_R1;
|
||||
public static boolean v1_13_R1;
|
||||
public static boolean v1_13_R2;
|
||||
public static boolean v1_14_R1;
|
||||
public static boolean v1_15_R1;
|
||||
public static boolean v1_16_R1;
|
||||
public static boolean v1_16_R2;
|
||||
public static boolean v1_16_R3;
|
||||
public static boolean v1_17_R1;
|
||||
public static boolean v1_18_R1;
|
||||
public static boolean v1_18_R2;
|
||||
|
||||
public static void onCheck() {
|
||||
isNMS = Bukkit.getServer().getClass().getPackage().getName();
|
||||
v1_8_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_8_R1");
|
||||
v1_8_R2 = Bukkit.getServer().getClass().getPackage().getName().contains("1_8_R2");
|
||||
v1_8_R3 = Bukkit.getServer().getClass().getPackage().getName().contains("1_8_R3");
|
||||
v1_9_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_9_R1");
|
||||
v1_9_R2 = Bukkit.getServer().getClass().getPackage().getName().contains("1_9_R2");
|
||||
v1_10_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_10_R1");
|
||||
v1_11_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_11_R1");
|
||||
v1_12_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_12_R1");
|
||||
v1_13_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_13_R1");
|
||||
v1_13_R2 = Bukkit.getServer().getClass().getPackage().getName().contains("1_13_R2");
|
||||
v1_14_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_14_R1");
|
||||
v1_15_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_15_R1");
|
||||
v1_16_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_16_R1");
|
||||
v1_16_R2 = Bukkit.getServer().getClass().getPackage().getName().contains("1_16_R2");
|
||||
v1_16_R3 = Bukkit.getServer().getClass().getPackage().getName().contains("1_16_R3");
|
||||
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_R2 = Bukkit.getServer().getClass().getPackage().getName().contains("1_18_R2");
|
||||
}
|
||||
}
|
@@ -0,0 +1,77 @@
|
||||
package net.t2code.lib.Spigot.Lib.plugins;
|
||||
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class PluginCheck {
|
||||
public static Boolean pluginCheck(String pluginName){
|
||||
return Bukkit.getPluginManager().getPlugin(pluginName) != null;
|
||||
}
|
||||
public static Plugin pluginInfos(String pluginName){
|
||||
return Bukkit.getPluginManager().getPlugin(pluginName);
|
||||
}
|
||||
public static Boolean papi(){
|
||||
return Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null;
|
||||
}
|
||||
public static Boolean vault(){
|
||||
return Bukkit.getPluginManager().getPlugin("Vault") != null;
|
||||
}
|
||||
public static Boolean plotSquared(){
|
||||
return Bukkit.getPluginManager().getPlugin("PlotSquared") != null;
|
||||
}
|
||||
public static Boolean plugManGUI(){
|
||||
return Bukkit.getPluginManager().getPlugin("PlugManGUI") != null;
|
||||
}
|
||||
public static Boolean cmi(){
|
||||
return Bukkit.getPluginManager().getPlugin("CMI") != null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* T2Code Plugins
|
||||
* @return
|
||||
*/
|
||||
public static Boolean cgui(){
|
||||
return Bukkit.getPluginManager().getPlugin("CommandGUI") != null;
|
||||
}
|
||||
public static Boolean plotSquaredGUI(){
|
||||
return Bukkit.getPluginManager().getPlugin("PlotSquaredGUI") != null;
|
||||
}
|
||||
public static Boolean wbs(){
|
||||
return Bukkit.getPluginManager().getPlugin("WonderBagShop") != null;
|
||||
}
|
||||
public static Boolean opSec(){
|
||||
return Bukkit.getPluginManager().getPlugin("OPSecurity") != null;
|
||||
}
|
||||
public static Boolean papiTest(){
|
||||
return Bukkit.getPluginManager().getPlugin("PaPiTest") != null;
|
||||
}
|
||||
public static Boolean booster(){
|
||||
return Bukkit.getPluginManager().getPlugin("Booster") != null;
|
||||
}
|
||||
public static Boolean antiMapCopy(){
|
||||
return Bukkit.getPluginManager().getPlugin("AAntiMapCopy") != null;
|
||||
}
|
||||
public static Boolean loreEditor(){
|
||||
return Bukkit.getPluginManager().getPlugin("LoreEditor") != null;
|
||||
}
|
||||
public static Boolean t2cAlias(){
|
||||
return Bukkit.getPluginManager().getPlugin("T2C-Alias") != null;
|
||||
}
|
||||
public static Boolean t2cWarp(){
|
||||
return Bukkit.getPluginManager().getPlugin("T2C-Warp") != null;
|
||||
}
|
||||
|
||||
public static Boolean pluginNotFound(Plugin plugin, String prefix, String pl, Integer spigotID) {
|
||||
if (Bukkit.getPluginManager().getPlugin(pl) == null) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(prefix + " §e" + pl + " §4could not be found. Please download it here: " +
|
||||
"§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package net.t2code.lib.Spigot.Lib.register;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class Register {
|
||||
public static void listener(Listener listener, Plugin plugin) {
|
||||
Bukkit.getServer().getPluginManager().registerEvents(listener, plugin);
|
||||
}
|
||||
|
||||
public static void permission(String permission, Plugin plugin) {
|
||||
if (plugin.getServer().getPluginManager().getPermission(permission) == null) {
|
||||
plugin.getServer().getPluginManager().addPermission(new Permission(permission));
|
||||
}
|
||||
}
|
||||
|
||||
public static void permission(String permission, PermissionDefault setDefault, Plugin plugin) {
|
||||
permission(permission, plugin);
|
||||
plugin.getServer().getPluginManager().getPermission(permission).setDefault(setDefault);
|
||||
}
|
||||
|
||||
public static void permission(String permission, String children, Boolean setBoolean, Plugin plugin) {
|
||||
permission(permission, plugin);
|
||||
plugin.getServer().getPluginManager().getPermission(permission).getChildren().put(children, setBoolean);
|
||||
}
|
||||
|
||||
public static void permission(String permission, PermissionDefault setDefault, String children, Boolean setBoolean, Plugin plugin) {
|
||||
permission(permission, plugin);
|
||||
plugin.getServer().getPluginManager().getPermission(permission).setDefault(setDefault);
|
||||
plugin.getServer().getPluginManager().getPermission(permission).getChildren().put(children, setBoolean);
|
||||
}
|
||||
}
|
90
src/main/java/net/t2code/lib/Spigot/Lib/replace/Replace.java
Normal file
90
src/main/java/net/t2code/lib/Spigot/Lib/replace/Replace.java
Normal file
@@ -0,0 +1,90 @@
|
||||
package net.t2code.lib.Spigot.Lib.replace;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class Replace {
|
||||
|
||||
public static String replace(String prefix, String Text) {
|
||||
return Text.replace("[prefix]", prefix).replace("&", "§").replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä");
|
||||
}
|
||||
|
||||
|
||||
public static String replace(String prefix,Player player, String Text) {
|
||||
return PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä"));
|
||||
}
|
||||
|
||||
|
||||
public static List<String> replace(String prefix, List<String> Text) {
|
||||
List<String> output = new ArrayList<>();
|
||||
for (String input : Text) {
|
||||
output.add(input.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä"));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
public static List<String> replace(String prefix,Player player, List<String> Text) {
|
||||
List<String> output = new ArrayList();
|
||||
if (player == null) {
|
||||
return Arrays.asList("player is null");
|
||||
}
|
||||
if (Text == null) {
|
||||
return Arrays.asList("Text is null");
|
||||
}
|
||||
for (String input : Text) {
|
||||
output.add(PlaceholderAPI.setPlaceholders(player, input.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
public static List replacePrice(String prefix,List<String> Text, String price) {
|
||||
List rp = new ArrayList();
|
||||
for (String s : Text) {
|
||||
rp.add(s.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[price]", String.valueOf(price)));
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
|
||||
public static List replacePrice(String prefix,Player player, List<String> Text, String price) {
|
||||
List rp = new ArrayList();
|
||||
for (String s : Text) {
|
||||
rp.add(PlaceholderAPI.setPlaceholders(player, s.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[price]", String.valueOf(price))));
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
public static String replacePrice(String prefix, String Text, String price) {
|
||||
return Text.replace("[prefix]", prefix).replace("&", "§").replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[price]", String.valueOf(price));
|
||||
}
|
||||
|
||||
|
||||
public static String replacePrice(String prefix,Player player, String Text, String price) {
|
||||
return PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix).replace("&", "§")
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[price]", String.valueOf(price)));
|
||||
}
|
||||
|
||||
}
|
167
src/main/java/net/t2code/lib/Spigot/Lib/update/UpdateAPI.java
Normal file
167
src/main/java/net/t2code/lib/Spigot/Lib/update/UpdateAPI.java
Normal file
@@ -0,0 +1,167 @@
|
||||
package net.t2code.lib.Spigot.Lib.update;
|
||||
|
||||
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.messages.TextBuilder;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.system.config.SelectLibConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Scanner;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class UpdateAPI {
|
||||
public static HashMap<String, UpdateObject> PluginVersionen = new HashMap<>();
|
||||
|
||||
public static void join(Plugin plugin, String prefix, String perm, Player player, String spigot, String discord) {
|
||||
String pluginVersion = plugin.getDescription().getVersion();
|
||||
String publicVersion = UpdateAPI.PluginVersionen.get(plugin.getName()).publicVersion;
|
||||
if (!player.hasPermission(perm) || !player.isOp()) {
|
||||
return;
|
||||
}
|
||||
if (publicVersion == null) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
join(plugin, prefix, perm, player, spigot, discord);
|
||||
}
|
||||
}.runTaskLater(plugin, 20L);
|
||||
} else use(plugin, prefix, player, pluginVersion, publicVersion, spigot, discord);
|
||||
}
|
||||
|
||||
private static void use(Plugin plugin, String prefix, Player player, String pluginVersion, String publicVersion, String spigot, String discord) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!pluginVersion.equals(publicVersion)) {
|
||||
if (SelectLibConfig.UpdateCheckOnJoin) {
|
||||
UpdateAPI.sendUpdateMsg(prefix, spigot, discord, pluginVersion, publicVersion, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskLater(plugin, 200L);
|
||||
}
|
||||
|
||||
public static void sendUpdateMsg(String Prefix, String Spigot, String Discord, String pluginVersion, String publicVersion) {
|
||||
send.console("§4=========== " + Prefix + " §4===========");
|
||||
send.console("§6A new version was found!");
|
||||
send.console("§6Your version: §c" + pluginVersion + " §7- §6Current version: §a" + publicVersion);
|
||||
send.console("§6You can download it here: §e" + Spigot);
|
||||
send.console("§6You can find more information on Discord: §e" + Discord);
|
||||
send.console("§4=========== " + Prefix + " §4===========");
|
||||
}
|
||||
|
||||
public static void sendUpdateMsg(String Prefix, String Spigot, String Discord, String pluginVersion, String publicVersion, Player player) {
|
||||
if (publicVersion.equals("§4No public version found!")) {
|
||||
return;
|
||||
}
|
||||
send.player(player, Prefix);
|
||||
TextComponent comp = new TextBuilder(Prefix + " §6A new version was found!")
|
||||
.addHover("§6You can download it here: §e" + Spigot).addClickEvent(ClickEvent.Action.OPEN_URL, Spigot).build();
|
||||
player.spigot().sendMessage(comp);
|
||||
TextComponent comp1 = new TextBuilder(Prefix + " §c" + pluginVersion + " §7-> §a" + publicVersion)
|
||||
.addHover("§6You can download it here: §e" + Spigot).addClickEvent(ClickEvent.Action.OPEN_URL, Spigot).build();
|
||||
player.spigot().sendMessage(comp1);
|
||||
TextComponent comp2 = new TextBuilder(Prefix + " §6You can find more information on Discord.")
|
||||
.addHover("§e" + Discord).addClickEvent(ClickEvent.Action.OPEN_URL, Discord).build();
|
||||
player.spigot().sendMessage(comp2);
|
||||
send.player(player, Prefix);
|
||||
}
|
||||
|
||||
private static Boolean noUpdate = true;
|
||||
|
||||
public static void onUpdateCheck(Plugin plugin, String Prefix, String Spigot, int SpigotID, String Discord) {
|
||||
int taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
||||
public void run() {
|
||||
|
||||
(new UpdateAPI((JavaPlugin) plugin, SpigotID)).getVersion((update_version) -> {
|
||||
UpdateObject update = new UpdateObject(
|
||||
plugin.getName(),
|
||||
plugin.getDescription().getVersion(),
|
||||
update_version
|
||||
);
|
||||
UpdateAPI.PluginVersionen.put(plugin.getName(), update);
|
||||
|
||||
if (!plugin.getDescription().getVersion().equalsIgnoreCase(update_version)) {
|
||||
noUpdate = true;
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sendUpdateMsg(Prefix, Spigot, Discord, plugin.getDescription().getVersion(), update_version);
|
||||
}
|
||||
}.runTaskLater(plugin, 600L);
|
||||
} else {
|
||||
|
||||
if (noUpdate) {
|
||||
send.console(Prefix + " §2No update found.");
|
||||
noUpdate = false;
|
||||
}
|
||||
}
|
||||
}, Prefix, plugin.getDescription().getVersion());
|
||||
}
|
||||
}, 0L, 20 * 60 * 60L);
|
||||
}
|
||||
|
||||
private JavaPlugin plugin;
|
||||
private int resourceId;
|
||||
|
||||
public UpdateAPI(JavaPlugin plugin, int resourceId) {
|
||||
this.plugin = plugin;
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
public void getVersion(Consumer<String> consumer, String Prefix, String pluginVersion) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
|
||||
try {
|
||||
InputStream inputStream = (new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId)).openStream();
|
||||
try {
|
||||
Scanner scanner = new Scanner(inputStream);
|
||||
|
||||
try {
|
||||
if (scanner.hasNext()) {
|
||||
consumer.accept(scanner.next());
|
||||
}
|
||||
} catch (Throwable var8) {
|
||||
try {
|
||||
scanner.close();
|
||||
} catch (Throwable var7) {
|
||||
var8.addSuppressed(var7);
|
||||
}
|
||||
throw var8;
|
||||
}
|
||||
scanner.close();
|
||||
} catch (Throwable var9) {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (Throwable var6) {
|
||||
var9.addSuppressed(var6);
|
||||
}
|
||||
}
|
||||
throw var9;
|
||||
}
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
} catch (IOException var10) {
|
||||
UpdateObject update = new UpdateObject(
|
||||
plugin.getName(),
|
||||
pluginVersion,
|
||||
"§4No public version found!"
|
||||
);
|
||||
UpdateAPI.PluginVersionen.put(plugin.getName(), update);
|
||||
this.plugin.getLogger().severe(Prefix + "§4 Cannot look for updates: " + var10.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package net.t2code.lib.Spigot.Lib.update;
|
||||
|
||||
public class UpdateObject {
|
||||
|
||||
public String pluginName;
|
||||
public String pluginVersion;
|
||||
public String publicVersion;
|
||||
|
||||
public UpdateObject(String pluginName, String pluginVersion, String publicVersion) {
|
||||
this.pluginName = pluginName;
|
||||
this.pluginVersion = pluginVersion;
|
||||
this.publicVersion = publicVersion;
|
||||
}
|
||||
}
|
68
src/main/java/net/t2code/lib/Spigot/Lib/vault/Vault.java
Normal file
68
src/main/java/net/t2code/lib/Spigot/Lib/vault/Vault.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package net.t2code.lib.Spigot.Lib.vault;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import net.t2code.lib.Spigot.system.languages.SelectLibMsg;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
public class Vault {
|
||||
|
||||
public static Boolean vaultEnable;
|
||||
public static Boolean connected;
|
||||
|
||||
public static boolean buy(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 {
|
||||
if (Main.eco.getBalance(p) < price) {
|
||||
return false;
|
||||
} else {
|
||||
Main.eco.withdrawPlayer(p, price);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void loadVault() throws InterruptedException {
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
if (Main.plugin.getServer().getPluginManager().getPlugin("Vault") != null) {
|
||||
vaultEnable = true;
|
||||
RegisteredServiceProvider<Economy> eco = Main.plugin.getServer().getServicesManager().getRegistration(Economy.class);
|
||||
if (eco != null) {
|
||||
Main.eco = eco.getProvider();
|
||||
if (Main.eco != null) {
|
||||
connected = true;
|
||||
send.console(Main.prefix + " §2Vault / Economy successfully connected!" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
} else {
|
||||
connected = false;
|
||||
send.console(Main.prefix + " §4Economy could not be connected / found! 1" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
}
|
||||
} else {
|
||||
connected = false;
|
||||
send.console(Main.prefix + " §4Economy could not be connected / found! 2" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
}
|
||||
RegisteredServiceProvider<Permission> perm = Main.plugin.getServer().getServicesManager().getRegistration(Permission.class);
|
||||
if (perm != null) {
|
||||
Main.perm = perm.getProvider();
|
||||
}
|
||||
} else {
|
||||
vaultEnable = false;
|
||||
connected = false;
|
||||
send.console(Main.prefix + " §4Vault could not be connected! 3" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
}
|
||||
}
|
||||
|
||||
public static void vaultDisable() {
|
||||
connected = false;
|
||||
send.console(Main.prefix + " §4Vault / Economy successfully deactivated.");
|
||||
}
|
||||
}
|
@@ -0,0 +1,189 @@
|
||||
package net.t2code.lib.Spigot.Lib.yamlConfiguration;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||
import net.t2code.lib.Spigot.system.languages.SelectLibMsg;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Config {
|
||||
public static void set(String path, String value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(String path, YamlConfiguration YamlConfiguration) {
|
||||
YamlConfiguration.set(path, null);
|
||||
}
|
||||
|
||||
public static void set(String path, Integer value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(String path, Double value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(String path, Boolean value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(String path, List value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setSound(String soundName, String sound1_8, String sound1_9, String sound1_13, YamlConfiguration yamlConfiguration) {
|
||||
Config.set("Sound." + soundName + ".Enable", true, yamlConfiguration);
|
||||
String sound;
|
||||
if (MCVersion.minecraft1_8) {
|
||||
sound = sound1_8.toString();
|
||||
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
sound = sound1_9.toString();
|
||||
} else sound = sound1_13.toString();
|
||||
Config.set("Sound." + soundName + ".Sound", sound, yamlConfiguration);
|
||||
}
|
||||
|
||||
public static void setSound(String soundName, String sound1_8, String sound1_13, YamlConfiguration yamlConfiguration) {
|
||||
Config.set("Sound." + soundName + ".Enable", true, yamlConfiguration);
|
||||
String sound;
|
||||
if (MCVersion.minecraft1_8) {
|
||||
sound = sound1_8.toString();
|
||||
} else sound = sound1_13.toString();
|
||||
Config.set("Sound." + soundName + ".Sound", sound, yamlConfiguration);
|
||||
}
|
||||
|
||||
public static void setSound(String soundName, String sound, YamlConfiguration yamlConfiguration) {
|
||||
Config.set("Sound." + soundName + ".Enable", true, yamlConfiguration);
|
||||
Config.set("Sound." + soundName + ".Sound", sound.toString(), yamlConfiguration);
|
||||
}
|
||||
|
||||
public static boolean selectSoundEnable( String soundName, YamlConfiguration yamlConfiguration) {
|
||||
return selectBoolean("Sound." + soundName + ".Enable", yamlConfiguration);
|
||||
}
|
||||
|
||||
public static String selectSound(String prefix, String soundName, YamlConfiguration yamlConfiguration) {
|
||||
return select(prefix, "Sound." + soundName + ".Sound", yamlConfiguration);
|
||||
}
|
||||
|
||||
public static Sound checkSound(String sound1_8, String sound1_9, String sound1_13, String selectSoundFromConfig, String prefix) {
|
||||
String SOUND;
|
||||
if (MCVersion.minecraft1_8) {
|
||||
SOUND = sound1_8;
|
||||
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
SOUND = sound1_9;
|
||||
} else SOUND = sound1_13;
|
||||
|
||||
try {
|
||||
Sound sound_Buy = Sound.valueOf(selectSoundFromConfig);
|
||||
if (sound_Buy != null) {
|
||||
return sound_Buy;
|
||||
} else return null;
|
||||
} catch (Exception e) {
|
||||
send.console("§4\n§4\n§4\n" + SelectLibMsg.SoundNotFound.replace("[prefix]", prefix)
|
||||
.replace("[sound]", "§8Buy: §6" + selectSoundFromConfig) + "§4\n§4\n§4\n");
|
||||
return Sound.valueOf(SOUND);
|
||||
}
|
||||
}
|
||||
|
||||
public static Sound checkSound(String sound1_8, String sound1_13, String selectSoundFromConfig, String prefix) {
|
||||
String SOUND;
|
||||
if (MCVersion.minecraft1_8) {
|
||||
SOUND = sound1_8;
|
||||
} else SOUND = sound1_13;
|
||||
|
||||
try {
|
||||
Sound sound_Buy = Sound.valueOf(selectSoundFromConfig);
|
||||
if (sound_Buy != null) {
|
||||
return sound_Buy;
|
||||
} else return null;
|
||||
} catch (Exception e) {
|
||||
send.console("§4\n§4\n§4\n" + SelectLibMsg.SoundNotFound.replace("[prefix]", prefix)
|
||||
.replace("[sound]", "§8Buy: §6" + selectSoundFromConfig) + "§4\n§4\n§4\n");
|
||||
return Sound.valueOf(SOUND);
|
||||
}
|
||||
}
|
||||
|
||||
public static Sound checkSound(String sound, String selectSoundFromConfig, String prefix) {
|
||||
try {
|
||||
Sound sound_Buy = Sound.valueOf(selectSoundFromConfig);
|
||||
if (sound_Buy != null) {
|
||||
return sound_Buy;
|
||||
} else return null;
|
||||
} catch (Exception e) {
|
||||
send.console("§4\n§4\n§4\n" + SelectLibMsg.SoundNotFound.replace("[prefix]", prefix)
|
||||
.replace("[sound]", "§8Buy: §6" + selectSoundFromConfig) + "§4\n§4\n§4\n");
|
||||
return Sound.valueOf(sound);
|
||||
}
|
||||
}
|
||||
|
||||
public static String select(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
||||
return Replace.replace(prefix, yamlConfiguration.getString(path));
|
||||
}
|
||||
|
||||
public static void select(String prefix, String value, String path, YamlConfiguration yamlConfiguration) {
|
||||
value = Replace.replace(prefix, yamlConfiguration.getString(path));
|
||||
}
|
||||
|
||||
public static Integer selectInt(String path, YamlConfiguration yamlConfiguration) {
|
||||
return (yamlConfiguration.getInt(path));
|
||||
}
|
||||
|
||||
public static void select(String path, Integer value, YamlConfiguration yamlConfiguration) {
|
||||
value = (yamlConfiguration.getInt(path));
|
||||
}
|
||||
|
||||
public static Boolean selectBoolean(String path, YamlConfiguration yamlConfiguration) {
|
||||
return (yamlConfiguration.getBoolean(path));
|
||||
}
|
||||
|
||||
public static void select(String path, Boolean value, YamlConfiguration yamlConfiguration) {
|
||||
value = (yamlConfiguration.getBoolean(path));
|
||||
}
|
||||
|
||||
public static Double selectDouble(String path, YamlConfiguration yamlConfiguration) {
|
||||
return (yamlConfiguration.getDouble(path));
|
||||
}
|
||||
|
||||
public static void select(String path, Double value, YamlConfiguration yamlConfiguration) {
|
||||
value = (yamlConfiguration.getDouble(path));
|
||||
}
|
||||
|
||||
public static List selectList(String path, YamlConfiguration yamlConfiguration) {
|
||||
return (yamlConfiguration.getList(path));
|
||||
}
|
||||
|
||||
public static void select(String path, List value, YamlConfiguration yamlConfiguration) {
|
||||
value = (yamlConfiguration.getList(path));
|
||||
}
|
||||
|
||||
public static List selectList(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
||||
List<String> output = new ArrayList<>();
|
||||
List<String> input = yamlConfiguration.getStringList(path);
|
||||
for (String st : input) {
|
||||
output.add(Replace.replace(prefix, st));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public static void select(String prefix, List value, String path, YamlConfiguration yamlConfiguration) {
|
||||
List<String> output = new ArrayList<>();
|
||||
List<String> input = yamlConfiguration.getStringList(path);
|
||||
for (String st : input) {
|
||||
output.add(Replace.replace(prefix, st));
|
||||
}
|
||||
value = output;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user