Compare commits
14 Commits
f1a5fa9423
...
10.2
Author | SHA1 | Date | |
---|---|---|---|
|
ad5d7e09ea | ||
|
c564cdead1 | ||
2db5be7d56 | |||
|
9f19d2b039 | ||
3cb557c0e1 | |||
da2e9ff6a4 | |||
|
68d89e2e9e | ||
c171a1674d | |||
1c962a54d6 | |||
1ce07cce81 | |||
3c6bb074d8 | |||
07293cded4 | |||
6cbae613a3 | |||
9d0902f611 |
@@ -1,7 +1,7 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="T2CodeLib_9.0_Snapshot_1">
|
||||
<artifact type="jar" name="T2CodeLib_10.2">
|
||||
<output-path>$PROJECT_DIR$/../../Plugins/T2CodeLib/.jar</output-path>
|
||||
<root id="archive" name="T2CodeLib_9.0_Snapshot_1.jar">
|
||||
<root id="archive" name="T2CodeLib_10.2.jar">
|
||||
<element id="module-output" name="T2CodeLib" />
|
||||
</root>
|
||||
</artifact>
|
2
pom.xml
2
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>9.0_Snapshot_1</version>
|
||||
<version>10.2</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>T2CodeLib</name>
|
||||
|
@@ -12,11 +12,11 @@ public final class BMain extends Plugin {
|
||||
public static String Version;
|
||||
public static String Autor;
|
||||
|
||||
public static String Prefix = Util.Prefix;
|
||||
public static Integer SpigotID = Util.SpigotID;
|
||||
public static Integer BstatsID = Util.BstatsID;
|
||||
public static String Spigot = Util.Spigot;
|
||||
public static String Discord = Util.Discord;
|
||||
public static String Prefix = Util.getPrefix();
|
||||
public static Integer SpigotID = Util.getSpigotID();
|
||||
public static Integer BstatsID = Util.getBstatsID();
|
||||
public static String Spigot = Util.getSpigot();
|
||||
public static String Discord = Util.getDiscord();
|
||||
|
||||
|
||||
@Override
|
||||
|
@@ -0,0 +1,85 @@
|
||||
package net.t2code.lib.Bungee.Lib.yamlConfiguration;
|
||||
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BConfig {
|
||||
public static void set(String path, String value, Configuration configuration) {
|
||||
if (!configuration.contains(path)) {
|
||||
configuration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(String path, Configuration configuration) {
|
||||
configuration.set(path, null);
|
||||
}
|
||||
|
||||
public static void set(String path, Integer value, Configuration configuration) {
|
||||
if (!configuration.contains(path)) {
|
||||
configuration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(String path, Double value, Configuration configuration) {
|
||||
if (!configuration.contains(path)) {
|
||||
configuration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(String path, Boolean value, Configuration configuration) {
|
||||
if (!configuration.contains(path)) {
|
||||
configuration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(String path, List<String> value, Configuration configuration) {
|
||||
if (!configuration.contains(path)) {
|
||||
configuration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String select(String prefix, String path, Configuration configuration) {
|
||||
return Replace.replace(prefix, configuration.getString(path));
|
||||
}
|
||||
|
||||
|
||||
public static Integer selectInt(String path, Configuration configuration) {
|
||||
return (configuration.getInt(path));
|
||||
}
|
||||
|
||||
public static Boolean selectBoolean(String path, Configuration configuration) {
|
||||
return (configuration.getBoolean(path));
|
||||
}
|
||||
|
||||
public static Double selectDouble(String path, Configuration configuration) {
|
||||
return (configuration.getDouble(path));
|
||||
}
|
||||
|
||||
public static List<String> selectList(String path, Configuration configuration) {
|
||||
return (configuration.getStringList(path));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static List<String> selectList(String prefix, String path, Configuration configuration) {
|
||||
List<String> output = new ArrayList<>();
|
||||
List<String> input = configuration.getStringList(path);
|
||||
for (String st : input) {
|
||||
output.add(Replace.replace(prefix, st));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public static void select(String prefix, List<String> value, String path, Configuration configuration) {
|
||||
List<String> output = new ArrayList<>();
|
||||
List<String> input = configuration.getStringList(path);
|
||||
for (String st : input) {
|
||||
output.add(Replace.replace(prefix, st));
|
||||
}
|
||||
value = output;
|
||||
}
|
||||
}
|
@@ -2,6 +2,7 @@ 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.replace.Replace;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import net.t2code.lib.Spigot.system.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -78,19 +79,30 @@ public class T2CodeTemplate {
|
||||
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 (sender instanceof Player) {
|
||||
|
||||
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);
|
||||
TextComponent comp2 = new TextBuilder(prefix + " §2Version: §6" + pluginVersion)
|
||||
.addHover("§8Click to copy").addClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, Replace.removeColorCode(prefix) +" - "+ pluginVersion).build();
|
||||
sender.spigot().sendMessage(comp2);
|
||||
if (!publicVersion.equalsIgnoreCase(pluginVersion)) {
|
||||
UpdateAPI.sendUpdateMsg(prefix, spigot, discord, pluginVersion, publicVersion, (Player) sender);
|
||||
}
|
||||
TextComponent comp3 = new TextBuilder(prefix + " §2Spigot: §6" + spigot)
|
||||
.addHover("§8Open Spigot").addClickEvent(ClickEvent.Action.OPEN_URL, spigot).build();
|
||||
sender.spigot().sendMessage(comp3);
|
||||
TextComponent comp4 = new TextBuilder(prefix + " §2Discord: §6" + discord)
|
||||
.addHover("§8Open Discord").addClickEvent(ClickEvent.Action.OPEN_URL, discord).build();
|
||||
sender.spigot().sendMessage(comp4);
|
||||
} else {
|
||||
if (publicVersion.equalsIgnoreCase(pluginVersion)) {
|
||||
send.sender(sender, prefix + " §2Version: §6" + pluginVersion);
|
||||
} else {
|
||||
UpdateAPI.sendUpdateMsg(prefix, spigot, discord, pluginVersion, publicVersion);
|
||||
}
|
||||
send.sender(sender, prefix + " §2Spigot: §6" + spigot);
|
||||
send.sender(sender, prefix + " §2Discord: §6" + discord);
|
||||
|
||||
}
|
||||
send.sender(sender, prefix + " §2Spigot: §6" + spigot);
|
||||
send.sender(sender, prefix + " §2Discord: §6" + discord);
|
||||
send.sender(sender, prefix + "§4======= " + prefix + " §4=======");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -5,9 +5,6 @@ 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) {
|
||||
@@ -35,4 +32,8 @@ public class Register {
|
||||
plugin.getServer().getPluginManager().getPermission(permission).setDefault(setDefault);
|
||||
plugin.getServer().getPluginManager().getPermission(permission).getChildren().put(children, setBoolean);
|
||||
}
|
||||
public static void permissionDescription(String permission, String description, Plugin plugin) {
|
||||
plugin.getServer().getPluginManager().getPermission(permission).setDescription(description);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -63,6 +63,19 @@ public class Replace {
|
||||
return rp;
|
||||
}
|
||||
|
||||
public static String removeColorCode(String value){
|
||||
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) {
|
||||
List<String> rp = new ArrayList();
|
||||
|
@@ -6,6 +6,7 @@ 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.Main;
|
||||
import net.t2code.lib.Spigot.system.config.SelectLibConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -25,18 +26,17 @@ public class UpdateAPI {
|
||||
|
||||
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) {
|
||||
if (UpdateAPI.PluginVersionen.get(plugin.getName()) == 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);
|
||||
} else use(plugin, prefix, player, pluginVersion, UpdateAPI.PluginVersionen.get(plugin.getName()).publicVersion, spigot, discord);
|
||||
}
|
||||
|
||||
private static void use(Plugin plugin, String prefix, Player player, String pluginVersion, String publicVersion, String spigot, String discord) {
|
||||
@@ -54,7 +54,19 @@ public class UpdateAPI {
|
||||
|
||||
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!");
|
||||
if (publicVersion.toLowerCase().contains("dev") || publicVersion.toLowerCase().contains("beta") || publicVersion.toLowerCase().contains("snapshot")){
|
||||
if (publicVersion.toLowerCase().contains("dev")){
|
||||
send.console("§6A new §4DEV§6 version was found!");
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("beta")){
|
||||
send.console("§6A new §2BETA§6 version was found!");
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("snapshot")){
|
||||
send.console("§6A new §eSNAPSHOT§6 version was found!");
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
@@ -66,9 +78,27 @@ public class UpdateAPI {
|
||||
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);
|
||||
if (publicVersion.toLowerCase().contains("dev") || publicVersion.toLowerCase().contains("beta") || publicVersion.toLowerCase().contains("snapshot")){
|
||||
if (publicVersion.toLowerCase().contains("dev")){
|
||||
TextComponent comp = new TextBuilder(Prefix + " §6A new §4DEV§6 version was found!")
|
||||
.addHover("§6You can download it here: §e" + Spigot).addClickEvent(ClickEvent.Action.OPEN_URL, Spigot).build();
|
||||
player.spigot().sendMessage(comp);
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("beta")){
|
||||
TextComponent comp = new TextBuilder(Prefix + " §6A new §2BETA§6 version was found!")
|
||||
.addHover("§6You can download it here: §e" + Spigot).addClickEvent(ClickEvent.Action.OPEN_URL, Spigot).build();
|
||||
player.spigot().sendMessage(comp);
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("snapshot")){
|
||||
TextComponent comp = new TextBuilder(Prefix + " §6A new §eSNAPSHOT§6 version was found!")
|
||||
.addHover("§6You can download it here: §e" + Spigot).addClickEvent(ClickEvent.Action.OPEN_URL, Spigot).build();
|
||||
player.spigot().sendMessage(comp);
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
@@ -81,9 +111,12 @@ public class UpdateAPI {
|
||||
private static Boolean noUpdate = true;
|
||||
|
||||
public static void onUpdateCheck(Plugin plugin, String Prefix, String Spigot, int SpigotID, String Discord) {
|
||||
onUpdateCheck(plugin, Prefix, Spigot, SpigotID, Discord, 60);
|
||||
}
|
||||
|
||||
public static void onUpdateCheck(Plugin plugin, String Prefix, String Spigot, int SpigotID, String Discord, Integer timeInMin) {
|
||||
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(),
|
||||
@@ -91,7 +124,6 @@ public class UpdateAPI {
|
||||
update_version
|
||||
);
|
||||
UpdateAPI.PluginVersionen.put(plugin.getName(), update);
|
||||
|
||||
if (!plugin.getDescription().getVersion().equalsIgnoreCase(update_version)) {
|
||||
noUpdate = true;
|
||||
new BukkitRunnable() {
|
||||
@@ -101,7 +133,6 @@ public class UpdateAPI {
|
||||
}
|
||||
}.runTaskLater(plugin, 600L);
|
||||
} else {
|
||||
|
||||
if (noUpdate) {
|
||||
send.console(Prefix + " §2No update found.");
|
||||
noUpdate = false;
|
||||
@@ -109,7 +140,7 @@ public class UpdateAPI {
|
||||
}
|
||||
}, Prefix, plugin.getDescription().getVersion());
|
||||
}
|
||||
}, 0L, 20 * 60 * 60L);
|
||||
}, 0L, timeInMin * 60 * 20L);
|
||||
}
|
||||
|
||||
private JavaPlugin plugin;
|
||||
|
@@ -4,6 +4,7 @@ import net.md_5.bungee.protocol.packet.Commands;
|
||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import net.t2code.lib.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@@ -22,29 +23,36 @@ import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
private static Plugin plugin = Main.plugin;
|
||||
private static String prefix = Main.prefix;
|
||||
private static List autor = Main.autor;
|
||||
private static String version = Main.version;
|
||||
private static String spigot = Main.spigot;
|
||||
private static String discord = Main.discord;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!sender.hasPermission("t2code.admin")){
|
||||
send.sender(sender,"§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
if (args.length == 0) {
|
||||
T2CodeTemplate.sendInfo(sender, prefix, spigot, discord, autor, version, UpdateAPI.PluginVersionen.get(plugin.getName()).publicVersion);
|
||||
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
|
||||
} else {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "info":
|
||||
case "plugin":
|
||||
case "pl":
|
||||
case "version":
|
||||
case "ver":
|
||||
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
|
||||
return false;
|
||||
}
|
||||
if ("debug".equals(args[0].toLowerCase())) {
|
||||
if (args.length != 2) {
|
||||
send.sender(sender,"§4Use: §7/t2code debug createReportLog");
|
||||
send.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
||||
return false;
|
||||
}
|
||||
if ("createreportlog".equals(args[1].toLowerCase())) {
|
||||
|
||||
CreateReportLog.create(sender);
|
||||
CreateReportLog.create(sender);
|
||||
|
||||
} else send.sender(sender,"§4Use: §7/t2code debug createReportLog");
|
||||
} else send.sender(sender,"§4Use: §7/t2code debug createReportLog");
|
||||
} else send.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
||||
} else send.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -53,6 +61,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
//TabCompleter
|
||||
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
||||
put("debug", "t2code.admin");
|
||||
put("info", "t2code.admin");
|
||||
}};
|
||||
|
||||
@Override
|
||||
|
@@ -14,6 +14,6 @@ public class JoinEvent implements Listener {
|
||||
@EventHandler
|
||||
public void onJoinEvent(PlayerLoginEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
UpdateAPI.join(Main.plugin, Util.Prefix, "t2code.lib.updatemsg", event.getPlayer(), Main.spigot, Main.discord);
|
||||
UpdateAPI.join(Main.plugin, Util.getPrefix(), "t2code.lib.updatemsg", event.getPlayer(), Main.spigot, Main.discord);
|
||||
}
|
||||
}
|
@@ -35,11 +35,11 @@ public final class Main extends JavaPlugin {
|
||||
public static List<String> autor;
|
||||
public static String version;
|
||||
|
||||
public static String prefix = Util.Prefix;
|
||||
public static Integer spigotID = Util.SpigotID;
|
||||
public static Integer bstatsID = Util.BstatsID;
|
||||
public static String spigot = Util.Spigot;
|
||||
public static String discord = Util.Discord;
|
||||
public static String prefix = Util.getPrefix();
|
||||
public static Integer spigotID = Util.getSpigotID();
|
||||
public static Integer bstatsID = Util.getBstatsID();
|
||||
public static String spigot = Util.getSpigot();
|
||||
public static String discord = Util.getDiscord();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
@@ -49,6 +49,16 @@ public final class Main extends JavaPlugin {
|
||||
version = plugin.getDescription().getVersion();
|
||||
Long long_;
|
||||
long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord);
|
||||
if (Util.getSnapshot()){
|
||||
send.console(prefix + " §eYou are running §4" + version + " §eof " + prefix + "§e! §4This is a trial version! §eSome features may not be working as expected. Please report all bugs here: http://dc.t2code.net §4UpdateChecker & bStats may be disabled!");
|
||||
send.console(prefix + " §4 §e-------------------");
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//send.console("§4 _|_|_|_|_| _|_| _|_|_| _| ");
|
||||
//send.console("§4 _| _| _| _| _|_| _|_|_| _|_| ");
|
||||
//send.console("§4 _| _| _| _| _| _| _| _|_|_|_| ");
|
||||
@@ -97,8 +107,11 @@ public final class Main extends JavaPlugin {
|
||||
LanguagesCreate.langCreate();
|
||||
SelectLibConfig.onSelect();
|
||||
SelectLibMsg.onSelect(prefix);
|
||||
UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
|
||||
Metrics.Bstats(plugin, bstatsID);
|
||||
if (!Util.getSnapshot()){
|
||||
UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
|
||||
Metrics.Bstats(plugin, bstatsID);
|
||||
}
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
|
||||
T2CodeTemplate.onLoadFooter(prefix, long_);
|
||||
}
|
||||
|
@@ -0,0 +1,33 @@
|
||||
package net.t2code.lib.Spigot.system;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Scanner;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class UpdateChecker {
|
||||
private final JavaPlugin plugin;
|
||||
private final int resourceId;
|
||||
|
||||
public UpdateChecker(JavaPlugin plugin, int resourceId) {
|
||||
this.plugin = plugin;
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
public void getVersion(final Consumer<String> consumer) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
|
||||
try (InputStream inputStream = new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId).openStream(); Scanner scanner = new Scanner(inputStream)) {
|
||||
if (scanner.hasNext()) {
|
||||
consumer.accept(scanner.next());
|
||||
}
|
||||
} catch (IOException exception) {
|
||||
plugin.getLogger().info("Unable to check for updates: " + exception.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -12,6 +12,7 @@ import java.io.IOException;
|
||||
public class ConfigCreate {
|
||||
|
||||
private static Boolean UpdateCheckOnJoin = true;
|
||||
private static Integer UpdateCheckTimeInterval = 60;
|
||||
private static Boolean Debug = false;
|
||||
private static String language = "english";
|
||||
|
||||
@@ -38,7 +39,8 @@ public class ConfigCreate {
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
Config.set("Plugin.UpdateCheckOnJoin", UpdateCheckOnJoin, yamlConfiguration);
|
||||
Config.set("Plugin.UpdateCheck.OnJoin", UpdateCheckOnJoin, yamlConfiguration);
|
||||
Config.set("Plugin.UpdateCheck.TimeInterval", UpdateCheckTimeInterval, yamlConfiguration);
|
||||
Config.set("Plugin.language", language, yamlConfiguration);
|
||||
|
||||
Config.set("BungeeCord.Enable", Bungee, yamlConfiguration);
|
||||
|
@@ -9,6 +9,7 @@ public class SelectLibConfig {
|
||||
|
||||
|
||||
public static Boolean UpdateCheckOnJoin;
|
||||
public static Integer UpdateCheckTimeInterval;
|
||||
public static Boolean Debug;
|
||||
public static String language;
|
||||
public static Boolean InventoriesCloseByServerStop;
|
||||
@@ -17,7 +18,8 @@ public class SelectLibConfig {
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheckOnJoin");
|
||||
UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheck.OnJoin");
|
||||
UpdateCheckTimeInterval = yamlConfiguration.getInt("Plugin.UpdateCheck.TimeInterval");
|
||||
Debug = yamlConfiguration.getBoolean("Plugin.Debug");
|
||||
language = yamlConfiguration.getString("Plugin.language");
|
||||
InventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop");
|
||||
|
@@ -1,9 +1,35 @@
|
||||
package net.t2code.lib;
|
||||
|
||||
public class Util {
|
||||
public static String Prefix = "§8[§4T2Code§5Lib§8]";
|
||||
public static Integer SpigotID = 96388;
|
||||
public static Integer BstatsID = 12518;
|
||||
public static String Spigot = "https://www.spigotmc.org/resources/" + SpigotID;
|
||||
public static String Discord = "http://dc.t2code.net";
|
||||
private static Boolean Snapshot = false;
|
||||
|
||||
private static String Prefix = "§8[§4T2Code§5Lib§8]";
|
||||
private static Integer SpigotID = 96388;
|
||||
private static Integer BstatsID = 12518;
|
||||
private static String Spigot = "https://www.spigotmc.org/resources/" + SpigotID;
|
||||
private static String Discord = "http://dc.t2code.net";
|
||||
|
||||
public static String getPrefix() {
|
||||
return Prefix;
|
||||
}
|
||||
|
||||
public static Integer getSpigotID() {
|
||||
return SpigotID;
|
||||
}
|
||||
|
||||
public static Integer getBstatsID() {
|
||||
return BstatsID;
|
||||
}
|
||||
|
||||
public static String getSpigot() {
|
||||
return Spigot;
|
||||
}
|
||||
|
||||
public static String getDiscord() {
|
||||
return Discord;
|
||||
}
|
||||
|
||||
public static Boolean getSnapshot(){
|
||||
return Snapshot;
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
name: T2CodeLib
|
||||
version: 9.0_Snapshot_1
|
||||
version: 10.2
|
||||
main: net.t2code.lib.Bungee.BMain
|
||||
author: JaTiTV, Jkobs
|
||||
description: Libarie from T2Code Plugins
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/net/t2code/lib/Spigot/system/UpdateChecker.class
Normal file
BIN
target/classes/net/t2code/lib/Spigot/system/UpdateChecker.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
name: T2CodeLib
|
||||
version: 9.0_Snapshot_1
|
||||
version: 10.2
|
||||
main: net.t2code.lib.Spigot.system.Main
|
||||
api-version: 1.13
|
||||
prefix: T2CodeLib
|
||||
|
Reference in New Issue
Block a user