1.5
This commit is contained in:
parent
6295ebe84b
commit
438bdbbb1e
4
pom.xml
4
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>de.jatitv</groupId>
|
||||
<artifactId>PaPiTest</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<version>1.5</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>PaPiTest</name>
|
||||
@ -78,7 +78,7 @@
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>12.0</version>
|
||||
<version>13.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -1,36 +1,32 @@
|
||||
package de.jatitv.papitest;
|
||||
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
|
||||
public class Util {
|
||||
private static double requiredT2CodeLibVersion = 12.0;
|
||||
private static String prefix = "§8[§5PaPi§6Test§8]";
|
||||
private static Integer spigotID = 90439;
|
||||
private static Integer bstatsID = 10342;
|
||||
private static String spigot = "https://www.spigotmc.org/resources/" + spigotID;
|
||||
private static String discord = "http://dc.t2code.net";
|
||||
|
||||
public static double getRequiredT2CodeLibVersion() {
|
||||
return requiredT2CodeLibVersion;
|
||||
public static String getInfoText() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String getRequiredT2CodeLibVersion() {
|
||||
return "13.0";
|
||||
}
|
||||
|
||||
public static String getPrefix() {
|
||||
return prefix;
|
||||
return "§8[§5PaPi§6Test§8]";
|
||||
}
|
||||
|
||||
public static Integer getSpigotID() {
|
||||
return spigotID;
|
||||
return 90439;
|
||||
}
|
||||
|
||||
public static Integer getBstatsID() {
|
||||
return bstatsID;
|
||||
return 10342;
|
||||
}
|
||||
|
||||
public static String getSpigot() {
|
||||
return spigot;
|
||||
return "https://www.spigotmc.org/resources/" + getSpigotID();
|
||||
}
|
||||
|
||||
public static String getDiscord() {
|
||||
return discord;
|
||||
return "http://dc.t2code.net";
|
||||
}
|
||||
}
|
||||
|
@ -3,12 +3,6 @@
|
||||
package de.jatitv.papitest.commands;
|
||||
|
||||
import de.jatitv.papitest.Util;
|
||||
import de.jatitv.papitest.config.Config;
|
||||
import de.jatitv.papitest.system.Main;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -4,10 +4,9 @@ import de.jatitv.papitest.Util;
|
||||
import de.jatitv.papitest.config.Config;
|
||||
import de.jatitv.papitest.system.Main;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -18,7 +17,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class Commands {
|
||||
protected static void info(CommandSender sender) {
|
||||
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
|
||||
T2Ctemplate.sendInfo(sender,Main.getPlugin(),Util.getSpigotID(),Util.getDiscord(),Util.getInfoText());
|
||||
}
|
||||
|
||||
protected static void reload(CommandSender sender) {
|
||||
@ -30,7 +29,7 @@ public class Commands {
|
||||
}
|
||||
|
||||
protected static void use(CommandSender sender, String[] args) {
|
||||
if (!PluginCheck.papi()) {
|
||||
if (!T2CpluginCheck.papi()) {
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§4\n" + Util.getPrefix() + " §4PlaceholderAPI could not be connected / found! " +
|
||||
"§9Please download it here: §6https://www.spigotmc.org/resources/placeholderapi.6245/§4\n" + Util.getPrefix());
|
||||
if (sender instanceof Player) {
|
||||
@ -62,7 +61,7 @@ public class Commands {
|
||||
protected static void execute(CommandSender sender, Player target, String placeholder) {
|
||||
|
||||
sender.sendMessage(Util.getPrefix() + " §b" + placeholder + " §7-> " + "§6" + PlaceholderAPI.setPlaceholders(target, placeholder));
|
||||
if (!MCVersion.minecraft1_8 && Config.Titel && sender instanceof Player) {
|
||||
if (!T2CmcVersion.isMc1_8() && Config.Titel && sender instanceof Player) {
|
||||
((Player)sender).sendTitle("§5PaPi§6Test§8: " + "§b" + placeholder, "§6" + PlaceholderAPI.setPlaceholders(target, placeholder));
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,7 @@ package de.jatitv.papitest.commands;
|
||||
|
||||
import de.jatitv.papitest.Util;
|
||||
import de.jatitv.papitest.config.Config;
|
||||
import de.jatitv.papitest.system.Main;
|
||||
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
|
||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -24,7 +23,7 @@ public class Reload {
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §2");
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §8-------------------------------");
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §2");
|
||||
if (PluginCheck.papi()) {
|
||||
if (T2CpluginCheck.papi()) {
|
||||
if (sender instanceof Player) {
|
||||
sender.sendMessage(Util.getPrefix() + " §2PlaceholderAPI successfully connected!");
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §2PlaceholderAPI successfully connected!");
|
||||
|
@ -4,7 +4,7 @@ package de.jatitv.papitest.config;
|
||||
|
||||
import de.jatitv.papitest.Util;
|
||||
import de.jatitv.papitest.system.Main;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
@ -20,7 +20,7 @@ public class Config {
|
||||
|
||||
public static void configCreate() {
|
||||
|
||||
File configYML = new File(Main.thisp().getDataFolder().getPath(), "Config.yml");
|
||||
File configYML = new File(Main.getPlugin().getDataFolder(), "Config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(configYML);
|
||||
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §4Config.yml load...");
|
||||
@ -33,7 +33,7 @@ public class Config {
|
||||
yamlConfiguration.set("Plugin.UpdateCheckOnJoin", true);
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §4Setting §6UpdateCheckOnJoin §4was added to §9Config.yml§4!");
|
||||
}
|
||||
if (!MCVersion.minecraft1_8) {
|
||||
if (!T2CmcVersion.isMc1_8()) {
|
||||
if (yamlConfiguration.contains("Titel.Enable")) {
|
||||
Titel = yamlConfiguration.getBoolean("Titel.Enable");
|
||||
} else {
|
||||
|
@ -3,13 +3,11 @@
|
||||
package de.jatitv.papitest.system;
|
||||
|
||||
import de.jatitv.papitest.Util;
|
||||
import de.jatitv.papitest.config.Config;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class JoinEvent implements Listener {
|
||||
|
||||
@ -17,7 +15,6 @@ public class JoinEvent implements Listener {
|
||||
@EventHandler
|
||||
public void onJoinEvent(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
UpdateAPI.join(Main.plugin, Util.getPrefix(),"papitest.admin",player,Util.getSpigot(), Util.getDiscord());
|
||||
T2CupdateAPI.join(Main.getPlugin(),Util.getPrefix(),"papitest.admin",player,Util.getSpigotID(),Util.getDiscord());
|
||||
}
|
||||
}
|
@ -6,20 +6,17 @@ import de.jatitv.papitest.Util;
|
||||
import de.jatitv.papitest.commands.CmdExecuter;
|
||||
import de.jatitv.papitest.commands.TabComplete;
|
||||
import de.jatitv.papitest.config.Config;
|
||||
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public final class Main extends JavaPlugin {
|
||||
|
||||
public static Main plugin;
|
||||
private static Main plugin;
|
||||
public static String version;
|
||||
public static List<String> autor;
|
||||
|
||||
@ -27,10 +24,6 @@ public final class Main extends JavaPlugin {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public static Plugin thisp() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Plugin startup logic
|
||||
@ -41,14 +34,13 @@ public final class Main extends JavaPlugin {
|
||||
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
|
||||
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §4Plugin load...");
|
||||
|
||||
UpdateAPI.onUpdateCheck(Main.plugin, Util.getPrefix(), Util.getSpigot(), Util.getSpigotID(), Util.getDiscord());
|
||||
T2CupdateAPI.onUpdateCheck(plugin,Util.getPrefix(),Util.getSpigotID(),Util.getDiscord());
|
||||
Metrics.Bstats(Main.plugin, Util.getBstatsID());
|
||||
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §8-------------------------------");
|
||||
Config.configCreate();
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §8-------------------------------");
|
||||
if (PluginCheck.papi()) {
|
||||
if (T2CpluginCheck.papi()) {
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §2PlaceholderAPI successfully connected!");
|
||||
} else {
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§4\n" + Util.getPrefix() + " §4PlaceholderAPI could not be connected / found! " +
|
||||
@ -74,20 +66,33 @@ public final class Main extends JavaPlugin {
|
||||
// Plugin shutdown logic
|
||||
}
|
||||
|
||||
public static Boolean pluginNotFound(String pl, Integer spigotID, double ver) {
|
||||
public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
|
||||
if (Bukkit.getPluginManager().getPlugin(pl) == null) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4could not be found. Please download it here: " +
|
||||
"§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
||||
plugin.getPluginLoader().disablePlugin(plugin);
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §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 {
|
||||
if (Double.parseDouble(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(pl)).getDescription().getVersion()) < ver) {
|
||||
String plVer = Bukkit.getPluginManager().getPlugin(pl).getDescription().getVersion();
|
||||
if (ver.contains("_")) {
|
||||
if (!plVer.equals(ver)) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires the version §2"
|
||||
+ ver + " §4of §6" + pl + " §4Please use this version! Please download it here or contact us in Discord: §6https://spigotmc.org/resources/"
|
||||
+ pl + "." + spigotID + " Or contact us in Discord: http://dc.t2code.net");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
String[] split = plVer.split("_");
|
||||
if (Double.parseDouble(split[0]) < Double.parseDouble(ver)) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires at least version §2" +
|
||||
ver + " §4of §6" + pl + " §4Please update it here: §6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to use this version of " +
|
||||
plugin.getDescription().getName() + ".");
|
||||
plugin.getPluginLoader().disablePlugin(plugin);
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires at least version §2"
|
||||
+ ver + " §4of §6" + pl + " §4Please update it here: §6https://spigotmc.org/resources/" + pl + "." + spigotID
|
||||
+ " §4to use this version of " + plugin.getDescription().getName() + ".");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: PaPiTest
|
||||
prefix: PaPiTest
|
||||
version: 1.3
|
||||
version: '${project.version}'
|
||||
api-version: 1.13
|
||||
main: de.jatitv.papitest.system.Main
|
||||
softdepend: [ T2CodeLib, PlaceholderAPI ]
|
||||
|
Loading…
Reference in New Issue
Block a user